timelineJS-rails 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/README.md +114 -1
  2. data/lib/timelineJS/rails/version.rb +1 -1
  3. data/vendor/assets/images/timelineJS/blank.gif +0 -0
  4. data/vendor/assets/images/timelineJS/fancybox_sprite.png +0 -0
  5. data/vendor/assets/images/timelineJS/fancybox_sprite@2x.png +0 -0
  6. data/vendor/assets/images/timelineJS/overlay.png +0 -0
  7. data/vendor/assets/images/timelineJS/themes/timeline-dark.png +0 -0
  8. data/vendor/assets/images/timelineJS/themes/timeline-dark@2x.png +0 -0
  9. data/vendor/assets/images/timelineJS/{timeline-texture.png → themes/timeline-texture.png} +0 -0
  10. data/vendor/assets/images/timelineJS/timeline.png +0 -0
  11. data/vendor/assets/images/timelineJS/timeline@2x.png +0 -0
  12. data/vendor/assets/javascripts/timelineJS/embed.js +110 -0
  13. data/vendor/assets/javascripts/timelineJS/locale/af.js +2 -0
  14. data/vendor/assets/javascripts/{js → timelineJS}/locale/ar.js +2 -2
  15. data/vendor/assets/javascripts/{js → timelineJS}/locale/bg.js +2 -2
  16. data/vendor/assets/javascripts/timelineJS/locale/ca.js +2 -0
  17. data/vendor/assets/javascripts/timelineJS/locale/cz.js +2 -0
  18. data/vendor/assets/javascripts/timelineJS/locale/da.js +2 -0
  19. data/vendor/assets/javascripts/{js → timelineJS}/locale/de.js +2 -2
  20. data/vendor/assets/javascripts/{js → timelineJS}/locale/el.js +2 -2
  21. data/vendor/assets/javascripts/timelineJS/locale/en-24hr.js +2 -0
  22. data/vendor/assets/javascripts/{js → timelineJS}/locale/en.js +2 -2
  23. data/vendor/assets/javascripts/timelineJS/locale/es.js +2 -0
  24. data/vendor/assets/javascripts/timelineJS/locale/eu.js +2 -0
  25. data/vendor/assets/javascripts/timelineJS/locale/fi.js +2 -0
  26. data/vendor/assets/javascripts/timelineJS/locale/fo.js +2 -0
  27. data/vendor/assets/javascripts/{js → timelineJS}/locale/fr.js +2 -2
  28. data/vendor/assets/javascripts/timelineJS/locale/gl.js +2 -0
  29. data/vendor/assets/javascripts/{js → timelineJS}/locale/hu.js +2 -2
  30. data/vendor/assets/javascripts/{js → timelineJS}/locale/hy.js +2 -2
  31. data/vendor/assets/javascripts/{js → timelineJS}/locale/id.js +2 -2
  32. data/vendor/assets/javascripts/{js → timelineJS}/locale/is.js +2 -2
  33. data/vendor/assets/javascripts/timelineJS/locale/it.js +2 -0
  34. data/vendor/assets/javascripts/timelineJS/locale/iw.js +2 -0
  35. data/vendor/assets/javascripts/timelineJS/locale/ja.js +2 -0
  36. data/vendor/assets/javascripts/timelineJS/locale/ka.js +2 -0
  37. data/vendor/assets/javascripts/timelineJS/locale/ko.js +2 -0
  38. data/vendor/assets/javascripts/timelineJS/locale/lv.js +2 -0
  39. data/vendor/assets/javascripts/timelineJS/locale/nl.js +2 -0
  40. data/vendor/assets/javascripts/{js → timelineJS}/locale/no.js +2 -2
  41. data/vendor/assets/javascripts/timelineJS/locale/pl.js +2 -0
  42. data/vendor/assets/javascripts/timelineJS/locale/pt-br.js +2 -0
  43. data/vendor/assets/javascripts/timelineJS/locale/pt.js +2 -0
  44. data/vendor/assets/javascripts/{js → timelineJS}/locale/ru.js +2 -2
  45. data/vendor/assets/javascripts/{js → timelineJS}/locale/sk.js +2 -2
  46. data/vendor/assets/javascripts/timelineJS/locale/sl.js +2 -0
  47. data/vendor/assets/javascripts/timelineJS/locale/sr-cy.js +2 -0
  48. data/vendor/assets/javascripts/timelineJS/locale/sr.js +2 -0
  49. data/vendor/assets/javascripts/timelineJS/locale/sv.js +2 -0
  50. data/vendor/assets/javascripts/{js → timelineJS}/locale/ta.js +2 -2
  51. data/vendor/assets/javascripts/{js → timelineJS}/locale/tl.js +2 -2
  52. data/vendor/assets/javascripts/{js → timelineJS}/locale/tr.js +2 -2
  53. data/vendor/assets/javascripts/timelineJS/locale/zh-cn.js +2 -0
  54. data/vendor/assets/javascripts/{js → timelineJS}/locale/zh-tw.js +2 -2
  55. data/vendor/assets/javascripts/{js → timelineJS}/timeline.js +2686 -257
  56. data/vendor/assets/stylesheets/{css → timelineJS}/themes/dark.css.erb +142 -102
  57. data/vendor/assets/stylesheets/{css → timelineJS}/themes/font/AbrilFatface-Average.css +14 -1
  58. data/vendor/assets/stylesheets/timelineJS/themes/font/Arvo-PTSans.css +43 -0
  59. data/vendor/assets/stylesheets/{css → timelineJS}/themes/font/Bevan-PotanoSans.css +14 -1
  60. data/vendor/assets/stylesheets/timelineJS/themes/font/BreeSerif-OpenSans.css +73 -0
  61. data/vendor/assets/stylesheets/{css → timelineJS}/themes/font/DroidSerif-DroidSans.css +32 -1
  62. data/vendor/assets/stylesheets/{css → timelineJS}/themes/font/Georgia-Helvetica.css +1 -1
  63. data/vendor/assets/stylesheets/{css → timelineJS}/themes/font/Lekton-Molengo.css +26 -1
  64. data/vendor/assets/stylesheets/timelineJS/themes/font/Lora-Istok.css +55 -0
  65. data/vendor/assets/stylesheets/{css → timelineJS}/themes/font/Merriweather-NewsCycle.css +32 -1
  66. data/vendor/assets/stylesheets/{css → timelineJS}/themes/font/NewsCycle-Merriweather.css +32 -1
  67. data/vendor/assets/stylesheets/{css → timelineJS}/themes/font/NixieOne-Ledger.css +15 -1
  68. data/vendor/assets/stylesheets/timelineJS/themes/font/PT.css +56 -0
  69. data/vendor/assets/stylesheets/timelineJS/themes/font/PTSerif-PTSans.css +43 -0
  70. data/vendor/assets/stylesheets/{css → timelineJS}/themes/font/Pacifico-Arimo.css +32 -1
  71. data/vendor/assets/stylesheets/timelineJS/themes/font/PlayfairDisplay-Muli.css +43 -0
  72. data/vendor/assets/stylesheets/{css → timelineJS}/themes/font/PoiretOne-Molengo.css +14 -1
  73. data/vendor/assets/stylesheets/{css → timelineJS}/themes/font/Rancho-Gudea.css +26 -1
  74. data/vendor/assets/stylesheets/{css → timelineJS}/themes/font/SansitaOne-Kameron.css +20 -1
  75. data/vendor/assets/stylesheets/{css → timelineJS}/timeline.css.erb +142 -103
  76. metadata +75 -59
  77. data/vendor/assets/images/timelineJS/timeline-dark.png +0 -0
  78. data/vendor/assets/javascripts/js/locale/ca.js +0 -2
  79. data/vendor/assets/javascripts/js/locale/cz.js +0 -2
  80. data/vendor/assets/javascripts/js/locale/dk.js +0 -2
  81. data/vendor/assets/javascripts/js/locale/es.js +0 -2
  82. data/vendor/assets/javascripts/js/locale/fo.js +0 -2
  83. data/vendor/assets/javascripts/js/locale/it.js +0 -2
  84. data/vendor/assets/javascripts/js/locale/ja.js +0 -2
  85. data/vendor/assets/javascripts/js/locale/kr.js +0 -2
  86. data/vendor/assets/javascripts/js/locale/nl.js +0 -2
  87. data/vendor/assets/javascripts/js/locale/pl.js +0 -2
  88. data/vendor/assets/javascripts/js/locale/pt-br.js +0 -2
  89. data/vendor/assets/javascripts/js/locale/pt.js +0 -2
  90. data/vendor/assets/javascripts/js/locale/sl.js +0 -2
  91. data/vendor/assets/javascripts/js/locale/zh-ch.js +0 -2
  92. data/vendor/assets/javascripts/js/storyjs-embed.js +0 -45
  93. data/vendor/assets/javascripts/js/timeline-min.js +0 -36
  94. data/vendor/assets/stylesheets/css/themes/font/Arvo-PTSans.css +0 -6
  95. data/vendor/assets/stylesheets/css/themes/font/BreeSerif-OpenSans.css +0 -6
  96. data/vendor/assets/stylesheets/css/themes/font/Lora-Istok.css +0 -6
  97. data/vendor/assets/stylesheets/css/themes/font/PT.css +0 -7
  98. data/vendor/assets/stylesheets/css/themes/font/PTSerif-PTSans.css +0 -6
  99. data/vendor/assets/stylesheets/css/themes/font/PlayfairDisplay-Muli.css +0 -6
@@ -0,0 +1,2 @@
1
+ /* Swedish LANGUAGE
2
+ ================================================== */typeof VMM!="undefined"&&(VMM.Language={lang:"sv",api:{wikipedia:"sv"},date:{month:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"],month_abbr:["jan","febr","mars","april","maj","juni","juli","aug","sept","okt","nov","dec"],day:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"],day_abbr:["sön","mån","tis","ons","tors","fre","lör"]},dateformats:{year:"yyyy",month_short:"mmm",month:"mmmm yyyy",full_short:"d mmm",full:"d mmmm',' yyyy",time_short:"HH:MM:ss",time_no_seconds_short:"H:MM",time_no_seconds_small_date:"H:MM'<br/><small>'d mmmm',' yyyy'</small>'",full_long:"d mmm',' yyyy 'vid' H:MM",full_long_small_date:"H:MM'<br/><small>d mmm',' yyyy'</small>'"},messages:{loading_timeline:"Laddar tidslinje... ",return_to_title:"Tillbaka till start",expand_timeline:"Förstora tidslinje",contract_timeline:"Förminska tidslinje",wikipedia:"Från Wikipedia, den fria encyklopedin",loading_content:"Laddar innehåll",loading:"Laddar"}});
@@ -1,2 +1,2 @@
1
- /* LANGUAGE
2
- ================================================== */typeof VMM!="undefined"&&(VMM.Language={lang:"ta",api:{wikipedia:"ta"},date:{month:["ஜனவரி","பெப்ரவரி","மார்ச்","ஏப்ரல்","மே","ஜுன்","ஜுலை","ஆகஸ்ட்","செப்டம்பர்","ஒக்டோபர்","நவம்பர்","டிசம்பர்"],month_abbr:["ஜன.","பெப்.","மார்ச்","ஏப்ரல்","மே","ஜுன்","ஜுலை","ஆகஸ்ட்","செப்ட்.","ஒக்டோ.","நவம்பர்","டிசம்பர்"],day:["ஞாயிறு","திங்கள்","செவ்வாய்","புதன்","வியாழன்","வெள்ளி","சனி"],day_abbr:["ஞா","தி","செ","பு","வி","வெ","சனி"]},dateformats:{year:"yyyy",month_short:"mmm",month:"mmmm yyyy",full_short:"mmm d",full:"mmmm d',' yyyy",time_no_seconds_short:"h:MM TT",time_no_seconds_small_date:"h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",full_long:"mmm d',' yyyy 'at' hh:MM TT",full_long_small_date:"hh:MM TT'<br/><small>mmm d',' yyyy'</small>'"},messages:{loading_timeline:"நேரக்கோடு தரவேறுகிறது.... ",return_to_title:"தலைப்பிற்குச் செல்ல",expand_timeline:"நேரக்கோட்டை விரிக்க",contract_timeline:"நேரக்கோட்டை சுருக்க",wikipedia:"கட்டற்ற கலைக்களஞ்சியம், விக்கிப்பீடியாவிலிருந்து",loading_content:"உள்ளடக்கம் தரவேறுகிறது...",loading:"தரவேறுகிறது"}});
1
+ /* Tamil LANGUAGE
2
+ ================================================== */typeof VMM!="undefined"&&(VMM.Language={lang:"ta",api:{wikipedia:"ta"},date:{month:["ஜனவரி","பெப்ரவரி","மார்ச்","ஏப்ரல்","மே","ஜுன்","ஜுலை","ஆகஸ்ட்","செப்டம்பர்","ஒக்டோபர்","நவம்பர்","டிசம்பர்"],month_abbr:["ஜன.","பெப்.","மார்ச்","ஏப்ரல்","மே","ஜுன்","ஜுலை","ஆகஸ்ட்","செப்ட்.","ஒக்டோ.","நவம்பர்","டிசம்பர்"],day:["ஞாயிறு","திங்கள்","செவ்வாய்","புதன்","வியாழன்","வெள்ளி","சனி"],day_abbr:["ஞா","தி","செ","பு","வி","வெ","சனி"]},dateformats:{year:"yyyy",month_short:"mmm",month:"mmmm yyyy",full_short:"mmm d",full:"mmmm d',' yyyy",time_short:"h:MM:ss TT",time_no_seconds_short:"h:MM TT",time_no_seconds_small_date:"h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",full_long:"mmm d',' yyyy 'at' hh:MM TT",full_long_small_date:"hh:MM TT'<br/><small>mmm d',' yyyy'</small>'"},messages:{loading_timeline:"நேரக்கோடு தரவேறுகிறது.... ",return_to_title:"தலைப்பிற்குச் செல்ல",expand_timeline:"நேரக்கோட்டை விரிக்க",contract_timeline:"நேரக்கோட்டை சுருக்க",wikipedia:"கட்டற்ற கலைக்களஞ்சியம், விக்கிப்பீடியாவிலிருந்து",loading_content:"உள்ளடக்கம் தரவேறுகிறது...",loading:"தரவேறுகிறது"}});
@@ -1,2 +1,2 @@
1
- /* LANGUAGE
2
- ================================================== */typeof VMM!="undefined"&&(VMM.Language={lang:"tl",api:{wikipedia:"tl"},date:{month:["Enemo","Pebrero","Marso","Abril","Mayo","Hunyo","Hulyo","Agosto","Setyembre","Oktubre","Nobyembre","Disyembre"],month_abbr:["Ene.","Peb.","Mar.","Abr.","Mayo","Hun.","Hul.","Ago.","Set.","Okt.","Nob.","Dis."],day:["Linggo","Lunes","Martes","Miyerkules","Huwebes","Biyernes","Sabado"],day_abbr:["Li.","L.","M.","Mi.","H.","B.","S."]},dateformats:{year:"yyyy",month_short:"mmm",month:"mmmm yyyy",full_short:"mmm d",full:"mmmm d',' yyyy",time_no_seconds_short:"h:MM TT",time_no_seconds_small_date:"h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",full_long:"mmm d',' yyyy 'at' h:MM TT",full_long_small_date:"h:MM TT'<br/><small>mmm d',' yyyy'</small>'"},messages:{loading_timeline:"Loading Timeline... ",return_to_title:"Return to Title",expand_timeline:"Expand Timeline",contract_timeline:"Contract Timeline",wikipedia:"Mula sa Wikipedia, ang malayang ensiklopedya",loading_content:"Loading Content",loading:"Loading"}});
1
+ /* Tagalog LANGUAGE
2
+ ================================================== */typeof VMM!="undefined"&&(VMM.Language={lang:"tl",api:{wikipedia:"tl"},date:{month:["Enemo","Pebrero","Marso","Abril","Mayo","Hunyo","Hulyo","Agosto","Setyembre","Oktubre","Nobyembre","Disyembre"],month_abbr:["Ene.","Peb.","Mar.","Abr.","Mayo","Hun.","Hul.","Ago.","Set.","Okt.","Nob.","Dis."],day:["Linggo","Lunes","Martes","Miyerkules","Huwebes","Biyernes","Sabado"],day_abbr:["Li.","L.","M.","Mi.","H.","B.","S."]},dateformats:{year:"yyyy",month_short:"mmm",month:"mmmm yyyy",full_short:"mmm d",full:"mmmm d',' yyyy",time_short:"h:MM:ss TT",time_no_seconds_short:"h:MM TT",time_no_seconds_small_date:"h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",full_long:"mmm d',' yyyy 'at' h:MM TT",full_long_small_date:"h:MM TT'<br/><small>mmm d',' yyyy'</small>'"},messages:{loading_timeline:"Loading Timeline... ",return_to_title:"Return to Title",expand_timeline:"Expand Timeline",contract_timeline:"Contract Timeline",wikipedia:"Mula sa Wikipedia, ang malayang ensiklopedya",loading_content:"Loading Content",loading:"Loading"}});
@@ -1,2 +1,2 @@
1
- /* LANGUAGE
2
- ================================================== */typeof VMM!="undefined"&&(VMM.Language={lang:"tr",api:{wikipedia:"tr"},date:{month:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],month_abbr:["Oca.","Şub.","Mar.","Nis.","May.","Haz.","Tem.","Ağu.","Eyl.","Eki.","Kas.","Ara."],day:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],day_abbr:["Paz.","Pzt.","Sal.","Çar.","Per.","Cum.","Cts."]},dateformats:{year:"yyyy",month_short:"mmm",month:"mmmm yyyy",full_short:"d mmm",full:"d mmmm',' yyyy",time_no_seconds_short:"H:MM",time_no_seconds_small_date:"H:MM'<br/><small>'d mmmm',' yyyy'</small>'",full_long:"d mmm',' yyyy 'at' H:MM",full_long_small_date:"H:MM '<br/><small>d mmm',' yyyy'</small>'"},messages:{loading_timeline:"Zaman Çizelgesi Yükleniyor... ",return_to_title:"Başlığa Dön",expand_timeline:"Zaman Çizelgesini Genişlet",contract_timeline:"Zaman Çizelgesini Daralt",wikipedia:"Wikipedia'dan, özgür ansiklopedi",loading_content:"İçerik Yükleniyor",loading:"Yükleniyor"}});
1
+ /* Turkish LANGUAGE
2
+ ================================================== */typeof VMM!="undefined"&&(VMM.Language={lang:"tr",api:{wikipedia:"tr"},date:{month:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],month_abbr:["Oca.","Şub.","Mar.","Nis.","May.","Haz.","Tem.","Ağu.","Eyl.","Eki.","Kas.","Ara."],day:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],day_abbr:["Paz.","Pzt.","Sal.","Çar.","Per.","Cum.","Cts."]},dateformats:{year:"yyyy",month_short:"mmm",month:"mmmm yyyy",full_short:"d mmm",full:"d mmmm',' yyyy",time_short:"HH:MM:ss",time_no_seconds_short:"H:MM",time_no_seconds_small_date:"H:MM'<br/><small>'d mmmm',' yyyy'</small>'",full_long:"d mmm',' yyyy 'at' H:MM",full_long_small_date:"H:MM '<br/><small>d mmm',' yyyy'</small>'"},messages:{loading_timeline:"Zaman Çizelgesi Yükleniyor... ",return_to_title:"Başlığa Dön",expand_timeline:"Zaman Çizelgesini Genişlet",contract_timeline:"Zaman Çizelgesini Daralt",wikipedia:"Wikipedia'dan, özgür ansiklopedi",loading_content:"İçerik Yükleniyor",loading:"Yükleniyor"}});
@@ -0,0 +1,2 @@
1
+ /* Chinese LANGUAGE
2
+ ================================================== */typeof VMM!="undefined"&&(VMM.Language={lang:"zh-cn",api:{wikipedia:"zh"},date:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],month_abbr:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],day:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],day_abbr:["周日","周一","周二","周三","周四","周五","周六"]},dateformats:{year:"yyyy年",month_short:"mmm",month:"yyyy年 mmmm",full_short:"mmm d",full:"yyyy年mmmm d日",time_short:"HH:MM:ss",time_no_seconds_short:"HH:MM",time_no_seconds_small_date:"HH:MM'<br/><small>'yyyy年mmmm d日'</small>'",full_long:"dddd',' yyyy年 mmm d日'um' HH:MM",full_long_small_date:"HH:MM'<br/><small>'dddd',' yyyy年 mmm d日'</small>'"},messages:{loading_timeline:"加载时间线... ",return_to_title:"回到开头",expand_timeline:"伸展时间",contract_timeline:"缩短时间",wikipedia:"来自维基百科,自由的百科全书",loading_content:"正在加载内容",loading:"加载中"}});
@@ -1,2 +1,2 @@
1
- /* LANGUAGE
2
- ================================================== */typeof VMM!="undefined"&&(VMM.Language={lang:"zh-tw",api:{wikipedia:"zh"},date:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],month_abbr:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],day:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],day_abbr:["週日","週一","週二","週三","週四","週五","週六"]},dateformats:{year:"yyyy",month_short:"mmm",month:"mmmm yyyy",full_short:"d mmm",full:"d mmmm yyyy",time_no_seconds_short:"HH:MM",time_no_seconds_small_date:"HH:MM'<br/><small>'d mmmm yyyy'</small>'",full_long:"dddd',' d mmm yyyy 'um' HH:MM",full_long_small_date:"HH:MM'<br/><small>'dddd',' d mmm yyyy'</small>'"},messages:{loading_timeline:"Loading Timeline... ",return_to_title:"Return to Title",expand_timeline:"Expand Timeline",contract_timeline:"Contract Timeline",wikipedia:"From Wikipedia, the free encyclopedia",loading_content:"Loading Content",loading:"Loading"}});
1
+ /* Taiwanese LANGUAGE
2
+ ================================================== */typeof VMM!="undefined"&&(VMM.Language={lang:"zh-tw",api:{wikipedia:"zh"},date:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],month_abbr:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],day:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],day_abbr:["週日","週一","週二","週三","週四","週五","週六"]},dateformats:{year:"yyyy",month_short:"mmm",month:"mmmm yyyy",full_short:"d mmm",full:"d mmmm yyyy",time_short:"HH:MM:ss",time_no_seconds_short:"HH:MM",time_no_seconds_small_date:"HH:MM'<br/><small>'d mmmm yyyy'</small>'",full_long:"dddd',' d mmm yyyy 'um' HH:MM",full_long_small_date:"HH:MM'<br/><small>'dddd',' d mmm yyyy'</small>'"},messages:{loading_timeline:"載入時間線... ",return_to_title:"回到開頭",expand_timeline:"展開時間",contract_timeline:"縮短時間",wikipedia:"擷取自維基百科, 自由之百科全書",loading_content:"載入內容",loading:"載入中"}});
@@ -185,6 +185,13 @@ if (typeof VMM == 'undefined') {
185
185
  que: []
186
186
  },
