1var PTB; 2(function ($) { 3 'use strict'; 4 function triggerEvent(a, b) { 5 var c; 6 document.createEvent ? (c = document.createEvent("HTMLEvents"), c.initEvent(b, !0, !0)) : document.createEventObject && (c = document.createEventObject(), c.eventType = b), c.eventName = b, a.dispatchEvent ? a.dispatchEvent(c) : a.fireEvent && htmlEvents["on" + b] ? a.fireEvent("on" + c.eventType, c) : a[b] ? a[b]() : a["on" + b] && a["on" + b]() 7 } 8 9 PTB = { 10 jsLazy:[], 11 cssLazy:[], 12 mobile:null, 13 hash: function (str) { 14 var hash = 0; 15 for (var i = 0, len = str.length; i < len; ++i) { 16 hash = ((hash << 5) - hash) + str.charCodeAt(i); 17 hash = hash & hash; // Convert to 32bit integer 18 } 19 return hash; 20 }, 21 LoadAsync: function (src, callback, version, test) { 22 var id = this.hash(src), // Make script path as ID 23 exist = this.jsLazy.indexOf(id) !== -1, 24 existElemens = exist || document.getElementById(id); 25 if(!exist){ 26 this.jsLazy.push(id); 27 } 28 if (existElemens) { 29 if (callback) { 30 if (test) { 31 var callbackTimer = setInterval(function () { 32 var call = false; 33 try { 34 call = test.call(); 35 } catch (e) { 36 } 37 if (call) { 38 clearInterval(callbackTimer); 39 callback.call(); 40 } 41 }, 20); 42 } else { 43 callback(); 44 } 45 } 46 return; 47 } 48 else if (test) { 49 try { 50 if (test.call()) { 51 if (callback) { 52 callback.call(); 53 } 54 return; 55 } 56 } catch (e) { 57 } 58 } 59 if (src.indexOf('.min.js') === -1 && typeof ptb.min!=='undefined') { 60 var name = src.match(/([^\/]+)(?=\.\w+$)/); 61 if (name && name[0]) { 62 name = name[0]; 63 if (ptb.min.js[name]) { 64 src = src.replace(name + '.js', name + '.min.js'); 65 } 66 } 67 } 68 var s, r, t; 69 r = false; 70 s = document.createElement('script'); 71 s.type = 'text/javascript'; 72 s.id = id; 73 if(!version && version!==false){ 74 version = ptb.ver; 75 } 76 s.src = version? src + '?ver=' + version : src; 77 s.async = true; 78 s.onload = s.onreadystatechange = function () { 79 if (!r && (!this.readyState || this.readyState === 'complete')) 80 { 81 r = true; 82 if (callback) { 83 callback(); 84 } 85 } 86 }; 87 t = document.getElementsByTagName('script')[0]; 88 t.parentNode.insertBefore(s, t); 89 }, 90 LoadCss: function (href, version, before, media,callback) { 91 var id = this.hash(href), 92 exist = this.cssLazy.indexOf(href) !== -1, 93 existElemens =exist || document.getElementById(id), 94 fullHref =!version ? href + '?ver=' + ptb.ver : href; 95 if(!exist){ 96 this.cssLazy.push(href); 97 } 98 if (existElemens || $("link[href='" + fullHref + "']").length > 0) { 99 if(callback){ 100 callback(); 101 } 102 return; 103 } 104 if (href.indexOf('.min.css') === -1 && typeof ptb.min!=='undefined') { 105 var name = href.match(/([^\/]+)(?=\.\w+$)/); 106 if (name && name[0]) { 107 name = name[0]; 108 if (ptb.min.css[name]) { 109 fullHref = fullHref.replace(name + '.css', name + '.min.css'); 110 } 111 } 112 } 113 var doc = window.document, 114 ss = doc.createElement('link'), 115 ref; 116 if (before) { 117 ref = before; 118 } 119 else { 120 var refs = (doc.body || doc.getElementsByTagName('head')[ 0 ]).childNodes; 121 ref = refs[ refs.length - 1]; 122 } 123 124 var sheets = doc.styleSheets; 125 ss.rel = 'stylesheet'; 126 ss.href = fullHref; 127 // temporarily set media to something inapplicable to ensure it'll fetch without blocking render 128 ss.media = 'only x'; 129 ss.async = 'async'; 130 ss.id = id; 131 132 // Inject link 133 // Note: `insertBefore` is used instead of `appendChild`, for safety re: http://www.paulirish.com/2011/surefire-dom-element-insertion/ 134 ref.parentNode.insertBefore(ss, (before ? ref : ref.nextSibling)); 135 // A method (exposed on return object for external use) that mimics onload by polling document.styleSheets until it includes the new sheet. 136 var onloadcssdefined = function (cb) { 137 var resolvedHref = ss.href, 138 i = sheets.length; 139 while (i--) { 140 if (sheets[ i ].href === resolvedHref) { 141 if (callback) { 142 callback(); 143 } 144 return cb(); 145 } 146 } 147 setTimeout(function () { 148 onloadcssdefined(cb); 149 }); 150 }; 151 152 // once loaded, set link's media back to `all` so that the stylesheet applies once it loads 153 ss.onloadcssdefined = onloadcssdefined; 154 onloadcssdefined(function () { 155 ss.media = media || 'all'; 156 }); 157 return ss; 158 }, 159 is_mobile:function(){ 160 if(this.mobile===null){ 161 this.mobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) || 162 /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
162sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0, 4)); 163 } 164 return this.mobile; 165 } 166 }; 167 168$(document).ready(function () { 169 var $body = $('body'), 170 single = $('.ptb_single_content').not('.post-password-required'); 171 function ptb_lightbox_position() { 172 $('#lightcase-case').find('.ptb_single_lightbox').css('max-height', $(window).height() - 100); 173 } 174 if(single.length>0){ 175 var next = single.find('.ptb-search-container'); 176 if (next.length > 0) { 177 single.after(next.first()); 178 } 179 single.replaceWith(single.find('.ptb_post').first()); 180 } 181 $(document).trigger('ptb_loaded',false) 182 .on('ptb_ligthbox_close', function () { 183 $('#lightcase-case').removeClass('ptb_is_single_lightbox'); 184 $body.removeClass('ptb_hide_scroll'); 185 $(window).unbind('resize', ptb_lightbox_position); 186 }); 187 188 //Single Page Lightbox 189 190 function PTB_Lightbox(){ 191 var items = $('a.ptb_open_lightbox'), 192 $lightbox = $('a.ptb_lightbox'); 193 if(items.length>0 || $lightbox.length>0){ 194 PTB.LoadCss(ptb.url + 'css/lightbox.css'); 195 PTB.LoadAsync(ptb.url + 'js/lightbox.min.js', function() { 196 if(items.length>0){ 197 items.lightcase({ 198 type: 'ajax', 199 maxWidth: $(window).width() * 0.8, 200 onFinish: { 201 bar: function () { 202 $body.addClass('ptb_hide_scroll'); 203 }, 204 baz: function () { 205 var $container = $('#lightcase-case'); 206 $container.addClass('ptb_is_single_lightbox').find('.ptb_post img').css('display', 'block'); 207 $(document).trigger('ptb_loaded',true); 208 triggerEvent(window, 'resize'); 209 ptb_lightbox_position(); 210 $(window).resize(ptb_lightbox_position); 211 PTB_Masonry($container); 212 PTB_Filter($container); 213 } 214 }, 215 onClose: { 216 qux: function () { 217 $.event.trigger({type: "ptb_ligthbox_close"}); 218 } 219 } 220 }); 221 } 222 //Page Lightbox 223 if($lightbox.length>0){ 224 $lightbox.lightcase({ 225 type: 'iframe', 226 onFinish: { 227 bar: function () { 228 $.event.trigger({type: "ptb_ligthbox_close"}); 229 $body.addClass('ptb_hide_scroll'); 230 } 231 }, 232 onClose: { 233 qux: function () { 234 $.event.trigger({type: "ptb_ligthbox_close"}); 235 } 236 } 237 }); 238 } 239 },null,function(){ 240 return ('undefined' !== typeof $.fn.lightcase); 241 }); 242 } 243 } 244 245 //Isotop Filter 246 function PTB_Filter(context){ 247 var $filter = $('.ptb-post-filter',context); 248 $filter.each(function () { 249 var $entity = $(this).next('.ptb_loops_wrapper'); 250 $(this).on('click', 'li', function (e) { 251 e.preventDefault(); 252 e.stopPropagation(); 253 var $posts = $entity.find('.ptb_post'), 254 masonry = $entity.hasClass('ptb_masonry'); 255 $posts.removeClass('ptb-isotop-filter-clear'); 256 257 if ($(this).hasClass('ptb_filter_active')) { 258 $filter.find('li.ptb_filter_active').removeClass('ptb_filter_active'); 259 $entity.removeClass('ptb-isotop-filter'); 260 $posts.stop().fadeIn('normal',function(){ 261 if(masonry){ 262 $entity.masonry('layout'); 263 } 264 }); 265 } 266 else { 267 $filter.find('li.ptb_filter_active').removeClass('ptb_filter_active'); 268 $(this).addClass('ptb_filter_active'); 269 $entity.addClass('ptb-isotop-filter'); 270 var $tax = '.ptb-tax-' + $(this).data('tax'), 271 $child = $(this).find('li'); 272 if ($child.length > 0) { 273 $child.each(function () { 274 $tax += ' ,.ptb-tax-' + $(this).data('tax'); 275 }); 276 } 277 var $items = $posts.filter($tax), 278 $grid = $entity.hasClass('ptb_grid4') ? 4 : ($entity.hasClass('ptb_grid3') ? 3 : ($entity.hasClass('ptb_grid2') ? 2 : 1)); 279 if ($grid > 1) { 280 $items.each(function ($i) { 281 if ($i % $grid === 0) { 282 $(this).addClass('ptb-isotop-filter-clear'); 283 } 284 }); 285 } 286 $posts.hide(); 287 $items.not('visible').stop().fadeIn('normal',function(){ 288 if(masonry){ 289 $entity.masonry('layout'); 290 } 291 }); 292 } 293 }); 294 }); 295 } 296 297 298 function PTB_Masonry(context){ 299 var items = $('.ptb_masonry',context); 300 if(items.length>0){ 301 PTB.LoadAsync(ptb.include + 'imagesloaded.min.js', function() { 302 PTB.LoadAsync(ptb.include + 'masonry.min.js', function() { 303 items.each(function(){ 304 this.insertAdjacentHTML('afterbegin','</div><div class="ptb_gutter_sizer"></div><div class="ptb_post_sizer"></div>'); 305 var that = $(this);
306 $(this).imagesLoaded().always(function(el){ 307 $(el.elements[0]).masonry({ 308 columnWidth : '.ptb_post_sizer' , 309 itemSelector:'.ptb_post', 310 isOriginLeft : ! $( 'body' ).hasClass( 'rtl' ), 311 gutter: '.ptb_gutter_sizer' 312 }); 313 }); 314 }); 315 },null,function(){ 316 return typeof $.fn.masonry!=='undefined'; 317 }); 318 },null,function(){ 319 return typeof $.fn.imagesLoaded!=='undefined'; 320 }); 321 } 322 } 323 324 function PTB_init() { 325 PTB_Lightbox(); 326 PTB_Masonry(); 327 PTB_Filter(); 328 } 329 PTB_init(); 330 $( document ).on( 'ptb_loaded', PTB_init ); 331 }); 332}(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.