supersized.3.2.7.min.js 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. /*
  2. Supersized - Fullscreen Slideshow jQuery Plugin
  3. Version : 3.2.7
  4. Site : www.buildinternet.com/project/supersized
  5. Author : Sam Dunn
  6. Company : One Mighty Roar (www.onemightyroar.com)
  7. License : MIT License / GPL License
  8. */
  9. (function (a) {
  10. a(document).ready(function () {
  11. a("body").append('<div id="supersized-loader"></div><ul id="supersized"></ul>')
  12. });
  13. a.supersized = function (b) {
  14. var c = "#supersized", d = this;
  15. d.$el = a(c);
  16. d.el = c;
  17. vars = a.supersized.vars;
  18. d.$el.data("supersized", d);
  19. api = d.$el.data("supersized");
  20. d.init = function () {
  21. a.supersized.vars = a.extend(a.supersized.vars, a.supersized.themeVars);
  22. a.supersized.vars.options = a.extend({}, a.supersized.defaultOptions, a.supersized.themeOptions, b);
  23. d.options = a.supersized.vars.options;
  24. d._build()
  25. };
  26. d._build = function () {
  27. var g = 0, e = "", j = "", h, f = "", i;
  28. while (g <= d.options.slides.length - 1) {
  29. switch (d.options.slide_links) {
  30. case"num":
  31. h = g;
  32. break;
  33. case"name":
  34. h = d.options.slides[g].title;
  35. break;
  36. case"blank":
  37. h = "";
  38. break
  39. }
  40. e = e + '<li class="slide-' + g + '"></li>';
  41. if (g == d.options.start_slide - 1) {
  42. if (d.options.slide_links) {
  43. j = j + '<li class="slide-link-' + g + ' current-slide"><a>' + h + "</a></li>"
  44. }
  45. if (d.options.thumb_links) {
  46. d.options.slides[g].thumb ? i = d.options.slides[g].thumb : i = d.options.slides[g].image;
  47. f = f + '<li class="thumb' + g + ' current-thumb"><img src="' + i + '"/></li>'
  48. }
  49. } else {
  50. if (d.options.slide_links) {
  51. j = j + '<li class="slide-link-' + g + '" ><a>' + h + "</a></li>"
  52. }
  53. if (d.options.thumb_links) {
  54. d.options.slides[g].thumb ? i = d.options.slides[g].thumb : i = d.options.slides[g].image;
  55. f = f + '<li class="thumb' + g + '"><img src="' + i + '"/></li>'
  56. }
  57. }
  58. g++
  59. }
  60. if (d.options.slide_links) {
  61. a(vars.slide_list).html(j)
  62. }
  63. if (d.options.thumb_links && vars.thumb_tray.length) {
  64. a(vars.thumb_tray).append('<ul id="' + vars.thumb_list.replace("#", "") + '">' + f + "</ul>")
  65. }
  66. a(d.el).append(e);
  67. if (d.options.thumbnail_navigation) {
  68. vars.current_slide - 1 < 0 ? prevThumb = d.options.slides.length - 1 : prevThumb = vars.current_slide - 1;
  69. a(vars.prev_thumb).show().html(a("<img/>").attr("src", d.options.slides[prevThumb].image));
  70. vars.current_slide == d.options.slides.length - 1 ? nextThumb = 0 : nextThumb = vars.current_slide + 1;
  71. a(vars.next_thumb).show().html(a("<img/>").attr("src", d.options.slides[nextThumb].image))
  72. }
  73. d._start()
  74. };
  75. d._start = function () {
  76. if (d.options.start_slide) {
  77. vars.current_slide = d.options.start_slide - 1
  78. } else {
  79. vars.current_slide = Math.floor(Math.random() * d.options.slides.length)
  80. }
  81. var o = d.options.new_window ? ' target="_blank"' : "";
  82. if (d.options.performance == 3) {
  83. d.$el.addClass("speed")
  84. } else {
  85. if ((d.options.performance == 1) || (d.options.performance == 2)) {
  86. d.$el.addClass("quality")
  87. }
  88. }
  89. if (d.options.random) {
  90. arr = d.options.slides;
  91. for (var h, m, k = arr.length; k; h = parseInt(Math.random() * k), m = arr[--k], arr[k] = arr[h], arr[h] = m) {
  92. }
  93. d.options.slides = arr
  94. }
  95. if (d.options.slides.length > 1) {
  96. if (d.options.slides.length > 2) {
  97. vars.current_slide - 1 < 0 ? loadPrev = d.options.slides.length - 1 : loadPrev = vars.current_slide - 1;
  98. var g = (d.options.slides[loadPrev].url) ? "href='" + d.options.slides[loadPrev].url + "'" : "";
  99. var q = a('<img src="' + d.options.slides[loadPrev].image + '"/>');
  100. var n = d.el + " li:eq(" + loadPrev + ")";
  101. q.appendTo(n).wrap("<a " + g + o + "></a>").parent().parent().addClass("image-loading prevslide");
  102. q.load(function () {
  103. a(this).data("origWidth", a(this).width()).data("origHeight", a(this).height());
  104. d.resizeNow()
  105. })
  106. }
  107. } else {
  108. d.options.slideshow = 0
  109. }
  110. g = (api.getField("url")) ? "href='" + api.getField("url") + "'" : "";
  111. var l = a('<img src="' + api.getField("image") + '"/>');
  112. var f = d.el + " li:eq(" + vars.current_slide + ")";
  113. l.appendTo(f).wrap("<a " + g + o + "></a>").parent().parent().addClass("image-loading activeslide");
  114. l.load(function () {
  115. d._origDim(a(this));
  116. d.resizeNow();
  117. d.launch();
  118. if (typeof theme != "undefined" && typeof theme._init == "function") {
  119. theme._init()
  120. }
  121. });
  122. if (d.options.slides.length > 1) {
  123. vars.current_slide == d.options.slides.length - 1 ? loadNext = 0 : loadNext = vars.current_slide + 1;
  124. g = (d.options.slides[loadNext].url) ? "href='" + d.options.slides[loadNext].url + "'" : "";
  125. var e = a('<img src="' + d.options.slides[loadNext].image + '"/>');
  126. var p = d.el + " li:eq(" + loadNext + ")";
  127. e.appendTo(p).wrap("<a " + g + o + "></a>").parent().parent().addClass("image-loading");
  128. e.load(function () {
  129. a(this).data("origWidth", a(this).width()).data("origHeight", a(this).height());
  130. d.resizeNow()
  131. })
  132. }
  133. d.$el.css("visibility", "hidden");
  134. a(".load-item").hide()
  135. };
  136. d.launch = function () {
  137. d.$el.css("visibility", "visible");
  138. a("#supersized-loader").remove();
  139. if (typeof theme != "undefined" && typeof theme.beforeAnimation == "function") {
  140. theme.beforeAnimation("next")
  141. }
  142. a(".load-item").show();
  143. if (d.options.keyboard_nav) {
  144. a(document.documentElement).keyup(function (e) {
  145. if (vars.in_animation) {
  146. return false
  147. }
  148. if ((e.keyCode == 37) || (e.keyCode == 40)) {
  149. clearInterval(vars.slideshow_interval);
  150. d.prevSlide()
  151. } else {
  152. if ((e.keyCode == 39) || (e.keyCode == 38)) {
  153. clearInterval(vars.slideshow_interval);
  154. d.nextSlide()
  155. } else {
  156. if (e.keyCode == 32 && !vars.hover_pause) {
  157. clearInterval(vars.slideshow_interval);
  158. d.playToggle()
  159. }
  160. }
  161. }
  162. })
  163. }
  164. if (d.options.slideshow && d.options.pause_hover) {
  165. a(d.el).hover(function () {
  166. if (vars.in_animation) {
  167. return false
  168. }
  169. vars.hover_pause = true;
  170. if (!vars.is_paused) {
  171. vars.hover_pause = "resume";
  172. d.playToggle()
  173. }
  174. }, function () {
  175. if (vars.hover_pause == "resume") {
  176. d.playToggle();
  177. vars.hover_pause = false
  178. }
  179. })
  180. }
  181. if (d.options.slide_links) {
  182. a(vars.slide_list + "> li").click(function () {
  183. index = a(vars.slide_list + "> li").index(this);
  184. targetSlide = index + 1;
  185. d.goTo(targetSlide);
  186. return false
  187. })
  188. }
  189. if (d.options.thumb_links) {
  190. a(vars.thumb_list + "> li").click(function () {
  191. index = a(vars.thumb_list + "> li").index(this);
  192. targetSlide = index + 1;
  193. api.goTo(targetSlide);
  194. return false
  195. })
  196. }
  197. if (d.options.slideshow && d.options.slides.length > 1) {
  198. if (d.options.autoplay && d.options.slides.length > 1) {
  199. vars.slideshow_interval = setInterval(d.nextSlide, d.options.slide_interval)
  200. } else {
  201. vars.is_paused = true
  202. }
  203. a(".load-item img").bind("contextmenu mousedown", function () {
  204. return false
  205. })
  206. }
  207. a(window).resize(function () {
  208. d.resizeNow()
  209. })
  210. };
  211. d.resizeNow = function () {
  212. return d.$el.each(function () {
  213. a("img", d.el).each(function () {
  214. thisSlide = a(this);
  215. var f = (thisSlide.data("origHeight") / thisSlide.data("origWidth")).toFixed(2);
  216. var e = d.$el.width(), h = d.$el.height(), i;
  217. if (d.options.fit_always) {
  218. if ((h / e) > f) {
  219. g()
  220. } else {
  221. j()
  222. }
  223. } else {
  224. if ((h <= d.options.min_height) && (e <= d.options.min_width)) {
  225. if ((h / e) > f) {
  226. d.options.fit_landscape && f < 1 ? g(true) : j(true)
  227. } else {
  228. d.options.fit_portrait && f >= 1 ? j(true) : g(true)
  229. }
  230. } else {
  231. if (e <= d.options.min_width) {
  232. if ((h / e) > f) {
  233. d.options.fit_landscape && f < 1 ? g(true) : j()
  234. } else {
  235. d.options.fit_portrait && f >= 1 ? j() : g(true)
  236. }
  237. } else {
  238. if (h <= d.options.min_height) {
  239. if ((h / e) > f) {
  240. d.options.fit_landscape && f < 1 ? g() : j(true)
  241. } else {
  242. d.options.fit_portrait && f >= 1 ? j(true) : g()
  243. }
  244. } else {
  245. if ((h / e) > f) {
  246. d.options.fit_landscape && f < 1 ? g() : j()
  247. } else {
  248. d.options.fit_portrait && f >= 1 ? j() : g()
  249. }
  250. }
  251. }
  252. }
  253. }
  254. function g(k) {
  255. if (k) {
  256. if (thisSlide.width() < e || thisSlide.width() < d.options.min_width) {
  257. if (thisSlide.width() * f >= d.options.min_height) {
  258. thisSlide.width(d.options.min_width);
  259. thisSlide.height(thisSlide.width() * f)
  260. } else {
  261. j()
  262. }
  263. }
  264. } else {
  265. if (d.options.min_height >= h && !d.options.fit_landscape) {
  266. if (e * f >= d.options.min_height || (e * f >= d.options.min_height && f <= 1)) {
  267. thisSlide.width(e);
  268. thisSlide.height(e * f)
  269. } else {
  270. if (f > 1) {
  271. thisSlide.height(d.options.min_height);
  272. thisSlide.width(thisSlide.height() / f)
  273. } else {
  274. if (thisSlide.width() < e) {
  275. thisSlide.width(e);
  276. thisSlide.height(thisSlide.width() * f)
  277. }
  278. }
  279. }
  280. } else {
  281. thisSlide.width(e);
  282. thisSlide.height(e * f)
  283. }
  284. }
  285. }
  286. function j(k) {
  287. if (k) {
  288. if (thisSlide.height() < h) {
  289. if (thisSlide.height() / f >= d.options.min_width) {
  290. thisSlide.height(d.options.min_height);
  291. thisSlide.width(thisSlide.height() / f)
  292. } else {
  293. g(true)
  294. }
  295. }
  296. } else {
  297. if (d.options.min_width >= e) {
  298. if (h / f >= d.options.min_width || f > 1) {
  299. thisSlide.height(h);
  300. thisSlide.width(h / f)
  301. } else {
  302. if (f <= 1) {
  303. thisSlide.width(d.options.min_width);
  304. thisSlide.height(thisSlide.width() * f)
  305. }
  306. }
  307. } else {
  308. thisSlide.height(h);
  309. thisSlide.width(h / f)
  310. }
  311. }
  312. }
  313. if (thisSlide.parents("li").hasClass("image-loading")) {
  314. a(".image-loading").removeClass("image-loading")
  315. }
  316. if (d.options.horizontal_center) {
  317. a(this).css("left", (e - a(this).width()) / 2)
  318. }
  319. if (d.options.vertical_center) {
  320. a(this).css("top", (h - a(this).height()) / 2)
  321. }
  322. });
  323. if (d.options.image_protect) {
  324. a("img", d.el).bind("contextmenu mousedown", function () {
  325. return false
  326. })
  327. }
  328. return false
  329. })
  330. };
  331. d.nextSlide = function () {
  332. if (vars.in_animation || !api.options.slideshow) {
  333. return false
  334. } else {
  335. vars.in_animation = true
  336. }
  337. clearInterval(vars.slideshow_interval);
  338. var h = d.options.slides, e = d.$el.find(".activeslide");
  339. a(".prevslide").removeClass("prevslide");
  340. e.removeClass("activeslide").addClass("prevslide");
  341. vars.current_slide + 1 == d.options.slides.length ? vars.current_slide = 0 : vars.current_slide++;
  342. var g = a(d.el + " li:eq(" + vars.current_slide + ")"), i = d.$el.find(".prevslide");
  343. if (d.options.performance == 1) {
  344. d.$el.removeClass("quality").addClass("speed")
  345. }
  346. loadSlide = false;
  347. vars.current_slide == d.options.slides.length - 1 ? loadSlide = 0 : loadSlide = vars.current_slide + 1;
  348. var k = d.el + " li:eq(" + loadSlide + ")";
  349. if (!a(k).html()) {
  350. var j = d.options.new_window ? ' target="_blank"' : "";
  351. imageLink = (d.options.slides[loadSlide].url) ? "href='" + d.options.slides[loadSlide].url + "'" : "";
  352. var f = a('<img src="' + d.options.slides[loadSlide].image + '"/>');
  353. f.appendTo(k).wrap("<a " + imageLink + j + "></a>").parent().parent().addClass("image-loading").css("visibility", "hidden");
  354. f.load(function () {
  355. d._origDim(a(this));
  356. d.resizeNow()
  357. })
  358. }
  359. if (d.options.thumbnail_navigation == 1) {
  360. vars.current_slide - 1 < 0 ? prevThumb = d.options.slides.length - 1 : prevThumb = vars.current_slide - 1;
  361. a(vars.prev_thumb).html(a("<img/>").attr("src", d.options.slides[prevThumb].image));
  362. nextThumb = loadSlide;
  363. a(vars.next_thumb).html(a("<img/>").attr("src", d.options.slides[nextThumb].image))
  364. }
  365. if (typeof theme != "undefined" && typeof theme.beforeAnimation == "function") {
  366. theme.beforeAnimation("next")
  367. }
  368. if (d.options.slide_links) {
  369. a(".current-slide").removeClass("current-slide");
  370. a(vars.slide_list + "> li").eq(vars.current_slide).addClass("current-slide")
  371. }
  372. g.css("visibility", "hidden").addClass("activeslide");
  373. switch (d.options.transition) {
  374. case 0:
  375. case"none":
  376. g.css("visibility", "visible");
  377. vars.in_animation = false;
  378. d.afterAnimation();
  379. break;
  380. case 1:
  381. case"fade":
  382. g.animate({opacity: 0}, 0).css("visibility", "visible").animate({opacity: 1, avoidTransforms: false}, d.options.transition_speed, function () {
  383. d.afterAnimation()
  384. });
  385. break;
  386. case 2:
  387. case"slideTop":
  388. g.animate({top: -d.$el.height()}, 0).css("visibility", "visible").animate({top: 0, avoidTransforms: false}, d.options.transition_speed, function () {
  389. d.afterAnimation()
  390. });
  391. break;
  392. case 3:
  393. case"slideRight":
  394. g.animate({left: d.$el.width()}, 0).css("visibility", "visible").animate({left: 0, avoidTransforms: false}, d.options.transition_speed, function () {
  395. d.afterAnimation()
  396. });
  397. break;
  398. case 4:
  399. case"slideBottom":
  400. g.animate({top: d.$el.height()}, 0).css("visibility", "visible").animate({top: 0, avoidTransforms: false}, d.options.transition_speed, function () {
  401. d.afterAnimation()
  402. });
  403. break;
  404. case 5:
  405. case"slideLeft":
  406. g.animate({left: -d.$el.width()}, 0).css("visibility", "visible").animate({left: 0, avoidTransforms: false}, d.options.transition_speed, function () {
  407. d.afterAnimation()
  408. });
  409. break;
  410. case 6:
  411. case"carouselRight":
  412. g.animate({left: d.$el.width()}, 0).css("visibility", "visible").animate({left: 0, avoidTransforms: false}, d.options.transition_speed, function () {
  413. d.afterAnimation()
  414. });
  415. e.animate({left: -d.$el.width(), avoidTransforms: false}, d.options.transition_speed);
  416. break;
  417. case 7:
  418. case"carouselLeft":
  419. g.animate({left: -d.$el.width()}, 0).css("visibility", "visible").animate({left: 0, avoidTransforms: false}, d.options.transition_speed, function () {
  420. d.afterAnimation()
  421. });
  422. e.animate({left: d.$el.width(), avoidTransforms: false}, d.options.transition_speed);
  423. break
  424. }
  425. return false
  426. };
  427. d.prevSlide = function () {
  428. if (vars.in_animation || !api.options.slideshow) {
  429. return false
  430. } else {
  431. vars.in_animation = true
  432. }
  433. clearInterval(vars.slideshow_interval);
  434. var h = d.options.slides, e = d.$el.find(".activeslide");
  435. a(".prevslide").removeClass("prevslide");
  436. e.removeClass("activeslide").addClass("prevslide");
  437. vars.current_slide == 0 ? vars.current_slide = d.options.slides.length - 1 : vars.current_slide--;
  438. var g = a(d.el + " li:eq(" + vars.current_slide + ")"), i = d.$el.find(".prevslide");
  439. if (d.options.performance == 1) {
  440. d.$el.removeClass("quality").addClass("speed")
  441. }
  442. loadSlide = vars.current_slide;
  443. var k = d.el + " li:eq(" + loadSlide + ")";
  444. if (!a(k).html()) {
  445. var j = d.options.new_window ? ' target="_blank"' : "";
  446. imageLink = (d.options.slides[loadSlide].url) ? "href='" + d.options.slides[loadSlide].url + "'" : "";
  447. var f = a('<img src="' + d.options.slides[loadSlide].image + '"/>');
  448. f.appendTo(k).wrap("<a " + imageLink + j + "></a>").parent().parent().addClass("image-loading").css("visibility", "hidden");
  449. f.load(function () {
  450. d._origDim(a(this));
  451. d.resizeNow()
  452. })
  453. }
  454. if (d.options.thumbnail_navigation == 1) {
  455. loadSlide == 0 ? prevThumb = d.options.slides.length - 1 : prevThumb = loadSlide - 1;
  456. a(vars.prev_thumb).html(a("<img/>").attr("src", d.options.slides[prevThumb].image));
  457. vars.current_slide == d.options.slides.length - 1 ? nextThumb = 0 : nextThumb = vars.current_slide + 1;
  458. a(vars.next_thumb).html(a("<img/>").attr("src", d.options.slides[nextThumb].image))
  459. }
  460. if (typeof theme != "undefined" && typeof theme.beforeAnimation == "function") {
  461. theme.beforeAnimation("prev")
  462. }
  463. if (d.options.slide_links) {
  464. a(".current-slide").removeClass("current-slide");
  465. a(vars.slide_list + "> li").eq(vars.current_slide).addClass("current-slide")
  466. }
  467. g.css("visibility", "hidden").addClass("activeslide");
  468. switch (d.options.transition) {
  469. case 0:
  470. case"none":
  471. g.css("visibility", "visible");
  472. vars.in_animation = false;
  473. d.afterAnimation();
  474. break;
  475. case 1:
  476. case"fade":
  477. g.animate({opacity: 0}, 0).css("visibility", "visible").animate({opacity: 1, avoidTransforms: false}, d.options.transition_speed, function () {
  478. d.afterAnimation()
  479. });
  480. break;
  481. case 2:
  482. case"slideTop":
  483. g.animate({top: d.$el.height()}, 0).css("visibility", "visible").animate({top: 0, avoidTransforms: false}, d.options.transition_speed, function () {
  484. d.afterAnimation()
  485. });
  486. break;
  487. case 3:
  488. case"slideRight":
  489. g.animate({left: -d.$el.width()}, 0).css("visibility", "visible").animate({left: 0, avoidTransforms: false}, d.options.transition_speed, function () {
  490. d.afterAnimation()
  491. });
  492. break;
  493. case 4:
  494. case"slideBottom":
  495. g.animate({top: -d.$el.height()}, 0).css("visibility", "visible").animate({top: 0, avoidTransforms: false}, d.options.transition_speed, function () {
  496. d.afterAnimation()
  497. });
  498. break;
  499. case 5:
  500. case"slideLeft":
  501. g.animate({left: d.$el.width()}, 0).css("visibility", "visible").animate({left: 0, avoidTransforms: false}, d.options.transition_speed, function () {
  502. d.afterAnimation()
  503. });
  504. break;
  505. case 6:
  506. case"carouselRight":
  507. g.animate({left: -d.$el.width()}, 0).css("visibility", "visible").animate({left: 0, avoidTransforms: false}, d.options.transition_speed, function () {
  508. d.afterAnimation()
  509. });
  510. e.animate({left: 0}, 0).animate({left: d.$el.width(), avoidTransforms: false}, d.options.transition_speed);
  511. break;
  512. case 7:
  513. case"carouselLeft":
  514. g.animate({left: d.$el.width()}, 0).css("visibility", "visible").animate({left: 0, avoidTransforms: false}, d.options.transition_speed, function () {
  515. d.afterAnimation()
  516. });
  517. e.animate({left: 0}, 0).animate({left: -d.$el.width(), avoidTransforms: false}, d.options.transition_speed);
  518. break
  519. }
  520. return false
  521. };
  522. d.playToggle = function () {
  523. if (vars.in_animation || !api.options.slideshow) {
  524. return false
  525. }
  526. if (vars.is_paused) {
  527. vars.is_paused = false;
  528. if (typeof theme != "undefined" && typeof theme.playToggle == "function") {
  529. theme.playToggle("play")
  530. }
  531. vars.slideshow_interval = setInterval(d.nextSlide, d.options.slide_interval)
  532. } else {
  533. vars.is_paused = true;
  534. if (typeof theme != "undefined" && typeof theme.playToggle == "function") {
  535. theme.playToggle("pause")
  536. }
  537. clearInterval(vars.slideshow_interval)
  538. }
  539. return false
  540. };
  541. d.goTo = function (f) {
  542. if (vars.in_animation || !api.options.slideshow) {
  543. return false
  544. }
  545. var e = d.options.slides.length;
  546. if (f < 0) {
  547. f = e
  548. } else {
  549. if (f > e) {
  550. f = 1
  551. }
  552. }
  553. f = e - f + 1;
  554. clearInterval(vars.slideshow_interval);
  555. if (typeof theme != "undefined" && typeof theme.goTo == "function") {
  556. theme.goTo()
  557. }
  558. if (vars.current_slide == e - f) {
  559. if (!(vars.is_paused)) {
  560. vars.slideshow_interval = setInterval(d.nextSlide, d.options.slide_interval)
  561. }
  562. return false
  563. }
  564. if (e - f > vars.current_slide) {
  565. vars.current_slide = e - f - 1;
  566. vars.update_images = "next";
  567. d._placeSlide(vars.update_images)
  568. } else {
  569. if (e - f < vars.current_slide) {
  570. vars.current_slide = e - f + 1;
  571. vars.update_images = "prev";
  572. d._placeSlide(vars.update_images)
  573. }
  574. }
  575. if (d.options.slide_links) {
  576. a(vars.slide_list + "> .current-slide").removeClass("current-slide");
  577. a(vars.slide_list + "> li").eq((e - f)).addClass("current-slide")
  578. }
  579. if (d.options.thumb_links) {
  580. a(vars.thumb_list + "> .current-thumb").removeClass("current-thumb");
  581. a(vars.thumb_list + "> li").eq((e - f)).addClass("current-thumb")
  582. }
  583. };
  584. d._placeSlide = function (e) {
  585. var h = d.options.new_window ? ' target="_blank"' : "";
  586. loadSlide = false;
  587. if (e == "next") {
  588. vars.current_slide == d.options.slides.length - 1 ? loadSlide = 0 : loadSlide = vars.current_slide + 1;
  589. var g = d.el + " li:eq(" + loadSlide + ")";
  590. if (!a(g).html()) {
  591. var h = d.options.new_window ? ' target="_blank"' : "";
  592. imageLink = (d.options.slides[loadSlide].url) ? "href='" + d.options.slides[loadSlide].url + "'" : "";
  593. var f = a('<img src="' + d.options.slides[loadSlide].image + '"/>');
  594. f.appendTo(g).wrap("<a " + imageLink + h + "></a>").parent().parent().addClass("image-loading").css("visibility", "hidden");
  595. f.load(function () {
  596. d._origDim(a(this));
  597. d.resizeNow()
  598. })
  599. }
  600. d.nextSlide()
  601. } else {
  602. if (e == "prev") {
  603. vars.current_slide - 1 < 0 ? loadSlide = d.options.slides.length - 1 : loadSlide = vars.current_slide - 1;
  604. var g = d.el + " li:eq(" + loadSlide + ")";
  605. if (!a(g).html()) {
  606. var h = d.options.new_window ? ' target="_blank"' : "";
  607. imageLink = (d.options.slides[loadSlide].url) ? "href='" + d.options.slides[loadSlide].url + "'" : "";
  608. var f = a('<img src="' + d.options.slides[loadSlide].image + '"/>');
  609. f.appendTo(g).wrap("<a " + imageLink + h + "></a>").parent().parent().addClass("image-loading").css("visibility", "hidden");
  610. f.load(function () {
  611. d._origDim(a(this));
  612. d.resizeNow()
  613. })
  614. }
  615. d.prevSlide()
  616. }
  617. }
  618. };
  619. d._origDim = function (e) {
  620. e.data("origWidth", e.width()).data("origHeight", e.height())
  621. };
  622. d.afterAnimation = function () {
  623. if (d.options.performance == 1) {
  624. d.$el.removeClass("speed").addClass("quality")
  625. }
  626. if (vars.update_images) {
  627. vars.current_slide - 1 < 0 ? setPrev = d.options.slides.length - 1 : setPrev = vars.current_slide - 1;
  628. vars.update_images = false;
  629. a(".prevslide").removeClass("prevslide");
  630. a(d.el + " li:eq(" + setPrev + ")").addClass("prevslide")
  631. }
  632. vars.in_animation = false;
  633. if (!vars.is_paused && d.options.slideshow) {
  634. vars.slideshow_interval = setInterval(d.nextSlide, d.options.slide_interval);
  635. if (d.options.stop_loop && vars.current_slide == d.options.slides.length - 1) {
  636. d.playToggle()
  637. }
  638. }
  639. if (typeof theme != "undefined" && typeof theme.afterAnimation == "function") {
  640. theme.afterAnimation()
  641. }
  642. return false
  643. };
  644. d.getField = function (e) {
  645. return d.options.slides[vars.current_slide][e]
  646. };
  647. d.init()
  648. };
  649. a.supersized.vars = {thumb_tray: "#thumb-tray", thumb_list: "#thumb-list", slide_list: "#slide-list", current_slide: 0, in_animation: false, is_paused: false, hover_pause: false, slideshow_interval: false, update_images: false, options: {}};
  650. a.supersized.defaultOptions = {slideshow: 1, autoplay: 1, start_slide: 1, stop_loop: 0, random: 0, slide_interval: 5000, transition: 1, transition_speed: 750, new_window: 1, pause_hover: 0, keyboard_nav: 1, performance: 1, image_protect: 1, fit_always: 0, fit_landscape: 0, fit_portrait: 1, min_width: 0, min_height: 0, horizontal_center: 1, vertical_center: 1, slide_links: 1, thumb_links: 1, thumbnail_navigation: 0};
  651. a.fn.supersized = function (b) {
  652. return this.each(function () {
  653. (new a.supersized(b))
  654. })
  655. }
  656. })(jQuery);
  657. $(function () {
  658. if ($('[data-supersized]').size() > 0) {
  659. var slides = [];
  660. var attrs = $('[data-supersized]').data('supersized').split(',');
  661. for (var i in attrs) slides.push({image: attrs[i]});
  662. $.supersized({
  663. min_width: 0, min_height: 0, fit_always: 0,
  664. transition: 1, slide_links: 'blank', performance: 1,
  665. fit_portrait: 1, fit_landscape: 0, slide_interval: 6000,
  666. vertical_center: 1, transition_speed: 3000, horizontal_center: 1, slides: slides
  667. });
  668. }
  669. });