https://jasenice.hr/wp-content/plugins/wp-file-download/app/site/t…=7.1.2.pagespeed.ce.wUNuD_SR1y.js
1/** 2 Copyright (c) 2012 Marco Pegoraro, http://movableapp.com/ 3 4 Permission is hereby granted, free of charge, to any person obtaining 5 a copy of this software and associated documentation files (the 6 "Software"), to deal in the Software without restriction, including 7 without limitation the rights to use, copy, modify, merge, publish, 8 distribute, sublicense, and/or sell copies of the Software, and to 9 permit persons to whom the Software is furnished to do so, subject to 10 the following conditions: 11 12 The above copyright notice and this permission notice shall be 13 included in all copies or substantial portions of the Software. 14 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 23 24 WHERE TO FIND MEDIA TABLE: 25 https://github.com/thepeg/MediaTable 26 http://consulenza-web.com/jquery/MediaTable/ 27 http://www.consulenza-web.com/2012/01/mediatable-jquery-plugin/ 28 29 **/ 30 31 32/** 33 * jQuery Bacheca 34 * Plugin Dimostrativo 35 */ 36 37;(function ($) { 38 39 40 /** 41 * DOM Initialization Logic 42 */ 43 44 var __loop = function (cfg, i) { 45 46 var $this = $(this), 47 wdg = $this.data('MediaTable'); 48 49 // Prevent re-initialization of the widget! 50 if (!$.isEmptyObject(wdg)) return; 51 52 // Build the widget context. 53 wdg = { 54 $wrap: $('<div>'), // Refer to the main content of the widget 55 $table: $this, // Refer to the MediaTable DOM (TABLE TAG) 56 $menu: false, // Refer to the column's toggler menu container 57 cfg: cfg, // widget local configuration object 58 id: $this.attr('id') 59 }; 60 61 // Setup Widget ID if not specified into DOM Table. 62 if (!wdg.id) { 63 wdg.id = 'MediaTable-' + i; 64 wdg.$table.attr('id', wdg.id); 65 } 66 67 68 // Activate the MediaTable. 69 wdg.$table.addClass('activeMediaTable'); 70 71 // Create the wrapper. 72 wdg.$wrap.addClass('mediaTableWrapper'); 73 74 // Place the wrapper near the table and fill with MediaTable. 75 wdg.$table.before(wdg.$wrap).appendTo(wdg.$wrap); 76 77 78 // Menu initialization logic. 79 if (wdg.cfg.menu) __initMenu(wdg); 80 81 // Columns Initialization Loop. 82 wdg.$table.find('thead th').each(function (i) { 83 __thInit.call(this, i, wdg); 84 }); 85 86 87 // Save widget context into table DOM. 88 wdg.$table.data('MediaTable', wdg); 89 90 }; // EndOf: "__loop()" ### 91 92 93 var __initMenu = function (wdg) { 94 95 // Buid menu objects 96 wdg.$menu = $('<div />'); 97 wdg.$menu.$header = $('<a title="' + wpfdTableTheme.columns + '" />'); 98 wdg.$menu.$list = $('<ul />'); 99 100 // Setup menu general properties and append to DOM. 101 wdg.$menu 102 .addClass('mediaTableMenu') 103 .addClass('mediaTableMenuClosed') 104 .append(wdg.$menu.$header) 105 .append(wdg.$menu.$list); 106 107 // Add a class to the wrapper to inform about menu presence. 108 wdg.$wrap.addClass('mediaTableWrapperWithMenu'); 109 110 // Setup menu title (handler) 111 wdg.$menu.$header.html(wdg.cfg.menuTitle); 112 wdg.$table.before(wdg.$menu); 113 114 // Bind screen change events to update checkbox status of displayed fields. 115 $(window).bind('orientationchange resize', function () { 116 wdg.$menu.find('input').trigger('updateCheck'); 117 }); 118 119 // Toggle list visibility when clicking the menu title. 120 wdg.$menu.$header.bind('click', function () { 121 wdg.$menu.toggleClass('mediaTableMenuClosed'); 122 }); 123 124 wdg.$table.parents('.wpfd-content').click(function (e) { 125 if (!$(e.target).closest('.mediaTableMenu').length) { 126 wdg.$menu.addClass('mediaTableMenuClosed'); 127 } 128 }); 129 }; // EndOf: "__initMenu()" ### 130 131 var __thInit = function (i, wdg) { 132 133 var $th = $(this), 134 id = $th.attr('id'), 135 classes = $th.attr('class'); 136 137 // Set up an auto-generated ID for the column.
138 // the ID is based upon widget's ID to allow multiple tables into one page. 139 if (!id) { 140 id = wdg.id + '-mediaTableCol-' + i; 141 $th.attr('id', id); 142 } 143 144 // Add toggle link to the menu. 145 if (wdg.cfg.menu && !$th.is('.persist') && !$th.is('.media_menu_column')) { 146 147 var $li = $('<li><input type="checkbox" name="toggle-cols" id="toggle-col-' + wdg.id + '-' + i + '" value="' + id + '" /> <label for="toggle-col-' + wdg.id + '-' + i + '">' + $th.text() + '</label></li>'); 148 wdg.$menu.$list.append($li); 149 150 __liInitActions($th, $li.find('input'), wdg); 151 152 } 153 154 // Propagate column's properties to each cell. 155 $('tbody tr:not(.nohide)', wdg.$table).each(function () { 156 __trInit.call(this, i, id, classes); 157 }); 158 $('tbody', wdg.$table).on('change', function () { 159 $('tbody tr:not(.nohide)', wdg.$table).each(function () { 160 __trInit.call(this, i, id, classes); 161 }); 162 }); 163 164 }; // EndOf: "__thInit()" ### 165 166 167 var __trInit = function (i, id, classes) { 168 169 var $cell = $(this).find('td,th').eq(i); 170 171 $cell.attr('headers', id); 172
173 if (classes) $cell.addClass(classes); 174 175 }; // EndOf: "__trInit()" ### 176 177 178 var __liInitActions = function ($th, $checkbox, wdg) { 179 180 var change = function () { 181 182 var val = $checkbox.val(), // this equals the header's ID, i.e. "company" 183 cols = wdg.$table.find("#" + val + ", [headers=" + val + "]"); // so we can easily find the matching header (id="company") and cells (headers="company") 184 185 if ($checkbox.is(":checked")) { 186 cols.show(); 187 cols.removeClass('wpfd-col-hidden'); 188 } else { 189 cols.hide(); 190 cols.addClass('wpfd-col-hidden') 191 } 192 ; 193 194 var wpfdTable = $('.wpfd-container table.wpfd-search-result'); 195 wpfdTable.each(function () { 196 var visibleRow = $(this).find('thead tr'); 197 visibleRow.each(function () { 198 var visibleColumn = $(this).find('th.optional:not(.wpfd-col-hidden)'); 199 visibleColumn.each(function () { 200 if ($(this).is(visibleColumn.last())) { 201 $(this).addClass('wpfd-last-col-table'); 202 $(this).addClass('wpfd-padding-right'); 203 } else { 204 $(this).removeClass('wpfd-last-col-table'); 205 $(this).removeClass('wpfd-padding-right'); 206 } 207 }) 208 }) 209 }) 210 }; 211 212 var updateCheck = function () { 213 214 //if ( $th.css("display") == "table-cell") { 215 if ($th.is(':visible') || $th.css('display') !== 'none') { 216 $checkbox.attr("checked", true); 217 } else { 218 $checkbox.attr("checked", false); 219 } 220 ; 221 222 }; 223 224 $checkbox 225 .bind('change', change) 226 .bind('updateCheck', updateCheck) 227 .trigger('updateCheck'); 228 229 } // EndOf: "__liInitActions()" ### 230 231 232 /** 233 * Widget Destroy Logic 234 */ 235 236 var __destroy = function () { 237 238 // Get the widget context. 239 var wdg = $(this).data('MediaTable'); 240 if (!wdg) return; 241 242 243 // Remove the wrapper from the MediaTable. 244 wdg.$wrap.after(wdg.$table).remove(); 245 246 // Remove MediaTable active class so media-query will not work. 247 wdg.$table.removeClass('activeMediaTable'); 248 249 250 // Remove DOM reference to the widget context. 251 wdg.$table.data('MediaTable', null); 252 253 }; // EndOf: "__destroy()" ### 254 255 256 /** 257 * jQuery Extension 258 */ 259 $.fn.mediaTable = function () { 260 261 var cfg = false; 262 263 // Default configuration block 264 if (!arguments.length || $.isPlainObject(arguments[0])) cfg = $.extend({}, { 265 266 // Teach the widget to create a toggle menu to declare column's visibility 267 menu: true, 268 menuTitle: '<i class="zmdi zmdi-settings"></i>', 269 270 t: 'e' 271 }, arguments[0]); 272 // -- default configuration block -- 273 274 275 // Items initialization loop: 276 if (cfg !== false) { 277 $(this).each(function (i) { 278 __loop.call(this, cfg, i); 279 }); 280 281 282 // Item actions loop - switch throught actions 283 } else if (arguments.length) switch (arguments[0]) { 284 285 case 'destroy': 286 $(this).each(function () { 287 __destroy.call(this); 288 }); 289 break; 290 291 } 292 293 294 // Mantengo la possibilit� di concatenare plugins. 295 return this; 296 297 }; // EndOf: "$.fn.mediaTable()" ### 298 299 300})(jQuery); 301
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.