1/* Fitvids */ 2(function ($) { 3 4 $.fn.fitVids = function (options) { 5 var settings = { 6 customSelector:null 7 } 8 9 var div = document.createElement('div'), 10 ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0]; 11 12 div.className = 'fit-vids-style'; 13 div.innerHTML = '­<style> \ 14 .fluid-width-video-wrapper { \ 15 width: 100%; \ 16 position: relative; \ 17 padding: 0; \ 18 } \ 19 \ 20 .fluid-width-video-wrapper iframe, \ 21 .fluid-width-video-wrapper object, \ 22 .fluid-width-video-wrapper embed { \ 23 position: absolute; \ 24 top: 0; \ 25 left: 0; \ 26 width: 100%; \ 27 height: 100%; \ 28 } \ 29 </style>'; 30 31 ref.parentNode.insertBefore(div, ref); 32 33 if (options) { 34 $.extend(settings, options); 35 } 36 37 return this.each(function () { 38 var selectors = [ 39 "iframe[src*='player.vimeo.com']", 40 "iframe[src*='www.youtube.com']", 41 "iframe[src*='www.kickstarter.com']", 42 "object", 43 "embed" 44 ]; 45 46 if (settings.customSelector) { 47 selectors.push(settings.customSelector); 48 } 49 50 var $allVideos = $(this).find(selectors.join(',')); 51 52 $allVideos.each(function () { 53 var $this = $(this); 54 if (this.tagName.toLowerCase() == 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { 55 return; 56 } 57 var height = this.tagName.toLowerCase() == 'object' ? $this.attr('height') : $this.height(), 58 aspectRatio = height / $this.width(); 59 if (!$this.attr('id')) { 60 var videoID = 'fitvid' + Math.floor(Math.random() * 999999); 61 $this.attr('id', videoID); 62 } 63 $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100) + "%"); 64 $this.removeAttr('height').removeAttr('width'); 65 }); 66 }); 67 68 } 69})(jQuery); 70 71/* Flexslider v1.8 */ 72(function (a) { 73 a.flexslider = function (c, b) { 74 var d = c; 75 d.init = function () { 76 d.vars = a.extend({}, a.flexslider.defaults, b); 77 d.data("flexslider", true); 78 d.container = a(".slides", d).first(); 79 d.slides = a(".slides:first > li", d); 80 d.count = d.slides.length; 81 d.animating = false; 82 d.currentSlide = d.vars.slideToStart; 83 d.animatingTo = d.currentSlide; 84 d.atEnd = (d.currentSlide == 0) ? true : false; 85 d.eventType = ("ontouchstart" in document.documentElement) ? "touchstart" : "click"; 86 d.cloneCount = 0; 87 d.cloneOffset = 0; 88 d.manualPause = false; 89 d.vertical = (d.vars.slideDirection == "vertical"); 90 d.prop = (d.vertical) ? "top" : "marginLeft"; 91 d.args = {}; 92 d.transitions = "webkitTransition" in document.body.style; 93 if (d.transitions) { 94 d.prop = "-webkit-transform" 95 } 96 if (d.vars.controlsContainer != "") { 97 d.controlsContainer = a(d.vars.controlsContainer).eq(a(".slides").index(d.container)); 98 d.containerExists = d.controlsContainer.length > 0 99 } 100 if (d.vars.manualControls != "") { 101 d.manualControls = a(d.vars.manualControls, ((d.containerExists) ? d.controlsContainer : d)); 102 d.manualExists = d.manualControls.length > 0 103 } 104 if (d.vars.randomize) { 105 d.slides.sort(function () { 106 return(Math.round(Math.random()) - 0.5) 107 }); 108 d.container.empty().append(d.slides) 109 } 110 if (d.vars.animation.toLowerCase() == "slide") { 111 if (d.transitions) { 112 d.setTransition(0) 113 } 114 d.css({overflow:"hidden"}); 115 if (d.vars.animationLoop) { 116 d.cloneCount = 2; 117 d.cloneOffset = 1; 118 d.container.append(d.slides.filter(":first").clone().addClass("clone")).prepend(d.slides.filter(":last").clone().addClass("clone")) 119 } 120 d.newSlides = a(".slides:first > li", d);
121 var m = (-1 * (d.currentSlide + d.cloneOffset)); 122 if (d.vertical) { 123 d.newSlides.css({display:"block", width:"100%", "float":"left"}); 124 d.container.height((d.count + d.cloneCount) * 200 + "%").css("position", "absolute").width("100%"); 125 setTimeout(function () { 126 d.css({position:"relative"}).height(d.slides.filter(":first").height()); 127 d.args[d.prop] = (d.transitions) ? "translate3d(0," + m * d.height() + "px,0)" : m * d.height() + "px"; 128 d.container.css(d.args) 129 }, 100) 130 } else { 131 d.args[d.prop] = (d.transitions) ? "translate3d(" + m * d.width() + "px,0,0)" : m * d.width() + "px"; 132 d.container.width((d.count + d.cloneCount) * 200 + "%").css(d.args); 133 setTimeout(function () { 134 d.newSlides.width(d.width()).css({"float":"left", display:"block"}) 135 }, 100) 136 } 137 } else { 138 d.transitions = false; 139 d.slides.css({width:"100%", "float":"left", marginRight:"-100%"}).eq(d.currentSlide).fadeIn(d.vars.animationDuration) 140 } 141 if (d.vars.controlNav) { 142 if (d.manualExists) { 143 d.controlNav = d.manualControls 144 } else { 145 var e = a('<ol class="flex-control-nav"></ol>'); 146 var s = 1; 147 for (var t = 0; t < d.count; t++) { 148 e.append("<li><a>" + s + "</a></li>"); 149 s++ 150 } 151 if (d.containerExists) { 152 a(d.controlsContainer).append(e); 153 d.controlNav = a(".flex-control-nav li a", d.controlsContainer) 154 } else { 155 d.append(e); 156 d.controlNav = a(".flex-control-nav li a", d) 157 } 158 } 159 d.controlNav.eq(d.currentSlide).addClass("active"); 160 d.controlNav.bind(d.eventType, function (i) { 161 i.preventDefault(); 162 if (!a(this).hasClass("active")) { 163 (d.controlNav.index(a(this)) > d.currentSlide) ? d.direction = "next" : d.direction = "prev"; 164 d.flexAnimate(d.controlNav.index(a(this)), d.vars.pauseOnAction) 165 } 166 }) 167 } 168 if (d.vars.directionNav) { 169 var v = a('<ul class="flex-direction-nav"><li><a class="prev" href="#">' + d.vars.prevText + '</a></li><li><a class="next" href="#">' + d.vars.nextText + "</a></li></ul>"); 170 if (d.containerExists) { 171 a(d.controlsContainer).append(v); 172 d.directionNav = a(".flex-direction-nav li a", d.controlsContainer) 173 } else { 174 d.append(v); 175 d.directionNav = a(".flex-direction-nav li a", d) 176 } 177 if (!d.vars.animationLoop) { 178 if (d.currentSlide == 0) { 179 d.directionNav.filter(".prev").addClass("disabled") 180 } else { 181 if (d.currentSlide == d.count - 1) { 182 d.directionNav.filter(".next").addClass("disabled") 183 } 184 } 185 } 186 d.directionNav.bind(d.eventType, function (i) { 187 i.preventDefault(); 188 var j = (a(this).hasClass("next")) ? d.getTarget("next") : d.getTarget("prev"); 189 if (d.canAdvance(j)) { 190 d.flexAnimate(j, d.vars.pauseOnAction) 191 } 192 }) 193 } 194 if (d.vars.keyboardNav && a("ul.slides").length == 1) { 195 function h(i) { 196 if (d.animating) { 197 return 198 } else { 199 if (i.keyCode != 39 && i.keyCode != 37) { 200 return 201 } else { 202 if (i.keyCode == 39) { 203 var j = d.getTarget("next") 204 } else { 205 if (i.keyCode == 37) { 206 var j = d.getTarget("prev") 207 } 208 } 209 if (d.canAdvance(j)) { 210 d.flexAnimate(j, d.vars.pauseOnAction) 211 } 212 } 213 } 214 } 215 216 a(document).bind("keyup", h) 217 } 218 if (d.vars.mousewheel) { 219 d.mousewheelEvent = (/Firefox/i.test(navigator.userAgent)) ? "DOMMouseScroll" : "mousewheel"; 220 d.bind(d.mousewheelEvent, function (y) { 221 y.preventDefault(); 222 y = y ? y : window.event; 223 var i = y.detail ? y.detail * -1 : y.wheelDelta / 40, j = (i < 0) ? d.getTarget("next") : d.getTarget("prev"); 224 if (d.canAdvance(j)) { 225 d.flexAnimate(j, d.vars.pauseOnAction) 226 } 227 }) 228 } 229 if (d.vars.slideshow) { 230 if (d.vars.pauseOnHover && d.vars.slideshow) { 231 d.hover(function () { 232 d.pause() 233 }, function () { 234 if (!d.manualPause) { 235 d.resume() 236 } 237 }) 238 } 239 d.animatedSlides = setInterval(d.animateSlides, d.vars.slideshowSpeed) 240 } 241 if (d.vars.pausePlay) {
242 var q = a('<div class="flex-pauseplay"><span></span></div>'); 243 if (d.containerExists) { 244 d.controlsContainer.append(q); 245 d.pausePlay = a(".flex-pauseplay span", d.controlsContainer) 246 } else { 247 d.append(q); 248 d.pausePlay = a(".flex-pauseplay span", d) 249 } 250 var n = (d.vars.slideshow) ? "pause" : "play"; 251 d.pausePlay.addClass(n).text((n == "pause") ? d.vars.pauseText : d.vars.playText); 252 d.pausePlay.bind(d.eventType, function (i) { 253 i.preventDefault(); 254 if (a(this).hasClass("pause")) { 255 d.pause(); 256 d.manualPause = true 257 } else { 258 d.resume(); 259 d.manualPause = false 260 } 261 }) 262 } 263 if ("ontouchstart" in document.documentElement) { 264 var w, u, l, r, o, x, p = false; 265 d.each(function () { 266 if ("ontouchstart" in document.documentElement) { 267 this.addEventListener("touchstart", g, false) 268 } 269 }); 270 function g(i) { 271 if (d.animating) { 272 i.preventDefault() 273 } else { 274 if (i.touches.length == 1) { 275 d.pause(); 276 r = (d.vertical) ? d.height() : d.width(); 277 x = Number(new Date()); 278 l = (d.vertical) ? (d.currentSlide + d.cloneOffset) * d.height() : (d.currentSlide + d.cloneOffset) * d.width(); 279 w = (d.vertical) ? i.touches[0].pageY : i.touches[0].pageX; 280 u = (d.vertical) ? i.touches[0].pageX : i.touches[0].pageY; 281 d.setTransition(0); 282 this.addEventListener("touchmove", k, false); 283 this.addEventListener("touchend", f, false) 284 } 285 } 286 } 287 288 function k(i) { 289 o = (d.vertical) ? w - i.touches[0].pageY : w - i.touches[0].pageX; 290 p = (d.vertical) ? (Math.abs(o) < Math.abs(i.touches[0].pageX - u)) : (Math.abs(o) < Math.abs(i.touches[0].pageY - u)); 291 if (!p) { 292 i.preventDefault(); 293 if (d.vars.animation == "slide" && d.transitions) { 294 if (!d.vars.animationLoop) { 295 o = o / ((d.currentSlide == 0 && o < 0 || d.currentSlide == d.count - 1 && o > 0) ? (Math.abs(o) / r + 2) : 1) 296 } 297 d.args[d.prop] = (d.vertical) ? "translate3d(0," + (-l - o) + "px,0)" : "translate3d(" + (-l - o) + "px,0,0)"; 298 d.container.css(d.args) 299 } 300 } 301 } 302 303 function f(j) { 304 d.animating = false; 305 if (d.animatingTo == d.currentSlide && !p && !(o == null)) { 306 var i = (o > 0) ? d.getTarget("next") : d.getTarget("prev"); 307 if (d.canAdvance(i) && Number(new Date()) - x < 550 && Math.abs(o) > 20 || Math.abs(o) > r / 2) { 308 d.flexAnimate(i, d.vars.pauseOnAction) 309 } else { 310 d.flexAnimate(d.currentSlide, d.vars.pauseOnAction) 311 } 312 } 313 this.removeEventListener("touchmove", k, false); 314 this.removeEventListener("touchend", f, false); 315 w = null; 316 u = null; 317 o = null; 318 l = null 319 } 320 } 321 if (d.vars.animation.toLowerCase() == "slide") { 322 a(window).resize(function () { 323 if (!d.animating) { 324 if (d.vertical) { 325 d.height(d.slides.filter(":first").height()); 326 d.args[d.prop] = (-1 * (d.currentSlide + d.
326cloneOffset)) * d.slides.filter(":first").height() + "px"; 327 if (d.transitions) { 328 d.setTransition(0); 329 d.args[d.prop] = (d.vertical) ? "translate3d(0," + d.args[d.prop] + ",0)" : "translate3d(" + d.args[d.prop] + ",0,0)" 330 } 331 d.container.css(d.args) 332 } else { 333 d.newSlides.width(d.width()); 334 d.args[d.prop] = (-1 * (d.currentSlide + d.cloneOffset)) * d.width() + "px"; 335 if (d.transitions) { 336 d.setTransition(0); 337 d.args[d.prop] = (d.vertical) ? "translate3d(0," + d.args[d.prop] + ",0)" : "translate3d(" + d.args[d.prop] + ",0,0)" 338 } 339 d.container.css(d.args) 340 } 341 } 342 }) 343 } 344 d.vars.start(d) 345 }; 346 d.flexAnimate = function (g, f) { 347 if (!d.animating) { 348 d.animating = true; 349 d.animatingTo = g; 350 d.vars.before(d); 351 if (f) { 352 d.pause() 353 } 354 if (d.vars.controlNav) { 355 d.controlNav.removeClass("active").eq(g).addClass("active") 356 } 357 d.atEnd = (g == 0 || g == d.count - 1) ? true : false; 358 if (!d.vars.animationLoop && d.vars.directionNav) { 359 if (g == 0) { 360 d.directionNav.removeClass("disabled").filter(".prev").addClass("disabled") 361 } else { 362 if (g == d.count - 1) { 363 d.directionNav.removeClass("disabled").filter(".next").addClass("disabled") 364 } else { 365 d.directionNav.removeClass("disabled") 366 } 367 } 368 } 369 if (!d.vars.animationLoop && g == d.count - 1) { 370 d.pause(); 371 d.vars.end(d) 372 } 373 if (d.vars.animation.toLowerCase() == "slide") { 374 var e = (d.vertical) ? d.slides.filter(":first").height() : d.slides.filter(":first").width(); 375 if (d.currentSlide == 0 && g == d.count - 1 && d.vars.animationLoop && d.direction != "next") { 376 d.slideString = "0px" 377 } else { 378 if (d.currentSlide == d.count - 1 && g == 0 && d.vars.animationLoop && d.direction != "prev") { 379 d.slideString = (-1 * (d.count + 1)) * e + "px" 380 } else { 381 d.slideString = (-1 * (g + d.cloneOffset)) * e + "px" 382 } 383 } 384 d.args[d.prop] = d.slideString; 385 if (d.transitions) { 386 d.setTransition(d.vars.animationDuration); 387 d.args[d.prop] = (d.vertical) ? "translate3d(0," + d.slideString + ",0)" : "translate3d(" + d.slideString + ",0,0)"; 388 d.container.css(d.args).one("webkitTransitionEnd transitionend", function () { 389 d.wrapup(e) 390 }) 391 } else { 392 d.container.animate(d.args, d.vars.animationDuration, function () { 393 d.wrapup(e) 394 }) 395 } 396 } else { 397 d.slides.eq(d.currentSlide).fadeOut(d.vars.animationDuration); 398 d.slides.eq(g).fadeIn(d.vars.animationDuration, function () { 399 d.wrapup() 400 }) 401 } 402 } 403 }; 404 d.wrapup = function (e) { 405 if (d.vars.animation == "slide") { 406 if (d.currentSlide == 0 && d.animatingTo == d.count - 1 && d.vars.animationLoop) { 407 d.args[d.prop] = (-1 * d.count) * e + "px"; 408 if (d.transitions) { 409 d.setTransition(0); 410 d.args[d.prop] = (d.vertical) ? "translate3d(0," + d.args[d.prop] + ",0)" : "translate3d(" + d.args[d.prop] + ",0,0)" 411 } 412 d.container.css(d.args) 413 } else { 414 if (d.currentSlide == d.count - 1 && d.animatingTo == 0 && d.vars.animationLoop) { 415 d.args[d.prop] = -1 * e + "px"; 416 if (d.transitions) { 417 d.setTransition(0); 418 d.args[d.prop] = (d.vertical) ? "translate3d(0," + d.args[d.prop] + ",0)" : "translate3d(" + d.args[d.prop] + ",0,0)" 419 } 420 d.container.css(d.args) 421 } 422 } 423 } 424 d.animating = false;
425 d.currentSlide = d.animatingTo; 426 d.vars.after(d) 427 }; 428 d.animateSlides = function () { 429 if (!d.animating) { 430 d.flexAnimate(d.getTarget("next")) 431 } 432 }; 433 d.pause = function () { 434 clearInterval(d.animatedSlides); 435 if (d.vars.pausePlay) { 436 d.pausePlay.removeClass("pause").addClass("play").text(d.vars.playText) 437 } 438 }; 439 d.resume = function () { 440 d.animatedSlides = setInterval(d.animateSlides, d.vars.slideshowSpeed); 441 if (d.vars.pausePlay) { 442 d.pausePlay.removeClass("play").addClass("pause").text(d.vars.pauseText) 443 } 444 }; 445 d.canAdvance = function (e) { 446 if (!d.vars.animationLoop && d.atEnd) { 447 if (d.currentSlide == 0 && e == d.count - 1 && d.direction != "next") { 448 return false 449 } else { 450 if (d.currentSlide == d.count - 1 && e == 0 && d.direction == "next") { 451 return false 452 } else { 453 return true 454 } 455 } 456 } else { 457 return true 458 } 459 }; 460 d.getTarget = function (e) { 461 d.direction = e; 462 if (e == "next") { 463 return(d.currentSlide == d.count - 1) ? 0 : d.currentSlide + 1 464 } else { 465 return(d.currentSlide == 0) ? d.count - 1 : d.currentSlide - 1 466 } 467 }; 468 d.setTransition = function (e) { 469 d.container.css({"-webkit-transition-duration":(e / 1000) + "s"}) 470 }; 471 d.init() 472 }; 473 a.flexslider.defaults = {animation:"fade", slideDirection:"horizontal", slideshow:true, slideshowSpeed:7000, animationDuration:600, directionNav:true, controlNav:true, keyboardNav:true, mousewheel:false, prevText:"◀", nextText:"▶", pausePlay:false, pauseText:"Pause", playText:"Play", randomize:false, slideToStart:0, animationLoop:true, pauseOnAction:true, pauseOnHover:false, controlsContainer:"", manualControls:"", start:function () { 474 }, before:function () { 475 }, after:function () { 476 }, end:function () { 477 }}; 478 a.fn.flexslider = function (b) { 479 return this.each(function () { 480 if (a(this).find(".slides li").length == 1) { 481 a(this).find(".slides li").fadeIn(400) 482 } else { 483 if (a(this).data("flexslider") != true) { 484 new a.flexslider(a(this), b) 485 } 486 } 487 }) 488 } 489})(jQuery); 490 491// usage: log('inside coolFunc', this, arguments); 492window.log = function () { 493 log.history = log.history || []; // store logs to an array for reference 494 log.history.push(arguments); 495 if (this.console) { 496 arguments.callee = arguments.callee.caller; 497 console.log(Array.prototype.slice.call(arguments)); 498 } 499}; 500(function (b) { 501 function c() { 502 } 503 504 for (var d = "assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","), a; a = d.pop();)b[a] = b[a] || c 505})(window.console = window.console || {}); 506 507// jQuery Easing 508jQuery.easing["jswing"] = jQuery.easing["swing"]; 509jQuery.extend(jQuery.easing, {def:"easeOutQuad", swing:function (a, b, c, d, e) { 510 return jQuery.easing[jQuery.easing.def](a, b, c, d, e) 511}, easeInQuad:function (a, b, c, d, e) { 512 return d * (b /= e) * b + c 513}, easeOutQuad:function (a, b, c, d, e) { 514 return-d * (b /= e) * (b - 2) + c 515}, easeInOutQuad:function (a, b, c, d, e) { 516 if ((b /= e / 2) < 1)return d / 2 * b * b + c; 517 return-d / 2 * (--b * (b - 2) - 1) + c 518}, easeInCubic:function (a, b, c, d, e) { 519 return d * (b /= e) * b * b + c 520}, easeOutCubic:function (a, b, c, d, e) { 521 return d * ((b = b / e - 1) * b * b + 1) + c 522}, easeInOutCubic:function (a, b, c, d, e) { 523 if ((b /= e / 2) < 1)return d / 2 * b * b * b + c; 524 return d / 2 * ((b -= 2) * b * b + 2) + c 525}, easeInQuart:function (a, b, c, d, e) { 526 return d * (b /= e) * b * b * b + c 527}, easeOutQuart:function (a, b, c, d, e) { 528 return-d * ((b = b / e - 1) * b * b * b - 1) + c 529}, easeInOutQuart:function (a, b, c, d, e) { 530 if ((b /= e / 2) < 1)return d / 2 * b * b * b * b + c; 531 return-d / 2 * ((b -= 2) * b * b * b - 2) + c 532}, easeInQuint:function (a, b, c, d, e) { 533 return d * (b /= e) * b * b * b * b + c 534}, easeOutQuint:function (a, b, c, d, e) { 535 return d * ((b = b / e - 1) * b * b * b * b + 1) + c 536}, easeInOutQuint:function (a, b, c, d, e) { 537 if ((b /= e / 2) < 1)return d / 2 * b * b * b * b * b + c; 538 return d / 2 * ((b -= 2) * b * b * b * b + 2) + c 539}, easeInSine:function (a, b, c, d, e) {
540 return-d * Math.cos(b / e * (Math.PI / 2)) + d + c 541}, easeOutSine:function (a, b, c, d, e) { 542 return d * Math.sin(b / e * (Math.PI / 2)) + c 543}, easeInOutSine:function (a, b, c, d, e) { 544 return-d / 2 * (Math.cos(Math.PI * b / e) - 1) + c 545}, easeInExpo:function (a, b, c, d, e) { 546 return b == 0 ? c : d * Math.pow(2, 10 * (b / e - 1)) + c 547}, easeOutExpo:function (a, b, c, d, e) { 548 return b == e ? c + d : d * (-Math.pow(2, -10 * b / e) + 1) + c 549}, easeInOutExpo:function (a, b, c, d, e) { 550 if (b == 0)return c; 551 if (b == e)return c + d; 552 if ((b /= e / 2) < 1)return d / 2 * Math.pow(2, 10 * (b - 1)) + c; 553 return d / 2 * (-Math.pow(2, -10 * --b) + 2) + c 554}, easeInCirc:function (a, b, c, d, e) { 555 return-d * (Math.sqrt(1 - (b /= e) * b) - 1) + c 556}, easeOutCirc:function (a, b, c, d, e) { 557 return d * Math.sqrt(1 - (b = b / e - 1) * b) + c 558}, easeInOutCirc:function (a, b, c, d, e) { 559 if ((b /= e / 2) < 1)return-d / 2 * (Math.sqrt(1 - b * b) - 1) + c; 560 return d / 2 * (Math.sqrt(1 - (b -= 2) * b) + 1) + c 561}, easeInElastic:function (a, b, c, d, e) { 562 var f = 1.70158; 563 var g = 0; 564 var h = d; 565 if (b == 0)return c; 566 if ((b /= e) == 1)return c + d; 567 if (!g)g = e * .3; 568 if (h < Math.abs(d)) { 569 h = d; 570 var f = g / 4 571 } else var f = g / (2 * Math.PI) * Math.asin(d / h); 572 return-(h * Math.pow(2, 10 * (b -= 1)) * Math.sin((b * e - f) * 2 * Math.PI / g)) + c 573}, easeOutElastic:function (a, b, c, d, e) { 574 var f = 1.70158; 575 var g = 0; 576 var h = d; 577 if (b == 0)return c; 578 if ((b /= e) == 1)return c + d; 579 if (!g)g = e * .3; 580 if (h < Math.abs(d)) { 581 h = d; 582 var f = g / 4 583 } else var f = g / (2 * Math.PI) * Math.asin(d / h); 584 return h * Math.pow(2, -10 * b) * Math.sin((b * e - f) * 2 * Math.PI / g) + d + c 585}, easeInOutElastic:function (a, b, c, d, e) { 586 var f = 1.70158; 587 var g = 0; 588 var h = d; 589 if (b == 0)return c; 590 if ((b /= e / 2) == 2)return c + d; 591 if (!g)g = e * .3 * 1.5; 592 if (h < Math.abs(d)) { 593 h = d; 594 var f = g / 4 595 } else var f = g / (2 * Math.PI) * Math.asin(d / h); 596 if (b < 1)return-.5 * h * Math.pow(2, 10 * (b -= 1)) * Math.sin((b * e - f) * 2 * Math.PI / g) + c; 597 return h * Math.pow(2, -10 * (b -= 1)) * Math.sin((b * e - f) * 2 * Math.PI / g) * .5 + d + c 598}, easeInBack:function (a, b, c, d, e, f) { 599 if (f == undefined)f = 1.70158; 600 return d * (b /= e) * b * ((f + 1) * b - f) + c 601}, easeOutBack:function (a, b, c, d, e, f) { 602 if (f == undefined)f = 1.70158; 603 return d * ((b = b / e - 1) * b * ((f + 1) * b + f) + 1) + c 604}, easeInOutBack:function (a, b, c, d, e, f) { 605 if (f == undefined)f = 1.70158; 606 if ((b /= e / 2) < 1)return d / 2 * b * b * (((f *= 1.525) + 1) * b - f) + c; 607 return d / 2 * ((b -= 2) * b * (((f *= 1.525) + 1) * b + f) + 2) + c 608}, easeInBounce:function (a, b, c, d, e) { 609 return d - jQuery.easing.easeOutBounce(a, e - b, 0, d, e) + c 610}, easeOutBounce:function (a, b, c, d, e) { 611 if ((b /= e) < 1 / 2.75) { 612 return d * 7.5625 * b * b + c 613 } else if (b < 2 / 2.75) { 614 return d * (7.5625 * (b -= 1.5 / 2.75) * b + .75) + c 615 } else if (b < 2.5 / 2.75) { 616 return d * (7.5625 * (b -= 2.25 / 2.75) * b + .9375) + c 617 } else { 618 return d * (7.5625 * (b -= 2.625 / 2.75) * b + .984375) + c 619 } 620}, easeInOutBounce:function (a, b, c, d, e) { 621 if (b < e / 2)return jQuery.easing.easeInBounce(a, b * 2, 0, d, e) * .5 + c; 622 return jQuery.easing.easeOutBounce(a, b * 2 - e, 0, d, e) * .5 + d * .5 + c 623}}) 624 625/* Tabber Tabs */ 626function tabberObj(argsObj) { 627 var arg; 628 this.div = null; 629 this.classMain = "tabber"; 630 this.classMainLive = "tabberlive"; 631 this.classTab = "tabbertab"; 632 this.classTabDefault = "tabbertabdefault"; 633 this.classNav = "tabbernav"; 634 this.classTabHide = "tabbertabhide"; 635 this.classNavActive = "tabberactive"; 636 this.titleElements = ['h2', 'h3', 'h4', 'h5', 'h6']; 637 this.titleElementsStripHTML = true; 638 this.removeTitle = true; 639 this.addLinkId = false; 640 this.linkIdFormat = '<tabberid>nav<tabnumberone>'; 641 for (arg in argsObj) { 642 this[arg] = argsObj[arg] 643 } 644 this.REclassMain = new RegExp('\\b' + this.classMain + '\\b', 'gi'); 645 this.REclassMainLive = new RegExp('\\b' + this.classMainLive + '\\b', 'gi'); 646 this.REclassTab = new RegExp('\\b' + this.classTab + '\\b', 'gi'); 647 this.REclassTabDefault = new RegExp('\\b' + this.classTabDefault + '\\b', 'gi'); 648 this.REclassTabHide = new RegExp('\\b' + this.classTabHide + '\\b', 'gi'); 649 this.tabs = new Array(); 650 if (this.div) { 651 this.init(this.div); 652 this.div = null 653 } 654} 655tabberObj.prototype.init = function (e) { 656 var childNodes, i, i2, t, defaultTab = 0, DOM_ul, DOM_li, DOM_a, aId, headingElement; 657 if (!document.getElementsByTagName) { 658 return false 659 } 660 if (e.id) { 661 this.id = e.id 662 } 663 this.tabs.length = 0; 664 childNodes = e.childNodes; 665 for (i = 0; i < childNodes.length; i++) { 666 if (childNodes[i].className && childNodes[i].className.match(this.REclassTab)) { 667 t = new Object(); 668 t.div = childNodes[i]; 669 this.tabs[this.tabs.length] = t; 670 if (childNodes[i].className.match(this.REclassTabDefault)) { 671 defaultTab = this.tabs.length - 1 672 } 673 } 674 } 675 DOM_ul = document.createElement("ul"); 676 DOM_ul.className = this.classNav; 677 for (i = 0; i < this.tabs.length; i++) { 678 t = this.tabs[i]; 679 t.headingText = t.div.title; 680 if (this.removeTitle) { 681 t.div.title = '' 682 } 683 if (!t.headingText) { 684 for (i2 = 0; i2 < this.titleElements.length; i2++) { 685 headingElement = t.div.getElementsByTagName(this.titleElements[i2])[0]; 686 if (headingElement) { 687 t.headingText = headingElement.innerHTML; 688 if (this.titleElementsStripHTML) { 689 t.headingText.replace(/<br>/gi, " "); 690 t.headingText = t.headingText.replace(/<[^>]+>/g, "") 691 } 692 break 693 } 694 } 695 } 696 if (!t.headingText) { 697 t.headingText = i + 1 698 } 699 DOM_li = document.createElement("li"); 700 t.li = DOM_li; 701 DOM_a = document.createElement("a"); 702 DOM_a.appendChild(document.createTextNode(t.headingText)); 703 DOM_a.href = "javascript:void(null);"; 704 DOM_a.title = t.headingText; 705 DOM_a.onclick = this.navClick; 706 DOM_a.tabber = this; 707 DOM_a.tabberIndex = i; 708 if (this.addLinkId && this.linkIdFormat) { 709 aId = this.linkIdFormat; 710 aId = aId.replace(/<tabberid>/gi, this.id); 711 aId = aId.replace(/<tabnumberzero>
711/gi, i); 712 aId = aId.replace(/<tabnumberone>/gi, i + 1); 713 aId = aId.replace(/<tabtitle>/gi, t.headingText.replace(/[^a-zA-Z0-9\-]/gi, '')); 714 DOM_a.id = aId 715 } 716 DOM_li.appendChild(DOM_a); 717 DOM_ul.appendChild(DOM_li) 718 } 719 e.insertBefore(DOM_ul, e.firstChild); 720 e.className = e.className.replace(this.REclassMain, this.classMainLive); 721 this.tabShow(defaultTab); 722 if (typeof this.onLoad == 'function') { 723 this.onLoad({tabber:this}) 724 } 725 return this 726}; 727tabberObj.prototype.navClick = function (event) { 728 var rVal, a, self, tabberIndex, onClickArgs; 729 a = this; 730 if (!a.tabber) { 731 return false 732 } 733 self = a.tabber; 734 tabberIndex = a.tabberIndex; 735 a.blur(); 736 if (typeof self.onClick == 'function') { 737 onClickArgs = {'tabber':self, 'index':tabberIndex, 'event':event}; 738 if (!event) { 739 onClickArgs.event = window.event 740 } 741 rVal = self.onClick(onClickArgs); 742 if (rVal === false) { 743 return false 744 } 745 } 746 self.tabShow(tabberIndex); 747 return false 748}; 749tabberObj.prototype.tabHideAll = function () { 750 var i; 751 for (i = 0; i < this.tabs.length; i++) { 752 this.tabHide(i) 753 } 754}; 755tabberObj.prototype.tabHide = function (tabberIndex) { 756 var div; 757 if (!this.tabs[tabberIndex]) { 758 return false 759 } 760 div = this.tabs[tabberIndex].div; 761 if (!div.className.match(this.REclassTabHide)) { 762 div.className += ' ' + this.classTabHide 763 } 764 this.navClearActive(tabberIndex); 765 return this 766}; 767tabberObj.prototype.tabShow = function (tabberIndex) { 768 var div; 769 if (!this.tabs[tabberIndex]) { 770 return false 771 } 772 this.tabHideAll(); 773 div = this.tabs[tabberIndex].div; 774 div.className = div.className.replace(this.REclassTabHide, ''); 775 this.navSetActive(tabberIndex); 776 if (typeof this.onTabDisplay == 'function') { 777 this.onTabDisplay({'tabber':this, 'index':tabberIndex}) 778 } 779 return this 780}; 781tabberObj.prototype.navSetActive = function (tabberIndex) { 782 this.tabs[tabberIndex].li.className = this.classNavActive; 783 return this 784}; 785tabberObj.prototype.navClearActive = function (tabberIndex) { 786 this.tabs[tabberIndex].li.className = ''; 787 return this 788}; 789function tabberAutomatic(tabberArgs) { 790 var tempObj, divs, i; 791 if (!tabberArgs) { 792 tabberArgs = {} 793 } 794 tempObj = new tabberObj(tabberArgs); 795 divs = document.getElementsByTagName("div"); 796 for (i = 0; i < divs.length; i++) { 797 if (divs[i].className && divs[i].className.match(tempObj.REclassMain)) { 798 tabberArgs.div = divs[i]; 799 divs[i].tabber = new tabberObj(tabberArgs) 800 } 801 } 802 return this 803} 804function tabberAutomaticOnLoad(tabberArgs) { 805 var oldOnLoad; 806 if (!tabberArgs) { 807 tabberArgs = {} 808 } 809 oldOnLoad = document.ready; 810 if (typeof document.ready != 'function') { 811 document.ready = function () { 812 tabberAutomatic(tabberArgs) 813 } 814 } else { 815 document.ready = function () { 816 oldOnLoad(); 817 tabberAutomatic(tabberArgs) 818 } 819 } 820} 821if (typeof tabberOptions == 'undefined') { 822 tabberAutomaticOnLoad() 823} else { 824 if (!tabberOptions['manualStartup']) { 825 tabberAutomaticOnLoad(tabberOptions) 826 } 827} 828 829/* Backstretch */ 830(function (a) { 831 a.backstretch = function (b, c, d) { 832 function r() { 833 if (b) { 834 var c; 835 var e; 836 if (f.length == 0) { 837 f = a("<div />").attr("id", "backstretch").css({left:0, top:0, position:j ? "fixed" : "absolute", overflow:"hidden", zIndex:-999999, margin:0, padding:0, height:"100%", width:"100%"}) 838 } else { 839 f.find("img").addClass("deleteable") 840 } 841 c = a("<img />").css({position:"absolute", display:"none", margin:0, padding:0, border:"none", zIndex:-999999}).bind("load", 842 function (b) { 843 var c = a(this), e, h; 844 c.css({width:"auto", height:"auto"}); 845 e = this.width || a(b.target).width(); 846 h = this.height || a(b.target).height(); 847 l = e / h; 848 s(); 849 c.fadeIn(g.speed, function () { 850 f.find(".deleteable").remove(); 851 if (typeof d == "function")d() 852 }) 853 }).appendTo(f); 854 e = a("<span />").attr("id", "pattern-filter").appendTo(f); 855 if (a("body #backstretch").length == 0) { 856 if (a(window).scrollTop() === 0)window.scrollTo(0, 0); 857 a("body").append(f) 858 } 859 f.data("settings", g); 860 c.attr("src", b); 861 a(window).unbind("resize.backstretch").bind("resize.backstretch", function () { 862 if ("onorientationchange"in window) { 863 if (window.pageYOffset === 0)window.scrollTo(0, 1) 864 } 865 s() 866 }) 867 } 868 } 869 870 function s() { 871 try {
872 q = {left:0, top:0}, rootWidth = n = i.width(), rootHeight = k ? window.innerHeight : i.height(), o = n / l; 873 if (o >= rootHeight) { 874 p = (o - rootHeight) / 2; 875 if (g.centeredY)q.top = "-" + p + "px" 876 } else { 877 o = rootHeight; 878 n = o * l; 879 p = (n - rootWidth) / 2; 880 if (g.centeredX)q.left = "-" + p + "px" 881 } 882 f.css({width:rootWidth, height:rootHeight}).find("img:not(.deleteable)").css({width:n, height:o}).css(q) 883 } catch (a) { 884 } 885 } 886 887 var e = {centeredX:true, centeredY:true, speed:1e3}, f = a("#backstretch"), g = f.data("settings") || e, h = f.data("settings"), i, j, k, l, m, n, o, p, q; 888 if (c && typeof c == "object")a.extend(g, c); 889 if (c && typeof c == "function")d = c; 890 a(document).ready(function () { 891 var b = window, c = navigator.userAgent, d = navigator.platform, e = c.match(/AppleWebKit\/([0-9]+)/), f = !!e && e[1], g = c.match(/Fennec\/([0-9]+)/), h = !!g && g[1], l = c.match(/Opera Mobi\/([0-9]+)/), m = !!l && l[1], n = c.match(/MSIE ([0-9]+)/), o = !!n && n[1]; 892 j = !((d.indexOf("iPhone") > -1 || d.indexOf("iPad") > -1 || d.indexOf("iPod") > -1) && f && f < 534 || b.operamini && {}.toString.call(b.operamini) === "[object OperaMini]" || l && m < 7458 || c.indexOf("Android") > -1 && f && f < 533 || h && h < 6 || "palmGetResource"in window && f && f < 534 || c.indexOf("MeeGo") > -1 && c.indexOf("NokiaBrowser/8.5.0") > -1 || o && o <= 6); 893 i = j ? a(window) : a(document); 894 k = j && window.innerHeight; 895 r() 896 }); 897 return this 898 } 899})(jQuery) 900 901/* My Scripts */ 902jQuery.noConflict(); 903 904/* Onload Scripts */ 905jQuery(window).load(function () { 906 907 908 // Automate the widths of the tabber tabs widget headers 909 var tabberHeaders = jQuery("ul.tabbernav li"); 910 var numberOfTabs = tabberHeaders.length; 911 var tabberPercentage = 99 / numberOfTabs; 912 var tabberPopular = jQuery("div.popular-posts img.wpp-thumbnail").parent("a").parent("li").last(); 913 var tabberLatest = jQuery("div.widget_recent_entries img.wpp-thumbnail").parent("a").parent("li").last(); 914 var tabberLastest = jQuery(tabberLatest).children("a").children("img"); 915 var tabberLast = jQuery(tabberPopular).children("a").children("img"); 916 917 jQuery(tabberLast).css("margin-bottom", "0px"); 918 jQuery(tabberLastest).css("margin-bottom", "0px"); 919 920 tabberHeaders.each(function () { 921 jQuery(tabberHeaders).css("width", tabberPercentage + "%"); 922 }); 923 924 925 jQuery('.slides, .flex-direction-nav, .flex-control-nav').hover(function () { 926 jQuery('.flex-direction-nav li .next').css('right', '0px'); 927 jQuery('.flex-direction-nav li .prev').css('left', '-2px'); 928 }, function () { 929 jQuery('.flex-direction-nav li .next').css('right', '-50px'); 930 jQuery('.flex-direction-nav li .prev').css('left', '-52px'); 931 }); 932 933 // Tidy up the tab widget loading 934 jQuery('.tabbertabs').css('height', 'auto'); 935 jQuery('.sdfsdf').remove(); 936 937}); 938 939/* Document Ready Scripts */ 940jQuery(document).ready(function ($omc) { 941 942 943 // Boot Fitvids.js 944 $omc("div.omc-video-container").fitVids(); 945 946 947 // Sort out the tab widget loading 948 $omc('.sdfsdf').delay(500).fadeOut(500).delay(500); 949 950 951 $ 952 /* omc('div.preloaders').fadeOut(400); */ 953 954 955 // Move the date-author-stamp beneath the gallery 956 var galleryStamp = $omc('p.omc-format-gallery'); 957 $omc('p.omc-format-gallery').remove(); 958 $omc('.gallery-to-slideshow-wrapper').after(galleryStamp); 959 960 961 // Add the "»" to the submenu 962 jQuery("nav#omc-main-navigation ul li ul.sub-menu li").each(function () { 963 if (jQuery(this).children('ul').length > 0) { 964 jQuery(this).find('a:first').append('<span class="omc-rarrr"> »</span>'); 965 } 966 }); 967 968 969 // Boot PrettyPhoto Lightbox 970 jQuery("a[rel^='prettyPhoto']").prettyPhoto({ 971 horizontal_padding:20, 972 theme:'light_square' 973 974 }); 975 976 977 // Boot the flexslider 978 jQuery('.flexslider').flexslider({ 979 animation:"fade", 980 controlsContainer:".flex-container", 981 slideshow:true 982 }); 983 984 985 // Fix the width of the slider pagination links 986 var flexCircles = $omc('ol.flex-control-nav > li').size(); 987 988 989 if (flexCircles < 9) { 990 $omc('ol.flex-control-nav').css("width", "37px"); 991 } 992 else if (flexCircles > 8) { 993 $omc('ol.flex-control-nav').css("width", "52px"); 994 } 995 996 // get rid of the ghost anchors in module a 997 $omc('.omc-module-a a:empty').remove(); 998 999 1000 // Boot the elastislide 1001 jQuery('#carousel').elastislide({ }); 1002 1003 1004 // fix the wp caption 1005 $omc('div.wp-caption').each(function () { 1006 $omc(this).removeAttr('style') 1007 }); 1008 1009 1010 // Shortcode animation - Show/Hide 1011 $omc("a.show_hide").toggle( 1012 function () { 1013 $omc(this).parent("div").children("div").fadeIn(300); 1014 }, 1015 function () { 1016 $omc(this).parent("div").children("div").fadeOut(300); 1017 } 1018 ); 1019 1020 1021 //Code for the Tabs Shortcode 1022 $omc(".omc-tab-content").hide(); 1023 $omc("ul.omc-tabs li:first-child").addClass("active").show(); 1024 $omc(".omc-tab-container .omc-tab-content:nth-child(2)").show(); 1025 $omc(".omc-tab-container").fadeIn(); 1026 1027 $omc("ul.omc-tabs li").click(function () { 1028 $omc(this).parent("ul").children("li").removeClass("active"); 1029 $omc(this).addClass("active"); 1030 $omc(this).parent("ul").next("div").children("div").hide(); 1031 var activeTab = $omc(this).find("a").attr("href"); 1032 $omc(activeTab).fadeIn(500); 1033 return false;
1034 }); 1035 1036 1037 // effect the color coded menu items 1038 var menuItems = $omc('nav#omc-main-navigation ul li'); 1039 $omc("li:has(small)").addClass("has-small"); 1040 1041 $omc(menuItems).hover(function () { 1042 1043 $omc(this).find('ul:first').fadeIn(1); 1044 1045 if ($omc(this).hasClass('has-small')) { 1046 1047 var menuColor = $omc(this).children('small').text(); 1048 var parentAnchor = $omc(this).children('a'); 1049 1050 if (menuColor !== '') { 1051 $omc(parentAnchor).css('background-color', '#' + menuColor); 1052 $omc(parentAnchor).css('color', '#FFF'); 1053 $omc(this).find('ul').css('background-color', '#' + menuColor); 1054 } 1055 } 1056 1057 }, function () { 1058 1059 $omc(this).find('ul:first').fadeOut(1); 1060 1061 if ($omc(this).hasClass('has-small')) { 1062 1063 var menuColor = $omc(this).children('small').text(); 1064 var parentAnchor = $omc(this).children('a'); 1065 1066 if (!$omc(this).parent('ul').hasClass('sub-menu')) { 1067 if ($omc(this).hasClass('current-menu-item')) { 1068 $omc(parentAnchor).css('background-color', '#' + menuColor); 1069 } else if ($omc(this).hasClass('current-category-ancestor')) { 1070 $omc(parentAnchor).css('background-color', '#' + menuColor); 1071 } else if ($omc(this).hasClass('current-menu-parent')) { 1072 $omc(parentAnchor).css('background-color', '#' + menuColor); 1073 } else if ($omc(this).hasClass('current-post-ancestor')) { 1074 $omc(parentAnchor).css('background-color', '#' + menuColor); 1075 } else { 1076 $omc(parentAnchor).css('background-color', '#FFF'); 1077 $omc(parentAnchor).css('color', '#333'); 1078 } 1079 } 1080 } 1081 }); 1082 1083 1084 // Adds navigation to the select element 1085 $omc("select#omc-mobile-menu").change(function () { 1086 window.location = $omc(this).find("option:selected").val(); 1087 }); 1088 1089 1090 // Header Menu Search 1091 var searchOverlay = $omc("span#omc-search-overlay"), 1092 searchForm = $omc("form.omc-search-form"), 1093 searchInput = $omc("input.omc-header-search-input-box"), 1094 searchButton = $omc("input.omc-header-search-button"); 1095 1096 $omc(searchOverlay).click(function () { 1097 searchInput.focus(); 1098 searchOverlay.fadeOut(1); 1099 }); 1100 1101 $omc(searchInput).blur(function () { 1102 $omc(searchForm).animate({ opacity:0}, 500); 1103 $omc(searchInput).animate({ width:'104px'}, 500, "easeOutSine"); 1104 $omc(searchButton).animate({ right:'0px'}, 900, "easeOutSine"); 1105 $omc(searchOverlay).fadeIn(400); 1106 }); 1107 1108 $omc(searchOverlay).mouseover(function () { 1109 $omc(searchForm).animate({ opacity:1}, 30); 1110 $omc(searchInput).val(""); 1111 $omc(searchInput).animate({ width:'154px'}, 10, "easeOutSine"); 1112 $omc(searchButton).animate({ right:'-35px'}, 30, "easeOutSine"); 1113 }); 1114 1115 $omc(searchOverlay).mouseout(function () { 1116 var focusedInputs = $omc(".omc-search-form input:focus"); 1117 if (focusedInputs != null && focusedInputs.length > 0) { 1118 inputHasFocus = true; 1119 } else { 1120 $omc(searchInput).animate({ width:'104px'}, 500, "easeOutSine"); 1121 $omc(searchButton).animate({ right:'0px'}, 900, "easeOutSine"); 1122 $omc(searchForm).animate({ opacity:0}, 500); 1123 $omc(searchOverlay).fadeIn(400); 1124 } 1125 1126 }); 1127 1128 1129 $omc('h4') 1130 .filter(function () { 1131 return $omc.trim($omc(this).text()) === '' 1132 }) 1133 .remove() 1134 1135 1136 // Social Hovers 1137 $omc("a.omc-social-media-icon.large").hover( 1138 function () { 1139 $omc(this).children("span.omc-icon").children("span").animate({ opacity:0 }, {speed:5000}, {queue:false}); 1140 }, 1141 function () { 1142 $omc(this).children("span.omc-icon").children("span").animate({ opacity:1 }, {speed:5000}, {queue:false}); 1143 } 1144 ); 1145 1146 1147 // hide #back-top first 1148 $omc("#back-top").hide(); 1149 1150 1151 // fade in #back-top 1152 $omc(function () { 1153 $omc(window).scroll(function () { 1154 if ($omc(this).scrollTop() > 100) { 1155 $omc('#back-top').fadeIn(); 1156 } else { 1157 $omc('#back-top').fadeOut(); 1158 } 1159 }); 1160 1161 // scroll body to 0px on click 1162 $omc('#back-top a, a.omc-mobile-back-to-top').click(function () { 1163 $omc('body,html').animate({ 1164 scrollTop:0 1165 }, 1000, 'easeOutQuint'); 1166 return false;
1167 }); 1168 }); 1169 1170 //get rid of the bs wp generated image style - stop doing this wordpress 1171 $omc('div.wp-caption').removeAttr("style"); 1172 $omc('div.wp-caption img').removeAttr("height"); 1173 $omc('#omc-full-article img').removeAttr("height"); 1174 $omc('div.wp-caption img').removeAttr("width"); 1175 1176 1177 // Get rid of the inline styles in the adpress widget 1178 $omc('li.widget_adpress_widget ul').css('width', '100%'); 1179 $omc('div#omc-top-banner ul').css('width', '100%'); 1180 1181 1182 //Knockout the margins on blog style two and module a 1183 $omc('article.omc-blog-two:odd').css('margin-right', '0px'); 1184 $omc('.omc-module-a').eq(1).css('margin-right', '0px'); 1185 1186 1187 // Fade in the star ratings 1188 $omc('span.omc-module-a-stars-under, span.leading-article.omc-module-a-stars-under, span.omc-blog-two-stars-under').css('opacity', '1'); 1189 1190 1191 // Sort out the styling of the gallery/video post formats 1192 $omc('article#omc-full-article h1, article#omc-full-article p.omc-date-time-gallery').fadeIn(); 1193 var galleryHeader = $omc('#omc-full-article.omc-inner-gallery > h1:first'); 1194 var pageHeader = $omc('body.page #omc-full-article > h1:first'); 1195 var galleryDate = $omc('.omc-date-time-gallery'); 1196 var videoDate = $omc('.omc-date-time-video'); 1197 1198 $omc(galleryHeader).remove(); 1199 $omc(galleryDate).remove(); 1200 $omc(videoDate).remove(); 1201 1202 var galleryTrue = $omc('#omc-full-article').has('.gallery-to-slideshow-wrapper'); 1203 1204 if (galleryTrue = false) { 1205 $omc(pageHeader).remove(); 1206 } 1207 1208 $omc('#omc-full-article > h1:first').after(videoDate); 1209 $omc('.gallery-to-slideshow-wrapper').after(galleryHeader); 1210 $omc('.gallery-to-slideshow-wrapper').after(pageHeader); 1211 $omc(galleryHeader).after(galleryDate); 1212 1213 $omc('img.avatar').removeAttr('height'); 1214 1215}); 1216 1217 1218/* PrettyPhoto v 3.1.4 */ 1219(function ($) { 1220 $.prettyPhoto = {version:'3.1.4'}; 1221 $.fn.prettyPhoto = function (pp_settings) { 1222 pp_settings = jQuery.extend({hook:'rel', animation_speed:'fast', ajaxcallback:function () { 1223 }, slideshow:5000, autoplay_slideshow:false, opacity:0.80, show_title:true, allow_resize:true, allow_expand:true, default_width:500, default_height:344, counter_separator_label:'/', theme:'pp_default', horizontal_padding:20, hideflash:false, wmode:'opaque', autoplay:true, modal:false, deeplinking:true, overlay_gallery:true, overlay_gallery_max:30, keyboard_shortcuts:true, changepicturecallback:function () { 1224 }, callback:function () { 1225 }, ie6_fallback:true, markup:'<div class="pp_pic_holder"> \ 1226 <div class="ppt"> </div> \ 1227 <div class="pp_top"> \ 1228 <div class="pp_left"></div> \ 1229 <div class="pp_middle"></div> \ 1230 <div class="pp_right"></div> \ 1231 </div> \ 1232 <div class="pp_content_container"> \ 1233 <div class="pp_left"> \ 1234 <div class="pp_right"> \ 1235 <div class="pp_content"> \ 1236 <div class="pp_loaderIcon"></div> \ 1237 <div class="pp_fade"> \ 1238 <a href="#" class="pp_expand" title="Expand the image">Expand</a> \ 1239 <div class="pp_hoverContainer"> \ 1240 <a class="pp_next" href="#">next</a> \ 1241 <a class="pp_previous" href="#">previous</a> \ 1242 </div> \ 1243 <div id="pp_full_res"></div> \ 1244 <div class="pp_details"> \ 1245 <div class="pp_nav"> \ 1246 <a href="#" class="pp_arrow_previous">Previous</a> \ 1247 <p class="currentTextHolder">0/0</p> \ 1248 <a href="#" class="pp_arrow_next">Next</a> \ 1249 </div> \ 1250 <p class="pp_description"></p> \ 1251 <div class="pp_social">{pp_social}</div> \ 1252 <a class="pp_close" href="#">Close</a> \ 1253 </div> \ 1254 </div> \ 1255 </div> \ 1256 </div> \ 1257 </div> \ 1258 </div> \ 1259 <div class="pp_bottom"> \ 1260 <div class="pp_left"></div> \ 1261 <div class="pp_middle"></div> \ 1262 <div class="pp_right"></div> \ 1263 </div> \ 1264 </div> \ 1265 <div class="pp_overlay"></div>', gallery_markup:'<div class="pp_gallery"> \ 1266 <a href="#" class="pp_arrow_previous">Previous</a> \ 1267 <div> \ 1268 <ul> \ 1269 {gallery} \ 1270 </ul> \ 1271 </div> \ 1272 <a href="#" class="pp_arrow_next">Next</a> \ 1273 </div>', image_markup:'<img id="fullResImage" src="{path}" />', flash_markup:'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>', quicktime_markup:'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>', iframe_markup:'<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>', inline_markup:'<div class="pp_inline">{content}</div>', custom_markup:'', social_tools:'<div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&layout=button_count&show_faces=true&width=500&action=like&font&colorscheme=light&height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>'}, pp_settings); 1274 var matchedObjects = this, percentBased = false, pp_dimensions, pp_open, pp_contentHeight, pp_contentWidth, pp_containerHeight, pp_containerWidth, windowHeight = $(window).height(), windowWidth = $(window).width(), pp_slideshow; 1275 doresize = true, scroll_pos = _get_scroll(); 1276 $(window).unbind('resize.prettyphoto').bind('resize.prettyphoto', function () { 1277 _center_overlay(); 1278 _resize_overlay(); 1279 }); 1280 if (pp_settings.keyboard_shortcuts) { 1281 $(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto', function (e) { 1282 if (typeof $pp_pic_holder != 'undefined') { 1283 if ($pp_pic_holder.is(':visible')) { 1284 switch (e.keyCode) { 1285 case 37: 1286 $.prettyPhoto.changePage('previous'); 1287 e.preventDefault(); 1288 break; 1289 case 39: 1290 $.prettyPhoto.changePage('next'); 1291 e.preventDefault(); 1292 break; 1293 case 27: 1294 if (!settings.modal) 1295 $.prettyPhoto.close(); 1296 e.preventDefault(); 1297 break; 1298 } 1299 ; 1300 } 1301 ; 1302 } 1303 ; 1304 }); 1305 } 1306 ; 1307 $.prettyPhoto.initialize = function () { 1308 settings = pp_settings; 1309 if (settings.theme == 'pp_default')settings.horizontal_padding = 16; 1310 if (settings.ie6_fallback && $.browser.msie && parseInt($.browser.version) == 6)settings.theme = "light_square"; 1311 theRel = $(this).attr(settings.hook); 1312 galleryRegExp = /\[(?:.*)\]/; 1313 isSet = (galleryRegExp.exec(theRel)) ? true : false;
1314 pp_images = (isSet) ? jQuery.map(matchedObjects, function (n, i) { 1315 if ($(n).attr(settings.hook).indexOf(theRel) != -1)return $(n).attr('href'); 1316 }) : $.makeArray($(this).attr('href')); 1317 pp_titles = (isSet) ? jQuery.map(matchedObjects, function (n, i) { 1318 if ($(n).attr(settings.hook).indexOf(theRel) != -1)return($(n).find('img').attr('alt')) ? $(n).find('img').attr('alt') : ""; 1319 }) : $.makeArray($(this).find('img').attr('alt')); 1320 pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function (n, i) { 1321 if ($(n).attr(settings.hook).indexOf(theRel) != -1)return($(n).attr('title')) ? $(n).attr('title') : ""; 1322 }) : $.makeArray($(this).attr('title')); 1323 if (pp_images.length > settings.overlay_gallery_max)settings.overlay_gallery = false; 1324 set_position = jQuery.inArray($(this).attr('href'), pp_images); 1325 rel_index = (isSet) ? set_position : $("a[" + settings.hook + "^='" + theRel + "']").index($(this)); 1326 _build_overlay(this); 1327 if (settings.allow_resize) 1328 $(window).bind('scroll.prettyphoto', function () { 1329 _center_overlay(); 1330 }); 1331 $.prettyPhoto.open(); 1332 return false; 1333 } 1334 $.prettyPhoto.open = function (event) { 1335 if (typeof settings == "undefined") { 1336 settings = pp_settings; 1337 if ($.browser.msie && $.browser.version == 6)settings.theme = "light_square"; 1338 pp_images = $.makeArray(arguments[0]); 1339 pp_titles = (arguments[1]) ? $.makeArray(arguments[1]) : $.makeArray(""); 1340 pp_descriptions = (arguments[2]) ? $.makeArray(arguments[2]) : $.makeArray(""); 1341 isSet = (pp_images.length > 1) ? true : false; 1342 set_position = (arguments[3]) ? arguments[3] : 0; 1343 _build_overlay(event.target); 1344 } 1345 if ($.browser.msie && $.browser.version == 6)$('select').css('visibility', 'hidden'); 1346 if (settings.hideflash)$('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility', 'hidden'); 1347 _checkPosition($(pp_images).size()); 1348 $('.pp_loaderIcon').show(); 1349 if (settings.deeplinking) 1350 setHashtag(); 1351 if (settings.social_tools) { 1352 facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href)); 1353 $pp_pic_holder.find('.pp_social').html(facebook_like_link); 1354 } 1355 if ($ppt.is(':hidden'))$ppt.css('opacity', 0).show(); 1356 $pp_overlay.show().fadeTo(settings.animation_speed, settings.opacity); 1357 $pp_pic_holder.find('.currentTextHolder').text((set_position + 1) + settings.counter_separator_label + $(pp_images).size()); 1358 if (typeof pp_descriptions[set_position] != 'undefined' && pp_descriptions[set_position] != "") { 1359 $pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position])); 1360 } else { 1361 $pp_pic_holder.find('.pp_description').hide(); 1362 } 1363 movie_width = (parseFloat(getParam('width', pp_images[set_position]))) ? getParam('width', pp_images[set_position]) : settings.default_width.toString(); 1364 movie_height = (parseFloat(getParam('height', pp_images[set_position]))) ? getParam('height', pp_images[set_position]) : settings.default_height.toString(); 1365 percentBased = false; 1366 if (movie_height.indexOf('%') != -1) { 1367 movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 150); 1368 percentBased = true; 1369 } 1370 if (movie_width.indexOf('%') != -1) { 1371 movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 150); 1372 percentBased = true; 1373 } 1374 $pp_pic_holder.fadeIn(function () { 1375 (settings.show_title && pp_titles[set_position] != "" && typeof pp_titles[set_position] != "undefined") ? $ppt.html(unescape(pp_titles[set_position])) : $ppt.html(' '); 1376 imgPreloader = ""; 1377 skipInjection = false;
1378 switch (_getFileType(pp_images[set_position])) { 1379 case'image': 1380 imgPreloader = new Image(); 1381 nextImage = new Image(); 1382 if (isSet && set_position < $(pp_images).size() - 1)nextImage.src = pp_images[set_position + 1]; 1383 prevImage = new Image(); 1384 if (isSet && pp_images[set_position - 1])prevImage.src = pp_images[set_position - 1]; 1385 $pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup.replace(/{path}/g, pp_images[set_position]); 1386 imgPreloader.onload = function () { 1387 pp_dimensions = _fitToViewport(imgPreloader.width, imgPreloader.height); 1388 _showContent(); 1389 }; 1390 imgPreloader.onerror = function () { 1391 alert('Image cannot be loaded. Make sure the path is correct and image exist.'); 1392 $.prettyPhoto.close(); 1393 }; 1394 imgPreloader.src = pp_images[set_position]; 1395 break; 1396 case'youtube': 1397 pp_dimensions = _fitToViewport(movie_width, movie_height); 1398 movie_id = getParam('v', pp_images[set_position]); 1399 if (movie_id == "") { 1400 movie_id = pp_images[set_position].split('youtu.be/'); 1401 movie_id = movie_id[1]; 1402 if (movie_id.indexOf('?') > 0) 1403 movie_id = movie_id.substr(0, movie_id.indexOf('?')); 1404 if (movie_id.indexOf('&') > 0) 1405 movie_id = movie_id.substr(0, movie_id.indexOf('&')); 1406 } 1407 movie = 'http://www.youtube.com/embed/' + movie_id; 1408 (getParam('rel', pp_images[set_position])) ? movie += "?rel=" + getParam('rel', pp_images[set_position]) : movie += "?rel=1"; 1409 if (settings.autoplay)movie += "&autoplay=1"; 1410 toInject = settings.iframe_markup.replace(/{width}/g, pp_dimensions['width']).replace(/{height}/g, pp_dimensions['height']).replace(/{wmode}/g, settings.wmode).replace(/{path}/g, movie); 1411 break; 1412 case'vimeo': 1413 pp_dimensions = _fitToViewport(movie_width, movie_height); 1414 movie_id = pp_images[set_position]; 1415 var regExp = /http:\/\/(www\.)?vimeo.com\/(\d+)/; 1416 var match = movie_id.match(regExp); 1417 movie = 'http://player.vimeo.com/video/' + match[2] + '?title=0&byline=0&portrait=0'; 1418 if (settings.autoplay)movie += "&autoplay=1;"; 1419 vimeo_width = pp_dimensions['width'] + '/embed/?moog_width=' + pp_dimensions['width']; 1420 toInject = settings.iframe_markup.replace(/{width}/g, vimeo_width).replace(/{height}/g, pp_dimensions['height']).replace(/{path}/g, movie); 1421 break; 1422 case'quicktime': 1423 pp_dimensions = _fitToViewport(movie_width, movie_height); 1424 pp_dimensions['height'] += 15; 1425 pp_dimensions['contentHeight'] += 15; 1426 pp_dimensions['containerHeight'] += 15; 1427 toInject = settings.quicktime_markup.replace(/{width}/g, pp_dimensions['width']).replace(/{height}/g, pp_dimensions['height']).replace(/{wmode}/g, settings.wmode).replace(/{path}/g, pp_images[set_position]).replace(/{autoplay}/g, settings.autoplay); 1428 break; 1429 case'flash': 1430 pp_dimensions = _fitToViewport(movie_width, movie_height); 1431 flash_vars = pp_images[set_position]; 1432 flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10, pp_images[set_position].length); 1433 filename = pp_images[set_position]; 1434 filename = filename.substring(0, filename.indexOf('?')); 1435 toInject = settings.flash_markup.replace(/{width}/g, pp_dimensions['width']).replace(/{height}/g, pp_dimensions['height']).replace(/{wmode}/g, settings.wmode).replace(/{path}/g, filename + '?' + flash_vars); 1436 break; 1437 case'iframe': 1438 pp_dimensions = _fitToViewport(movie_width, movie_height); 1439 frame_url = pp_images[set_position]; 1440 frame_url = frame_url.substr(0, frame_url.indexOf('iframe') - 1); 1441 toInject = settings.iframe_markup.replace(/{width}/g, pp_dimensions['width']).replace(/{height}/g, pp_dimensions['height']).replace(/{path}/g, frame_url); 1442 break; 1443 case'ajax': 1444 doresize = false;
1445 pp_dimensions = _fitToViewport(movie_width, movie_height); 1446 doresize = true; 1447 skipInjection = true; 1448 $.get(pp_images[set_position], function (responseHTML) { 1449 toInject = settings.inline_markup.replace(/{content}/g, responseHTML); 1450 $pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject; 1451 _showContent(); 1452 }); 1453 break; 1454 case'custom': 1455 pp_dimensions = _fitToViewport(movie_width, movie_height); 1456 toInject = settings.custom_markup; 1457 break; 1458 case'inline': 1459 myClone = $(pp_images[set_position]).clone().append('<br clear="all" />').css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show(); 1460 doresize = false; 1461 pp_dimensions = _fitToViewport($(myClone).width(), $(myClone).height()); 1462 doresize = true; 1463 $(myClone).remove(); 1464 toInject = settings.inline_markup.replace(/{content}/g, $(pp_images[set_position]).html()); 1465 break; 1466 } 1467 ; 1468 if (!imgPreloader && !skipInjection) { 1469 $pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject; 1470 _showContent(); 1471 } 1472 ; 1473 }); 1474 return false; 1475 }; 1476 $.prettyPhoto.changePage = function (direction) { 1477 currentGalleryPage = 0; 1478 if (direction == 'previous') { 1479 set_position--; 1480 if (set_position < 0)set_position = $(pp_images).size() - 1; 1481 } else if (direction == 'next') { 1482 set_position++; 1483 if (set_position > $(pp_images).size() - 1)set_position = 0; 1484 } else { 1485 set_position = direction; 1486 } 1487 ; 1488 rel_index = set_position; 1489 if (!doresize)doresize = true; 1490 if (settings.allow_expand) { 1491 $('.pp_contract').removeClass('pp_contract').addClass('pp_expand'); 1492 } 1493 _hideContent(function () { 1494 $.prettyPhoto.open(); 1495 }); 1496 }; 1497 $.prettyPhoto.changeGalleryPage = function (direction) { 1498 if (direction == 'next') { 1499 currentGalleryPage++; 1500 if (currentGalleryPage > totalPage)currentGalleryPage = 0; 1501 } else if (direction == 'previous') { 1502 currentGalleryPage--; 1503 if (currentGalleryPage < 0)currentGalleryPage = totalPage; 1504 } else { 1505 currentGalleryPage = direction; 1506 } 1507 ; 1508 slide_speed = (direction == 'next' || direction == 'previous') ? settings.animation_speed : 0; 1509 slide_to = currentGalleryPage * (itemsPerPage * itemWidth); 1510 $pp_gallery.find('ul').animate({left:-slide_to}, slide_speed); 1511 }; 1512 $.prettyPhoto.startSlideshow = function () { 1513 if (typeof pp_slideshow == 'undefined') { 1514 $pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function () { 1515 $.prettyPhoto.stopSlideshow(); 1516 return false; 1517 }); 1518 pp_slideshow = setInterval($.prettyPhoto.startSlideshow, settings.slideshow); 1519 } else { 1520 $.prettyPhoto.changePage('next'); 1521 } 1522 ; 1523 } 1524 $.prettyPhoto.stopSlideshow = function () { 1525 $pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function () { 1526 $.prettyPhoto.startSlideshow(); 1527 return false; 1528 }); 1529 clearInterval(pp_slideshow); 1530 pp_slideshow = undefined; 1531 } 1532 $.prettyPhoto.close = function () { 1533 if ($pp_overlay.is(":animated"))return; 1534 $.prettyPhoto.stopSlideshow(); 1535 $pp_pic_holder.stop().find('object,embed').css('visibility', 'hidden'); 1536 $('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed, function () { 1537 $(this).remove(); 1538 }); 1539 $pp_overlay.fadeOut(settings.animation_speed, function () { 1540 if ($.browser.msie && $.browser.version == 6)$('select').css('visibility', 'visible'); 1541 if (settings.hideflash)$('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility', 'visible'); 1542 $(this).remove(); 1543 $(window).unbind('scroll.prettyphoto'); 1544 clearHashtag(); 1545 settings.callback(); 1546 doresize = true; 1547 pp_open = false;
1548 delete settings; 1549 }); 1550 }; 1551 function _showContent() { 1552 $('.pp_loaderIcon').hide(); 1553 projectedTop = scroll_pos['scrollTop'] + ((windowHeight / 2) - (pp_dimensions['containerHeight'] / 2)); 1554 if (projectedTop < 0)projectedTop = 0; 1555 $ppt.fadeTo(settings.animation_speed, 1); 1556 $pp_pic_holder.find('.pp_content').animate({height:pp_dimensions['contentHeight'], width:pp_dimensions['contentWidth']}, settings.animation_speed); 1557 $pp_pic_holder.animate({'top':projectedTop, 'left':((windowWidth / 2) - (pp_dimensions['containerWidth'] / 2) < 0) ? 0 : (windowWidth / 2) - (pp_dimensions['containerWidth'] / 2), width:pp_dimensions['containerWidth']}, settings.animation_speed, function () { 1558 $pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']); 1559 $pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed); 1560 if (isSet && _getFileType(pp_images[set_position]) == "image") { 1561 $pp_pic_holder.find('.pp_hoverContainer').show(); 1562 } else { 1563 $pp_pic_holder.find('.pp_hoverContainer').hide(); 1564 } 1565 if (settings.allow_expand) { 1566 if (pp_dimensions['resized']) { 1567 $('a.pp_expand,a.pp_contract').show(); 1568 } else { 1569 $('a.pp_expand').hide(); 1570 } 1571 } 1572 if (settings.autoplay_slideshow && !pp_slideshow && !pp_open)$.prettyPhoto.startSlideshow(); 1573 settings.changepicturecallback(); 1574 pp_open = true; 1575 }); 1576 _insert_gallery(); 1577 pp_settings.ajaxcallback(); 1578 } 1579 1580 ; 1581 function _hideContent(callback) { 1582 $pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility', 'hidden'); 1583 $pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed, function () { 1584 $('.pp_loaderIcon').show(); 1585 callback(); 1586 }); 1587 } 1588 1589 ; 1590 function _checkPosition(setCount) { 1591 (setCount > 1) ? $('.pp_nav').show() : $('.pp_nav').hide(); 1592 } 1593 1594 ; 1595 function _fitToViewport(width, height) { 1596 resized = false; 1597 _getDimensions(width, height); 1598 imageWidth = width, imageHeight = height; 1599 if (((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allow_resize && !percentBased) { 1600 resized = true, fitting = false; 1601 while (!fitting) { 1602 if ((pp_containerWidth > windowWidth)) { 1603 imageWidth = (windowWidth - 200); 1604 imageHeight = (height / width) * imageWidth; 1605 } else if ((pp_containerHeight > windowHeight)) { 1606 imageHeight = (windowHeight - 200); 1607 imageWidth = (width / height) * imageHeight; 1608 } else { 1609 fitting = true; 1610 } 1611 ; 1612 pp_containerHeight = imageHeight, pp_containerWidth = imageWidth; 1613 } 1614 ; 1615 _getDimensions(imageWidth, imageHeight); 1616 if ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) { 1617 _fitToViewport(pp_containerWidth, pp_containerHeight) 1618 } 1619 ; 1620 } 1621 ; 1622 return{width:Math.floor(imageWidth), height:Math.floor(imageHeight), containerHeight:Math.floor(pp_containerHeight), containerWidth:Math.floor(pp_containerWidth) + (settings.horizontal_padding * 2), contentHeight:Math.floor(pp_contentHeight), contentWidth:Math.floor(pp_contentWidth), resized:resized}; 1623 } 1624 1625 ; 1626 function _getDimensions(width, height) { 1627 width = parseFloat(width); 1628 height = parseFloat(height); 1629 $pp_details = $pp_pic_holder.find('.pp_details'); 1630 $pp_details.width(width); 1631 detailsHeight = parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom')); 1632 $pp_details = $pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({'position':'absolute', 'top':-10000}); 1633 detailsHeight += $pp_details.height(); 1634 detailsHeight = (detailsHeight <= 34) ? 36 : detailsHeight; 1635 if ($.browser.msie && $.browser.version == 7)detailsHeight += 8; 1636 $pp_details.remove(); 1637 $pp_title = $pp_pic_holder.find('.ppt'); 1638 $pp_title.width(width); 1639 titleHeight = parseFloat($pp_title.css('marginTop')) + parseFloat($pp_title.css('marginBottom')); 1640 $pp_title = $pp_title.clone().appendTo($('body')).css({'position':'absolute', 'top':-10000}); 1641 titleHeight += $pp_title.height(); 1642 $pp_title.remove(); 1643 pp_contentHeight = height + detailsHeight; 1644 pp_contentWidth = width; 1645 pp_containerHeight = pp_contentHeight + titleHeight + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height(); 1646 pp_containerWidth = width; 1647 } 1648
1649 function _getFileType(itemSrc) { 1650 if (itemSrc.match(/youtube\.com\/watch/i) || itemSrc.match(/youtu\.be/i)) { 1651 return'youtube'; 1652 } else if (itemSrc.match(/vimeo\.com/i)) { 1653 return'vimeo'; 1654 } else if (itemSrc.match(/\b.mov\b/i)) { 1655 return'quicktime'; 1656 } else if (itemSrc.match(/\b.swf\b/i)) { 1657 return'flash'; 1658 } else if (itemSrc.match(/\biframe=true\b/i)) { 1659 return'iframe'; 1660 } else if (itemSrc.match(/\bajax=true\b/i)) { 1661 return'ajax'; 1662 } else if (itemSrc.match(/\bcustom=true\b/i)) { 1663 return'custom'; 1664 } else if (itemSrc.substr(0, 1) == '#') { 1665 return'inline'; 1666 } else { 1667 return'image'; 1668 } 1669 ; 1670 } 1671 1672 ; 1673 function _center_overlay() { 1674 if (doresize && typeof $pp_pic_holder != 'undefined') { 1675 scroll_pos = _get_scroll(); 1676 contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width(); 1677 projectedTop = (windowHeight / 2) + scroll_pos['scrollTop'] - (contentHeight / 2); 1678 if (projectedTop < 0)projectedTop = 0; 1679 if (contentHeight > windowHeight) 1680 return; 1681 $pp_pic_holder.css({'top':projectedTop, 'left':(windowWidth / 2) + scroll_pos['scrollLeft'] - (contentwidth / 2)}); 1682 } 1683 ; 1684 } 1685 1686 ; 1687 function _get_scroll() { 1688 if (self.pageYOffset) { 1689 return{scrollTop:self.pageYOffset, scrollLeft:self.pageXOffset}; 1690 } else if (document.documentElement && document.documentElement.scrollTop) { 1691 return{scrollTop:document.documentElement.scrollTop, scrollLeft:document.documentElement.scrollLeft}; 1692 } else if (document.body) { 1693 return{scrollTop:document.body.scrollTop, scrollLeft:document.body.scrollLeft}; 1694 } 1695 ; 1696 } 1697 1698 ; 1699 function _resize_overlay() { 1700 windowHeight = $(window).height(), windowWidth = $(window).width(); 1701 if (typeof $pp_overlay != "undefined")$pp_overlay.height($(document).height()).width(windowWidth); 1702 } 1703 1704 ; 1705 function _insert_gallery() { 1706 if (isSet && settings.overlay_gallery && _getFileType(pp_images[set_position]) == "image" && (settings.ie6_fallback && !($.browser.msie && parseInt($.browser.version) == 6))) { 1707 itemWidth = 52 + 5; 1708 navWidth = (settings.theme == "facebook" || settings.theme == "pp_default") ? 50 : 30; 1709 itemsPerPage = Math.floor((pp_dimensions['containerWidth'] - 100 - navWidth) / itemWidth); 1710 itemsPerPage = (itemsPerPage < pp_images.length) ? itemsPerPage : pp_images.length; 1711 totalPage = Math.ceil(pp_images.length / itemsPerPage) - 1; 1712 if (totalPage == 0) { 1713 navWidth = 0; 1714 $pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide(); 1715 } else { 1716 $pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show(); 1717 } 1718 ; 1719 galleryWidth = itemsPerPage * itemWidth; 1720 fullGalleryWidth = pp_images.length * itemWidth; 1721 $pp_gallery.css('margin-left', -((galleryWidth / 2) + (navWidth / 2))).find('div:first').width(galleryWidth + 5).find('ul').width(fullGalleryWidth).find('li.selected').removeClass('selected'); 1722 goToPage = (Math.floor(set_position / itemsPerPage) < totalPage) ? Math.floor(set_position / itemsPerPage) : totalPage; 1723 $.prettyPhoto.changeGalleryPage(goToPage); 1724 $pp_gallery_li.filter(':eq(' + set_position + ')').addClass('selected'); 1725 } else { 1726 $pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave'); 1727 } 1728 } 1729 1730 function _build_overlay(caller) { 1731 if (settings.social_tools) 1732 facebook_like_link = settings.social_tools.replace('{location_href}', encodeURIComponent(location.href)); 1733 settings.markup = settings.markup.replace('{pp_social}', ''); 1734 $('body').append(settings.markup); 1735 $pp_pic_holder = $('.pp_pic_holder'), $ppt = $('.ppt'), $pp_overlay
1735= $('div.pp_overlay'); 1736 if (isSet && settings.overlay_gallery) { 1737 currentGalleryPage = 0; 1738 toInject = ""; 1739 for (var i = 0; i < pp_images.length; i++) { 1740 if (!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)) { 1741 classname = 'default'; 1742 img_src = ''; 1743 } else { 1744 classname = ''; 1745 img_src = pp_images[i]; 1746 } 1747 toInject += "<li class='" + classname + "'><a href='#'><img src='" + img_src + "' width='50' alt='' /></a></li>"; 1748 } 1749 ; 1750 toInject = settings.gallery_markup.replace(/{gallery}/g, toInject); 1751 $pp_pic_holder.find('#pp_full_res').after(toInject); 1752 $pp_gallery = $('.pp_pic_holder .pp_gallery'), $pp_gallery_li = $pp_gallery.find('li'); 1753 $pp_gallery.find('.pp_arrow_next').click(function () { 1754 $.prettyPhoto.changeGalleryPage('next'); 1755 $.prettyPhoto.stopSlideshow(); 1756 return false; 1757 }); 1758 $pp_gallery.find('.pp_arrow_previous').click(function () { 1759 $.prettyPhoto.changeGalleryPage('previous'); 1760 $.prettyPhoto.stopSlideshow(); 1761 return false; 1762 }); 1763 $pp_pic_holder.find('.pp_content').hover(function () { 1764 $pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn(); 1765 }, function () { 1766 $pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut(); 1767 }); 1768 itemWidth = 52 + 5; 1769 $pp_gallery_li.each(function (i) { 1770 $(this).find('a').click(function () { 1771 $.prettyPhoto.changePage(i); 1772 $.prettyPhoto.stopSlideshow(); 1773 return false; 1774 }); 1775 }); 1776 } 1777 ; 1778 if (settings.slideshow) { 1779 $pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>') 1780 $pp_pic_holder.find('.pp_nav .pp_play').click(function () { 1781 $.prettyPhoto.startSlideshow(); 1782 return false; 1783 }); 1784 } 1785 $pp_pic_holder.attr('class', 'pp_pic_holder ' + settings.theme); 1786 $pp_overlay.css({'opacity':0, 'height':$(document).height(), 'width':$(window).width()}).bind('click', function () { 1787 if (!settings.modal)$.prettyPhoto.close(); 1788 }); 1789 $('a.pp_close').bind('click', function () { 1790 $.prettyPhoto.close(); 1791 return false; 1792 }); 1793 if (settings.allow_expand) { 1794 $('a.pp_expand').bind('click', function (e) { 1795 if ($(this).hasClass('pp_expand')) { 1796 $(this).removeClass('pp_expand').addClass('pp_contract'); 1797 doresize = false; 1798 } else { 1799 $(this).removeClass('pp_contract').addClass('pp_expand'); 1800 doresize = true; 1801 } 1802 ; 1803 _hideContent(function () { 1804 $.prettyPhoto.open(); 1805 }); 1806 return false; 1807 }); 1808 } 1809 $pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click', function () { 1810 $.prettyPhoto.changePage('previous'); 1811 $.prettyPhoto.stopSlideshow(); 1812 return false; 1813 }); 1814 $pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click', function () { 1815 $.prettyPhoto.changePage('next'); 1816 $.prettyPhoto.stopSlideshow(); 1817 return false; 1818 }); 1819 _center_overlay(); 1820 } 1821 1822 ; 1823 if (!pp_alreadyInitialized && getHashtag()) { 1824 pp_alreadyInitialized = true; 1825 hashIndex = getHashtag(); 1826 hashRel = hashIndex; 1827 hashIndex = hashIndex.substring(hashIndex.indexOf('/') + 1, hashIndex.length - 1); 1828 hashRel = hashRel.substring(0, hashRel.indexOf('/')); 1829 setTimeout(function () { 1830 $("a[" + pp_settings.hook + "^='" + hashRel + "']:eq(" + hashIndex + ")").trigger('click'); 1831 }, 50); 1832 } 1833 return this.unbind('click.prettyphoto').bind('click.prettyphoto', $.prettyPhoto.initialize); 1834 }; 1835 function getHashtag() { 1836 url = location.href; 1837 hashtag = (url.indexOf('#prettyPhoto') !== -1) ? decodeURI(url.substring(url.indexOf('#prettyPhoto') + 1, url.length)) : false;
1838 return hashtag; 1839 } 1840 1841 ; 1842 function setHashtag() { 1843 if (typeof theRel == 'undefined')return; 1844 location.hash = theRel + '/' + rel_index + '/'; 1845 } 1846 1847 ; 1848 function clearHashtag() { 1849 if (location.href.indexOf('#prettyPhoto') !== -1)location.hash = "prettyPhoto"; 1850 } 1851 1852 function getParam(name, url) { 1853 name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); 1854 var regexS = "[\\?&]" + name + "=([^&#]*)"; 1855 var regex = new RegExp(regexS); 1856 var results = regex.exec(url); 1857 return(results == null) ? "" : results[1]; 1858 } 1859})(jQuery); 1860var pp_alreadyInitialized = false; 1861 1862/* Elastislide */ 1863(function (a, b, c) { 1864 b.fn.touchwipe = function (a) { 1865 var c = {min_move_x:20, min_move_y:20, wipeLeft:function () { 1866 }, wipeRight:function () { 1867 }, wipeUp:function () { 1868 }, wipeDown:function () { 1869 }, preventDefaultEvents:true}; 1870 if (a)b.extend(c, a); 1871 this.each(function () { 1872 function e() { 1873 this.removeEventListener("touchmove", f); 1874 a = null; 1875 d = false 1876 } 1877 1878 function f(f) { 1879 if (c.preventDefaultEvents) { 1880 f.preventDefault() 1881 } 1882 if (d) { 1883 var g = f.touches[0].pageX; 1884 var h = f.touches[0].pageY; 1885 var i = a - g; 1886 var j = b - h; 1887 if (Math.abs(i) >= c.min_move_x) { 1888 e(); 1889 if (i > 0) { 1890 c.wipeLeft() 1891 } else { 1892 c.wipeRight() 1893 } 1894 } else if (Math.abs(j) >= c.min_move_y) { 1895 e(); 1896 if (j > 0) { 1897 c.wipeDown() 1898 } else { 1899 c.wipeUp() 1900 } 1901 } 1902 } 1903 } 1904 1905 function g(c) { 1906 if (c.touches.length == 1) { 1907 a = c.touches[0].pageX; 1908 b = c.touches[0].pageY; 1909 d = true; 1910 this.addEventListener("touchmove", f, false) 1911 } 1912 } 1913 1914 var a; 1915 var b; 1916 var d = false; 1917 if ("ontouchstart"in document.documentElement) { 1918 this.addEventListener("touchstart", g, false) 1919 } 1920 }); 1921 return this 1922 }; 1923 b.elastislide = function (a, c) { 1924 this.jQueryel = b(c); 1925 this._init(a) 1926 }; 1927 b.elastislide.defaults = {speed:450, easing:"easeOutQuad", imageW:186, margin:31, border:0, minItems:3, current:0, onClick:""}; 1928 b.elastislide.prototype = {_init:function (a) { 1929 this.options = b.extend(true, {}, b.elastislide.defaults, a); 1930 this.jQueryslider = this.jQueryel.find("ul"); 1931 this.jQueryitems = this.jQueryslider.children("li"); 1932 this.itemsCount = this.jQueryitems.length; 1933 this.jQueryesCarousel = this.jQueryslider.parent(); 1934 this._validateOptions(); 1935 this._configure(); 1936 this._addControls(); 1937 this._initEvents(); 1938 this.jQueryslider.show(); 1939 this._slideToCurrent(false) 1940 }, _validateOptions:function () { 1941 if (this.options.speed < 0)this.options.speed = 450; 1942 if (this.options.margin < 0)this.options.margin = 4; 1943 if (this.options.border < 0)this.options.border = 1; 1944 if (this.options.minItems < 1 || this.options.minItems > this.itemsCount)this.options.minItems = 1; 1945 if (this.options.current > this.itemsCount - 1)this.options.current = 0 1946 }, _configure:function () { 1947 this.current = this.options.current; 1948 this.visibleWidth = this.jQueryesCarousel.width(); 1949 if (this.visibleWidth < this.options.minItems * (this.options.imageW + 2 * this.options.border) + (this.options.minItems - 1) * this.options.margin) { 1950 this._setDim((this.visibleWidth - (this.options.minItems - 1) * this.options.margin) / this.options.minItems); 1951 this._setCurrentValues(); 1952 this.fitCount = this.options.minItems 1953 } else { 1954 this._setDim(); 1955 this._setCurrentValues() 1956 } 1957 this.jQueryslider.css({width:this.sliderW}) 1958 }, _setDim:function (a) { 1959 this.jQueryitems.css({marginRight:this.options.margin, width:a ? a : this.options.imageW + 2 * this.options.border}).children("a").css({borderWidth:this.options.border}) 1960 }, _setCurrentValues:function () { 1961 this.itemW = this.jQueryitems.outerWidth(true); 1962 this.sliderW = this.itemW * this.itemsCount;
1963 this.visibleWidth = this.jQueryesCarousel.width(); 1964 this.fitCount = Math.floor(this.visibleWidth / this.itemW) 1965 }, _addControls:function () { 1966 this.jQuerynavNext = b('<span class="es-nav-next">Next</span>'); 1967 this.jQuerynavPrev = b('<span class="es-nav-prev">Previous</span>'); 1968 b('<div class="es-nav"/>').append(this.jQuerynavPrev).append(this.jQuerynavNext).appendTo(this.jQueryel) 1969 }, _toggleControls:function (a, b) { 1970 if (a && b) { 1971 if (b === 1)a === "right" ? this.jQuerynavNext.show() : this.jQuerynavPrev.show(); else a === "right" ? this.jQuerynavNext.hide() : this.jQuerynavPrev.hide() 1972 } else if (this.current === this.itemsCount - 1 || this.fitCount >= this.itemsCount)this.jQuerynavNext.hide() 1973 }, _initEvents:function () { 1974 var c = this; 1975 b(a).bind("resize.elastislide", function (a) { 1976 c._setCurrentValues(); 1977 if (c.visibleWidth < c.options.minItems * (c.options.imageW + 2 * c.options.border) + (c.options.minItems - 1) * c.options.margin) { 1978 c._setDim((c.visibleWidth - (c.options.minItems - 1) * c.options.margin) / c.options.minItems); 1979 c._setCurrentValues(); 1980 c.fitCount = c.options.minItems 1981 } else { 1982 c._setDim(); 1983 c._setCurrentValues() 1984 } 1985 c.jQueryslider.css({width:c.sliderW + 10}); 1986 clearTimeout(c.resetTimeout); 1987 c.resetTimeout = setTimeout(function () { 1988 c._slideToCurrent() 1989 }, 200) 1990 }); 1991 this.jQuerynavNext.bind("click.elastislide", function (a) { 1992 c._slide("right") 1993 }); 1994 this.jQuerynavPrev.bind("click.elastislide", function (a) { 1995 c._slide("left") 1996 }); 1997 this.jQueryitems.bind("click.elastislide", function (a) { 1998 c.options.onClick(b(this)); 1999 return false 2000 }); 2001 c.jQueryslider.touchwipe({wipeLeft:function () { 2002 c._slide("right") 2003 }, wipeRight:function () { 2004 c._slide("left") 2005 }}) 2006 }, _slide:function (a, d, e, f) { 2007 if (this.jQueryslider.is(":animated"))return false; 2008 var g = parseFloat(this.jQueryslider.css("margin-left")); 2009 if (d === c) { 2010 var h = this.fitCount * this.itemW, d; 2011 if (h < 0)return false; 2012 if (a === "right" && this.sliderW - (Math.abs(g) + h) < this.visibleWidth) { 2013 h = this.sliderW - (Math.abs(g) + this.visibleWidth) - this.options.margin; 2014 this._toggleControls("right", -1); 2015 this._toggleControls("left", 1) 2016 } else if (a === "left" && Math.abs(g) - h < 0) { 2017 h = Math.abs(g); 2018 this._toggleControls("left", -1); 2019 this._toggleControls("right", 1) 2020 } else { 2021 var i; 2022 a === "right" ? i = Math.abs(g) + this.options.margin + Math.abs(h) : i = Math.abs(g) - this.options.margin - Math.abs(h); 2023 if (i > 0)this._toggleControls("left", 1); else this._toggleControls("left", -1); 2024 if (i < this.sliderW - this.visibleWidth)this._toggleControls("right", 1); else this._toggleControls("right", -1) 2025 } 2026 a === "right" ? d = "-=" + h : d = "+=" + h 2027 } else { 2028 var i = Math.abs(d); 2029 if (Math.max(this.sliderW, this.visibleWidth) - i < this.visibleWidth) { 2030 d = -(Math.max(this.sliderW, this.visibleWidth) - this.visibleWidth); 2031 if (d !== 0)d += this.options.margin; 2032 this._toggleControls("right", -1); 2033 i = Math.abs(d) 2034 } 2035 if (i > 0)this._toggleControls("left", 1); else this._toggleControls("left", -1); 2036 if (Math.max(this.sliderW, this.visibleWidth) - this.visibleWidth > i + this.options.margin)this._toggleControls("right", 1); else this._toggleControls("right", -1) 2037 } 2038 b.fn.applyStyle = e === c ? b.fn.animate : b.fn.css; 2039 var j = {marginLeft:d}; 2040 var k = this; 2041 this.jQueryslider.applyStyle(j, b.extend(true, [], {duration:this.options.speed, easing:this.options.easing, complete:function () { 2042 if (f)f.call() 2043 }})) 2044 }, _slideToCurrent:function (a) { 2045 var b = this.current * this.itemW; 2046 this._slide("", -b, a) 2047 }, add:function (a, b) { 2048 this.jQueryitems = this.jQueryitems.add(a); 2049 this.itemsCount = this.jQueryitems.length; 2050 this._setDim(); 2051 this._setCurrentValues(); 2052 this.jQueryslider.css({width:this.sliderW}); 2053 this._slideToCurrent(); 2054 if (b)b.call(a) 2055 }, destroy:function (a) { 2056 this._destroy(a) 2057 }, _destroy:function (c) { 2058 this.jQueryel.unbind(".elastislide").removeData("elastislide"); 2059 b(a).unbind(".elastislide");
2060 if (c)c.call() 2061 }}; 2062 var d = function (a) { 2063 if (this.console) { 2064 console.error(a) 2065 } 2066 }; 2067 b.fn.elastislide = function (a) { 2068 if (typeof a === "string") { 2069 var c = Array.prototype.slice.call(arguments, 1); 2070 this.each(function () { 2071 var e = b.data(this, "elastislide"); 2072 if (!e) { 2073 d("cannot call methods on elastislide prior to initialization; " + "attempted to call method '" + a + "'"); 2074 return 2075 } 2076 if (!b.isFunction(e[a]) || a.charAt(0) === "_") { 2077 d("no such method '" + a + "' for elastislide instance"); 2078 return 2079 } 2080 e[a].apply(e, c) 2081 }) 2082 } else { 2083 this.each(function () { 2084 var c = b.data(this, "elastislide"); 2085 if (!c) { 2086 b.data(this, "elastislide", new b.elastislide(a, this)) 2087 } 2088 }) 2089 } 2090 return this 2091 } 2092})(window, jQuery) 2093 2094; 2095(function ($) { 2096 function user_rating() { 2097 if ($('.omc-user-review-rating').length) { 2098 // Get elements 2099 this.el = this.build_el(); 2100 if (!this.is_rated()) { 2101 // Interface fixes 2102 this.el.stars.top.css('background-position-y', '1px'); 2103 this.el.stars.under.css('width', '100px'); 2104 // Bind Events 2105 this.bind_events(); 2106 } else { 2107 this.display_user_rating(); 2108 } 2109 } 2110 } 2111 2112 user_rating.prototype.is_rated = function () { 2113 if (this.readCookie('gonzo_rating_' + gonzo_script.post_id) === 'rated') { 2114 return true; 2115 } else { 2116 return false; 2117 } 2118 }; 2119 2120 user_rating.prototype.display_user_rating = function () { 2121 var score = this.readCookie('gonzo_rating_score_' + gonzo_script.post_id), 2122 position = this.readCookie('gonzo_rating_position_'+ gonzo_script.post_id); 2123 this.el.rating.score.html(score); 2124 this.el.stars.top.css('width', position + '%'); 2125 this.el.rating.label.your_rating.show(); 2126 this.el.rating.label.user_rating.hide(); 2127 }; 2128 2129 user_rating.prototype.build_el = function () { 2130 var el = { 2131 rating:{ 2132 score:$('SPAN.score', '.omc-user-review-description'), 2133 count:$('SPAN.count', '.omc-user-review-description'), 2134 label:{ 2135 your_rating:$('SPAN.your_rating', '.omc-user-review-description'), 2136 user_rating:$('SPAN.user_rating', '.omc-user-review-description') 2137 } 2138 }, 2139 stars:{ 2140 under:$('.omc-criteria-star-under', '.omc-user-review-rating'), 2141 top:$('.omc-criteria-star-top', '.omc-user-review-rating') 2142 } 2143 }; 2144 2145 // Plain JS style retrieval 2146 el.stars.old_position = parseInt(el.stars.top[0].style.width, 10); 2147 el.rating.old_score = el.rating.score.html(); 2148 2149 return el; 2150 }; 2151 2152 user_rating.prototype.bind_events = function () { 2153 var me = this; 2154 2155 // Hover effect 2156 me.el.stars.under.on('mouseover', function () { 2157 // changes the sprite 2158 me.el.stars.top.css('background-position-y', '-20px'); 2159 2160 // Changes the cursor 2161 $(this).css('cursor', 'pointer'); 2162 2163 // changes the text 2164 me.el.rating.label.your_rating.show(); 2165 me.el.rating.label.user_rating.hide(); 2166 2167 }); 2168 me.el.stars.under.on('mouseout', function () { 2169 // Returns the sprite 2170 me.el.stars.top.css('background-position-y', '1px'); 2171 2172 // Returns the initial position 2173 me.el.stars.top.css('width', me.el.stars.old_position + '%'); 2174 2175 // Returns the text and initial rating 2176 me.el.rating.label.user_rating.show(); 2177 me.el.rating.label.your_rating.hide(); 2178 me.el.rating.score.html(me.el.rating.old_score); 2179 2180 }); 2181 me.el.stars.under.on('mousemove', function (e) { 2182 if (!e.offsetX){ 2183 e.offsetX = e.clientX - $(e.target).offset().left; 2184 } 2185 // Moves the width 2186 var offset = e.offsetX + 4; 2187 if (offset > 100) { 2188 offset = 100; 2189 } 2190 me.el.stars.top.css('width', offset + '%'); 2191 2192 // Update the real-time score 2193 var score = Math.floor(((offset / 10) * 5)) / 10; 2194 if (score > 5) { 2195 score = 5; 2196 } 2197 me.el.rating.score.html(score); 2198 2199 }); 2200 2201 // Click effect 2202 me.el.stars.under.on('click', function (e) { 2203 if (!e.offsetX){ 2204 e.offsetX = e.clientX - $(e.target).offset().left; 2205 } 2206 var count = parseInt(me.el.rating.count.html(), 10) + 1, 2207 score = (Math.floor(((e.offsetX + 4) / 10) * 5) / 10), 2208 position = e.offsetX + 4; 2209 if (score > 5) { 2210 score = 5; 2211 } 2212 if (position > 100) { 2213 position = 100; 2214 } 2215 // Unbind events 2216 me.el.stars.under.off(); 2217 me.el.stars.under.css('cursor', 'default'); 2218 2219 // Stars animation 2220 me.el.stars.top.fadeOut(function () { 2221 me.el.stars.top.css('background-position-y', '0'); 2222 me.el.stars.top.fadeIn(); 2223 }); 2224 2225 // Count increment 2226 me.el.rating.count.html(count); 2227 2228 // AJAX call to wordpress 2229 var req = { 2230 action:'gonzo_rating', 2231 rating_position:position, 2232 rating_score:score, 2233 post_id:gonzo_script.post_id 2234 }; 2235 2236 $.post(gonzo_script.ajaxurl, req, function () { 2237 // Save cookie 2238 me.createCookie('gonzo_rating_' + gonzo_script.post_id, 'rated', 900); 2239 me.createCookie('gonzo_rating_score_' + gonzo_script.post_id, score, 900); 2240 me.createCookie('gonzo_rating_position_' + gonzo_script.post_id, position, 900); 2241 }) 2242 }); 2243 }; 2244 2245 user_rating.prototype.createCookie = function (name, value, days) { 2246 if (days) { 2247 var date = new Date(); 2248 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 2249 var expires = "; expires=" + date.toGMTString(); 2250 } 2251 else var expires = ""; 2252 document.cookie = name + "=" + value + expires + "; path=/"; 2253 } 2254 2255 user_rating.prototype.readCookie = function (name) { 2256 var nameEQ = name + "="; 2257 var ca = document.cookie.split(';'); 2258 for (var i = 0; i < ca.length; i++) { 2259 var c = ca[i]; 2260 while (c.charAt(0) == ' ') c = c.substring(1, c.length); 2261 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); 2262 } 2263 return null; 2264 } 2265
2266 user_rating.prototype.eraseCookie = function (name) { 2267 createCookie(name, "", -1); 2268 } 2269 2270 $(document).ready(function () { 2271 new user_rating(); 2272 }); 2273})(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.