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