1/*global jQuery*/ 2var g_sslYoutubeAPIReady = false; 3(function ($, app, debug, undefined) { 4 5 app.enableTextAnimation = (function($part, properties) { 6 if(properties['text-animation'] == 'enable' && !$('.ui-dialog').length) { 7 $part.children('span').textillate({ 8 initialDelay: 1000, 9 loop: true, 10 in: { 11 effect: properties['text-effect-in'], 12 delay: 100, 13 sync: true 14 }, 15 out: { 16 effect: properties['text-effect-out'], 17 shuffle: true 18 } 19 }); 20 } 21 }); 22 23 app.isControls = (function($element) { 24 return $element.hasClass('bx-controls-direction'); 25 }); 26 27 app.setArrows = (function($element, properties) { 28 if(this.isControls($element)) { 29 $element.find('a').each(function() { 30 $(this).attr('id', properties['background']); 31 }); 32 } 33 }); 34 35 var initVisualSettings = function($container, self) { 36 // Apply visual editor styles. 37 if ($.isPlainObject($container.data('settings'))) { 38 var settings = $container.data('settings'); 39 40 if ('__veditor__' in settings && settings['__veditor__']) { 41 $.each(settings['__veditor__'], function (selector, properties) { 42 var $part = $(selector, $container); 43 44 self.setArrows($part, properties); 45 $.each(properties, function (key, value) { 46 $part.css(key, value); 47 }); 48 if($part.is('.bx-caption')) { 49 self.enableTextAnimation($part, properties); 50 } 51 }); 52 } 53 } 54 }; 55 56 app.init = (function(selector) { 57 var self = this, 58 defaultSelector = '.supsystic-slider', 59 $container = (typeof selector == 'undefined') ? $(defaultSelector) : $(selector); 60 61 if (!$container.length) { 62 if (debug) { 63 console.log('Selector "' + selector + '" does not exists.'); 64 } 65 return false; 66 } 67 if ($.isEmptyObject(app.plugins)) { 68 if (debug) { 69 console.log('There are no registered plugins.'); 70 } 71 return false; 72 } 73 $.each(app.plugins, function (plugin, callback) { 74 if (debug) { 75 console.log('Plugin initialization: ' + plugin); 76 } 77 if (!$.isFunction(callback)) { 78 if (debug) { 79 console.log('The callback for the ' + plugin + ' is not a function.'); 80 } 81 } 82 callback($container); 83 $.each($container, function(index, value) { 84 initVisualSettings($(value), self); 85 }); 86 }); 87 return true; 88 }); 89 90 $(document).ready(function() { 91 //if General Mode equals Fade, script hides the Easing input 92 function disabledIfFade() { 93 var $generalMode = $('#generalMode').val(); 94 95 if ($generalMode == 'fade') { 96 $('#generalEasing').prop( "disabled", true ); 97 } else { 98 $('#generalEasing').prop( "disabled", false ); 99 } 100 } 101 102 function initVerticalModeElements() { 103 var $generalMode = $('#generalMode').val(); 104 105 if ($generalMode == 'vertical') { 106 $('#generalNumberOfSlides, #generalDistanceBetweenSlides, #generalVerticalArrowsMode').prop("disabled", false); 107 $('#general-number-of-slides, #general-distance-between-slides, #general-vertical-arrows-mode').show(); 108 } else { 109 $('#generalNumberOfSlides, #generalDistanceBetweenSlides, #generalVerticalArrowsMode').prop("disabled", true); 110 $('#general-number-of-slides, #general-distance-between-slides, #general-vertical-arrows-mode').hide(); 111 } 112 } 113 114 disabledIfFade(); 115 116 initVerticalModeElements(); 117 $('#generalMode').click(function() { 118 disabledIfFade(); 119 initVerticalModeElements(); 120 }); 121 122 app.init(); 123 // Show sliders (Bx & Coin) only after initialization 124 $('.supsystic-slider').css('visibility', 'visible'); 125 126 window.onYouTubeIframeAPIReady = function() { 127 g_sslYoutubeAPIReady = true; 128 }; 129 130 var $container = $('.supsystic-slider-wrapper'); 131 132 $container.each(function() { 133 socialShareInit($(this), $(this).find('.supsystic-slider').data('settings')); 134 }); 135 136 }).ajaxComplete(function() { 137 $('.supsystic-slider').css('visibility', 'visible'); 138 //app.init(); 139 }); 140 141 function socialShareInit($slider, settings) { 142 if(settings && settings.socialSharing && settings.socialSharing.status == 'enable') { 143 var $socialShare = $slider.find('.slider-social-share-html'), 144 sliderSharing = settings.socialSharing.sliderSharing && settings.socialSharing.sliderSharing.status == 'enable' ? settings.socialSharing.sliderSharing : false, 145 imageSharing = settings.socialSharing.imageSharing && settings.socialSharing.imageSharing.status == 'enable' ? settings.socialSharing.imageSharing : false, 146 socialButtonsUrl = getSocialButtonsUrl(); 147 148 if(sliderSharing) { 149 var $socialButtons = getSocialButtons($slider, '', socialButtonsUrl, '', '', ''), 150 buttons; 151 if (sliderSharing.buttonsPosition == 'top' || sliderSharing.buttonsPosition == 'all') { 152 buttons = $slider.find('.slider-sharing-top') 153 .html($socialButtons.html()) 154 .find('.supsystic-social-sharing'); 155 } 156 if (sliderSharing.buttonsPosition == 'bottom' || sliderSharing.buttonsPosition == 'all'){ 157 buttons = $slider.find('.slider-sharing-bottom') 158 .html($socialButtons.html()) 159 .find('.supsystic-social-sharing'); 160 } 161 window.initSupsysticSocialSharing(buttons); 162 initEvent($slider.find('.slider-sharing-top, .slider-sharing-bottom')); 163 } 164 165 if(imageSharing) { 166 var $images = $slider.find('.slide'), 167 socialButtonsClass = 'supsystic-slider-image-sharing ' + imageSharing.buttonsPosition + ' ' + imageSharing.buttonsAlign; 168 169 $images.each(function() { 170 var $this = $(this), 171 btns = getSocialButtonsByImage($slider, socialButtonsClass, $this); 172 if(btns) { 173 $this.append(btns); 174 } 175 }); 176 changeImageSocialHref($images.children('.supsystic-slider-image-sharing')); 177 correctImageSocialButtons($images.children('.supsystic-slider-image-sharing')); 178 initEvent($images.children('.supsystic-slider-image-sharing')); 179 } 180 } 181 } 182 183 function initEvent($elements){ 184 if(!$elements.size()){ 185 return; 186 } 187 $elements.find('.supsystic-social-sharing a.social-sharing-button').on('click',function (e) { 188 e.preventDefault(); 189 e.stopPropagation(); 190 e.stopImmediatePropagation(); 191 $(document).trigger('ssSocialClick', this); 192 if (e.currentTarget.href.slice(-1) !== '#') { 193 window.open(e.currentTarget.href, 'mw' + e.timeStamp, 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); 194 } 195 }); 196 } 197 198 function getSocialButtonsUrl() { 199 var socialButtonsUrl = window.location.href.replace(window.location.hash,''); 200 201 socialButtonsUrl = removePopUpHashFromUrl(socialButtonsUrl); 202 203 if(socialButtonsUrl.indexOf('#') + 1 == socialButtonsUrl.length){ 204 socialButtonsUrl = socialButtonsUrl.substr(0, socialButtonsUrl.length - 1); 205 } 206 207 return socialButtonsUrl; 208 } 209 210 function removePopUpHashFromUrl(url){ 211 var match = url.match(/gg-\d+-\d+/); 212 213 return url.replace(url[url.indexOf(match)-1] + match,""); 214 } 215 216 function getSocialButtons($slider, wrapper_class, url, img_id, img_src, title, noCounter) { 217 title = title || null; 218 219 var html = $slider.find('.slider-social-share-html').html(); 220 if (html !== undefined && html.length){ 221 html = html.replace(/{url}/g, url).replace(/{title}/g, title); 222 if(noCounter) { 223 // cut counter div 224 html = html.replace(/<div class="counter-wrap.*?>.*?<\/div>/g, ''); 225 } 226 } 227 228 return $('<div>', { 229 class: wrapper_class, 230 'data-img-thumbnail': img_src, 231 'data-img-id': img_id, 232 'data-img-title': title 233 }).html(html); 234 } 235 236 function getSocialButtonsByImage($slider, wrapper_class, $element) { 237 var type = $slider.find('.supsystic-slider').data('type'), 238 $img = $element.find('img').first(), 239 imgSrc = $img.attr('src') ? $img.attr('src') : $img.attr('src2'), 240 $captionContainer, 241 url = imgSrc; 242 243 if(url) { 244 var title = $element.attr('title'), 245 imageId = $element.data('id'); 246 247 switch(type) { 248 case 'bx': 249 $captionContainer = $element.find('.bx-caption'); 250 break; 251 case 'coin': 252 $captionContainer = $slider.find('.cs-title'); 253 break; 254 case 'jssor': 255 $captionContainer = $element.find('.jssor-caption'); 256 break; 257 default: 258 $captionContainer = []; 259 break; 260 } 261 if ($captionContainer.length) { 262 var caption = $.trim( 263 $captionContainer.clone().html($captionContainer.html() 264 .replace(/<br\s*[\/]?>/gi, ' ')) 265 .text() 266 .replace(/\s+/, ' ') 267 ); 268 269 if (caption.length) { 270 title = caption; 271 } 272 } 273 if (imgSrc && imgSrc.indexOf('http') !== 0) { 274 imgSrc = 'http:' + imgSrc; 275 } 276 277 function updateQueryStringParameter(uri, key, value) { 278 var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"), 279 separator = uri.indexOf('?') !== -1 ? "&" : "?"; 280 281 if (uri.match(re)) { 282 return uri.replace(re, '$1' + key + "=" + value + '$2'); 283 } else { 284 return uri + separator + key + "=" + value; 285 } 286 } 287 url = encodeURIComponent(updateQueryStringParameter(url, 'shared-image', imageId)); 288 return getSocialButtons($slider, wrapper_class, url, '', imgSrc, title, true); 289 } 290 return false;
291 } 292 293 function correctImageSocialButtons($imageSharing) { 294 if(!$imageSharing.size()){ 295 return; 296 } 297 var $example = $imageSharing.eq(0), 298 width = $example.width(), 299 height = $example.height(), 300 correctCss = {}, 301 self = this; 302 303 if($example.hasClass('vertical')){ 304 var buttonWidth = $example.find('.social-sharing-button').eq(0).outerWidth(); 305 306 correctCss.width = buttonWidth; 307 $example.width(buttonWidth); 308 } 309 /* css is used now: transform: translateX(-50%); */ 310 /*if($example.hasClass('center')){ 311 $.extend(correctCss,{'margin-left': '-' + (width/2) + 'px'}) 312 } 313 if($example.hasClass('middle')){ 314 $.extend(correctCss,{'margin-top': '-' + (height/2) + 'px'}) 315 }*/ 316 $imageSharing.find('.social-sharing-button.print').on('click',function(){ 317 var image_url = $(this).closest('.supsystic-slider-image-sharing').data('img-thumbnail'); 318 window.open(image_url).print(); 319 }); 320 $imageSharing.find('.social-sharing-button.bookmark').on('click',function(){ 321 if (window.sidebar && window.sidebar.addPanel) { // Mozilla Firefox Bookmark 322 window.sidebar.addPanel(document.title, window.location.href, ''); 323 } else if (window.external && ('AddFavorite' in window.external)) { // IE Favorite 324 window.external.AddFavorite(location.href, document.title); 325 } else if (window.opera && window.print) { // Opera Hotlist 326 this.title = document.title; 327 return true; 328 } else { // webkit - safari/chrome 329 alert('Press ' + (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Command/Cmd' : 'CTRL') + ' + D to bookmark this page.'); 330 } 331 }); 332 $imageSharing.find('.social-sharing-button.mail').on('click',function(){ 333 var $infoElement = $(this).closest('.supsystic-slider-image-sharing'), 334 image_id = $infoElement.data('img-id'), 335 image_title = typeof $infoElement.data('img-title') !== "undefined" ? ', ' + $infoElement.data('img-title') : '', 336 url = $infoElement.attr('data-img-thumbnail'), 337 mailTo = (jQuery(this).attr('data-mailto').length > 0) ? jQuery(this).attr('data-mailto') : '', 338 src = 'mailto:'+mailTo+'?subject=' + encodeURIComponent(document.title) + image_title + '&body=' + url, 339 iframe = $('<iframe id="mailtoFrame" src="' + src + '" width="1" height="1" border="0" frameborder="0"></iframe>'); 340 341 $('body').append(iframe); 342 window.setTimeout(function(){ 343 iframe.remove(); 344 }, 500); 345 }); 346 $imageSharing.each(function(){ 347 $(this).css(correctCss); 348 349 var thumbnail = $(this).data('img-thumbnail'); 350 351 if(thumbnail) { 352 var socialSharingImageOperators = { 353 'pinterest': 'media' 354 }; 355 for(var sharingClass in socialSharingImageOperators){ 356 var $button = $(this).find('.social-sharing-button.' + sharingClass); 357 358 if($button.size()){ 359 var img_url = $(this).data('img-url'), 360 img_id = $(this).data('img-id'), 361 url = getSocialButtonsUrl(), 362 href = $button.attr('href').replace(img_url, addPopUpHashToUrl(url, img_id)) + 363 '&' + socialSharingImageOperators[sharingClass] + '=' + thumbnail; 364 365 $button.attr('href', href); 366 } 367 } 368 } 369 }); 370 } 371 372 function changeImageSocialHref($imageSharing) { 373 if(!$imageSharing.size()){ 374 return; 375 } 376 $imageSharing.each(function(){ 377 378 var $buttons = $(this).find('.social-sharing-button'); 379 380 $buttons.each(function () { 381 var button = $(this); 382 var buttonHref = button.attr('data-main-href'); 383 button.attr('href', buttonHref); 384 }); 385 386 }); 387 } 388 389 function addPopUpHashToUrl(url, hash){ 390 if(hash.length = 0){ 391 return url; 392 } 393 var prefix = url.indexOf(prefix) != -1 ? '&' : '?'; 394 395 return url + prefix + hash; 396 } 397 398}(jQuery, window.SupsysticSlider = window.SupsysticSlider || {}, document.location.hash == '#debug'));
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.