1(function ($) { 2 Drupal.behaviors.media_preview_sizer = { 3 attach: function (context, settings) { 4 //add in slider support for image sizing in the library 5 //find the exposed filters and add the slider inline with them 6 $(".media-browser-wrapper .views-exposed-form .views-exposed-widgets").once('media_preview_sizer').append("<div class='views-exposed-widget slide-widget'><label>Image Size</label><div class='slide-image'></div></div>"); 7 var valued = (!localStorage.getItem("slideWidth")) ? 200 : localStorage.getItem("slideWidth"); 8 //set a default CSS size for the list items 9 $('#media-browser-library-list li').css('width', localStorage.getItem('slideWidth') + 'px'); 10 //using a preset image style with a max width of 300, set the minimum and starting value 11 $('.slide-image').once('media_preview_sizer').slider({ 12 value: valued, 13 min: 100, 14 max: 300, 15 step: 2, 16 //when the slider moves, resize the image according to the px amount 17 slide: function (event, ui) { 18 //store value in localstorage 19 localStorage.setItem('slideWidth', ui.value); 20 $('#media-browser-library-list li').css('width', localStorage.getItem('slideWidth') + 'px'); 21 } 22 }); 23 } 24 }; 25}(jQuery));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.