1 2/** 3 * Cookie plugin 1.0 4 * 5 * Copyright (c) 2006 Klaus Hartl (stilbuero.de) 6 * Dual licensed under the MIT and GPL licenses: 7 * http://www.opensource.org/licenses/mit-license.php 8 * http://www.gnu.org/licenses/gpl.html 9 * 10 */ 11jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}}; 12; 13(function ($) { 14 Drupal.viewsSlideshow = Drupal.viewsSlideshow || {}; 15 16 /** 17 * Views Slideshow Controls 18 */ 19 Drupal.viewsSlideshowControls = Drupal.viewsSlideshowControls || {}; 20 21 /** 22 * Implement the play hook for controls. 23 */ 24 Drupal.viewsSlideshowControls.play = function (options) { 25 // Route the control call to the correct control type. 26 // Need to use try catch so we don't have to check to make sure every part 27 // of the object is defined. 28 try { 29 if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play == 'function') { 30 Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play(options); 31 } 32 } 33 catch(err) { 34 // Don't need to do anything on error. 35 } 36 37 try { 38 if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play == 'function') { 39 Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play(options); 40 } 41 } 42 catch(err) { 43 // Don't need to do anything on error. 44 } 45 }; 46 47 /** 48 * Implement the pause hook for controls. 49 */ 50 Drupal.viewsSlideshowControls.pause = function (options) { 51 // Route the control call to the correct control type. 52 // Need to use try catch so we don't have to check to make sure every part 53 // of the object is defined. 54 try { 55 if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause == 'function') { 56 Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause(options); 57 } 58 } 59 catch(err) { 60 // Don't need to do anything on error. 61 } 62 63 try { 64 if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause == 'function') { 65 Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause(options); 66 } 67 } 68 catch(err) { 69 // Don't need to do anything on error. 70 } 71 }; 72 73 74 /** 75 * Views Slideshow Text Controls 76 */ 77 78 // Add views slideshow api calls for views slideshow text controls. 79 Drupal.behaviors.viewsSlideshowControlsText = { 80 attach: function (context) { 81 82 // Process previous link 83 $('.views_slideshow_controls_text_previous:not(.views-slideshow-controls-text-previous-processed)', context).addClass('views-slideshow-controls-text-previous-processed').each(function() { 84 var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_previous_', ''); 85 $(this).click(function() { 86 Drupal.viewsSlideshow.action({ "action": 'previousSlide', "slideshowID": uniqueID }); 87 return false; 88 }); 89 }); 90 91 // Process next link
92 $('.views_slideshow_controls_text_next:not(.views-slideshow-controls-text-next-processed)', context).addClass('views-slideshow-controls-text-next-processed').each(function() { 93 var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_next_', ''); 94 $(this).click(function() { 95 Drupal.viewsSlideshow.action({ "action": 'nextSlide', "slideshowID": uniqueID }); 96 return false; 97 }); 98 }); 99 100 // Process pause link 101 $('.views_slideshow_controls_text_pause:not(.views-slideshow-controls-text-pause-processed)', context).addClass('views-slideshow-controls-text-pause-processed').each(function() { 102 var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_pause_', ''); 103 $(this).click(function() { 104 if (Drupal.settings.viewsSlideshow[uniqueID].paused) { 105 Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID, "force": true }); 106 } 107 else { 108 Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID, "force": true }); 109 } 110 return false; 111 }); 112 }); 113 } 114 }; 115 116 Drupal.viewsSlideshowControlsText = Drupal.viewsSlideshowControlsText || {}; 117 118 /** 119 * Implement the pause hook for text controls. 120 */ 121 Drupal.viewsSlideshowControlsText.pause = function (options) { 122 var pauseText = Drupal.theme.prototype['viewsSlideshowControlsPause'] ? Drupal.theme('viewsSlideshowControlsPause') : ''; 123 $('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(pauseText); 124 $('#views_slideshow_controls_text_pause_' + options.slideshowID).removeClass('views-slideshow-controls-text-status-play'); 125 $('#views_slideshow_controls_text_pause_' + options.slideshowID).addClass('views-slideshow-controls-text-status-pause'); 126 }; 127 128 /** 129 * Implement the play hook for text controls. 130 */ 131 Drupal.viewsSlideshowControlsText.play = function (options) { 132 var playText = Drupal.theme.prototype['viewsSlideshowControlsPlay'] ? Drupal.theme('viewsSlideshowControlsPlay') : ''; 133 $('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(playText); 134 $('#views_slideshow_controls_text_pause_' + options.slideshowID).removeClass('views-slideshow-controls-text-status-pause'); 135 $('#views_slideshow_controls_text_pause_' + options.slideshowID).addClass('views-slideshow-controls-text-status-play'); 136 }; 137 138 // Theme the resume control. 139 Drupal.theme.prototype.viewsSlideshowControlsPause = function () { 140 return Drupal.t('Resume'); 141 }; 142 143 // Theme the pause control. 144 Drupal.theme.prototype.viewsSlideshowControlsPlay = function () { 145 return Drupal.t('Pause'); 146 }; 147 148 /** 149 * Views Slideshow Pager 150 */ 151 Drupal.viewsSlideshowPager = Drupal.viewsSlideshowPager || {}; 152 153 /** 154 * Implement the transitionBegin hook for pagers. 155 */ 156 Drupal.viewsSlideshowPager.transitionBegin = function (options) { 157 // Route the pager call to the correct pager type. 158 // Need to use try catch so we don't have to check to make sure every part 159 // of the object is defined. 160 try { 161 if (typeof Drupal.settings.viewsSlideshowPager != "undefined" && typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin == 'function') { 162 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin(options); 163 if (Drupal.settings.viewsSlideshowPager[options.slideshowID].top.master_pager === 1) { 164 $.each(Drupal.settings.viewsSlideshow, function(i, obj) { 165 if (i != options.slideshowID) { 166 options.slideshowID = i; 167 options.action = 'goToSlide'; 168 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide(options); 169 } 170 }); 171 } 172 } 173 } 174 catch(err) { 175 // Don't need to do anything on error. 176 } 177 178 try { 179 if (typeof Drupal.settings.viewsSlideshowPager != "undefined" && typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin == 'function') { 180 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin(options); 181 if (Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.master_pager === 1) { 182 $.each(Drupal.settings.viewsSlideshow, function(i, obj) { 183 if (i != options.slideshowID) { 184 options.slideshowID = i; 185 options.action = 'goToSlide'; 186 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide(options); 187 } 188 }); 189 } 190 } 191 } 192 catch(err) { 193 // Don't need to do anything on error. 194 } 195 }; 196 197 /** 198 * Implement the goToSlide hook for pagers. 199 */ 200 Drupal.viewsSlideshowPager.goToSlide = function (options) { 201 // Route the pager call to the correct pager type. 202 // Need to use try catch so we don't have to check to make sure every part 203 // of the object is defined. 204 try { 205 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide == 'function') { 206 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide(options); 207 } 208 } 209 catch(err) { 210 // Don't need to do anything on error. 211 } 212 213 try { 214 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide == 'function') { 215 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide(options); 216 } 217 } 218 catch(err) { 219 // Don't need to do anything on error. 220 } 221 }; 222 223 /** 224 * Implement the previousSlide hook for pagers. 225 */ 226 Drupal.viewsSlideshowPager.previousSlide = function (options) { 227 // Route the pager call to the correct pager type. 228 // Need to use try catch so we don't have to check to make sure every part 229 // of the object is defined. 230 try { 231 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide == 'function') { 232 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide(options); 233 } 234 } 235 catch(err) { 236 // Don't need to do anything on error. 237 } 238 239 try { 240 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide == 'function') { 241 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide(options); 242 } 243 } 244 catch(err) { 245 // Don't need to do anything on error. 246 } 247 }; 248 249 /** 250 * Implement the nextSlide hook for pagers. 251 */ 252 Drupal.viewsSlideshowPager.nextSlide = function (options) { 253 // Route the pager call to the correct pager type. 254 // Need to use try catch so we don't have to check to make sure every part 255 // of the object is defined. 256 try { 257 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide == 'function') { 258 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide(options); 259 } 260 } 261 catch(err) { 262 // Don't need to do anything on error. 263 } 264 265 try { 266 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide == 'function') { 267 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide(options); 268 } 269 } 270 catch(err) { 271 // Don't need to do anything on error. 272 } 273 }; 274 275 276 /** 277 * Views Slideshow Pager Fields 278 */ 279 280 // Add views slideshow api calls for views slideshow pager fields. 281 Drupal.behaviors.viewsSlideshowPagerFields = { 282 attach: function (context) { 283 // Process pause on hover.
284 $('.views_slideshow_pager_field:not(.views-slideshow-pager-field-processed)', context).addClass('views-slideshow-pager-field-processed').each(function() { 285 // Parse out the location and unique id from the full id. 286 var pagerInfo = $(this).attr('id').split('_'); 287 var location = pagerInfo[2]; 288 pagerInfo.splice(0, 3); 289 var uniqueID = pagerInfo.join('_'); 290 291 // Add the activate and pause on pager hover event to each pager item. 292 if (Drupal.settings.viewsSlideshowPagerFields[uniqueID][location].activatePauseOnHover) { 293 $(this).children().each(function(index, pagerItem) { 294 var mouseIn = function() { 295 Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index }); 296 Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID }); 297 }; 298 299 var mouseOut = function() { 300 Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID }); 301 }; 302 303 if (jQuery.fn.hoverIntent) { 304 $(pagerItem).hoverIntent(mouseIn, mouseOut); 305 } 306 else { 307 $(pagerItem).hover(mouseIn, mouseOut); 308 } 309 }); 310 } 311 else { 312 $(this).children().each(function(index, pagerItem) { 313 $(pagerItem).click(function() { 314 Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index }); 315 }); 316 }); 317 } 318 }); 319 } 320 }; 321 322 Drupal.viewsSlideshowPagerFields = Drupal.viewsSlideshowPagerFields || {}; 323 324 /** 325 * Implement the transitionBegin hook for pager fields pager. 326 */ 327 Drupal.viewsSlideshowPagerFields.transitionBegin = function (options) {
328 for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { 329 // Remove active class from pagers 330 $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); 331 332 // Add active class to active pager. 333 $('#views_slideshow_pager_field_item_'+ pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active'); 334 } 335 }; 336 337 /** 338 * Implement the goToSlide hook for pager fields pager. 339 */ 340 Drupal.viewsSlideshowPagerFields.goToSlide = function (options) { 341 for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { 342 // Remove active class from pagers 343 $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); 344 345 // Add active class to active pager. 346 $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active'); 347 } 348 }; 349 350 /** 351 * Implement the previousSlide hook for pager fields pager. 352 */ 353 Drupal.viewsSlideshowPagerFields.previousSlide = function (options) {
354 for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { 355 // Get the current active pager. 356 var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', ''); 357 358 // If we are on the first pager then activate the last pager. 359 // Otherwise activate the previous pager. 360 if (pagerNum == 0) { 361 pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length() - 1; 362 } 363 else { 364 pagerNum--; 365 } 366 367 // Remove active class from pagers 368 $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); 369 370 // Add active class to active pager. 371 $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + pagerNum).addClass('active'); 372 } 373 }; 374 375 /** 376 * Implement the nextSlide hook for pager fields pager. 377 */ 378 Drupal.viewsSlideshowPagerFields.nextSlide = function (options) {
379 for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { 380 // Get the current active pager. 381 var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', ''); 382 var totalPagers = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length(); 383 384 // If we are on the last pager then activate the first pager. 385 // Otherwise activate the next pager. 386 pagerNum++; 387 if (pagerNum == totalPagers) { 388 pagerNum = 0; 389 } 390 391 // Remove active class from pagers 392 $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); 393 394 // Add active class to active pager. 395 $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + slideNum).addClass('active'); 396 } 397 }; 398 399 400 /** 401 * Views Slideshow Slide Counter 402 */ 403 404 Drupal.viewsSlideshowSlideCounter = Drupal.viewsSlideshowSlideCounter || {}; 405 406 /** 407 * Implement the transitionBegin for the slide counter. 408 */ 409 Drupal.viewsSlideshowSlideCounter.transitionBegin = function (options) { 410 $('#views_slideshow_slide_counter_' + options.slideshowID + ' .num').text(options.slideNum + 1); 411 }; 412 413 /** 414 * This is used as a router to process actions for the slideshow. 415 */ 416 Drupal.viewsSlideshow.action = function (options) { 417 // Set default values for our return status. 418 var status = { 419 'value': true, 420 'text': '' 421 }; 422 423 // If an action isn't specified return false. 424 if (typeof options.action == 'undefined' || options.action == '') { 425 status.value = false; 426 status.text = Drupal.t('There was no action specified.'); 427 return error; 428 } 429 430 // If we are using pause or play switch paused state accordingly. 431 if (options.action == 'pause') { 432 Drupal.settings.viewsSlideshow[options.slideshowID].paused = 1; 433 // If the calling method is forcing a pause then mark it as such. 434 if (options.force) { 435 Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 1; 436 } 437 } 438 else if (options.action == 'play') { 439 // If the slideshow isn't forced pause or we are forcing a play then play 440 // the slideshow. 441 // Otherwise return telling the calling method that it was forced paused. 442 if (!Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce || options.force) { 443 Drupal.settings.viewsSlideshow[options.slideshowID].paused = 0; 444 Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 0; 445 } 446 else { 447 status.value = false; 448 status.text += ' ' + Drupal.t('This slideshow is forced paused.'); 449 return status; 450 } 451 } 452 453 // We use a switch statement here mainly just to limit the type of actions 454 // that are available. 455 switch (options.action) { 456 case "goToSlide": 457 case "transitionBegin": 458 case "transitionEnd": 459 // The three methods above require a slide number. Checking if it is 460 // defined and it is a number that is an integer. 461 if (typeof options.slideNum == 'undefined' || typeof options.slideNum !== 'number' || parseInt(options.slideNum) != (options.slideNum - 0)) { 462 status.value = false; 463 status.text = Drupal.t('An invalid integer was specified for slideNum.'); 464 } 465 case "pause": 466 case "play": 467 case "nextSlide": 468 case "previousSlide": 469 // Grab our list of methods. 470 var methods = Drupal.settings.viewsSlideshow[options.slideshowID]['methods']; 471 472 // if the calling method specified methods that shouldn't be called then 473 // exclude calling them. 474 var excludeMethodsObj = {}; 475 if (typeof options.excludeMethods !== 'undefined') { 476 // We need to turn the excludeMethods array into an object so we can use the in 477 // function. 478 for (var i=0; i < excludeMethods.length; i++) { 479 excludeMethodsObj[excludeMethods[i]] = ''; 480 } 481 } 482 483 // Call every registered method and don't call excluded ones. 484 for (i = 0; i < methods[options.action].length; i++) { 485 if (Drupal[methods[options.action][i]] != undefined && typeof Drupal[methods[options.action][i]][options.action] == 'function' && !(methods[options.action][i] in excludeMethodsObj)) { 486 Drupal[methods[options.action][i]][options.action](options); 487 } 488 } 489 break; 490
491 // If it gets here it's because it's an invalid action. 492 default: 493 status.value = false; 494 status.text = Drupal.t('An invalid action "!action" was specified.', { "!action": options.action }); 495 } 496 return status; 497 }; 498})(jQuery); 499;
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.