187
187
 
188
+ vine: {
189
+ active: false,
190
+ array: [],
191
+ api_loaded: false,
192
+ que: []
193
+ },
194
+
188
195
  webthumb: {
189
196
  active: false,
190
197
  array: [],
@@ -411,6 +418,12 @@ var type={
411
418
  ================================================== */
412
419
  if(typeof VMM != 'undefined') {
413
420
 
421
+ VMM.modal = function(elem, opt) {
422
+ if( typeof( jQuery ) != 'undefined' ){
423
+ jQuery(elem).fancybox(opt);
424
+ }
425
+ };
426
+
414
427
  VMM.smoothScrollTo = function(elem, duration, ease) {
415
428
  if( typeof( jQuery ) != 'undefined' ){
416
429
  var _ease = "easein",
@@ -1216,6 +1229,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Date == 'undefined') {
1216
1229
  month: "mmmm yyyy",
1217
1230
  full_short: "mmm d",
1218
1231
  full: "mmmm d',' yyyy",
1232
+ time_short: "h:MM:ss TT",
1219
1233
  time_no_seconds_short: "h:MM TT",
1220
1234
  time_no_seconds_small_date: "h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
1221
1235
  full_long: "mmm d',' yyyy 'at' hh:MM TT",
@@ -1253,14 +1267,24 @@ if(typeof VMM != 'undefined' && typeof VMM.Date == 'undefined') {
1253
1267
  dateFormat.i18n.monthNames = lang.date.month_abbr.concat(lang.date.month);
1254
1268
  },
1255
1269
 
1256
- parse: function(d) {
1270
+ parse: function(d, precision) {
1257
1271
  "use strict";
1258
1272
  var date,
1259
1273
  date_array,
1260
1274
  time_array,
1261
- time_parse;
1262
-
1275
+ time_parse,
1276
+ p = {
1277
+ year: false,
1278
+ month: false,
1279
+ day: false,
1280
+ hour: false,
1281
+ minute: false,
1282
+ second: false,
1283
+ millisecond: false
1284
+ };
1285
+
1263
1286
  if (type.of(d) == "date") {
1287
+ trace("DEBUG THIS, ITs A DATE");
1264
1288
  date = d;
1265
1289
  } else {
1266
1290
  date = new Date(0, 0, 1, 0, 0, 0, 0);
@@ -1270,54 +1294,124 @@ if(typeof VMM != 'undefined' && typeof VMM.Date == 'undefined') {
1270
1294
  for(var i = 0; i < date_array.length; i++) {
1271
1295
  date_array[i] = parseInt(date_array[i], 10);
1272
1296
  }
1273
- if ( date_array[0] ) { date.setFullYear( date_array[0]); }
1274
- if ( date_array[1] > 1 ) { date.setMonth( date_array[1] - 1); }
1275
- if ( date_array[2] > 1 ) { date.setDate( date_array[2]); }
1276
- if ( date_array[3] > 1 ) { date.setHours( date_array[3]); }
1277
- if ( date_array[4] > 1 ) { date.setMinutes( date_array[4]); }
1278
- if ( date_array[5] > 1 ) { date.setSeconds( date_array[5]); }
1279
- if ( date_array[6] > 1 ) { date.setMilliseconds( date_array[6]); }
1297
+ if (date_array[0]) {
1298
+ date.setFullYear(date_array[0]);
1299
+ p.year = true;
1300
+ }
1301
+ if (date_array[1]) {
1302
+ date.setMonth(date_array[1] - 1);
1303
+ p.month = true;
1304
+ }
1305
+ if (date_array[2]) {
1306
+ date.setDate(date_array[2]);
1307
+ p.day = true;
1308
+ }
1309
+ if (date_array[3]) {
1310
+ date.setHours(date_array[3]);
1311
+ p.hour = true;
1312
+ }
1313
+ if (date_array[4]) {
1314
+ date.setMinutes(date_array[4]);
1315
+ p.minute = true;
1316
+ }
1317
+ if (date_array[5]) {
1318
+ date.setSeconds(date_array[5]);
1319
+ if (date_array[5] >= 1) {
1320
+ p.second = true;
1321
+ }
1322
+ }
1323
+ if (date_array[6]) {
1324
+ date.setMilliseconds(date_array[6]);
1325
+ if (date_array[6] >= 1) {
1326
+ p.millisecond = true;
1327
+ }
1328
+ }
1280
1329
  } else if (d.match("/")) {
1281
1330
  if (d.match(" ")) {
1331
+
1282
1332
  time_parse = d.split(" ");
1283
1333
  if (d.match(":")) {
1284
1334
  time_array = time_parse[1].split(":");
1285
- if ( time_array[0] >= 1 ) { date.setHours( time_array[0]); }
1286
- if ( time_array[1] >= 1 ) { date.setMinutes( time_array[1]); }
1287
- if ( time_array[2] >= 1 ) { date.setSeconds( time_array[2]); }
1288
- if ( time_array[3] >= 1 ) { date.setMilliseconds( time_array[3]); }
1335
+ if (time_array[0] >= 0 ) {
1336
+ date.setHours(time_array[0]);
1337
+ p.hour = true;
1338
+ }
1339
+ if (time_array[1] >= 0) {
1340
+ date.setMinutes(time_array[1]);
1341
+ p.minute = true;
1342
+ }
1343
+ if (time_array[2] >= 0) {
1344
+ date.setSeconds(time_array[2]);
1345
+ p.second = true;
1346
+ }
1347
+ if (time_array[3] >= 0) {
1348
+ date.setMilliseconds(time_array[3]);
1349
+ p.millisecond = true;
1350
+ }
1289
1351
  }
1290
1352
  date_array = time_parse[0].split("/");
1291
1353
  } else {
1292
1354
  date_array = d.split("/");
1293
1355
  }
1294
- if ( date_array[2] ) { date.setFullYear( date_array[2]); }
1295
- if ( date_array[0] > 1 ) { date.setMonth( date_array[0] - 1); }
1296
- if ( date_array[1] > 1 ) { date.setDate( date_array[1]); }
1356
+ if (date_array[2]) {
1357
+ date.setFullYear(date_array[2]);
1358
+ p.year = true;
1359
+ }
1360
+ if (date_array[0] >= 0) {
1361
+ date.setMonth(date_array[0] - 1);
1362
+ p.month = true;
1363
+ }
1364
+ if (date_array[1] >= 0) {
1365
+ if (date_array[1].length > 2) {
1366
+ date.setFullYear(date_array[1]);
1367
+ p.year = true;
1368
+ } else {
1369
+ date.setDate(date_array[1]);
1370
+ p.day = true;
1371
+ }
1372
+ }
1297
1373
  } else if (d.match("now")) {
1298
- var now = new Date();
1374
+ var now = new Date();
1375
+
1299
1376
  date.setFullYear(now.getFullYear());
1377
+ p.year = true;
1378
+
1300
1379
  date.setMonth(now.getMonth());
1380
+ p.month = true;
1381
+
1301
1382
  date.setDate(now.getDate());
1383
+ p.day = true;
1384
+
1302
1385
  if (d.match("hours")) {
1303
1386
  date.setHours(now.getHours());
1387
+ p.hour = true;
1304
1388
  }
1305
1389
  if (d.match("minutes")) {
1306
1390
  date.setHours(now.getHours());
1307
1391
  date.setMinutes(now.getMinutes());
1392
+ p.hour = true;
1393
+ p.minute = true;
1308
1394
  }
1309
1395
  if (d.match("seconds")) {
1310
1396
  date.setHours(now.getHours());
1311
1397
  date.setMinutes(now.getMinutes());
1312
1398
  date.setSeconds(now.getSeconds());
1399
+ p.hour = true;
1400
+ p.minute = true;
1401
+ p.second = true;
1313
1402
  }
1314
1403
  if (d.match("milliseconds")) {
1315
1404
  date.setHours(now.getHours());
1316
1405
  date.setMinutes(now.getMinutes());
1317
1406
  date.setSeconds(now.getSeconds());
1318
1407
  date.setMilliseconds(now.getMilliseconds());
1408
+ p.hour = true;
1409
+ p.minute = true;
1410
+ p.second = true;
1411
+ p.millisecond = true;
1319
1412
  }
1320
- } else if (d.length <= 5) {
1413
+ } else if (d.length <= 8) {
1414
+ p.year = true;
1321
1415
  date.setFullYear(parseInt(d, 10));
1322
1416
  date.setMonth(0);
1323
1417
  date.setDate(1);
@@ -1330,19 +1424,55 @@ if(typeof VMM != 'undefined' && typeof VMM.Date == 'undefined') {
1330
1424
  // IE 8 < Won't accept dates with a "-" in them.
1331
1425
  time_parse = d.split("T");
1332
1426
  if (d.match(":")) {
1333
- time_array = _time_parse[1].split(":");
1334
- if ( time_array[0] >= 1 ) { date.setHours( time_array[0]); }
1335
- if ( time_array[1] >= 1 ) { date.setMinutes( time_array[1]); }
1336
- if ( time_array[2] >= 1 ) { date.setSeconds( time_array[2]); }
1337
- if ( time_array[3] >= 1 ) { date.setMilliseconds( time_array[3]); }
1427
+ time_array = time_parse[1].split(":");
1428
+ if (time_array[0] >= 1) {
1429
+ date.setHours(time_array[0]);
1430
+ p.hour = true;
1431
+ }
1432
+ if (time_array[1] >= 1) {
1433
+ date.setMinutes(time_array[1]);
1434
+ p.minute = true;
1435
+ }
1436
+ if (time_array[2] >= 1) {
1437
+ date.setSeconds(time_array[2]);
1438
+ if (time_array[2] >= 1) {
1439
+ p.second = true;
1440
+ }
1441
+ }
1442
+ if (time_array[3] >= 1) {
1443
+ date.setMilliseconds(time_array[3]);
1444
+ if (time_array[3] >= 1) {
1445
+ p.millisecond = true;
1446
+ }
1447
+ }
1448
+ }
1449
+ date_array = time_parse[0].split("-");
1450
+ if (date_array[0]) {
1451
+ date.setFullYear(date_array[0]);
1452
+ p.year = true;
1453
+ }
1454
+ if (date_array[1] >= 0) {
1455
+ date.setMonth(date_array[1] - 1);
1456
+ p.month = true;
1457
+ }
1458
+ if (date_array[2] >= 0) {
1459
+ date.setDate(date_array[2]);
1460
+ p.day = true;
1338
1461
  }
1339
- _d_array = time_parse[0].split("-");
1340
- if ( date_array[0] ) { date.setFullYear( date_array[0]); }
1341
- if ( date_array[1] > 1 ) { date.setMonth( date_array[1] - 1); }
1342
- if ( date_array[2] > 1 ) { date.setDate( date_array[2]); }
1343
1462
 
1344
1463
  } else {
1345
1464
  date = new Date(Date.parse(d));
1465
+ p.year = true;
1466
+ p.month = true;
1467
+ p.day = true;
1468
+ p.hour = true;
1469
+ p.minute = true;
1470
+ if (date.getSeconds() >= 1) {
1471
+ p.second = true;
1472
+ }
1473
+ if (date.getMilliseconds() >= 1) {
1474
+ p.millisecond = true;
1475
+ }
1346
1476
  }
1347
1477
  } else {
1348
1478
  date = new Date(
@@ -1352,13 +1482,35 @@ if(typeof VMM != 'undefined' && typeof VMM.Date == 'undefined') {
1352
1482
  parseInt(d.slice(8,10), 10),
1353
1483
  parseInt(d.slice(10,12), 10)
1354
1484
  );
1485
+ p.year = true;
1486
+ p.month = true;
1487
+ p.day = true;
1488
+ p.hour = true;
1489
+ p.minute = true;
1490
+ if (date.getSeconds() >= 1) {
1491
+ p.second = true;
1492
+ }
1493
+ if (date.getMilliseconds() >= 1) {
1494
+ p.millisecond = true;
1495
+ }
1496
+
1355
1497
  }
1356
1498
 
1357
1499
  }
1358
- return date;
1500
+
1501
+ if (precision != null && precision != "") {
1502
+ return {
1503
+ date: date,
1504
+ precision: p
1505
+ };
1506
+ } else {
1507
+ return date;
1508
+ }
1359
1509
  },
1510
+
1511
+
1360
1512
 
1361
- prettyDate: function(d, is_abbr, d2) {
1513
+ prettyDate: function(d, is_abbr, p, d2) {
1362
1514
  var _date,
1363
1515
  _date2,
1364
1516
  format,
@@ -1368,46 +1520,94 @@ if(typeof VMM != 'undefined' && typeof VMM.Date == 'undefined') {
1368
1520
  bc_number,
1369
1521
  bc_string;
1370
1522
 
1371
- if (d2 != null) {
1523
+ if (d2 != null && d2 != "" && typeof d2 != 'undefined') {
1372
1524
  is_pair = true;
1525
+ trace("D2 " + d2);
1373
1526
  }
1374
1527
 
1375
1528
 
1376
1529
  if (type.of(d) == "date") {
1377
- if (d.getMonth() === 0 && d.getDate() == 1 && d.getHours() === 0 && d.getMinutes() === 0 ) {
1378
- // YEAR ONLY
1379
- format = VMM.Date.dateformats.year;
1380
- } else if (d.getDate() <= 1 && d.getHours() === 0 && d.getMinutes() === 0) {
1381
- // YEAR MONTH
1382
- if (is_abbr) {
1383
- format = VMM.Date.dateformats.month_short;
1384
- } else {
1385
- format = VMM.Date.dateformats.month;
1386
- }
1387
- } else if (d.getHours() === 0 && d.getMinutes() === 0) {
1388
- // YEAR MONTH DAY
1389
- if (is_abbr) {
1390
- format = VMM.Date.dateformats.full_short;
1391
- } else {
1392
- format = VMM.Date.dateformats.full;
1393
- }
1394
- } else if (d.getMinutes() === 0) {
1395
- // YEAR MONTH DAY HOUR
1396
- if (is_abbr) {
1397
- format = VMM.Date.dateformats.time_no_seconds_short;
1530
+
1531
+ if (type.of(p) == "object") {
1532
+ if (p.millisecond || p.second && d.getSeconds() >= 1) {
1533
+ // YEAR MONTH DAY HOUR MINUTE
1534
+ if (is_abbr){
1535
+ format = VMM.Date.dateformats.time_short;
1536
+ } else {
1537
+ format = VMM.Date.dateformats.time_short;
1538
+ }
1539
+ } else if (p.minute) {
1540
+ // YEAR MONTH DAY HOUR MINUTE
1541
+ if (is_abbr){
1542
+ format = VMM.Date.dateformats.time_no_seconds_short;
1543
+ } else {
1544
+ format = VMM.Date.dateformats.time_no_seconds_small_date;
1545
+ }
1546
+ } else if (p.hour) {
1547
+ // YEAR MONTH DAY HOUR
1548
+ if (is_abbr) {
1549
+ format = VMM.Date.dateformats.time_no_seconds_short;
1550
+ } else {
1551
+ format = VMM.Date.dateformats.time_no_seconds_small_date;
1552
+ }
1553
+ } else if (p.day) {
1554
+ // YEAR MONTH DAY
1555
+ if (is_abbr) {
1556
+ format = VMM.Date.dateformats.full_short;
1557
+ } else {
1558
+ format = VMM.Date.dateformats.full;
1559
+ }
1560
+ } else if (p.month) {
1561
+ // YEAR MONTH
1562
+ if (is_abbr) {
1563
+ format = VMM.Date.dateformats.month_short;
1564
+ } else {
1565
+ format = VMM.Date.dateformats.month;
1566
+ }
1567
+ } else if (p.year) {
1568
+ format = VMM.Date.dateformats.year;
1398
1569
  } else {
1399
- format = VMM.Date.dateformats.time_no_seconds_small_date;
1570
+ format = VMM.Date.dateformats.year;
1400
1571
  }
1572
+
1401
1573
  } else {
1402
- // YEAR MONTH DAY HOUR MINUTE
1403
- if (is_abbr){
1404
- format = VMM.Date.dateformats.time_no_seconds_short;
1574
+
1575
+ if (d.getMonth() === 0 && d.getDate() == 1 && d.getHours() === 0 && d.getMinutes() === 0 ) {
1576
+ // YEAR ONLY
1577
+ format = VMM.Date.dateformats.year;
1578
+ } else if (d.getDate() <= 1 && d.getHours() === 0 && d.getMinutes() === 0) {
1579
+ // YEAR MONTH
1580
+ if (is_abbr) {
1581
+ format = VMM.Date.dateformats.month_short;
1582
+ } else {
1583
+ format = VMM.Date.dateformats.month;
1584
+ }
1585
+ } else if (d.getHours() === 0 && d.getMinutes() === 0) {
1586
+ // YEAR MONTH DAY
1587
+ if (is_abbr) {
1588
+ format = VMM.Date.dateformats.full_short;
1589
+ } else {
1590
+ format = VMM.Date.dateformats.full;
1591
+ }
1592
+ } else if (d.getMinutes() === 0) {
1593
+ // YEAR MONTH DAY HOUR
1594
+ if (is_abbr) {
1595
+ format = VMM.Date.dateformats.time_no_seconds_short;
1596
+ } else {
1597
+ format = VMM.Date.dateformats.time_no_seconds_small_date;
1598
+ }
1405
1599
  } else {
1406
- format = VMM.Date.dateformats.full_long;
1600
+ // YEAR MONTH DAY HOUR MINUTE
1601
+ if (is_abbr){
1602
+ format = VMM.Date.dateformats.time_no_seconds_short;
1603
+ } else {
1604
+ format = VMM.Date.dateformats.full_long;
1605
+ }
1407
1606
  }
1408
1607
  }
1409
1608
 
1410
1609
  _date = dateFormat(d, format, false);
1610
+ //_date = "Jan"
1411
1611
  bc_check = _date.split(" ");
1412
1612
 
1413
1613
  // BC TIME SUPPORT
@@ -1423,7 +1623,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Date == 'undefined') {
1423
1623
 
1424
1624
 
1425
1625
  if (is_pair) {
1426
- _date2 = dateFormat(d2, format);
1626
+ _date2 = dateFormat(d2, format, false);
1427
1627
  bc_check = _date2.split(" ");
1428
1628
  // BC TIME SUPPORT
1429
1629
  for(var j = 0; j < bc_check.length; j++) {
@@ -1824,7 +2024,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
1824
2024
  // http://, https://, ftp://
1825
2025
  var urlPattern = /\b(?:https?|ftp):\/\/[a-z0-9-+&@#\/%?=~_|!:,.;]*[a-z0-9-+&@#\/%=~_|]/gim;
1826
2026
  var url_pattern = /(\()((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&'()*+,;=:\/?#[\]@%]+)(\))|(\[)((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&'()*+,;=:\/?#[\]@%]+)(\])|(\{)((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&'()*+,;=:\/?#[\]@%]+)(\})|(<|&(?:lt|#60|#x3c);)((?:ht|f)tps?:\/\/[a-z0-9\-._~!$&'()*+,;=:\/?#[\]@%]+)(>|&(?:gt|#62|#x3e);)|((?:^|[^=\s'"\]])\s*['"]?|[^=\s]\s+)(\b(?:ht|f)tps?:\/\/[a-z0-9\-._~!$'()*+,;=:\/?#[\]@%]+(?:(?!&(?:gt|#0*62|#x0*3e);|&(?:amp|apos|quot|#0*3[49]|#x0*2[27]);[.!&',:?;]?(?:[^a-z0-9\-._~!$&'()*+,;=:\/?#[\]@%]|$))&[a-z0-9\-._~!$'()*+,;=:\/?#[\]@%]*)*[a-z0-9\-_~$()*+=\/#[\]@%])/img;
1827
- var url_replace = '$1$4$7$10$13<a href="$2$5$8$11$14" class="hyphenate">$2$5$8$11$14</a>$3$6$9$12';
2027
+ var url_replace = '$1$4$7$10$13<a href="$2$5$8$11$14" target="_blank" class="hyphenate">$2$5$8$11$14</a>$3$6$9$12';
1828
2028
 
1829
2029
  // www. sans http:// or https://
1830
2030
  var pseudoUrlPattern = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
@@ -1844,8 +2044,10 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
1844
2044
  .replace(url_pattern, url_replace)
1845
2045
  .replace(pseudoUrlPattern, "$1<a target='_blank' class='hyphenate' onclick='void(0)' href='http://$2'>$2</a>")
1846
2046
  .replace(emailAddressPattern, "<a target='_blank' onclick='void(0)' href='mailto:$1'>$1</a>")
1847
- .replace(twitterHandlePattern, "<a href='http://twitter.com/$1' target='_blank' onclick='void(0)'>@$1</a>")
1848
- .replace(twitterSearchPattern, "<a href='http://twitter.com/#search?q=%23$2' target='_blank' 'void(0)'>$1</a>");
2047
+ .replace(twitterHandlePattern, "<a href='http://twitter.com/$1' target='_blank' onclick='void(0)'>@$1</a>");
2048
+
2049
+ // TURN THIS BACK ON TO AUTOMAGICALLY LINK HASHTAGS TO TWITTER SEARCH
2050
+ //.replace(twitterSearchPattern, "<a href='http://twitter.com/#search?q=%23$2' target='_blank' 'void(0)'>$1</a>");
1849
2051
  },
1850
2052
 
1851
2053
  linkify_wikipedia: function(text) {
@@ -2561,6 +2763,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Language == 'undefined') {
2561
2763
  month: "mmmm yyyy",
2562
2764
  full_short: "mmm d",
2563
2765
  full: "mmmm d',' yyyy",
2766
+ time_short: "h:MM:ss TT",
2564
2767
  time_no_seconds_short: "h:MM TT",
2565
2768
  time_no_seconds_small_date: "h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",
2566
2769
  full_long: "mmm d',' yyyy 'at' h:MM TT",
@@ -2632,6 +2835,9 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
2632
2835
  if (VMM.master_config.vimeo.active) {
2633
2836
  VMM.ExternalAPI.vimeo.pushQue();
2634
2837
  }
2838
+ if (VMM.master_config.vine.active) {
2839
+ VMM.ExternalAPI.vine.pushQue();
2840
+ }
2635
2841
  if (VMM.master_config.twitter.active) {
2636
2842
  VMM.ExternalAPI.twitter.pushQue();
2637
2843
  }
@@ -2658,9 +2864,14 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
2658
2864
 
2659
2865
  var id = tweet.mid.toString(),
2660
2866
  error_obj = { twitterid: tweet.mid },
2661
- the_url = "http://api.twitter.com/1/statuses/show.json?id=" + tweet.mid + "&include_entities=true&callback=?",
2662
- twitter_timeout = setTimeout(VMM.ExternalAPI.twitter.errorTimeOut, VMM.master_config.timers.api, tweet),
2663
- callback_timeout= setTimeout(callback, VMM.master_config.timers.api, tweet);
2867
+ the_url = "http://api.twitter.com/1/statuses/show.json?id=" + tweet.mid + "&include_entities=true&callback=?";
2868
+ //twitter_timeout = setTimeout(VMM.ExternalAPI.twitter.errorTimeOut, VMM.master_config.timers.api, tweet),
2869
+ //callback_timeout= setTimeout(callback, VMM.master_config.timers.api, tweet);
2870
+
2871
+ VMM.ExternalAPI.twitter.getOEmbed(tweet, callback);
2872
+
2873
+ /*
2874
+ // Disabled thanks to twitter's new api
2664
2875
 
2665
2876
  VMM.getJSON(the_url, function(d) {
2666
2877
  var id = d.id_str,
@@ -2705,6 +2916,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
2705
2916
  callback();
2706
2917
  });
2707
2918
 
2919
+ */
2708
2920
  },
2709
2921
 
2710
2922
  errorTimeOut: function(tweet) {
@@ -2727,18 +2939,65 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
2727
2939
 
2728
2940
  },
2729
2941
 
2942
+ errorTimeOutOembed: function(tweet) {
2943
+ trace("TWITTER JSON ERROR TIMEOUT " + tweet.mid);
2944
+ VMM.attachElement("#"+tweet.id.toString(), VMM.MediaElement.loadingmessage("Still waiting on Twitter: " + tweet.mid) );
2945
+ },
2946
+
2730
2947
  pushQue: function() {
2731
2948
  if (VMM.master_config.twitter.que.length > 0) {
2732
2949
  VMM.ExternalAPI.twitter.create(VMM.master_config.twitter.que[0], VMM.ExternalAPI.twitter.pushQue);
2733
2950
  VMM.master_config.twitter.que.remove(0);
2734
2951
  }
2735
2952
  },
2736
-
2737
-
2953
+
2954
+ getOEmbed: function(tweet, callback) {
2955
+
2956
+ var the_url = "http://api.twitter.com/1/statuses/oembed.json?id=" + tweet.mid + "&omit_script=true&include_entities=true&callback=?",
2957
+ twitter_timeout = setTimeout(VMM.ExternalAPI.twitter.errorTimeOutOembed, VMM.master_config.timers.api, tweet);
2958
+ //callback_timeout= setTimeout(callback, VMM.master_config.timers.api, tweet);
2959
+
2960
+ VMM.getJSON(the_url, function(d) {
2961
+ var twit = "",
2962
+ tuser = "";
2963
+
2964
+
2965
+ // TWEET CONTENT
2966
+ twit += d.html.split("<\/p>\&mdash;")[0] + "</p></blockquote>";
2967
+ tuser = d.author_url.split("twitter.com\/")[1];
2968
+
2969
+
2970
+ // TWEET AUTHOR
2971
+ twit += "<div class='vcard author'>";
2972
+ twit += "<a class='screen-name url' href='" + d.author_url + "' target='_blank'>";
2973
+ twit += "<span class='avatar'></span>";
2974
+ twit += "<span class='fn'>" + d.author_name + "</span>";
2975
+ twit += "<span class='nickname'>@" + tuser + "<span class='thumbnail-inline'></span></span>";
2976
+ twit += "</a>";
2977
+ twit += "</div>";
2978
+
2979
+ VMM.attachElement("#"+tweet.id.toString(), twit );
2980
+ VMM.attachElement("#text_thumb_"+tweet.id.toString(), d.html );
2981
+ VMM.attachElement("#marker_content_" + tweet.id.toString(), d.html );
2982
+ })
2983
+ .error(function(jqXHR, textStatus, errorThrown) {
2984
+ trace("TWITTER error");
2985
+ trace("TWITTER ERROR: " + textStatus + " " + jqXHR.responseText);
2986
+ clearTimeout(twitter_timeout);
2987
+ //clearTimeout(callback_timeout);
2988
+ VMM.attachElement("#"+tweet.id, VMM.MediaElement.loadingmessage("ERROR LOADING TWEET " + tweet.mid) );
2989
+ })
2990
+ .success(function(d) {
2991
+ clearTimeout(twitter_timeout);
2992
+ clearTimeout(callback_timeout);
2993
+ callback();
2994
+ });
2995
+
2996
+ },
2738
2997
 
2739
2998
  getHTML: function(id) {
2740
2999
  //var the_url = document.location.protocol + "//api.twitter.com/1/statuses/oembed.json?id=" + id+ "&callback=?";
2741
- var the_url = "http://api.twitter.com/1/statuses/oembed.json?id=" + id+ "&callback=?";
3000
+ var the_url = "http://api.twitter.com/1/statuses/oembed.json?id=" + id+ "&omit_script=true&include_entities=true&callback=?";
2742
3001
  VMM.getJSON(the_url, VMM.ExternalAPI.twitter.onJSONLoaded);
2743
3002
  },
2744
3003
 
@@ -2929,7 +3188,13 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
2929
3188
  api_key = Aes.Ctr.decrypt(VMM.ExternalAPI.keys_master.google, VMM.ExternalAPI.keys_master.vp, 256);
2930
3189
  }
2931
3190
 
2932
- map_url = "http://maps.googleapis.com/maps/api/js?key=" + api_key + "&libraries=places&sensor=false&callback=VMM.ExternalAPI.googlemaps.onMapAPIReady";
3191
+
3192
+ /*
3193
+ Investigating a google map api change on the latest release that causes custom map types to stop working
3194
+ http://stackoverflow.com/questions/13486271/google-map-markermanager-cannot-call-method-substr-of-undefined
3195
+ soulution is to use api ver 3.9
3196
+ */
3197
+ map_url = "http://maps.googleapis.com/maps/api/js?key=" + api_key + "&v=3.9&libraries=places&sensor=false&callback=VMM.ExternalAPI.googlemaps.onMapAPIReady";
2933
3198
 
2934
3199
  if (VMM.master_config.googlemaps.active) {
2935
3200
  VMM.master_config.googlemaps.que.push(m);
@@ -3081,8 +3346,8 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
3081
3346
  VMM.appendElement("#"+unique_map_id, map_attribution_html);
3082
3347
  }
3083
3348
 
3084
- // DETERMINE IF KML IS POSSIBLE
3085
- if (m.id[0].match("msid")) {
3349
+ // DETERMINE IF KML IS POSSIBLE
3350
+ if (type.of(VMM.Util.getUrlVars(m.id)["msid"]) == "string") {
3086
3351
  loadKML();
3087
3352
  } else {
3088
3353
  //loadPlaces();
@@ -3415,7 +3680,7 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
3415
3680
  "stamen": "Map tiles by <a href='http://stamen.com'>Stamen Design</a>, under <a href='http://creativecommons.org/licenses/by/3.0'>CC BY 3.0</a>. Data by <a href='http://openstreetmap.org'>OpenStreetMap</a>, under <a href='http://creativecommons.org/licenses/by-sa/3.0'>CC BY SA</a>.",
3416
3681
  "apple": "Map data &copy; 2012 Apple, Imagery &copy; 2012 Apple"
3417
3682
  },
3418
-
3683
+
3419
3684
  map_providers: {
3420
3685
  "toner": {
3421
3686
  "url": "http://{S}tile.stamen.com/toner/{Z}/{X}/{Y}.png",
@@ -4028,6 +4293,35 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
4028
4293
 
4029
4294
  },
4030
4295
 
4296
+ vine: {
4297
+
4298
+ get: function(m) {
4299
+ VMM.master_config.vine.que.push(m);
4300
+ VMM.master_config.vine.active = true;
4301
+ },
4302
+
4303
+ create: function(m, callback) {
4304
+ trace("VINE CREATE");
4305
+
4306
+ var video_url = "https://vine.co/v/" + m.id + "/embed/simple";
4307
+
4308
+
4309
+
4310
+ // VIDEO
4311
+ // TODO: NEED TO ADD ASYNC SCRIPT TO TIMELINE FLOW
4312
+ VMM.attachElement("#" + m.uid, "<iframe frameborder='0' width='100%' height='100%' src='" + video_url + "'></iframe><script async src='http://platform.vine.co/static/scripts/embed.js' charset='utf-8'></script>");
4313
+
4314
+ },
4315
+
4316
+ pushQue: function() {
4317
+ if (VMM.master_config.vine.que.length > 0) {
4318
+ VMM.ExternalAPI.vine.create(VMM.master_config.vine.que[0], VMM.ExternalAPI.vine.pushQue);
4319
+ VMM.master_config.vine.que.remove(0);
4320
+ }
4321
+ }
4322
+
4323
+ },
4324
+
4031
4325
  webthumb: {
4032
4326
 
4033
4327
  get: function(m, thumb) {
@@ -4050,17 +4344,15 @@ if(typeof VMM != 'undefined' && typeof VMM.ExternalAPI == 'undefined') {
4050
4344
 
4051
4345
  create: function(m) {
4052
4346
  trace("WEB THUMB CREATE");
4053
- //http://pagepeeker.com/t/{size}/{url}
4054
- //http://api.snapito.com/free/lc?url=
4055
4347
 
4056
- var thumb_url = "http://pagepeeker.com/t/";
4348
+ var thumb_url = "http://free.pagepeeker.com/v2/thumbs.php?";
4057
4349
  url = m.id.replace("http://", "");//.split("/")[0];
4058
4350
 
4059
4351
  // Main Image
4060
- VMM.attachElement("#" + m.uid, "<a href='" + m.id + "' target='_blank'><img src='" + thumb_url + "x/" + url + "'></a>");
4352
+ VMM.attachElement("#" + m.uid, "<a href='" + m.id + "' target='_blank'><img src='" + thumb_url + "size=x&url=" + url + "'></a>");
4061
4353
 
4062
4354
  // Thumb
4063
- VMM.attachElement("#" + m.uid + "_thumb", "<a href='" + m.id + "' target='_blank'><img src='" + thumb_url + "t/" + url + "'></a>");
4355
+ VMM.attachElement("#" + m.uid + "_thumb", "<img src='" + thumb_url + "size=t&url=" + url + "'>");
4064
4356
  },
4065
4357
 
4066
4358
  pushQue: function() {
@@ -4139,6 +4431,9 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
4139
4431
  } else if (m.type == "vimeo") {
4140
4432
  mediaElem = "<div class='thumbnail thumb-vimeo' id='" + uid + "_thumb'></div>";
4141
4433
  return mediaElem;
4434
+ } else if (m.type == "vine") {
4435
+ mediaElem = "<div class='thumbnail thumb-vine'></div>";
4436
+ return mediaElem;
4142
4437
  } else if (m.type == "dailymotion") {
4143
4438
  mediaElem = "<div class='thumbnail thumb-video'></div>";
4144
4439
  return mediaElem;
@@ -4166,6 +4461,9 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
4166
4461
  } else if (m.type == "quote") {
4167
4462
  mediaElem = "<div class='thumbnail thumb-quote'></div>";
4168
4463
  return mediaElem;
4464
+ } else if (m.type == "iframe") {
4465
+ mediaElem = "<div class='thumbnail thumb-video'></div>";
4466
+ return mediaElem;
4169
4467
  } else if (m.type == "unknown") {
4170
4468
  if (m.id.match("blockquote")) {
4171
4469
  mediaElem = "<div class='thumbnail thumb-quote'></div>";
@@ -4233,6 +4531,10 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
4233
4531
  // DAILYMOTION
4234
4532
  } else if (m.type == "dailymotion") {
4235
4533
  mediaElem = "<div class='media-shadow'><iframe class='media-frame video dailymotion' autostart='false' frameborder='0' width='100%' height='100%' src='http://www.dailymotion.com/embed/video/" + m.id + "'></iframe></div>";
4534
+ // VINE
4535
+ } else if (m.type == "vine") {
4536
+ mediaElem = "<div class='media-shadow media-frame video vine' id='" + m.uid + "'>" + loading_messege + "</div>";
4537
+ VMM.ExternalAPI.vine.get(m);
4236
4538
  // TWITTER
4237
4539
  } else if (m.type == "twitter"){
4238
4540
  mediaElem = "<div class='twitter' id='" + m.uid + "'>" + loading_messege + "</div>";
@@ -4265,6 +4567,10 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaElement == 'undefined') {
4265
4567
  } else if (m.type == "storify") {
4266
4568
  isTextMedia = true;
4267
4569
  mediaElem = "<div class='plain-text-quote'>" + m.id + "</div>";
4570
+ // IFRAME
4571
+ } else if (m.type == "iframe") {
4572
+ isTextMedia = true;
4573
+ mediaElem = "<div class='media-shadow'><iframe class='media-frame video' autostart='false' frameborder='0' width='100%' height='100%' src='" + m.id + "'></iframe></div>";
4268
4574
  // QUOTE
4269
4575
  } else if (m.type == "quote") {
4270
4576
  isTextMedia = true;
@@ -4337,8 +4643,10 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaType == 'undefined') {
4337
4643
  media.id = VMM.Util.getUrlVars(d)["v"];
4338
4644
  } else if (d.match('\/embed\/')) {
4339
4645
  media.id = d.split("embed\/")[1].split(/[?&]/)[0];
4340
- } else {
4646
+ } else if (d.match(/v\/|v=|youtu\.be\//)){
4341
4647
  media.id = d.split(/v\/|v=|youtu\.be\//)[1].split(/[?&]/)[0];
4648
+ } else {
4649
+ trace("YOUTUBE IN URL BUT NOT A VALID VIDEO");
4342
4650
  }
4343
4651
  media.start = VMM.Util.getUrlVars(d)["t"];
4344
4652
  media.hd = VMM.Util.getUrlVars(d)["hd"];
@@ -4352,6 +4660,16 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaType == 'undefined') {
4352
4660
  media.id = d.split(/video\/|\/\/dailymotion\.com\//)[1];
4353
4661
  media.type = "dailymotion";
4354
4662
  success = true;
4663
+ } else if (d.match('(www.)?vine\.co')) {
4664
+ trace("VINE");
4665
+ //https://vine.co/v/b55LOA1dgJU
4666
+ if (d.match("vine.co/v/")) {
4667
+ media.id = d.split("vine.co/v/")[1];
4668
+ trace(media.id);
4669
+ }
4670
+ trace(d);
4671
+ media.type = "vine";
4672
+ success = true;
4355
4673
  } else if (d.match('(player.)?soundcloud\.com')) {
4356
4674
  media.type = "soundcloud";
4357
4675
  media.id = d;
@@ -4418,6 +4736,12 @@ if(typeof VMM != 'undefined' && typeof VMM.MediaType == 'undefined') {
4418
4736
  media.type = "quote";
4419
4737
  media.id = d;
4420
4738
  success = true;
4739
+ } else if (d.match('iframe')) {
4740
+ media.type = "iframe";
4741
+ trace("IFRAME")
4742
+ trace( d.match(/src\=([^\s]*)\s/)[1].split(/"/)[1]);
4743
+ media.id = d.match(/src\=([^\s]*)\s/)[1].split(/"/)[1];
4744
+ success = true;
4421
4745
  } else {
4422
4746
  trace("unknown media");
4423
4747
  media.type = "unknown";
@@ -4479,8 +4803,6 @@ if(typeof VMM != 'undefined' && typeof VMM.TextElement == 'undefined') {
4479
4803
  /* DRAG SLIDER
4480
4804
  ================================================== */
4481
4805
  if(typeof VMM != 'undefined' && typeof VMM.DragSlider == 'undefined') {
4482
- // VMM.DragSlider.createSlidePanel(drag_object, move_object, w, padding, sticky);
4483
- // VMM.DragSlider.cancelSlide();
4484
4806
 
4485
4807
  VMM.DragSlider = function() {
4486
4808
  var drag = {
@@ -4492,6 +4814,10 @@ if(typeof VMM != 'undefined' && typeof VMM.DragSlider == 'undefined') {
4492
4814
  start: 0,
4493
4815
  end: 0
4494
4816
  },
4817
+ pagey: {
4818
+ start: 0,
4819
+ end: 0
4820
+ },
4495
4821
  left: {
4496
4822
  start: 0,
4497
4823
  end: 0
@@ -4593,7 +4919,7 @@ if(typeof VMM != 'undefined' && typeof VMM.DragSlider == 'undefined') {
4593
4919
  if (!drag.touch) {
4594
4920
  e.preventDefault();
4595
4921
  }
4596
- e.stopPropagation();
4922
+ //e.stopPropagation();
4597
4923
  return true;
4598
4924
  }
4599
4925
 
@@ -4601,7 +4927,7 @@ if(typeof VMM != 'undefined' && typeof VMM.DragSlider == 'undefined') {
4601
4927
  if (!drag.touch) {
4602
4928
  e.preventDefault();
4603
4929
  }
4604
- e.stopPropagation();
4930
+ //e.stopPropagation();
4605
4931
  if (drag.sliding) {
4606
4932
  drag.sliding = false;
4607
4933
  dragEnd(e.data.element, e.data.delement, e);
@@ -4614,12 +4940,6 @@ if(typeof VMM != 'undefined' && typeof VMM.DragSlider == 'undefined') {
4614
4940
  function onDragMove(e) {
4615
4941
  dragMove(e.data.element, e);
4616
4942
 
4617
- if (Math.abs(drag.left.start) > getLeft(elem)) {
4618
-
4619
-
4620
- }
4621
-
4622
- return false;
4623
4943
  }
4624
4944
 
4625
4945
  function dragStart(elem, delem, e) {
@@ -4627,8 +4947,10 @@ if(typeof VMM != 'undefined' && typeof VMM.DragSlider == 'undefined') {
4627
4947
  trace("IS TOUCH")
4628
4948
  VMM.Lib.css(elem, '-webkit-transition-duration', '0');
4629
4949
  drag.pagex.start = e.originalEvent.touches[0].screenX;
4950
+ drag.pagey.start = e.originalEvent.touches[0].screenY;
4630
4951
  } else {
4631
4952
  drag.pagex.start = e.pageX;
4953
+ drag.pagey.start = e.pageY;
4632
4954
  }
4633
4955
  drag.left.start = getLeft(elem);
4634
4956
  drag.time.start = new Date().getTime();
@@ -4644,23 +4966,29 @@ if(typeof VMM != 'undefined' && typeof VMM.DragSlider == 'undefined') {
4644
4966
  }
4645
4967
 
4646
4968
  function dragMove(elem, e) {
4647
- var drag_to;
4969
+ var drag_to, drag_to_y;
4648
4970
  drag.sliding = true;
4649
4971
  if (drag.touch) {
4650
4972
  drag.pagex.end = e.originalEvent.touches[0].screenX;
4973
+ drag.pagey.end = e.originalEvent.touches[0].screenY;
4651
4974
  } else {
4652
4975
  drag.pagex.end = e.pageX;
4976
+ drag.pagey.end = e.pageY;
4653
4977
  }
4978
+
4654
4979
  drag.left.end = getLeft(elem);
4655
4980
  drag_to = -(drag.pagex.start - drag.pagex.end - drag.left.start);
4656
4981
 
4982
+
4983
+ if (Math.abs(drag.pagey.start) - Math.abs(drag.pagey.end) > 10) {
4984
+ trace("SCROLLING Y")
4985
+ trace(Math.abs(drag.pagey.start) - Math.abs(drag.pagey.end));
4986
+ }
4657
4987
  if (Math.abs(drag_to - drag.left.start) > 10) {
4658
4988
  VMM.Lib.css(elem, 'left', drag_to);
4659
4989
  e.preventDefault();
4660
4990
  e.stopPropagation();
4661
4991
  }
4662
- //VMM.Lib.css(elem, 'left', drag_to);
4663
-
4664
4992
  }
4665
4993
 
4666
4994
  function dragMomentum(elem, e) {
@@ -4701,27 +5029,16 @@ if(typeof VMM != 'undefined' && typeof VMM.DragSlider == 'undefined') {
4701
5029
  }
4702
5030
 
4703
5031
  VMM.fireEvent(dragslider, "DRAGUPDATE", [drag_info]);
4704
-
5032
+
4705
5033
  if (!is_sticky) {
4706
5034
  if (drag_info.time > 0) {
4707
5035
  if (drag.touch) {
4708
- //VMM.Lib.css(elem, '-webkit-transition-property', 'left');
4709
- //VMM.Lib.css(elem, '-webkit-transition-duration', drag_info.time);
4710
- //VMM.Lib.css(elem, 'left', drag_info.left);
4711
-
4712
- //VMM.Lib.animate(elem, drag_info.time, "easeOutQuad", {"left": drag_info.left});
4713
5036
  VMM.Lib.animate(elem, drag_info.time, "easeOutCirc", {"left": drag_info.left});
4714
- //VMM.Lib.css(elem, 'webkitTransition', '');
4715
- //VMM.Lib.css(elem, 'webkitTransition', '-webkit-transform ' + drag_info.time + 'ms cubic-bezier(0.33, 0.66, 0.66, 1)');
4716
- //VMM.Lib.css(elem, 'webkitTransform', 'translate3d(' + drag_info.left + 'px, 0, 0)');
4717
-
4718
5037
  } else {
4719
5038
  VMM.Lib.animate(elem, drag_info.time, drag.ease, {"left": drag_info.left});
4720
5039
  }
4721
5040
  }
4722
5041
  }
4723
-
4724
-
4725
5042
  }
4726
5043
 
4727
5044
  function getLeft(elem) {
@@ -5161,7 +5478,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
5161
5478
  };
5162
5479
 
5163
5480
  // Handle smaller sizes
5164
- if (VMM.Browser.device == "mobile" || current_width <= 640) {
5481
+ if (VMM.Browser.device == "mobile" || current_width < 641) {
5165
5482
  is_skinny = true;
5166
5483
 
5167
5484
  }
@@ -5306,7 +5623,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
5306
5623
 
5307
5624
  /* POSITION SLIDES
5308
5625
  ================================================== */
5309
- var positionSlides = function() {
5626
+ function positionSlides() {
5310
5627
  var pos = 0,
5311
5628
  i = 0;
5312
5629
 
@@ -5318,7 +5635,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
5318
5635
 
5319
5636
  /* OPACITY SLIDES
5320
5637
  ================================================== */
5321
- var opacitySlides = function(n) {
5638
+ function opacitySlides(n) {
5322
5639
  var _ease = "linear",
5323
5640
  i = 0;
5324
5641
 
@@ -5377,7 +5694,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
5377
5694
  VMM.attachElement(navigation.prevDate, _title);
5378
5695
  VMM.attachElement(navigation.prevTitle, "");
5379
5696
  } else {
5380
- VMM.attachElement(navigation.prevDate, VMM.Date.prettyDate(data[current_slide - 1].startdate));
5697
+ VMM.attachElement(navigation.prevDate, VMM.Date.prettyDate(data[current_slide - 1].startdate, false, data[current_slide - 1].precisiondate));
5381
5698
  VMM.attachElement(navigation.prevTitle, _title);
5382
5699
  }
5383
5700
  } else {
@@ -5395,7 +5712,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
5395
5712
  VMM.attachElement(navigation.nextDate, _title);
5396
5713
  VMM.attachElement(navigation.nextTitle, "");
5397
5714
  } else {
5398
- VMM.attachElement(navigation.nextDate, VMM.Date.prettyDate(data[current_slide + 1].startdate) );
5715
+ VMM.attachElement(navigation.nextDate, VMM.Date.prettyDate(data[current_slide + 1].startdate, false, data[current_slide + 1].precisiondate) );
5399
5716
  VMM.attachElement(navigation.nextTitle, _title);
5400
5717
  }
5401
5718
  } else {
@@ -5521,6 +5838,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
5521
5838
  showMessege(null, "Swipe to Navigate");
5522
5839
  VMM.Lib.height($explainer, config.slider.height);
5523
5840
  VMM.bindEvent($explainer, onExplainerClick);
5841
+ VMM.bindEvent($explainer, onExplainerClick, 'touchend');
5524
5842
  }
5525
5843
 
5526
5844
  reSize(false, true);
@@ -5562,6 +5880,7 @@ if (typeof VMM.Slider != 'undefined') {
5562
5880
  _enqueue = true,
5563
5881
  _removeque = false,
5564
5882
  _id = "slide_",
5883
+ _class = 0,
5565
5884
  timer = {pushque:"", render:"", relayout:"", remove:"", skinny:false},
5566
5885
  times = {pushque:500, render:100, relayout:100, remove:30000};
5567
5886
 
@@ -5569,7 +5888,17 @@ if (typeof VMM.Slider != 'undefined') {
5569
5888
  this.enqueue = _enqueue;
5570
5889
  this.id = _id;
5571
5890
 
5891
+
5572
5892
  element = VMM.appendAndGetElement(_parent, "<div>", "slider-item");
5893
+
5894
+ if (typeof data.classname != 'undefined') {
5895
+ trace("HAS CLASSNAME");
5896
+ VMM.Lib.addClass(element, data.classname);
5897
+ } else {
5898
+ trace("NO CLASSNAME");
5899
+ trace(data);
5900
+ }
5901
+
5573
5902
  c = {slide:"", text: "", media: "", media_element: "", layout: "content-container layout", has: { headline: false, text: false, media: false }};
5574
5903
 
5575
5904
  /* PUBLIC
@@ -5730,8 +6059,8 @@ if (typeof VMM.Slider != 'undefined') {
5730
6059
  if (data.startdate != null && data.startdate != "") {
5731
6060
  if (type.of(data.startdate) == "date") {
5732
6061
  if (data.type != "start") {
5733
- var st = VMM.Date.prettyDate(data.startdate);
5734
- var en = VMM.Date.prettyDate(data.enddate);
6062
+ var st = VMM.Date.prettyDate(data.startdate, false, data.precisiondate);
6063
+ var en = VMM.Date.prettyDate(data.enddate, false, data.precisiondate);
5735
6064
  var tag = "";
5736
6065
  /* TAG / CATEGORY
5737
6066
  ================================================== */
@@ -5764,6 +6093,7 @@ if (typeof VMM.Slider != 'undefined') {
5764
6093
  if (data.text != null && data.text != "") {
5765
6094
  c.has.text = true;
5766
6095
  c.text += VMM.createElement("p", VMM.Util.linkify_with_twitter(data.text, "_blank"));
6096
+
5767
6097
  }
5768
6098
 
5769
6099
  if (c.has.text || c.has.headline) {
@@ -5809,7 +6139,16 @@ if (typeof VMM.Slider != 'undefined') {
5809
6139
  VMM.Lib.addClass($slide, c.layout);
5810
6140
  }
5811
6141
 
5812
-
6142
+ /* ADD MODALS
6143
+ ================================================== */
6144
+ // MOVE TO EVENT LISTENER UP THE FOOD CHAIN
6145
+ /*
6146
+ VMM.modal('.vmm-modal', {
6147
+ openEffect: 'elastic',
6148
+ closeEffect: 'elastic',
6149
+ padding: [2, 2, 2, 2]
6150
+ });
6151
+ */
5813
6152
  };
5814
6153
 
5815
6154
  }
@@ -5818,69 +6157,2094 @@ if (typeof VMM.Slider != 'undefined') {
5818
6157
 
5819
6158
 
5820
6159
  /* **********************************************
5821
- Begin AES.js
6160
+ Begin jquery.fancybox.js
5822
6161
  ********************************************** */
5823
6162
 
5824
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
5825
- /* AES implementation in JavaScript (c) Chris Veness 2005-2011 */
5826
- /* - see http://csrc.nist.gov/publications/PubsFIPS.html#197 */
5827
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
5828
-
5829
- var Aes = {}; // Aes namespace
5830
-
5831
- /**
5832
- * AES Cipher function: encrypt 'input' state with Rijndael algorithm
5833
- * applies Nr rounds (10/12/14) using key schedule w for 'add round key' stage
6163
+ /*!
6164
+ * fancyBox - jQuery Plugin
6165
+ * version: 2.1.5 (Fri, 14 Jun 2013)
6166
+ * @requires jQuery v1.6 or later
6167
+ *
6168
+ * Examples at http://fancyapps.com/fancybox/
6169
+ * License: www.fancyapps.com/fancybox/#license
6170
+ *
6171
+ * Copyright 2012 Janis Skarnelis - janis@fancyapps.com
5834
6172
  *
5835
- * @param {Number[]} input 16-byte (128-bit) input state array
5836
- * @param {Number[][]} w Key schedule as 2D byte-array (Nr+1 x Nb bytes)
5837
- * @returns {Number[]} Encrypted output state array
5838
6173
  */
5839
- Aes.cipher = function(input, w) { // main Cipher function [§5.1]
5840
- var Nb = 4; // block size (in words): no of columns in state (fixed at 4 for AES)
5841
- var Nr = w.length/Nb - 1; // no of rounds: 10/12/14 for 128/192/256-bit keys
5842
6174
 
5843
- var state = [[],[],[],[]]; // initialise 4xNb byte-array 'state' with input [§3.4]
5844
- for (var i=0; i<4*Nb; i++) state[i%4][Math.floor(i/4)] = input[i];
6175
+ (function (window, document, $, undefined) {
6176
+ "use strict";
5845
6177
 
5846
- state = Aes.addRoundKey(state, w, 0, Nb);
6178
+ var H = $("html"),
6179
+ W = $(window),
6180
+ D = $(document),
6181
+ F = $.fancybox = function () {
6182
+ F.open.apply( this, arguments );
6183
+ },
6184
+ IE = navigator.userAgent.match(/msie/i),
6185
+ didUpdate = null,
6186
+ isTouch = document.createTouch !== undefined,
5847
6187
 
5848
- for (var round=1; round<Nr; round++) {
5849
- state = Aes.subBytes(state, Nb);
5850
- state = Aes.shiftRows(state, Nb);
5851
- state = Aes.mixColumns(state, Nb);
5852
- state = Aes.addRoundKey(state, w, round, Nb);
5853
- }
6188
+ isQuery = function(obj) {
6189
+ return obj && obj.hasOwnProperty && obj instanceof $;
6190
+ },
6191
+ isString = function(str) {
6192
+ return str && $.type(str) === "string";
6193
+ },
6194
+ isPercentage = function(str) {
6195
+ return isString(str) && str.indexOf('%') > 0;
6196
+ },
6197
+ isScrollable = function(el) {
6198
+ return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight)));
6199
+ },
6200
+ getScalar = function(orig, dim) {
6201
+ var value = parseInt(orig, 10) || 0;
5854
6202
 
5855
- state = Aes.subBytes(state, Nb);
5856
- state = Aes.shiftRows(state, Nb);
5857
- state = Aes.addRoundKey(state, w, Nr, Nb);
6203
+ if (dim && isPercentage(orig)) {
6204
+ value = F.getViewport()[ dim ] / 100 * value;
6205
+ }
5858
6206
 
5859
- var output = new Array(4*Nb); // convert state to 1-d array before returning [§3.4]
5860
- for (var i=0; i<4*Nb; i++) output[i] = state[i%4][Math.floor(i/4)];
5861
- return output;
5862
- }
6207
+ return Math.ceil(value);
6208
+ },
6209
+ getValue = function(value, dim) {
6210
+ return getScalar(value, dim) + 'px';
6211
+ };
5863
6212
 
5864
- /**
5865
- * Perform Key Expansion to generate a Key Schedule
5866
- *
5867
- * @param {Number[]} key Key as 16/24/32-byte array
5868
- * @returns {Number[][]} Expanded key schedule as 2D byte-array (Nr+1 x Nb bytes)
5869
- */
5870
- Aes.keyExpansion = function(key) { // generate Key Schedule (byte-array Nr+1 x Nb) from Key [§5.2]
5871
- var Nb = 4; // block size (in words): no of columns in state (fixed at 4 for AES)
5872
- var Nk = key.length/4 // key length (in words): 4/6/8 for 128/192/256-bit keys
5873
- var Nr = Nk + 6; // no of rounds: 10/12/14 for 128/192/256-bit keys
6213
+ $.extend(F, {
6214
+ // The current version of fancyBox
6215
+ version: '2.1.5',
6216
+
6217
+ defaults: {
6218
+ padding : 15,
6219
+ margin : 20,
6220
+
6221
+ width : 800,
6222
+ height : 600,
6223
+ minWidth : 100,
6224
+ minHeight : 100,
6225
+ maxWidth : 9999,
6226
+ maxHeight : 9999,
6227
+ pixelRatio: 1, // Set to 2 for retina display support
6228
+
6229
+ autoSize : true,
6230
+ autoHeight : false,
6231
+ autoWidth : false,
6232
+
6233
+ autoResize : true,
6234
+ autoCenter : !isTouch,
6235
+ fitToView : true,
6236
+ aspectRatio : false,
6237
+ topRatio : 0.5,
6238
+ leftRatio : 0.5,
6239
+
6240
+ scrolling : 'auto', // 'auto', 'yes' or 'no'
6241
+ wrapCSS : '',
6242
+
6243
+ arrows : true,
6244
+ closeBtn : true,
6245
+ closeClick : false,
6246
+ nextClick : false,
6247
+ mouseWheel : true,
6248
+ autoPlay : false,
6249
+ playSpeed : 3000,
6250
+ preload : 3,
6251
+ modal : false,
6252
+ loop : true,
6253
+
6254
+ ajax : {
6255
+ dataType : 'html',
6256
+ headers : { 'X-fancyBox': true }
6257
+ },
6258
+ iframe : {
6259
+ scrolling : 'auto',
6260
+ preload : true
6261
+ },
6262
+ swf : {
6263
+ wmode: 'transparent',
6264
+ allowfullscreen : 'true',
6265
+ allowscriptaccess : 'always'
6266
+ },
5874
6267
 
5875
- var w = new Array(Nb*(Nr+1));
5876
- var temp = new Array(4);
6268
+ keys : {
6269
+ next : {
6270
+ 13 : 'left', // enter
6271
+ 34 : 'up', // page down
6272
+ 39 : 'left', // right arrow
6273
+ 40 : 'up' // down arrow
6274
+ },
6275
+ prev : {
6276
+ 8 : 'right', // backspace
6277
+ 33 : 'down', // page up
6278
+ 37 : 'right', // left arrow
6279
+ 38 : 'down' // up arrow
6280
+ },
6281
+ close : [27], // escape key
6282
+ play : [32], // space - start/stop slideshow
6283
+ toggle : [70] // letter "f" - toggle fullscreen
6284
+ },
5877
6285
 
5878
- for (var i=0; i<Nk; i++) {
5879
- var r = [key[4*i], key[4*i+1], key[4*i+2], key[4*i+3]];
5880
- w[i] = r;
5881
- }
6286
+ direction : {
6287
+ next : 'left',
6288
+ prev : 'right'
6289
+ },
5882
6290
 
5883
- for (var i=Nk; i<(Nb*(Nr+1)); i++) {
6291
+ scrollOutside : true,
6292
+
6293
+ // Override some properties
6294
+ index : 0,
6295
+ type : null,
6296
+ href : null,
6297
+ content : null,
6298
+ title : null,
6299
+
6300
+ // HTML templates
6301
+ tpl: {
6302
+ wrap : '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
6303
+ image : '<img class="fancybox-image" src="{href}" alt="" />',
6304
+ iframe : '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen' + (IE ? ' allowtransparency="true"' : '') + '></iframe>',
6305
+ error : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',
6306
+ closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',
6307
+ next : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
6308
+ prev : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
6309
+ },
6310
+
6311
+ // Properties for each animation type
6312
+ // Opening fancyBox
6313
+ openEffect : 'fade', // 'elastic', 'fade' or 'none'
6314
+ openSpeed : 250,
6315
+ openEasing : 'swing',
6316
+ openOpacity : true,
6317
+ openMethod : 'zoomIn',
6318
+
6319
+ // Closing fancyBox
6320
+ closeEffect : 'fade', // 'elastic', 'fade' or 'none'
6321
+ closeSpeed : 250,
6322
+ closeEasing : 'swing',
6323
+ closeOpacity : true,
6324
+ closeMethod : 'zoomOut',
6325
+
6326
+ // Changing next gallery item
6327
+ nextEffect : 'elastic', // 'elastic', 'fade' or 'none'
6328
+ nextSpeed : 250,
6329
+ nextEasing : 'swing',
6330
+ nextMethod : 'changeIn',
6331
+
6332
+ // Changing previous gallery item
6333
+ prevEffect : 'elastic', // 'elastic', 'fade' or 'none'
6334
+ prevSpeed : 250,
6335
+ prevEasing : 'swing',
6336
+ prevMethod : 'changeOut',
6337
+
6338
+ // Enable default helpers
6339
+ helpers : {
6340
+ overlay : true,
6341
+ title : true
6342
+ },
6343
+
6344
+ // Callbacks
6345
+ onCancel : $.noop, // If canceling
6346
+ beforeLoad : $.noop, // Before loading
6347
+ afterLoad : $.noop, // After loading
6348
+ beforeShow : $.noop, // Before changing in current item
6349
+ afterShow : $.noop, // After opening
6350
+ beforeChange : $.noop, // Before changing gallery item
6351
+ beforeClose : $.noop, // Before closing
6352
+ afterClose : $.noop // After closing
6353
+ },
6354
+
6355
+ //Current state
6356
+ group : {}, // Selected group
6357
+ opts : {}, // Group options
6358
+ previous : null, // Previous element
6359
+ coming : null, // Element being loaded
6360
+ current : null, // Currently loaded element
6361
+ isActive : false, // Is activated
6362
+ isOpen : false, // Is currently open
6363
+ isOpened : false, // Have been fully opened at least once
6364
+
6365
+ wrap : null,
6366
+ skin : null,
6367
+ outer : null,
6368
+ inner : null,
6369
+
6370
+ player : {
6371
+ timer : null,
6372
+ isActive : false
6373
+ },
6374
+
6375
+ // Loaders
6376
+ ajaxLoad : null,
6377
+ imgPreload : null,
6378
+
6379
+ // Some collections
6380
+ transitions : {},
6381
+ helpers : {},
6382
+
6383
+ /*
6384
+ * Static methods
6385
+ */
6386
+
6387
+ open: function (group, opts) {
6388
+ if (!group) {
6389
+ return;
6390
+ }
6391
+
6392
+ if (!$.isPlainObject(opts)) {
6393
+ opts = {};
6394
+ }
6395
+
6396
+ // Close if already active
6397
+ if (false === F.close(true)) {
6398
+ return;
6399
+ }
6400
+
6401
+ // Normalize group
6402
+ if (!$.isArray(group)) {
6403
+ group = isQuery(group) ? $(group).get() : [group];
6404
+ }
6405
+
6406
+ // Recheck if the type of each element is `object` and set content type (image, ajax, etc)
6407
+ $.each(group, function(i, element) {
6408
+ var obj = {},
6409
+ href,
6410
+ title,
6411
+ content,
6412
+ type,
6413
+ rez,
6414
+ hrefParts,
6415
+ selector;
6416
+
6417
+ if ($.type(element) === "object") {
6418
+ // Check if is DOM element
6419
+ if (element.nodeType) {
6420
+ element = $(element);
6421
+ }
6422
+
6423
+ if (isQuery(element)) {
6424
+ obj = {
6425
+ href : element.data('fancybox-href') || element.attr('href'),
6426
+ title : element.data('fancybox-title') || element.attr('title'),
6427
+ isDom : true,
6428
+ element : element
6429
+ };
6430
+
6431
+ if ($.metadata) {
6432
+ $.extend(true, obj, element.metadata());
6433
+ }
6434
+
6435
+ } else {
6436
+ obj = element;
6437
+ }
6438
+ }
6439
+
6440
+ href = opts.href || obj.href || (isString(element) ? element : null);
6441
+ title = opts.title !== undefined ? opts.title : obj.title || '';
6442
+
6443
+ content = opts.content || obj.content;
6444
+ type = content ? 'html' : (opts.type || obj.type);
6445
+
6446
+ if (!type && obj.isDom) {
6447
+ type = element.data('fancybox-type');
6448
+
6449
+ if (!type) {
6450
+ rez = element.prop('class').match(/fancybox\.(\w+)/);
6451
+ type = rez ? rez[1] : null;
6452
+ }
6453
+ }
6454
+
6455
+ if (isString(href)) {
6456
+ // Try to guess the content type
6457
+ if (!type) {
6458
+ if (F.isImage(href)) {
6459
+ type = 'image';
6460
+
6461
+ } else if (F.isSWF(href)) {
6462
+ type = 'swf';
6463
+
6464
+ } else if (href.charAt(0) === '#') {
6465
+ type = 'inline';
6466
+
6467
+ } else if (isString(element)) {
6468
+ type = 'html';
6469
+ content = element;
6470
+ }
6471
+ }
6472
+
6473
+ // Split url into two pieces with source url and content selector, e.g,
6474
+ // "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id"
6475
+ if (type === 'ajax') {
6476
+ hrefParts = href.split(/\s+/, 2);
6477
+ href = hrefParts.shift();
6478
+ selector = hrefParts.shift();
6479
+ }
6480
+ }
6481
+
6482
+ if (!content) {
6483
+ if (type === 'inline') {
6484
+ if (href) {
6485
+ content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7
6486
+
6487
+ } else if (obj.isDom) {
6488
+ content = element;
6489
+ }
6490
+
6491
+ } else if (type === 'html') {
6492
+ content = href;
6493
+
6494
+ } else if (!type && !href && obj.isDom) {
6495
+ type = 'inline';
6496
+ content = element;
6497
+ }
6498
+ }
6499
+
6500
+ $.extend(obj, {
6501
+ href : href,
6502
+ type : type,
6503
+ content : content,
6504
+ title : title,
6505
+ selector : selector
6506
+ });
6507
+
6508
+ group[ i ] = obj;
6509
+ });
6510
+
6511
+ // Extend the defaults
6512
+ F.opts = $.extend(true, {}, F.defaults, opts);
6513
+
6514
+ // All options are merged recursive except keys
6515
+ if (opts.keys !== undefined) {
6516
+ F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false;
6517
+ }
6518
+
6519
+ F.group = group;
6520
+
6521
+ return F._start(F.opts.index);
6522
+ },
6523
+
6524
+ // Cancel image loading or abort ajax request
6525
+ cancel: function () {
6526
+ var coming = F.coming;
6527
+
6528
+ if (!coming || false === F.trigger('onCancel')) {
6529
+ return;
6530
+ }
6531
+
6532
+ F.hideLoading();
6533
+
6534
+ if (F.ajaxLoad) {
6535
+ F.ajaxLoad.abort();
6536
+ }
6537
+
6538
+ F.ajaxLoad = null;
6539
+
6540
+ if (F.imgPreload) {
6541
+ F.imgPreload.onload = F.imgPreload.onerror = null;
6542
+ }
6543
+
6544
+ if (coming.wrap) {
6545
+ coming.wrap.stop(true, true).trigger('onReset').remove();
6546
+ }
6547
+
6548
+ F.coming = null;
6549
+
6550
+ // If the first item has been canceled, then clear everything
6551
+ if (!F.current) {
6552
+ F._afterZoomOut( coming );
6553
+ }
6554
+ },
6555
+
6556
+ // Start closing animation if is open; remove immediately if opening/closing
6557
+ close: function (event) {
6558
+ F.cancel();
6559
+
6560
+ if (false === F.trigger('beforeClose')) {
6561
+ return;
6562
+ }
6563
+
6564
+ F.unbindEvents();
6565
+
6566
+ if (!F.isActive) {
6567
+ return;
6568
+ }
6569
+
6570
+ if (!F.isOpen || event === true) {
6571
+ $('.fancybox-wrap').stop(true).trigger('onReset').remove();
6572
+
6573
+ F._afterZoomOut();
6574
+
6575
+ } else {
6576
+ F.isOpen = F.isOpened = false;
6577
+ F.isClosing = true;
6578
+
6579
+ $('.fancybox-item, .fancybox-nav').remove();
6580
+
6581
+ F.wrap.stop(true, true).removeClass('fancybox-opened');
6582
+
6583
+ F.transitions[ F.current.closeMethod ]();
6584
+ }
6585
+ },
6586
+
6587
+ // Manage slideshow:
6588
+ // $.fancybox.play(); - toggle slideshow
6589
+ // $.fancybox.play( true ); - start
6590
+ // $.fancybox.play( false ); - stop
6591
+ play: function ( action ) {
6592
+ var clear = function () {
6593
+ clearTimeout(F.player.timer);
6594
+ },
6595
+ set = function () {
6596
+ clear();
6597
+
6598
+ if (F.current && F.player.isActive) {
6599
+ F.player.timer = setTimeout(F.next, F.current.playSpeed);
6600
+ }
6601
+ },
6602
+ stop = function () {
6603
+ clear();
6604
+
6605
+ D.unbind('.player');
6606
+
6607
+ F.player.isActive = false;
6608
+
6609
+ F.trigger('onPlayEnd');
6610
+ },
6611
+ start = function () {
6612
+ if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) {
6613
+ F.player.isActive = true;
6614
+
6615
+ D.bind({
6616
+ 'onCancel.player beforeClose.player' : stop,
6617
+ 'onUpdate.player' : set,
6618
+ 'beforeLoad.player' : clear
6619
+ });
6620
+
6621
+ set();
6622
+
6623
+ F.trigger('onPlayStart');
6624
+ }
6625
+ };
6626
+
6627
+ if (action === true || (!F.player.isActive && action !== false)) {
6628
+ start();
6629
+ } else {
6630
+ stop();
6631
+ }
6632
+ },
6633
+
6634
+ // Navigate to next gallery item
6635
+ next: function ( direction ) {
6636
+ var current = F.current;
6637
+
6638
+ if (current) {
6639
+ if (!isString(direction)) {
6640
+ direction = current.direction.next;
6641
+ }
6642
+
6643
+ F.jumpto(current.index + 1, direction, 'next');
6644
+ }
6645
+ },
6646
+
6647
+ // Navigate to previous gallery item
6648
+ prev: function ( direction ) {
6649
+ var current = F.current;
6650
+
6651
+ if (current) {
6652
+ if (!isString(direction)) {
6653
+ direction = current.direction.prev;
6654
+ }
6655
+
6656
+ F.jumpto(current.index - 1, direction, 'prev');
6657
+ }
6658
+ },
6659
+
6660
+ // Navigate to gallery item by index
6661
+ jumpto: function ( index, direction, router ) {
6662
+ var current = F.current;
6663
+
6664
+ if (!current) {
6665
+ return;
6666
+ }
6667
+
6668
+ index = getScalar(index);
6669
+
6670
+ F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ];
6671
+ F.router = router || 'jumpto';
6672
+
6673
+ if (current.loop) {
6674
+ if (index < 0) {
6675
+ index = current.group.length + (index % current.group.length);
6676
+ }
6677
+
6678
+ index = index % current.group.length;
6679
+ }
6680
+
6681
+ if (current.group[ index ] !== undefined) {
6682
+ F.cancel();
6683
+
6684
+ F._start(index);
6685
+ }
6686
+ },
6687
+
6688
+ // Center inside viewport and toggle position type to fixed or absolute if needed
6689
+ reposition: function (e, onlyAbsolute) {
6690
+ var current = F.current,
6691
+ wrap = current ? current.wrap : null,
6692
+ pos;
6693
+
6694
+ if (wrap) {
6695
+ pos = F._getPosition(onlyAbsolute);
6696
+
6697
+ if (e && e.type === 'scroll') {
6698
+ delete pos.position;
6699
+
6700
+ wrap.stop(true, true).animate(pos, 200);
6701
+
6702
+ } else {
6703
+ wrap.css(pos);
6704
+
6705
+ current.pos = $.extend({}, current.dim, pos);
6706
+ }
6707
+ }
6708
+ },
6709
+
6710
+ update: function (e) {
6711
+ var type = (e && e.type),
6712
+ anyway = !type || type === 'orientationchange';
6713
+
6714
+ if (anyway) {
6715
+ clearTimeout(didUpdate);
6716
+
6717
+ didUpdate = null;
6718
+ }
6719
+
6720
+ if (!F.isOpen || didUpdate) {
6721
+ return;
6722
+ }
6723
+
6724
+ didUpdate = setTimeout(function() {
6725
+ var current = F.current;
6726
+
6727
+ if (!current || F.isClosing) {
6728
+ return;
6729
+ }
6730
+
6731
+ F.wrap.removeClass('fancybox-tmp');
6732
+
6733
+ if (anyway || type === 'load' || (type === 'resize' && current.autoResize)) {
6734
+ F._setDimension();
6735
+ }
6736
+
6737
+ if (!(type === 'scroll' && current.canShrink)) {
6738
+ F.reposition(e);
6739
+ }
6740
+
6741
+ F.trigger('onUpdate');
6742
+
6743
+ didUpdate = null;
6744
+
6745
+ }, (anyway && !isTouch ? 0 : 300));
6746
+ },
6747
+
6748
+ // Shrink content to fit inside viewport or restore if resized
6749
+ toggle: function ( action ) {
6750
+ if (F.isOpen) {
6751
+ F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView;
6752
+
6753
+ // Help browser to restore document dimensions
6754
+ if (isTouch) {
6755
+ F.wrap.removeAttr('style').addClass('fancybox-tmp');
6756
+
6757
+ F.trigger('onUpdate');
6758
+ }
6759
+
6760
+ F.update();
6761
+ }
6762
+ },
6763
+
6764
+ hideLoading: function () {
6765
+ D.unbind('.loading');
6766
+
6767
+ $('#fancybox-loading').remove();
6768
+ },
6769
+
6770
+ showLoading: function () {
6771
+ var el, viewport;
6772
+
6773
+ F.hideLoading();
6774
+
6775
+ el = $('<div id="fancybox-loading"><div></div></div>').click(F.cancel).appendTo('body');
6776
+
6777
+ // If user will press the escape-button, the request will be canceled
6778
+ D.bind('keydown.loading', function(e) {
6779
+ if ((e.which || e.keyCode) === 27) {
6780
+ e.preventDefault();
6781
+
6782
+ F.cancel();
6783
+ }
6784
+ });
6785
+
6786
+ if (!F.defaults.fixed) {
6787
+ viewport = F.getViewport();
6788
+
6789
+ el.css({
6790
+ position : 'absolute',
6791
+ top : (viewport.h * 0.5) + viewport.y,
6792
+ left : (viewport.w * 0.5) + viewport.x
6793
+ });
6794
+ }
6795
+ },
6796
+
6797
+ getViewport: function () {
6798
+ var locked = (F.current && F.current.locked) || false,
6799
+ rez = {
6800
+ x: W.scrollLeft(),
6801
+ y: W.scrollTop()
6802
+ };
6803
+
6804
+ if (locked) {
6805
+ rez.w = locked[0].clientWidth;
6806
+ rez.h = locked[0].clientHeight;
6807
+
6808
+ } else {
6809
+ // See http://bugs.jquery.com/ticket/6724
6810
+ rez.w = isTouch && window.innerWidth ? window.innerWidth : W.width();
6811
+ rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height();
6812
+ }
6813
+
6814
+ return rez;
6815
+ },
6816
+
6817
+ // Unbind the keyboard / clicking actions
6818
+ unbindEvents: function () {
6819
+ if (F.wrap && isQuery(F.wrap)) {
6820
+ F.wrap.unbind('.fb');
6821
+ }
6822
+
6823
+ D.unbind('.fb');
6824
+ W.unbind('.fb');
6825
+ },
6826
+
6827
+ bindEvents: function () {
6828
+ var current = F.current,
6829
+ keys;
6830
+
6831
+ if (!current) {
6832
+ return;
6833
+ }
6834
+
6835
+ // Changing document height on iOS devices triggers a 'resize' event,
6836
+ // that can change document height... repeating infinitely
6837
+ W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update);
6838
+
6839
+ keys = current.keys;
6840
+
6841
+ if (keys) {
6842
+ D.bind('keydown.fb', function (e) {
6843
+ var code = e.which || e.keyCode,
6844
+ target = e.target || e.srcElement;
6845
+
6846
+ // Skip esc key if loading, because showLoading will cancel preloading
6847
+ if (code === 27 && F.coming) {
6848
+ return false;
6849
+ }
6850
+
6851
+ // Ignore key combinations and key events within form elements
6852
+ if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) {
6853
+ $.each(keys, function(i, val) {
6854
+ if (current.group.length > 1 && val[ code ] !== undefined) {
6855
+ F[ i ]( val[ code ] );
6856
+
6857
+ e.preventDefault();
6858
+ return false;
6859
+ }
6860
+
6861
+ if ($.inArray(code, val) > -1) {
6862
+ F[ i ] ();
6863
+
6864
+ e.preventDefault();
6865
+ return false;
6866
+ }
6867
+ });
6868
+ }
6869
+ });
6870
+ }
6871
+
6872
+ if ($.fn.mousewheel && current.mouseWheel) {
6873
+ F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) {
6874
+ var target = e.target || null,
6875
+ parent = $(target),
6876
+ canScroll = false;
6877
+
6878
+ while (parent.length) {
6879
+ if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) {
6880
+ break;
6881
+ }
6882
+
6883
+ canScroll = isScrollable( parent[0] );
6884
+ parent = $(parent).parent();
6885
+ }
6886
+
6887
+ if (delta !== 0 && !canScroll) {
6888
+ if (F.group.length > 1 && !current.canShrink) {
6889
+ if (deltaY > 0 || deltaX > 0) {
6890
+ F.prev( deltaY > 0 ? 'down' : 'left' );
6891
+
6892
+ } else if (deltaY < 0 || deltaX < 0) {
6893
+ F.next( deltaY < 0 ? 'up' : 'right' );
6894
+ }
6895
+
6896
+ e.preventDefault();
6897
+ }
6898
+ }
6899
+ });
6900
+ }
6901
+ },
6902
+
6903
+ trigger: function (event, o) {
6904
+ var ret, obj = o || F.coming || F.current;
6905
+
6906
+ if (!obj) {
6907
+ return;
6908
+ }
6909
+
6910
+ if ($.isFunction( obj[event] )) {
6911
+ ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1));
6912
+ }
6913
+
6914
+ if (ret === false) {
6915
+ return false;
6916
+ }
6917
+
6918
+ if (obj.helpers) {
6919
+ $.each(obj.helpers, function (helper, opts) {
6920
+ if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) {
6921
+ F.helpers[helper][event]($.extend(true, {}, F.helpers[helper].defaults, opts), obj);
6922
+ }
6923
+ });
6924
+ }
6925
+
6926
+ D.trigger(event);
6927
+ },
6928
+
6929
+ isImage: function (str) {
6930
+ return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i);
6931
+ },
6932
+
6933
+ isSWF: function (str) {
6934
+ return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i);
6935
+ },
6936
+
6937
+ _start: function (index) {
6938
+ var coming = {},
6939
+ obj,
6940
+ href,
6941
+ type,
6942
+ margin,
6943
+ padding;
6944
+
6945
+ index = getScalar( index );
6946
+ obj = F.group[ index ] || null;
6947
+
6948
+ if (!obj) {
6949
+ return false;
6950
+ }
6951
+
6952
+ coming = $.extend(true, {}, F.opts, obj);
6953
+
6954
+ // Convert margin and padding properties to array - top, right, bottom, left
6955
+ margin = coming.margin;
6956
+ padding = coming.padding;
6957
+
6958
+ if ($.type(margin) === 'number') {
6959
+ coming.margin = [margin, margin, margin, margin];
6960
+ }
6961
+
6962
+ if ($.type(padding) === 'number') {
6963
+ coming.padding = [padding, padding, padding, padding];
6964
+ }
6965
+
6966
+ // 'modal' propery is just a shortcut
6967
+ if (coming.modal) {
6968
+ $.extend(true, coming, {
6969
+ closeBtn : false,
6970
+ closeClick : false,
6971
+ nextClick : false,
6972
+ arrows : false,
6973
+ mouseWheel : false,
6974
+ keys : null,
6975
+ helpers: {
6976
+ overlay : {
6977
+ closeClick : false
6978
+ }
6979
+ }
6980
+ });
6981
+ }
6982
+
6983
+ // 'autoSize' property is a shortcut, too
6984
+ if (coming.autoSize) {
6985
+ coming.autoWidth = coming.autoHeight = true;
6986
+ }
6987
+
6988
+ if (coming.width === 'auto') {
6989
+ coming.autoWidth = true;
6990
+ }
6991
+
6992
+ if (coming.height === 'auto') {
6993
+ coming.autoHeight = true;
6994
+ }
6995
+
6996
+ /*
6997
+ * Add reference to the group, so it`s possible to access from callbacks, example:
6998
+ * afterLoad : function() {
6999
+ * this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
7000
+ * }
7001
+ */
7002
+
7003
+ coming.group = F.group;
7004
+ coming.index = index;
7005
+
7006
+ // Give a chance for callback or helpers to update coming item (type, title, etc)
7007
+ F.coming = coming;
7008
+
7009
+ if (false === F.trigger('beforeLoad')) {
7010
+ F.coming = null;
7011
+
7012
+ return;
7013
+ }
7014
+
7015
+ type = coming.type;
7016
+ href = coming.href;
7017
+
7018
+ if (!type) {
7019
+ F.coming = null;
7020
+
7021
+ //If we can not determine content type then drop silently or display next/prev item if looping through gallery
7022
+ if (F.current && F.router && F.router !== 'jumpto') {
7023
+ F.current.index = index;
7024
+
7025
+ return F[ F.router ]( F.direction );
7026
+ }
7027
+
7028
+ return false;
7029
+ }
7030
+
7031
+ F.isActive = true;
7032
+
7033
+ if (type === 'image' || type === 'swf') {
7034
+ coming.autoHeight = coming.autoWidth = false;
7035
+ coming.scrolling = 'visible';
7036
+ }
7037
+
7038
+ if (type === 'image') {
7039
+ coming.aspectRatio = true;
7040
+ }
7041
+
7042
+ if (type === 'iframe' && isTouch) {
7043
+ coming.scrolling = 'scroll';
7044
+ }
7045
+
7046
+ // Build the neccessary markup
7047
+ coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo( coming.parent || 'body' );
7048
+
7049
+ $.extend(coming, {
7050
+ skin : $('.fancybox-skin', coming.wrap),
7051
+ outer : $('.fancybox-outer', coming.wrap),
7052
+ inner : $('.fancybox-inner', coming.wrap)
7053
+ });
7054
+
7055
+ $.each(["Top", "Right", "Bottom", "Left"], function(i, v) {
7056
+ coming.skin.css('padding' + v, getValue(coming.padding[ i ]));
7057
+ });
7058
+
7059
+ F.trigger('onReady');
7060
+
7061
+ // Check before try to load; 'inline' and 'html' types need content, others - href
7062
+ if (type === 'inline' || type === 'html') {
7063
+ if (!coming.content || !coming.content.length) {
7064
+ return F._error( 'content' );
7065
+ }
7066
+
7067
+ } else if (!href) {
7068
+ return F._error( 'href' );
7069
+ }
7070
+
7071
+ if (type === 'image') {
7072
+ F._loadImage();
7073
+
7074
+ } else if (type === 'ajax') {
7075
+ F._loadAjax();
7076
+
7077
+ } else if (type === 'iframe') {
7078
+ F._loadIframe();
7079
+
7080
+ } else {
7081
+ F._afterLoad();
7082
+ }
7083
+ },
7084
+
7085
+ _error: function ( type ) {
7086
+ $.extend(F.coming, {
7087
+ type : 'html',
7088
+ autoWidth : true,
7089
+ autoHeight : true,
7090
+ minWidth : 0,
7091
+ minHeight : 0,
7092
+ scrolling : 'no',
7093
+ hasError : type,
7094
+ content : F.coming.tpl.error
7095
+ });
7096
+
7097
+ F._afterLoad();
7098
+ },
7099
+
7100
+ _loadImage: function () {
7101
+ // Reset preload image so it is later possible to check "complete" property
7102
+ var img = F.imgPreload = new Image();
7103
+
7104
+ img.onload = function () {
7105
+ this.onload = this.onerror = null;
7106
+
7107
+ F.coming.width = this.width / F.opts.pixelRatio;
7108
+ F.coming.height = this.height / F.opts.pixelRatio;
7109
+
7110
+ F._afterLoad();
7111
+ };
7112
+
7113
+ img.onerror = function () {
7114
+ this.onload = this.onerror = null;
7115
+
7116
+ F._error( 'image' );
7117
+ };
7118
+
7119
+ img.src = F.coming.href;
7120
+
7121
+ if (img.complete !== true) {
7122
+ F.showLoading();
7123
+ }
7124
+ },
7125
+
7126
+ _loadAjax: function () {
7127
+ var coming = F.coming;
7128
+
7129
+ F.showLoading();
7130
+
7131
+ F.ajaxLoad = $.ajax($.extend({}, coming.ajax, {
7132
+ url: coming.href,
7133
+ error: function (jqXHR, textStatus) {
7134
+ if (F.coming && textStatus !== 'abort') {
7135
+ F._error( 'ajax', jqXHR );
7136
+
7137
+ } else {
7138
+ F.hideLoading();
7139
+ }
7140
+ },
7141
+ success: function (data, textStatus) {
7142
+ if (textStatus === 'success') {
7143
+ coming.content = data;
7144
+
7145
+ F._afterLoad();
7146
+ }
7147
+ }
7148
+ }));
7149
+ },
7150
+
7151
+ _loadIframe: function() {
7152
+ var coming = F.coming,
7153
+ iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime()))
7154
+ .attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling)
7155
+ .attr('src', coming.href);
7156
+
7157
+ // This helps IE
7158
+ $(coming.wrap).bind('onReset', function () {
7159
+ try {
7160
+ $(this).find('iframe').hide().attr('src', '//about:blank').end().empty();
7161
+ } catch (e) {}
7162
+ });
7163
+
7164
+ if (coming.iframe.preload) {
7165
+ F.showLoading();
7166
+
7167
+ iframe.one('load', function() {
7168
+ $(this).data('ready', 1);
7169
+
7170
+ // iOS will lose scrolling if we resize
7171
+ if (!isTouch) {
7172
+ $(this).bind('load.fb', F.update);
7173
+ }
7174
+
7175
+ // Without this trick:
7176
+ // - iframe won't scroll on iOS devices
7177
+ // - IE7 sometimes displays empty iframe
7178
+ $(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show();
7179
+
7180
+ F._afterLoad();
7181
+ });
7182
+ }
7183
+
7184
+ coming.content = iframe.appendTo( coming.inner );
7185
+
7186
+ if (!coming.iframe.preload) {
7187
+ F._afterLoad();
7188
+ }
7189
+ },
7190
+
7191
+ _preloadImages: function() {
7192
+ var group = F.group,
7193
+ current = F.current,
7194
+ len = group.length,
7195
+ cnt = current.preload ? Math.min(current.preload, len - 1) : 0,
7196
+ item,
7197
+ i;
7198
+
7199
+ for (i = 1; i <= cnt; i += 1) {
7200
+ item = group[ (current.index + i ) % len ];
7201
+
7202
+ if (item.type === 'image' && item.href) {
7203
+ new Image().src = item.href;
7204
+ }
7205
+ }
7206
+ },
7207
+
7208
+ _afterLoad: function () {
7209
+ var coming = F.coming,
7210
+ previous = F.current,
7211
+ placeholder = 'fancybox-placeholder',
7212
+ current,
7213
+ content,
7214
+ type,
7215
+ scrolling,
7216
+ href,
7217
+ embed;
7218
+
7219
+ F.hideLoading();
7220
+
7221
+ if (!coming || F.isActive === false) {
7222
+ return;
7223
+ }
7224
+
7225
+ if (false === F.trigger('afterLoad', coming, previous)) {
7226
+ coming.wrap.stop(true).trigger('onReset').remove();
7227
+
7228
+ F.coming = null;
7229
+
7230
+ return;
7231
+ }
7232
+
7233
+ if (previous) {
7234
+ F.trigger('beforeChange', previous);
7235
+
7236
+ previous.wrap.stop(true).removeClass('fancybox-opened')
7237
+ .find('.fancybox-item, .fancybox-nav')
7238
+ .remove();
7239
+ }
7240
+
7241
+ F.unbindEvents();
7242
+
7243
+ current = coming;
7244
+ content = coming.content;
7245
+ type = coming.type;
7246
+ scrolling = coming.scrolling;
7247
+
7248
+ $.extend(F, {
7249
+ wrap : current.wrap,
7250
+ skin : current.skin,
7251
+ outer : current.outer,
7252
+ inner : current.inner,
7253
+ current : current,
7254
+ previous : previous
7255
+ });
7256
+
7257
+ href = current.href;
7258
+
7259
+ switch (type) {
7260
+ case 'inline':
7261
+ case 'ajax':
7262
+ case 'html':
7263
+ if (current.selector) {
7264
+ content = $('<div>').html(content).find(current.selector);
7265
+
7266
+ } else if (isQuery(content)) {
7267
+ if (!content.data(placeholder)) {
7268
+ content.data(placeholder, $('<div class="' + placeholder + '"></div>').insertAfter( content ).hide() );
7269
+ }
7270
+
7271
+ content = content.show().detach();
7272
+
7273
+ current.wrap.bind('onReset', function () {
7274
+ if ($(this).find(content).length) {
7275
+ content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false);
7276
+ }
7277
+ });
7278
+ }
7279
+ break;
7280
+
7281
+ case 'image':
7282
+ content = current.tpl.image.replace('{href}', href);
7283
+ break;
7284
+
7285
+ case 'swf':
7286
+ content = '<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="' + href + '"></param>';
7287
+ embed = '';
7288
+
7289
+ $.each(current.swf, function(name, val) {
7290
+ content += '<param name="' + name + '" value="' + val + '"></param>';
7291
+ embed += ' ' + name + '="' + val + '"';
7292
+ });
7293
+
7294
+ content += '<embed src="' + href + '" type="application/x-shockwave-flash" width="100%" height="100%"' + embed + '></embed></object>';
7295
+ break;
7296
+ }
7297
+
7298
+ if (!(isQuery(content) && content.parent().is(current.inner))) {
7299
+ current.inner.append( content );
7300
+ }
7301
+
7302
+ // Give a chance for helpers or callbacks to update elements
7303
+ F.trigger('beforeShow');
7304
+
7305
+ // Set scrolling before calculating dimensions
7306
+ current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling));
7307
+
7308
+ // Set initial dimensions and start position
7309
+ F._setDimension();
7310
+
7311
+ F.reposition();
7312
+
7313
+ F.isOpen = false;
7314
+ F.coming = null;
7315
+
7316
+ F.bindEvents();
7317
+
7318
+ if (!F.isOpened) {
7319
+ $('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove();
7320
+
7321
+ } else if (previous.prevMethod) {
7322
+ F.transitions[ previous.prevMethod ]();
7323
+ }
7324
+
7325
+ F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ]();
7326
+
7327
+ F._preloadImages();
7328
+ },
7329
+
7330
+ _setDimension: function () {
7331
+ var viewport = F.getViewport(),
7332
+ steps = 0,
7333
+ canShrink = false,
7334
+ canExpand = false,
7335
+ wrap = F.wrap,
7336
+ skin = F.skin,
7337
+ inner = F.inner,
7338
+ current = F.current,
7339
+ width = current.width,
7340
+ height = current.height,
7341
+ minWidth = current.minWidth,
7342
+ minHeight = current.minHeight,
7343
+ maxWidth = current.maxWidth,
7344
+ maxHeight = current.maxHeight,
7345
+ scrolling = current.scrolling,
7346
+ scrollOut = current.scrollOutside ? current.scrollbarWidth : 0,
7347
+ margin = current.margin,
7348
+ wMargin = getScalar(margin[1] + margin[3]),
7349
+ hMargin = getScalar(margin[0] + margin[2]),
7350
+ wPadding,
7351
+ hPadding,
7352
+ wSpace,
7353
+ hSpace,
7354
+ origWidth,
7355
+ origHeight,
7356
+ origMaxWidth,
7357
+ origMaxHeight,
7358
+ ratio,
7359
+ width_,
7360
+ height_,
7361
+ maxWidth_,
7362
+ maxHeight_,
7363
+ iframe,
7364
+ body;
7365
+
7366
+ // Reset dimensions so we could re-check actual size
7367
+ wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp');
7368
+
7369
+ wPadding = getScalar(skin.outerWidth(true) - skin.width());
7370
+ hPadding = getScalar(skin.outerHeight(true) - skin.height());
7371
+
7372
+ // Any space between content and viewport (margin, padding, border, title)
7373
+ wSpace = wMargin + wPadding;
7374
+ hSpace = hMargin + hPadding;
7375
+
7376
+ origWidth = isPercentage(width) ? (viewport.w - wSpace) * getScalar(width) / 100 : width;
7377
+ origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height;
7378
+
7379
+ if (current.type === 'iframe') {
7380
+ iframe = current.content;
7381
+
7382
+ if (current.autoHeight && iframe.data('ready') === 1) {
7383
+ try {
7384
+ if (iframe[0].contentWindow.document.location) {
7385
+ inner.width( origWidth ).height(9999);
7386
+
7387
+ body = iframe.contents().find('body');
7388
+
7389
+ if (scrollOut) {
7390
+ body.css('overflow-x', 'hidden');
7391
+ }
7392
+
7393
+ origHeight = body.outerHeight(true);
7394
+ }
7395
+
7396
+ } catch (e) {}
7397
+ }
7398
+
7399
+ } else if (current.autoWidth || current.autoHeight) {
7400
+ inner.addClass( 'fancybox-tmp' );
7401
+
7402
+ // Set width or height in case we need to calculate only one dimension
7403
+ if (!current.autoWidth) {
7404
+ inner.width( origWidth );
7405
+ }
7406
+
7407
+ if (!current.autoHeight) {
7408
+ inner.height( origHeight );
7409
+ }
7410
+
7411
+ if (current.autoWidth) {
7412
+ origWidth = inner.width();
7413
+ }
7414
+
7415
+ if (current.autoHeight) {
7416
+ origHeight = inner.height();
7417
+ }
7418
+
7419
+ inner.removeClass( 'fancybox-tmp' );
7420
+ }
7421
+
7422
+ width = getScalar( origWidth );
7423
+ height = getScalar( origHeight );
7424
+
7425
+ ratio = origWidth / origHeight;
7426
+
7427
+ // Calculations for the content
7428
+ minWidth = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth);
7429
+ maxWidth = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth);
7430
+
7431
+ minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight);
7432
+ maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight);
7433
+
7434
+ // These will be used to determine if wrap can fit in the viewport
7435
+ origMaxWidth = maxWidth;
7436
+ origMaxHeight = maxHeight;
7437
+
7438
+ if (current.fitToView) {
7439
+ maxWidth = Math.min(viewport.w - wSpace, maxWidth);
7440
+ maxHeight = Math.min(viewport.h - hSpace, maxHeight);
7441
+ }
7442
+
7443
+ maxWidth_ = viewport.w - wMargin;
7444
+ maxHeight_ = viewport.h - hMargin;
7445
+
7446
+ if (current.aspectRatio) {
7447
+ if (width > maxWidth) {
7448
+ width = maxWidth;
7449
+ height = getScalar(width / ratio);
7450
+ }
7451
+
7452
+ if (height > maxHeight) {
7453
+ height = maxHeight;
7454
+ width = getScalar(height * ratio);
7455
+ }
7456
+
7457
+ if (width < minWidth) {
7458
+ width = minWidth;
7459
+ height = getScalar(width / ratio);
7460
+ }
7461
+
7462
+ if (height < minHeight) {
7463
+ height = minHeight;
7464
+ width = getScalar(height * ratio);
7465
+ }
7466
+
7467
+ } else {
7468
+ width = Math.max(minWidth, Math.min(width, maxWidth));
7469
+
7470
+ if (current.autoHeight && current.type !== 'iframe') {
7471
+ inner.width( width );
7472
+
7473
+ height = inner.height();
7474
+ }
7475
+
7476
+ height = Math.max(minHeight, Math.min(height, maxHeight));
7477
+ }
7478
+
7479
+ // Try to fit inside viewport (including the title)
7480
+ if (current.fitToView) {
7481
+ inner.width( width ).height( height );
7482
+
7483
+ wrap.width( width + wPadding );
7484
+
7485
+ // Real wrap dimensions
7486
+ width_ = wrap.width();
7487
+ height_ = wrap.height();
7488
+
7489
+ if (current.aspectRatio) {
7490
+ while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) {
7491
+ if (steps++ > 19) {
7492
+ break;
7493
+ }
7494
+
7495
+ height = Math.max(minHeight, Math.min(maxHeight, height - 10));
7496
+ width = getScalar(height * ratio);
7497
+
7498
+ if (width < minWidth) {
7499
+ width = minWidth;
7500
+ height = getScalar(width / ratio);
7501
+ }
7502
+
7503
+ if (width > maxWidth) {
7504
+ width = maxWidth;
7505
+ height = getScalar(width / ratio);
7506
+ }
7507
+
7508
+ inner.width( width ).height( height );
7509
+
7510
+ wrap.width( width + wPadding );
7511
+
7512
+ width_ = wrap.width();
7513
+ height_ = wrap.height();
7514
+ }
7515
+
7516
+ } else {
7517
+ width = Math.max(minWidth, Math.min(width, width - (width_ - maxWidth_)));
7518
+ height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_)));
7519
+ }
7520
+ }
7521
+
7522
+ if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) {
7523
+ width += scrollOut;
7524
+ }
7525
+
7526
+ inner.width( width ).height( height );
7527
+
7528
+ wrap.width( width + wPadding );
7529
+
7530
+ width_ = wrap.width();
7531
+ height_ = wrap.height();
7532
+
7533
+ canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight;
7534
+ canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight));
7535
+
7536
+ $.extend(current, {
7537
+ dim : {
7538
+ width : getValue( width_ ),
7539
+ height : getValue( height_ )
7540
+ },
7541
+ origWidth : origWidth,
7542
+ origHeight : origHeight,
7543
+ canShrink : canShrink,
7544
+ canExpand : canExpand,
7545
+ wPadding : wPadding,
7546
+ hPadding : hPadding,
7547
+ wrapSpace : height_ - skin.outerHeight(true),
7548
+ skinSpace : skin.height() - height
7549
+ });
7550
+
7551
+ if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) {
7552
+ inner.height('auto');
7553
+ }
7554
+ },
7555
+
7556
+ _getPosition: function (onlyAbsolute) {
7557
+ var current = F.current,
7558
+ viewport = F.getViewport(),
7559
+ margin = current.margin,
7560
+ width = F.wrap.width() + margin[1] + margin[3],
7561
+ height = F.wrap.height() + margin[0] + margin[2],
7562
+ rez = {
7563
+ position: 'absolute',
7564
+ top : margin[0],
7565
+ left : margin[3]
7566
+ };
7567
+
7568
+ if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) {
7569
+ rez.position = 'fixed';
7570
+
7571
+ } else if (!current.locked) {
7572
+ rez.top += viewport.y;
7573
+ rez.left += viewport.x;
7574
+ }
7575
+
7576
+ rez.top = getValue(Math.max(rez.top, rez.top + ((viewport.h - height) * current.topRatio)));
7577
+ rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width) * current.leftRatio)));
7578
+
7579
+ return rez;
7580
+ },
7581
+
7582
+ _afterZoomIn: function () {
7583
+ var current = F.current;
7584
+
7585
+ if (!current) {
7586
+ return;
7587
+ }
7588
+
7589
+ F.isOpen = F.isOpened = true;
7590
+
7591
+ F.wrap.css('overflow', 'visible').addClass('fancybox-opened');
7592
+
7593
+ F.update();
7594
+
7595
+ // Assign a click event
7596
+ if ( current.closeClick || (current.nextClick && F.group.length > 1) ) {
7597
+ F.inner.css('cursor', 'pointer').bind('click.fb', function(e) {
7598
+ if (!$(e.target).is('a') && !$(e.target).parent().is('a')) {
7599
+ e.preventDefault();
7600
+
7601
+ F[ current.closeClick ? 'close' : 'next' ]();
7602
+ }
7603
+ });
7604
+ }
7605
+
7606
+ // Create a close button
7607
+ if (current.closeBtn) {
7608
+ $(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', function(e) {
7609
+ e.preventDefault();
7610
+
7611
+ F.close();
7612
+ });
7613
+ }
7614
+
7615
+ // Create navigation arrows
7616
+ if (current.arrows && F.group.length > 1) {
7617
+ if (current.loop || current.index > 0) {
7618
+ $(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev);
7619
+ }
7620
+
7621
+ if (current.loop || current.index < F.group.length - 1) {
7622
+ $(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next);
7623
+ }
7624
+ }
7625
+
7626
+ F.trigger('afterShow');
7627
+
7628
+ // Stop the slideshow if this is the last item
7629
+ if (!current.loop && current.index === current.group.length - 1) {
7630
+ F.play( false );
7631
+
7632
+ } else if (F.opts.autoPlay && !F.player.isActive) {
7633
+ F.opts.autoPlay = false;
7634
+
7635
+ F.play();
7636
+ }
7637
+ },
7638
+
7639
+ _afterZoomOut: function ( obj ) {
7640
+ obj = obj || F.current;
7641
+
7642
+ $('.fancybox-wrap').trigger('onReset').remove();
7643
+
7644
+ $.extend(F, {
7645
+ group : {},
7646
+ opts : {},
7647
+ router : false,
7648
+ current : null,
7649
+ isActive : false,
7650
+ isOpened : false,
7651
+ isOpen : false,
7652
+ isClosing : false,
7653
+ wrap : null,
7654
+ skin : null,
7655
+ outer : null,
7656
+ inner : null
7657
+ });
7658
+
7659
+ F.trigger('afterClose', obj);
7660
+ }
7661
+ });
7662
+
7663
+ /*
7664
+ * Default transitions
7665
+ */
7666
+
7667
+ F.transitions = {
7668
+ getOrigPosition: function () {
7669
+ var current = F.current,
7670
+ element = current.element,
7671
+ orig = current.orig,
7672
+ pos = {},
7673
+ width = 50,
7674
+ height = 50,
7675
+ hPadding = current.hPadding,
7676
+ wPadding = current.wPadding,
7677
+ viewport = F.getViewport();
7678
+
7679
+ if (!orig && current.isDom && element.is(':visible')) {
7680
+ orig = element.find('img:first');
7681
+
7682
+ if (!orig.length) {
7683
+ orig = element;
7684
+ }
7685
+ }
7686
+
7687
+ if (isQuery(orig)) {
7688
+ pos = orig.offset();
7689
+
7690
+ if (orig.is('img')) {
7691
+ width = orig.outerWidth();
7692
+ height = orig.outerHeight();
7693
+ }
7694
+
7695
+ } else {
7696
+ pos.top = viewport.y + (viewport.h - height) * current.topRatio;
7697
+ pos.left = viewport.x + (viewport.w - width) * current.leftRatio;
7698
+ }
7699
+
7700
+ if (F.wrap.css('position') === 'fixed' || current.locked) {
7701
+ pos.top -= viewport.y;
7702
+ pos.left -= viewport.x;
7703
+ }
7704
+
7705
+ pos = {
7706
+ top : getValue(pos.top - hPadding * current.topRatio),
7707
+ left : getValue(pos.left - wPadding * current.leftRatio),
7708
+ width : getValue(width + wPadding),
7709
+ height : getValue(height + hPadding)
7710
+ };
7711
+
7712
+ return pos;
7713
+ },
7714
+
7715
+ step: function (now, fx) {
7716
+ var ratio,
7717
+ padding,
7718
+ value,
7719
+ prop = fx.prop,
7720
+ current = F.current,
7721
+ wrapSpace = current.wrapSpace,
7722
+ skinSpace = current.skinSpace;
7723
+
7724
+ if (prop === 'width' || prop === 'height') {
7725
+ ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start);
7726
+
7727
+ if (F.isClosing) {
7728
+ ratio = 1 - ratio;
7729
+ }
7730
+
7731
+ padding = prop === 'width' ? current.wPadding : current.hPadding;
7732
+ value = now - padding;
7733
+
7734
+ F.skin[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) ) );
7735
+ F.inner[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) );
7736
+ }
7737
+ },
7738
+
7739
+ zoomIn: function () {
7740
+ var current = F.current,
7741
+ startPos = current.pos,
7742
+ effect = current.openEffect,
7743
+ elastic = effect === 'elastic',
7744
+ endPos = $.extend({opacity : 1}, startPos);
7745
+
7746
+ // Remove "position" property that breaks older IE
7747
+ delete endPos.position;
7748
+
7749
+ if (elastic) {
7750
+ startPos = this.getOrigPosition();
7751
+
7752
+ if (current.openOpacity) {
7753
+ startPos.opacity = 0.1;
7754
+ }
7755
+
7756
+ } else if (effect === 'fade') {
7757
+ startPos.opacity = 0.1;
7758
+ }
7759
+
7760
+ F.wrap.css(startPos).animate(endPos, {
7761
+ duration : effect === 'none' ? 0 : current.openSpeed,
7762
+ easing : current.openEasing,
7763
+ step : elastic ? this.step : null,
7764
+ complete : F._afterZoomIn
7765
+ });
7766
+ },
7767
+
7768
+ zoomOut: function () {
7769
+ var current = F.current,
7770
+ effect = current.closeEffect,
7771
+ elastic = effect === 'elastic',
7772
+ endPos = {opacity : 0.1};
7773
+
7774
+ if (elastic) {
7775
+ endPos = this.getOrigPosition();
7776
+
7777
+ if (current.closeOpacity) {
7778
+ endPos.opacity = 0.1;
7779
+ }
7780
+ }
7781
+
7782
+ F.wrap.animate(endPos, {
7783
+ duration : effect === 'none' ? 0 : current.closeSpeed,
7784
+ easing : current.closeEasing,
7785
+ step : elastic ? this.step : null,
7786
+ complete : F._afterZoomOut
7787
+ });
7788
+ },
7789
+
7790
+ changeIn: function () {
7791
+ var current = F.current,
7792
+ effect = current.nextEffect,
7793
+ startPos = current.pos,
7794
+ endPos = { opacity : 1 },
7795
+ direction = F.direction,
7796
+ distance = 200,
7797
+ field;
7798
+
7799
+ startPos.opacity = 0.1;
7800
+
7801
+ if (effect === 'elastic') {
7802
+ field = direction === 'down' || direction === 'up' ? 'top' : 'left';
7803
+
7804
+ if (direction === 'down' || direction === 'right') {
7805
+ startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance);
7806
+ endPos[ field ] = '+=' + distance + 'px';
7807
+
7808
+ } else {
7809
+ startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance);
7810
+ endPos[ field ] = '-=' + distance + 'px';
7811
+ }
7812
+ }
7813
+
7814
+ // Workaround for http://bugs.jquery.com/ticket/12273
7815
+ if (effect === 'none') {
7816
+ F._afterZoomIn();
7817
+
7818
+ } else {
7819
+ F.wrap.css(startPos).animate(endPos, {
7820
+ duration : current.nextSpeed,
7821
+ easing : current.nextEasing,
7822
+ complete : F._afterZoomIn
7823
+ });
7824
+ }
7825
+ },
7826
+
7827
+ changeOut: function () {
7828
+ var previous = F.previous,
7829
+ effect = previous.prevEffect,
7830
+ endPos = { opacity : 0.1 },
7831
+ direction = F.direction,
7832
+ distance = 200;
7833
+
7834
+ if (effect === 'elastic') {
7835
+ endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px';
7836
+ }
7837
+
7838
+ previous.wrap.animate(endPos, {
7839
+ duration : effect === 'none' ? 0 : previous.prevSpeed,
7840
+ easing : previous.prevEasing,
7841
+ complete : function () {
7842
+ $(this).trigger('onReset').remove();
7843
+ }
7844
+ });
7845
+ }
7846
+ };
7847
+
7848
+ /*
7849
+ * Overlay helper
7850
+ */
7851
+
7852
+ F.helpers.overlay = {
7853
+ defaults : {
7854
+ closeClick : true, // if true, fancyBox will be closed when user clicks on the overlay
7855
+ speedOut : 200, // duration of fadeOut animation
7856
+ showEarly : true, // indicates if should be opened immediately or wait until the content is ready
7857
+ css : {}, // custom CSS properties
7858
+ locked : !isTouch, // if true, the content will be locked into overlay
7859
+ fixed : true // if false, the overlay CSS position property will not be set to "fixed"
7860
+ },
7861
+
7862
+ overlay : null, // current handle
7863
+ fixed : false, // indicates if the overlay has position "fixed"
7864
+ el : $('html'), // element that contains "the lock"
7865
+
7866
+ // Public methods
7867
+ create : function(opts) {
7868
+ opts = $.extend({}, this.defaults, opts);
7869
+
7870
+ if (this.overlay) {
7871
+ this.close();
7872
+ }
7873
+
7874
+ this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( F.coming ? F.coming.parent : opts.parent );
7875
+ this.fixed = false;
7876
+
7877
+ if (opts.fixed && F.defaults.fixed) {
7878
+ this.overlay.addClass('fancybox-overlay-fixed');
7879
+
7880
+ this.fixed = true;
7881
+ }
7882
+ },
7883
+
7884
+ open : function(opts) {
7885
+ var that = this;
7886
+
7887
+ opts = $.extend({}, this.defaults, opts);
7888
+
7889
+ if (this.overlay) {
7890
+ this.overlay.unbind('.overlay').width('auto').height('auto');
7891
+
7892
+ } else {
7893
+ this.create(opts);
7894
+ }
7895
+
7896
+ if (!this.fixed) {
7897
+ W.bind('resize.overlay', $.proxy( this.update, this) );
7898
+
7899
+ this.update();
7900
+ }
7901
+
7902
+ if (opts.closeClick) {
7903
+ this.overlay.bind('click.overlay', function(e) {
7904
+ if ($(e.target).hasClass('fancybox-overlay')) {
7905
+ if (F.isActive) {
7906
+ F.close();
7907
+ } else {
7908
+ that.close();
7909
+ }
7910
+
7911
+ return false;
7912
+ }
7913
+ });
7914
+ }
7915
+
7916
+ this.overlay.css( opts.css ).show();
7917
+ },
7918
+
7919
+ close : function() {
7920
+ var scrollV, scrollH;
7921
+
7922
+ W.unbind('resize.overlay');
7923
+
7924
+ if (this.el.hasClass('fancybox-lock')) {
7925
+ $('.fancybox-margin').removeClass('fancybox-margin');
7926
+
7927
+ scrollV = W.scrollTop();
7928
+ scrollH = W.scrollLeft();
7929
+
7930
+ this.el.removeClass('fancybox-lock');
7931
+
7932
+ W.scrollTop( scrollV ).scrollLeft( scrollH );
7933
+ }
7934
+
7935
+ $('.fancybox-overlay').remove().hide();
7936
+
7937
+ $.extend(this, {
7938
+ overlay : null,
7939
+ fixed : false
7940
+ });
7941
+ },
7942
+
7943
+ // Private, callbacks
7944
+
7945
+ update : function () {
7946
+ var width = '100%', offsetWidth;
7947
+
7948
+ // Reset width/height so it will not mess
7949
+ this.overlay.width(width).height('100%');
7950
+
7951
+ // jQuery does not return reliable result for IE
7952
+ if (IE) {
7953
+ offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth);
7954
+
7955
+ if (D.width() > offsetWidth) {
7956
+ width = D.width();
7957
+ }
7958
+
7959
+ } else if (D.width() > W.width()) {
7960
+ width = D.width();
7961
+ }
7962
+
7963
+ this.overlay.width(width).height(D.height());
7964
+ },
7965
+
7966
+ // This is where we can manipulate DOM, because later it would cause iframes to reload
7967
+ onReady : function (opts, obj) {
7968
+ var overlay = this.overlay;
7969
+
7970
+ $('.fancybox-overlay').stop(true, true);
7971
+
7972
+ if (!overlay) {
7973
+ this.create(opts);
7974
+ }
7975
+
7976
+ if (opts.locked && this.fixed && obj.fixed) {
7977
+ if (!overlay) {
7978
+ this.margin = D.height() > W.height() ? $('html').css('margin-right').replace("px", "") : false;
7979
+ }
7980
+
7981
+ obj.locked = this.overlay.append( obj.wrap );
7982
+ obj.fixed = false;
7983
+ }
7984
+
7985
+ if (opts.showEarly === true) {
7986
+ this.beforeShow.apply(this, arguments);
7987
+ }
7988
+ },
7989
+
7990
+ beforeShow : function(opts, obj) {
7991
+ var scrollV, scrollH;
7992
+
7993
+ if (obj.locked) {
7994
+ if (this.margin !== false) {
7995
+ $('*').filter(function(){
7996
+ return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap") );
7997
+ }).addClass('fancybox-margin');
7998
+
7999
+ this.el.addClass('fancybox-margin');
8000
+ }
8001
+
8002
+ scrollV = W.scrollTop();
8003
+ scrollH = W.scrollLeft();
8004
+
8005
+ this.el.addClass('fancybox-lock');
8006
+
8007
+ W.scrollTop( scrollV ).scrollLeft( scrollH );
8008
+ }
8009
+
8010
+ this.open(opts);
8011
+ },
8012
+
8013
+ onUpdate : function() {
8014
+ if (!this.fixed) {
8015
+ this.update();
8016
+ }
8017
+ },
8018
+
8019
+ afterClose: function (opts) {
8020
+ // Remove overlay if exists and fancyBox is not opening
8021
+ // (e.g., it is not being open using afterClose callback)
8022
+ //if (this.overlay && !F.isActive) {
8023
+ if (this.overlay && !F.coming) {
8024
+ this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this ));
8025
+ }
8026
+ }
8027
+ };
8028
+
8029
+ /*
8030
+ * Title helper
8031
+ */
8032
+
8033
+ F.helpers.title = {
8034
+ defaults : {
8035
+ type : 'float', // 'float', 'inside', 'outside' or 'over',
8036
+ position : 'bottom' // 'top' or 'bottom'
8037
+ },
8038
+
8039
+ beforeShow: function (opts) {
8040
+ var current = F.current,
8041
+ text = current.title,
8042
+ type = opts.type,
8043
+ title,
8044
+ target;
8045
+
8046
+ if ($.isFunction(text)) {
8047
+ text = text.call(current.element, current);
8048
+ }
8049
+
8050
+ if (!isString(text) || $.trim(text) === '') {
8051
+ return;
8052
+ }
8053
+
8054
+ title = $('<div class="fancybox-title fancybox-title-' + type + '-wrap">' + text + '</div>');
8055
+
8056
+ switch (type) {
8057
+ case 'inside':
8058
+ target = F.skin;
8059
+ break;
8060
+
8061
+ case 'outside':
8062
+ target = F.wrap;
8063
+ break;
8064
+
8065
+ case 'over':
8066
+ target = F.inner;
8067
+ break;
8068
+
8069
+ default: // 'float'
8070
+ target = F.skin;
8071
+
8072
+ title.appendTo('body');
8073
+
8074
+ if (IE) {
8075
+ title.width( title.width() );
8076
+ }
8077
+
8078
+ title.wrapInner('<span class="child"></span>');
8079
+
8080
+ //Increase bottom margin so this title will also fit into viewport
8081
+ F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) );
8082
+ break;
8083
+ }
8084
+
8085
+ title[ (opts.position === 'top' ? 'prependTo' : 'appendTo') ](target);
8086
+ }
8087
+ };
8088
+
8089
+ // jQuery plugin initialization
8090
+ $.fn.fancybox = function (options) {
8091
+ var index,
8092
+ that = $(this),
8093
+ selector = this.selector || '',
8094
+ run = function(e) {
8095
+ var what = $(this).blur(), idx = index, relType, relVal;
8096
+
8097
+ if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) {
8098
+ relType = options.groupAttr || 'data-fancybox-group';
8099
+ relVal = what.attr(relType);
8100
+
8101
+ if (!relVal) {
8102
+ relType = 'rel';
8103
+ relVal = what.get(0)[ relType ];
8104
+ }
8105
+
8106
+ if (relVal && relVal !== '' && relVal !== 'nofollow') {
8107
+ what = selector.length ? $(selector) : that;
8108
+ what = what.filter('[' + relType + '="' + relVal + '"]');
8109
+ idx = what.index(this);
8110
+ }
8111
+
8112
+ options.index = idx;
8113
+
8114
+ // Stop an event from bubbling if everything is fine
8115
+ if (F.open(what, options) !== false) {
8116
+ e.preventDefault();
8117
+ }
8118
+ }
8119
+ };
8120
+
8121
+ options = options || {};
8122
+ index = options.index || 0;
8123
+
8124
+ if (!selector || options.live === false) {
8125
+ that.unbind('click.fb-start').bind('click.fb-start', run);
8126
+
8127
+ } else {
8128
+ D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run);
8129
+ }
8130
+
8131
+ this.filter('[data-fancybox-start=1]').trigger('click');
8132
+
8133
+ return this;
8134
+ };
8135
+
8136
+ // Tests that need a body at doc ready
8137
+ D.ready(function() {
8138
+ var w1, w2;
8139
+
8140
+ if ( $.scrollbarWidth === undefined ) {
8141
+ // http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth
8142
+ $.scrollbarWidth = function() {
8143
+ var parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'),
8144
+ child = parent.children(),
8145
+ width = child.innerWidth() - child.height( 99 ).innerWidth();
8146
+
8147
+ parent.remove();
8148
+
8149
+ return width;
8150
+ };
8151
+ }
8152
+
8153
+ if ( $.support.fixedPosition === undefined ) {
8154
+ $.support.fixedPosition = (function() {
8155
+ var elem = $('<div style="position:fixed;top:20px;"></div>').appendTo('body'),
8156
+ fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 );
8157
+
8158
+ elem.remove();
8159
+
8160
+ return fixed;
8161
+ }());
8162
+ }
8163
+
8164
+ $.extend(F.defaults, {
8165
+ scrollbarWidth : $.scrollbarWidth(),
8166
+ fixed : $.support.fixedPosition,
8167
+ parent : $('body')
8168
+ });
8169
+
8170
+ //Get real width of page scroll-bar
8171
+ w1 = $(window).width();
8172
+
8173
+ H.addClass('fancybox-lock-test');
8174
+
8175
+ w2 = $(window).width();
8176
+
8177
+ H.removeClass('fancybox-lock-test');
8178
+
8179
+ $("<style type='text/css'>.fancybox-margin{margin-right:" + (w2 - w1) + "px;}</style>").appendTo("head");
8180
+ });
8181
+
8182
+ }(window, document, jQuery));
8183
+
8184
+ /* **********************************************
8185
+ Begin AES.js
8186
+ ********************************************** */
8187
+
8188
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
8189
+ /* AES implementation in JavaScript (c) Chris Veness 2005-2011 */
8190
+ /* - see http://csrc.nist.gov/publications/PubsFIPS.html#197 */
8191
+ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
8192
+
8193
+ var Aes = {}; // Aes namespace
8194
+
8195
+ /**
8196
+ * AES Cipher function: encrypt 'input' state with Rijndael algorithm
8197
+ * applies Nr rounds (10/12/14) using key schedule w for 'add round key' stage
8198
+ *
8199
+ * @param {Number[]} input 16-byte (128-bit) input state array
8200
+ * @param {Number[][]} w Key schedule as 2D byte-array (Nr+1 x Nb bytes)
8201
+ * @returns {Number[]} Encrypted output state array
8202
+ */
8203
+ Aes.cipher = function(input, w) { // main Cipher function [§5.1]
8204
+ var Nb = 4; // block size (in words): no of columns in state (fixed at 4 for AES)
8205
+ var Nr = w.length/Nb - 1; // no of rounds: 10/12/14 for 128/192/256-bit keys
8206
+
8207
+ var state = [[],[],[],[]]; // initialise 4xNb byte-array 'state' with input [§3.4]
8208
+ for (var i=0; i<4*Nb; i++) state[i%4][Math.floor(i/4)] = input[i];
8209
+
8210
+ state = Aes.addRoundKey(state, w, 0, Nb);
8211
+
8212
+ for (var round=1; round<Nr; round++) {
8213
+ state = Aes.subBytes(state, Nb);
8214
+ state = Aes.shiftRows(state, Nb);
8215
+ state = Aes.mixColumns(state, Nb);
8216
+ state = Aes.addRoundKey(state, w, round, Nb);
8217
+ }
8218
+
8219
+ state = Aes.subBytes(state, Nb);
8220
+ state = Aes.shiftRows(state, Nb);
8221
+ state = Aes.addRoundKey(state, w, Nr, Nb);
8222
+
8223
+ var output = new Array(4*Nb); // convert state to 1-d array before returning [§3.4]
8224
+ for (var i=0; i<4*Nb; i++) output[i] = state[i%4][Math.floor(i/4)];
8225
+ return output;
8226
+ }
8227
+
8228
+ /**
8229
+ * Perform Key Expansion to generate a Key Schedule
8230
+ *
8231
+ * @param {Number[]} key Key as 16/24/32-byte array
8232
+ * @returns {Number[][]} Expanded key schedule as 2D byte-array (Nr+1 x Nb bytes)
8233
+ */
8234
+ Aes.keyExpansion = function(key) { // generate Key Schedule (byte-array Nr+1 x Nb) from Key [§5.2]
8235
+ var Nb = 4; // block size (in words): no of columns in state (fixed at 4 for AES)
8236
+ var Nk = key.length/4 // key length (in words): 4/6/8 for 128/192/256-bit keys
8237
+ var Nr = Nk + 6; // no of rounds: 10/12/14 for 128/192/256-bit keys
8238
+
8239
+ var w = new Array(Nb*(Nr+1));
8240
+ var temp = new Array(4);
8241
+
8242
+ for (var i=0; i<Nk; i++) {
8243
+ var r = [key[4*i], key[4*i+1], key[4*i+2], key[4*i+3]];
8244
+ w[i] = r;
8245
+ }
8246
+
8247
+ for (var i=Nk; i<(Nb*(Nr+1)); i++) {
5884
8248
  w[i] = new Array(4);
5885
8249
  for (var t=0; t<4; t++) temp[t] = w[i-1][t];
5886
8250
  if (i % Nk == 0) {
@@ -6445,7 +8809,7 @@ Utf8.decode = function(strUtf) {
6445
8809
 
6446
8810
  , setContent: function () {
6447
8811
  var $tip = this.tip()
6448
- $tip.find('.tooltip-inner').html(this.getTitle())
8812
+ $tip.find('.timeline-tooltip-inner').html(this.getTitle())
6449
8813
  $tip.removeClass('fade in top bottom left right')
6450
8814
  }
6451
8815
 
@@ -6555,7 +8919,7 @@ Utf8.decode = function(strUtf) {
6555
8919
  , placement: 'top'
6556
8920
  , trigger: 'hover'
6557
8921
  , title: ''
6558
- , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
8922
+ , template: '<div class="timeline-tooltip"><div class="timeline-tooltip-arrow"></div><div class="timeline-tooltip-inner"></div></div>'
6559
8923
  }
6560
8924
 
6561
8925
  }( window.jQuery );
@@ -6576,6 +8940,7 @@ Utf8.decode = function(strUtf) {
6576
8940
  // @codekit-prepend "Media/VMM.Media.js";
6577
8941
  // @codekit-prepend "Slider/VMM.DragSlider.js";
6578
8942
  // @codekit-prepend "Slider/VMM.Slider.js";
8943
+ // @codekit-prepend "Library/jquery.fancybox.js";
6579
8944
  // @codekit-prepend "Library/AES.js";
6580
8945
  // @codekit-prepend "Library/bootstrap-tooltip.js";
6581
8946
 
@@ -6605,18 +8970,9 @@ if(typeof VMM != 'undefined' && typeof VMM.StoryJS == 'undefined') {
6605
8970
  * TimelineJS
6606
8971
  * Designed and built by Zach Wise at VéritéCo
6607
8972
 
6608
- * This program is free software: you can redistribute it and/or modify
6609
- * it under the terms of the GNU General Public License as published by
6610
- * the Free Software Foundation, either version 3 of the License, or
6611
- * (at your option) any later version.
6612
-
6613
- * This program is distributed in the hope that it will be useful,
6614
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
6615
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6616
- * GNU General Public License for more details.
6617
-
6618
- * http://www.gnu.org/licenses/
6619
-
8973
+ * This Source Code Form is subject to the terms of the Mozilla Public
8974
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
8975
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6620
8976
  */
6621
8977
 
6622
8978
  /* * CodeKit Import
@@ -6711,6 +9067,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
6711
9067
  nav: {
6712
9068
  start_page: false,
6713
9069
  interval_width: 200,
9070
+ interval_override: false, // change this to override the interval of years, months etc.
6714
9071
  density: 4,
6715
9072
  minor_width: 0,
6716
9073
  minor_left: 0,
@@ -7015,7 +9372,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
7015
9372
  if (type.of(_data) == "string") {
7016
9373
  config.source = _data;
7017
9374
  }
7018
-
9375
+
7019
9376
  // LANGUAGE
7020
9377
  VMM.Date.setLanguage(config.language);
7021
9378
  VMM.master_config.language = config.language;
@@ -7044,8 +9401,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
7044
9401
  VMM.fireEvent(global, config.events.messege, "No data source provided");
7045
9402
  //VMM.Timeline.DataObj.getData(VMM.getElement(timeline_id));
7046
9403
  }
7047
-
7048
-
9404
+
7049
9405
  };
7050
9406
 
7051
9407
  this.iframeLoaded = function() {
@@ -7134,28 +9490,6 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
7134
9490
 
7135
9491
  };
7136
9492
 
7137
- function ie7Build() {
7138
- trace("IE7 or lower");
7139
- for(var i = 0; i < _dates.length; i++) {
7140
- trace(_dates[i]);
7141
- /*
7142
- var st = VMM.Date.prettyDate(data.startdate);
7143
- var en = VMM.Date.prettyDate(data.enddate);
7144
- var tag = "";
7145
- if (data.tag != null && data.tag != "") {
7146
- tag = VMM.createElement("span", data.tag, "slide-tag");
7147
- }
7148
-
7149
- if (st != en) {
7150
- c.text += VMM.createElement("h2", st + " &mdash; " + en + tag, "date");
7151
- } else {
7152
- c.text += VMM.createElement("h2", st + tag, "date");
7153
- }
7154
- */
7155
-
7156
- }
7157
- };
7158
-
7159
9493
  function updateSize() {
7160
9494
  trace("UPDATE SIZE");
7161
9495
  config.width = VMM.Lib.width($timeline);
@@ -7180,7 +9514,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
7180
9514
  */
7181
9515
  }
7182
9516
 
7183
- if (config.width < 640) {
9517
+ if (config.width < 641) {
7184
9518
  VMM.Lib.addClass($timeline, "vco-skinny");
7185
9519
  } else {
7186
9520
  VMM.Lib.removeClass($timeline, "vco-skinny");
@@ -7199,25 +9533,19 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
7199
9533
 
7200
9534
  if (data.date[i].startDate != null && data.date[i].startDate != "") {
7201
9535
 
7202
- var _date = {};
7203
-
7204
- // START DATE
7205
- if (data.date[i].type == "tweets") {
7206
- _date.startdate = VMM.ExternalAPI.twitter.parseTwitterDate(data.date[i].startDate);
7207
- } else {
7208
- _date.startdate = VMM.Date.parse(data.date[i].startDate);
7209
- }
9536
+ var _date = {},
9537
+ do_start = VMM.Date.parse(data.date[i].startDate, true),
9538
+ do_end;
9539
+
9540
+ _date.startdate = do_start.date;
9541
+ _date.precisiondate = do_start.precision;
7210
9542
 
7211
9543
  if (!isNaN(_date.startdate)) {
7212
9544
 
7213
9545
 
7214
9546
  // END DATE
7215
9547
  if (data.date[i].endDate != null && data.date[i].endDate != "") {
7216
- if (data.date[i].type == "tweets") {
7217
- _date.enddate = VMM.ExternalAPI.twitter.parseTwitterDate(data.date[i].endDate);
7218
- } else {
7219
- _date.enddate = VMM.Date.parse(data.date[i].endDate);
7220
- }
9548
+ _date.enddate = VMM.Date.parse(data.date[i].endDate);
7221
9549
  } else {
7222
9550
  _date.enddate = _date.startdate;
7223
9551
  }
@@ -7229,11 +9557,11 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
7229
9557
  _date.needs_slug = true;
7230
9558
  }
7231
9559
  }
7232
-
9560
+
7233
9561
  _date.title = data.date[i].headline;
7234
9562
  _date.headline = data.date[i].headline;
7235
9563
  _date.type = data.date[i].type;
7236
- _date.date = VMM.Date.prettyDate(_date.startdate);
9564
+ _date.date = VMM.Date.prettyDate(_date.startdate, false, _date.precisiondate);
7237
9565
  _date.asset = data.date[i].asset;
7238
9566
  _date.fulldate = _date.startdate.getTime();
7239
9567
  _date.text = data.date[i].text;
@@ -7241,6 +9569,8 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
7241
9569
  _date.tag = data.date[i].tag;
7242
9570
  _date.slug = data.date[i].slug;
7243
9571
  _date.uniqueid = VMM.Util.unique_ID(7);
9572
+ _date.classname = data.date[i].classname;
9573
+
7244
9574
 
7245
9575
  _dates.push(_date);
7246
9576
  }
@@ -7262,12 +9592,14 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
7262
9592
  if (data.headline != null && data.headline != "" && data.text != null && data.text != "") {
7263
9593
 
7264
9594
  var startpage_date,
9595
+ do_start,
7265
9596
  _date = {},
7266
9597
  td_num = 0,
7267
9598
  td;
7268
9599
 
7269
9600
  if (typeof data.startDate != 'undefined') {
7270
- startpage_date = VMM.Date.parse(data.startDate);
9601
+ do_start = VMM.Date.parse(data.startDate, true);
9602
+ startpage_date = do_start.date;
7271
9603
  } else {
7272
9604
  startpage_date = false;
7273
9605
  }
@@ -7300,11 +9632,12 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
7300
9632
 
7301
9633
  _date.uniqueid = VMM.Util.unique_ID(7);
7302
9634
  _date.enddate = _date.startdate;
9635
+ _date.precisiondate = do_start.precision;
7303
9636
  _date.title = data.headline;
7304
9637
  _date.headline = data.headline;
7305
9638
  _date.text = data.text;
7306
9639
  _date.type = "start";
7307
- _date.date = VMM.Date.prettyDate(data.startDate);
9640
+ _date.date = VMM.Date.prettyDate(data.startDate, false, _date.precisiondate);
7308
9641
  _date.asset = data.asset;
7309
9642
  _date.slug = false;
7310
9643
  _date.needs_slug = false;
@@ -7599,27 +9932,32 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
7599
9932
  if (e.originalEvent) {
7600
9933
  e = e.originalEvent;
7601
9934
  }
9935
+
9936
+ // Browsers unable to differntiate between up/down and left/right scrolling
9937
+ /*
7602
9938
  if (e.wheelDelta) {
7603
9939
  delta = e.wheelDelta/6;
7604
9940
  } else if (e.detail) {
7605
9941
  delta = -e.detail*12;
7606
9942
  }
7607
- if (delta) {
7608
- if (e.preventDefault) {
7609
- e.preventDefault();
7610
- }
7611
- e.returnValue = false;
7612
- }
7613
- // Webkit
9943
+ */
9944
+
9945
+ // Webkit and browsers able to differntiate between up/down and left/right scrolling
7614
9946
  if (typeof e.wheelDeltaX != 'undefined' ) {
7615
9947
  delta = e.wheelDeltaY/6;
7616
9948
  if (Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY)) {
7617
9949
  delta = e.wheelDeltaX/6;
7618
9950
  } else {
7619
- delta = e.wheelDeltaY/6;
9951
+ //delta = e.wheelDeltaY/6;
9952
+ delta = 0;
7620
9953
  }
7621
9954
  }
7622
-
9955
+ if (delta) {
9956
+ if (e.preventDefault) {
9957
+ e.preventDefault();
9958
+ }
9959
+ e.returnValue = false;
9960
+ }
7623
9961
  // Stop from scrolling too far
7624
9962
  scroll_to = VMM.Lib.position($timenav).left + delta;
7625
9963
 
@@ -7634,7 +9972,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
7634
9972
  VMM.Lib.css($timenav, "left", scroll_to);
7635
9973
  }
7636
9974
 
7637
- var refreshTimeline = function() {
9975
+ function refreshTimeline() {
7638
9976
  trace("config.nav.multiplier " + config.nav.multiplier.current);
7639
9977
  positionMarkers(true);
7640
9978
  positionEras(true);
@@ -7657,7 +9995,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
7657
9995
  VMM.Lib.toggleClass(e.data.elem, "zFront");
7658
9996
  };
7659
9997
 
7660
- var goToMarker = function(n, ease, duration, fast, firstrun) {
9998
+ function goToMarker(n, ease, duration, fast, firstrun) {
7661
9999
  trace("GO TO MARKER");
7662
10000
  var _ease = config.ease,
7663
10001
  _duration = config.duration,
@@ -7705,7 +10043,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
7705
10043
 
7706
10044
  /* CALCULATIONS
7707
10045
  ================================================== */
7708
- var averageMarkerPositionDistance = function() {
10046
+ function averageMarkerPositionDistance() {
7709
10047
  var last_pos = 0,
7710
10048
  pos = 0,
7711
10049
  pos_dif = 0,
@@ -7726,7 +10064,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
7726
10064
  return VMM.Util.average(mp_diff).mean;
7727
10065
  }
7728
10066
 
7729
- var averageDateDistance = function() {
10067
+ function averageDateDistance() {
7730
10068
  var last_dd = 0,
7731
10069
  dd = 0,
7732
10070
  _dd = "",
@@ -7750,7 +10088,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
7750
10088
  return VMM.Util.average(date_diffs);
7751
10089
  }
7752
10090
 
7753
- var calculateMultiplier = function() {
10091
+ function calculateMultiplier() {
7754
10092
  var temp_multiplier = config.nav.multiplier.current,
7755
10093
  i = 0;
7756
10094
 
@@ -7764,7 +10102,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
7764
10102
 
7765
10103
  }
7766
10104
 
7767
- var calculateInterval = function() {
10105
+ function calculateInterval() {
7768
10106
  // NEED TO REWRITE ALL OF THIS
7769
10107
  var _first = getDateFractions(data[0].startdate),
7770
10108
  _last = getDateFractions(data[data.length - 1].enddate);
@@ -7897,7 +10235,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
7897
10235
  interval_calc.second.minor = 10;
7898
10236
  }
7899
10237
 
7900
- var getDateFractions = function(the_date, is_utc) {
10238
+ function getDateFractions(the_date, is_utc) {
7901
10239
 
7902
10240
  var _time = {};
7903
10241
  _time.days = the_date / dateFractionBrowser.day;
@@ -7936,7 +10274,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
7936
10274
  Positions elements on the timeline based on date
7937
10275
  relative to the calculated interval
7938
10276
  ================================================== */
7939
- var positionRelative = function(_interval, first, last) {
10277
+ function positionRelative(_interval, first, last) {
7940
10278
  var _first,
7941
10279
  _last,
7942
10280
  _type = _interval.type,
@@ -8023,14 +10361,14 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8023
10361
  return timerelative
8024
10362
  }
8025
10363
 
8026
- var positionOnTimeline = function(the_interval, timerelative) {
10364
+ function positionOnTimeline(the_interval, timerelative) {
8027
10365
  return {
8028
10366
  begin: (timerelative.start - interval.base) * (config.nav.interval_width / config.nav.multiplier.current),
8029
10367
  end: (timerelative.end - interval.base) * (config.nav.interval_width / config.nav.multiplier.current)
8030
10368
  };
8031
10369
  }
8032
10370
 
8033
- var positionMarkers = function(is_animated) {
10371
+ function positionMarkers(is_animated) {
8034
10372
 
8035
10373
  var row = 2,
8036
10374
  previous_pos = 0,
@@ -8042,6 +10380,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8042
10380
  cur_mark = 0,
8043
10381
  in_view_margin = config.width,
8044
10382
  pos_cache_array = [],
10383
+ pos_cache_obj = {id: i, pos: 0, row: 0, marker: 0},
8045
10384
  pos_cache_max = 6,
8046
10385
  in_view = {
8047
10386
  left: timenav_pos.visible.left - in_view_margin,
@@ -8063,7 +10402,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8063
10402
  pos = positionOnTimeline(interval, markers[i].relative_pos),
8064
10403
  row_pos = 0,
8065
10404
  is_in_view = false,
8066
- pos_cache_obj = {id: i, pos: 0, row: 0},
10405
+
8067
10406
  pos_cache_close = 0;
8068
10407
 
8069
10408
 
@@ -8111,6 +10450,8 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8111
10450
 
8112
10451
  // CONTROL ROW POSITION
8113
10452
  if (tags.length > 0) {
10453
+ var need_half_row = false,
10454
+ half_row_number = 0;
8114
10455
 
8115
10456
  for (k = 0; k < tags.length; k++) {
8116
10457
  if (k < config.nav.rows.current.length) {
@@ -8120,10 +10461,35 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8120
10461
  trace("ON LAST ROW");
8121
10462
  VMM.Lib.addClass(marker.flag, "flag-small-last");
8122
10463
  }
10464
+
10465
+ // Experimental, to try and avoid too much stacking on tagged flags
10466
+ if (pos.begin - previous_pos.begin < 5) {
10467
+ if (pos_cache_obj.row == row) {
10468
+ trace("TAGGED FLAG TOO CLOSE ON SAME ROW");
10469
+ trace(pos_cache_obj.row);
10470
+ trace(row);
10471
+ VMM.Lib.addClass(marker.flag, "flag-small");
10472
+ VMM.Lib.addClass(pos_cache_obj.marker.flag, "flag-small");
10473
+
10474
+ if (row < config.nav.rows.half.length - 1) {
10475
+ //row ++;
10476
+ half_row_number = (row *2) + 1;
10477
+ need_half_row = true;
10478
+ }
10479
+ }
10480
+ } else {
10481
+ VMM.Lib.removeClass(marker.flag, "flag-small");
10482
+ }
10483
+ // END Experimental
10484
+
8123
10485
  }
8124
10486
  }
8125
10487
  }
8126
- row_pos = config.nav.rows.current[row];
10488
+ if (need_half_row) {
10489
+ row_pos = config.nav.rows.half[half_row_number];
10490
+ } else {
10491
+ row_pos = config.nav.rows.current[row];
10492
+ }
8127
10493
  } else {
8128
10494
 
8129
10495
  if (pos.begin - previous_pos.begin < (config.nav.marker.width + config.spacing)) {
@@ -8148,6 +10514,8 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8148
10514
  // POSITION CACHE
8149
10515
  pos_cache_obj.pos = pos;
8150
10516
  pos_cache_obj.row = row;
10517
+ pos_cache_obj.marker = marker;
10518
+
8151
10519
  pos_cache_array.push(pos_cache_obj);
8152
10520
  if (pos_cache_array.length > pos_cache_max) {
8153
10521
  pos_cache_array.remove(0);
@@ -8191,7 +10559,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8191
10559
 
8192
10560
  }
8193
10561
 
8194
- var positionEras = function(is_animated) {
10562
+ function positionEras(is_animated) {
8195
10563
  var i = 0,
8196
10564
  p = 0;
8197
10565
 
@@ -8199,6 +10567,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8199
10567
  var era = era_markers[i],
8200
10568
  pos = positionOnTimeline(interval, era.relative_pos),
8201
10569
  row_pos = 0,
10570
+ row = 0,
8202
10571
  era_height = config.nav.marker.height * config.nav.rows.full.length,
8203
10572
  era_length = pos.end - pos.begin;
8204
10573
 
@@ -8238,7 +10607,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8238
10607
  }
8239
10608
  }
8240
10609
 
8241
- var positionInterval = function(the_main_element, the_intervals, is_animated, is_minor) {
10610
+ function positionInterval(the_main_element, the_intervals, is_animated, is_minor) {
8242
10611
 
8243
10612
  var last_position = 0,
8244
10613
  last_position_major = 0,
@@ -8373,7 +10742,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8373
10742
 
8374
10743
  /* Interval Elements
8375
10744
  ================================================== */
8376
- var createIntervalElements = function(_interval, _array, _element_parent) {
10745
+ function createIntervalElements(_interval, _array, _element_parent) {
8377
10746
 
8378
10747
  var inc_time = 0,
8379
10748
  _first_run = true,
@@ -8579,7 +10948,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8579
10948
 
8580
10949
  /* BUILD
8581
10950
  ================================================== */
8582
- var build = function() {
10951
+ function build() {
8583
10952
  var i = 0,
8584
10953
  j = 0;
8585
10954
 
@@ -8597,8 +10966,8 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8597
10966
  $timenavindicator = VMM.appendAndGetElement($timebackground, "<div>", "timenav-indicator");
8598
10967
  $timeintervalbackground = VMM.appendAndGetElement($timebackground, "<div>", "timenav-interval-background", "<div class='top-highlight'></div>");
8599
10968
  $toolbar = VMM.appendAndGetElement(layout, "<div>", "vco-toolbar");
8600
-
8601
-
10969
+
10970
+
8602
10971
  buildInterval();
8603
10972
  buildMarkers();
8604
10973
  buildEras();
@@ -8614,7 +10983,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8614
10983
  $backhome = VMM.appendAndGetElement($toolbar, "<div>", "back-home", "<div class='icon'></div>");
8615
10984
  VMM.bindEvent(".back-home", onBackHome, "click");
8616
10985
  VMM.Lib.attribute($backhome, "title", VMM.master_config.language.messages.return_to_title);
8617
- VMM.Lib.attribute($backhome, "rel", "tooltip");
10986
+ VMM.Lib.attribute($backhome, "rel", "timeline-tooltip");
8618
10987
 
8619
10988
  }
8620
10989
 
@@ -8640,10 +11009,10 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8640
11009
  VMM.bindEvent($zoomout, onZoomOut, "click");
8641
11010
  // TOOLTIP
8642
11011
  VMM.Lib.attribute($zoomin, "title", VMM.master_config.language.messages.expand_timeline);
8643
- VMM.Lib.attribute($zoomin, "rel", "tooltip");
11012
+ VMM.Lib.attribute($zoomin, "rel", "timeline-tooltip");
8644
11013
  VMM.Lib.attribute($zoomout, "title", VMM.master_config.language.messages.contract_timeline);
8645
- VMM.Lib.attribute($zoomout, "rel", "tooltip");
8646
- $toolbar.tooltip({selector: "div[rel=tooltip]", placement: "right"});
11014
+ VMM.Lib.attribute($zoomout, "rel", "timeline-tooltip");
11015
+ $toolbar.tooltip({selector: "div[rel=timeline-tooltip]", placement: "right"});
8647
11016
 
8648
11017
 
8649
11018
  // MOUSE EVENTS
@@ -8674,7 +11043,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8674
11043
 
8675
11044
  };
8676
11045
 
8677
- var buildInterval = function() {
11046
+ function buildInterval() {
8678
11047
  var i = 0,
8679
11048
  j = 0;
8680
11049
  // CALCULATE INTERVAL
@@ -8683,7 +11052,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8683
11052
  calculateInterval();
8684
11053
 
8685
11054
  /* DETERMINE DEFAULT INTERVAL TYPE
8686
- millenium, ages, epoch, era and eon are not working yet
11055
+ millenium, ages, epoch, era and eon are not optimized yet. They may never be.
8687
11056
  ================================================== */
8688
11057
  /*
8689
11058
  if (timespan.eons > data.length / config.nav.density) {
@@ -8750,6 +11119,49 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8750
11119
  trace("INTERVAL TYPE: " + interval.type);
8751
11120
  trace("INTERVAL MAJOR TYPE: " + interval_major.type);
8752
11121
 
11122
+ // OVERRIDE INTERVAL USING CONFIG
11123
+ if (config.nav.interval_override) {
11124
+ trace("INTERVAL OVERRIDE");
11125
+ if (config.nav.interval_override == "centuries") {
11126
+ interval = interval_calc.century;
11127
+ interval_major = interval_calc.millenium;
11128
+ interval_macro = interval_calc.decade;
11129
+ } else if (config.nav.interval_override == "decades") {
11130
+ interval = interval_calc.decade;
11131
+ interval_major = interval_calc.century;
11132
+ interval_macro = interval_calc.year;
11133
+ } else if (config.nav.interval_override == "years") {
11134
+ interval = interval_calc.year;
11135
+ interval_major = interval_calc.decade;
11136
+ interval_macro = interval_calc.month;
11137
+ } else if (config.nav.interval_override == "months") {
11138
+ interval = interval_calc.month;
11139
+ interval_major = interval_calc.year;
11140
+ interval_macro = interval_calc.day;
11141
+ } else if (config.nav.interval_override == "days") {
11142
+ interval = interval_calc.day;
11143
+ interval_major = interval_calc.month;
11144
+ interval_macro = interval_calc.hour;
11145
+ } else if (config.nav.interval_override == "hours") {
11146
+ interval = interval_calc.hour;
11147
+ interval_major = interval_calc.day;
11148
+ interval_macro = interval_calc.minute;
11149
+ } else if (config.nav.interval_override == "minutes") {
11150
+ interval = interval_calc.minute;
11151
+ interval_major = interval_calc.hour;
11152
+ interval_macro = interval_calc.second;
11153
+ } else if (config.nav.interval_override == "seconds") {
11154
+ interval = interval_calc.second;
11155
+ interval_major = interval_calc.minute;
11156
+ interval_macro = interval_calc.second;
11157
+ } else {
11158
+ trace("NO IDEA WHAT THE TYPE SHOULD BE");
11159
+ interval = interval_calc.day;
11160
+ interval_major = interval_calc.month;
11161
+ interval_macro = interval_calc.hour;
11162
+ }
11163
+ }
11164
+
8753
11165
  createIntervalElements(interval, interval_array, $timeinterval);
8754
11166
  createIntervalElements(interval_major, interval_major_array, $timeintervalmajor);
8755
11167
 
@@ -8763,7 +11175,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8763
11175
  }
8764
11176
  }
8765
11177
 
8766
- var buildMarkers = function() {
11178
+ function buildMarkers() {
8767
11179
 
8768
11180
  var row = 2,
8769
11181
  lpos = 0,
@@ -8799,8 +11211,15 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8799
11211
  _marker_thumb = "";
8800
11212
 
8801
11213
  // THUMBNAIL
11214
+ //trace(data[i].asset);
11215
+ //trace(data[i].asset.thumbnail);
8802
11216
  if (data[i].asset != null && data[i].asset != "") {
8803
- VMM.appendElement(_marker_content, VMM.MediaElement.thumbnail(data[i].asset, 24, 24, data[i].uniqueid));
11217
+ if (data[i].asset.thumbnail != null && data[i].asset.thumbnail != "") {
11218
+ trace("HAS THUMBNAIL");
11219
+ VMM.appendElement(_marker_content, VMM.MediaElement.thumbnail(data[i].asset, 24, 24, data[i].uniqueid));
11220
+ } else {
11221
+ VMM.appendElement(_marker_content, VMM.MediaElement.thumbnail(data[i].asset, 24, 24, data[i].uniqueid));
11222
+ }
8804
11223
  } else {
8805
11224
  VMM.appendElement(_marker_content, "<div style='margin-right:7px;height:50px;width:2px;float:left;'></div>");
8806
11225
  }
@@ -8908,7 +11327,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8908
11327
 
8909
11328
  }
8910
11329
 
8911
- var buildEras = function() {
11330
+ function buildEras() {
8912
11331
  var number_of_colors = 6,
8913
11332
  current_color = 0,
8914
11333
  j = 0;
@@ -8960,6 +11379,7 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
8960
11379
 
8961
11380
  }
8962
11381
 
11382
+
8963
11383
  /* **********************************************
8964
11384
  Begin VMM.Timeline.DataObj.js
8965
11385
  ********************************************** */
@@ -8988,12 +11408,18 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef
8988
11408
  trace("DATA SOURCE: STORIFY");
8989
11409
  VMM.Timeline.DataObj.model.storify.getData(raw_data);
8990
11410
  //http://api.storify.com/v1/stories/number10gov/g8-and-nato-chicago-summit
8991
- } else if (raw_data.match(".jsonp")) {
11411
+ } else if (raw_data.match("\.jsonp")) {
8992
11412
  trace("DATA SOURCE: JSONP");
8993
11413
  LoadLib.js(raw_data, VMM.Timeline.DataObj.onJSONPLoaded);
8994
11414
  } else {
8995
11415
  trace("DATA SOURCE: JSON");
8996
- VMM.getJSON(raw_data + "?callback=onJSONP_Data", VMM.Timeline.DataObj.parseJSON);
11416
+ var req = "";
11417
+ if (raw_data.indexOf("?") > -1) {
11418
+ req = raw_data + "&callback=onJSONP_Data";
11419
+ } else {
11420
+ req = raw_data + "?callback=onJSONP_Data";
11421
+ }
11422
+ VMM.getJSON(req, VMM.Timeline.DataObj.parseJSON);
8997
11423
  }
8998
11424
  } else if (type.of(raw_data) == "html") {
8999
11425
  trace("DATA SOURCE: HTML");
@@ -9132,10 +11558,13 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef
9132
11558
  googlespreadsheet: {
9133
11559
 
9134
11560
  getData: function(raw) {
9135
- var getjsondata, key, url, timeout, tries = 0;
11561
+ var getjsondata, key, worksheet, url, timeout, tries = 0;
9136
11562
 
9137
11563
  key = VMM.Util.getUrlVars(raw)["key"];
9138
- url = "https://spreadsheets.google.com/feeds/list/" + key + "/od6/public/values?alt=json";
11564
+ worksheet = VMM.Util.getUrlVars(raw)["worksheet"];
11565
+ if (typeof worksheet == "undefined") worksheet = "od6";
11566
+
11567
+ url = "https://spreadsheets.google.com/feeds/list/" + key + "/" + worksheet + "/public/values?alt=json";
9139
11568
 
9140
11569
  timeout = setTimeout(function() {
9141
11570
  trace("Google Docs timeout " + url);