Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.99 KB | None | 0 0
  1. @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
  2. @using ClientDependency.Core
  3. @using ClientDependency.Core.Mvc
  4. @using AdoramaPix.Umbraco.Core.Models
  5. @using AdoramaPix.Umbraco.Core.Utilities
  6. @using AdoramaPix.Navigation.Clear;
  7. @using Archetype.Models;
  8. @using Archetype.Extensions;
  9.  
  10. @{
  11. Layout = "Master.cshtml";
  12. var globalSettings = Umbraco.ContentSingleAtXPath("//globalSettings");
  13. Html.RequiresCss("~/css/InfoTip.css");
  14. Html.RequiresCss("~/css/adoramapix.ui.css");
  15. Html.RequiresCss("~/css/adoramapix.content.css");
  16. Html.RequiresCss("~/css/adoramapix.hacks.css");
  17. var ogImage = Umbraco.Media(Umbraco.Field("opengraphMetaImage", recursive: true).ToString());
  18. var ogImg = "";
  19. if (ogImage != null)
  20. {
  21. ogImg = ogImage.Url;
  22. }
  23. }
  24. @section metaContent {
  25. <meta property="fb:admins" content="@globalSettings.GetPropertyValue("facebookMeatAdmins")" />
  26. <meta property="fb:app_id" content="@globalSettings.GetPropertyValue("facebookAppID")" />
  27. <meta property="og:type" content="@Umbraco.Field("opengraphMetaType", recursive: true)" />
  28. <meta property="og:title" content="@Umbraco.Field("opengraphMetaTitle", recursive: true)" />
  29. <meta property="og:site_name" content="@Umbraco.Field("opengraphMetaSiteName", recursive: true)" />
  30. <meta property="og:image" content="@ogImg" />
  31. <meta property="og:description" content="@Umbraco.Field("opengraphMetaDescription", recursive: true)" />
  32. <meta name="description" content="@Umbraco.Field("pixMetaDescription", recursive: true)" />
  33. <meta name="keywords" content="@Umbraco.Field("pixMetaKeywords", recursive: true)" />
  34. <meta name="viewport" content="@Umbraco.Field("pixMetaViewport", recursive: true)">
  35. }
  36. @section headContent{
  37. }
  38. @if (sections != null)
  39. {
  40. @Html.RenderArchetypePartialsEx(sections)
  41.  
  42. }
  43.  
  44. @section footer{
  45. <link href="//fonts.googleapis.com/css?family=Lato:400,300,700" rel="stylesheet" type="text/css">
  46. <script src="//use.typekit.net/rqi6qdz.js" type="text/javascript"></script>
  47. <script type="text/javascript">try { Typekit.load(); } catch (e) { }</script>
  48. <style type="text/css">
  49. #stripWrapper { height: 90px; }
  50. </style>
  51.  
  52. <script type="text/javascript">
  53. /*String splited*/
  54. function cutLongString(element, count_lit, light) {
  55. var text = element.html();
  56. var all_len = text.length;
  57. var new_text;
  58.  
  59. if (all_len > count_lit) {
  60. new_text = text.substr(0, (count_lit - 3)) + '...';
  61. if (light) {
  62. var first_part_text = new_text.substr(0, (count_lit - 10));
  63. var light_part_text = new_text.substr((count_lit - 10), count_lit);
  64. var light_text = "";
  65. var array_color = ["#8D8D8D", "#8D8D8D", "#8D8D8D", "#8D8D8D", "#848484", "#949494", "#a4a4a4", "#b4b4b4", "#c4c4c4", "#d4d4d4"];
  66. for (var i = 0; i < 10; i++) {
  67. light_text += "<span style='color: " + array_color[i] + "'>" + light_part_text.substr(i, 1) + "</span>";
  68. }
  69. new_text = first_part_text + light_text;
  70. }
  71. element.html(new_text);
  72. }
  73. }
  74.  
  75. function onBannerClick(flag, url) {
  76. if (flag) {
  77. if (url && url.length > 0) {
  78. window.location = url;
  79. } else {
  80. showLoginPopup(window.location);
  81. }
  82. }
  83. }
  84.  
  85. $(document).ready(function () {
  86. var queryParams = (function () {
  87. var url = window.location.toString();
  88. url.match(/\?(.+)$/);
  89. var params = RegExp.$1;
  90. var params = params.split("&");
  91. var queryStringList = {};
  92.  
  93. for (var i = 0; i < params.length; i++) {
  94. var tmp = params[i].split("=");
  95. queryStringList[tmp[0]] = unescape(tmp[1]);
  96. }
  97. return queryStringList;
  98. })();
  99.  
  100. if (queryParams.NextPage) {
  101. showLoginPopup(queryParams.NextPage);
  102. }
  103. else if (queryParams.Referral)
  104. {
  105. showRegisterPopup(null, queryParams.Referral);
  106. }
  107.  
  108. $('.card .card--text p').each(function () {
  109. cutLongString($(this), 85, true);
  110. });
  111.  
  112.  
  113. var $document = $(document),
  114. $body = $('body'),
  115.  
  116. // js events fired when animations end
  117. animationEnd = "animationend webkitAnimationEnd oanimationend MSAnimationEnd",
  118. transitionEnd = "webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend";
  119.  
  120.  
  121. mfh.apix.CarouselsInstance = new mfh.apix.Carousel();
  122. mfh.apix.CarouselsInstance.init();
  123. (function () {
  124.  
  125. var $extra = $('#hero-carousel-extra'),
  126. biggerHeight = 0,
  127. loop = true,
  128. timer = null,
  129. animTimer = null,
  130. heroCarousel = function (index) {
  131. var $this = $(this),
  132. $pages = $this.children(),
  133. len = $pages.length,
  134. $this = $(this);
  135.  
  136. createNav($this, len, $this);
  137.  
  138. select($this, 0, loop);
  139. },
  140.  
  141. createNav = function ($el, len, $this) {
  142.  
  143. var $nav = $el.next('nav'),
  144. $as;
  145.  
  146. $this.swipe({
  147. swipeLeft: function (event, direction, distance, duration, fingerCount) {
  148. var index = $nav.find('a.active').index() - 1;
  149. select($el, index, false);
  150. },
  151. swipeRight: function (event, direction, distance, duration, fingerCount) {
  152. var index = $nav.find('a.active').index();
  153. var len = $this.children().length;
  154. select($el, index !== len - 1 ? index + 1 : 0, false);
  155. },
  156. threshold: 30
  157. });
  158.  
  159.  
  160. $nav.addClass('nav--carousel');
  161.  
  162. for (var i = 0; i < len; i++) {
  163. $nav.append('<a href="page-' + i + '"></a>');
  164. }
  165.  
  166. $nav.css({
  167. 'margin-left': -($nav.width() / 2) + 'px'
  168. })
  169.  
  170. $as = $nav.find('a');
  171.  
  172. $as.on('click', function (e) {
  173.  
  174. e.preventDefault();
  175.  
  176. var $this = $(this),
  177. index = $as.index($this[0]),
  178. disabled = $this.attr('disabled');
  179.  
  180. if (disabled === undefined) {
  181. loop = false;
  182. select($el, index, loop);
  183. }
  184. });
  185.  
  186. },
  187.  
  188. select = function ($carousel, index, loop) {
  189.  
  190. var $pages = $carousel.children(),
  191. len = $pages.length,
  192. $page = $($carousel.children().get(index)),
  193. $active = $pages.filter('.active'),
  194. $nav = $carousel.next('nav'),
  195. $navItems = $nav.children(),
  196. $navItemsToActive = $($navItems.get(index)),
  197. $extras = $extra.children(),
  198. $extraPage = $($extras.get(index));
  199. $blueBox = $(".b-start-book__content");
  200. $bookStart = $("#start-book");
  201.  
  202. if (timer)
  203. clearTimeout(timer);
  204.  
  205. if ($active == $page)
  206. return;
  207.  
  208. $active.css({
  209. 'z-index': 1
  210. });
  211.  
  212. $page.css({
  213. 'z-index': 2
  214. });
  215.  
  216. if ($extraPage.hasClass("disabled")) {
  217. if (!$blueBox.hasClass("disabled")) {
  218. $blueBox.addClass("disabled")
  219. }
  220. } else {
  221. if ($blueBox.hasClass("disabled")) {
  222. $blueBox.removeClass("disabled");
  223. }
  224. }
  225.  
  226. if ($extraPage.attr("data-url") != undefined) {
  227. if (!$bookStart.hasClass("clickable")) {
  228. $bookStart.addClass("clickable")
  229. }
  230.  
  231. $bookStart
  232. .off("click")
  233. .on("click", function () {
  234. onBannerClick(true, $extraPage.data("url"));
  235. });
  236. } else {
  237. if ($bookStart.hasClass("clickable")) {
  238. $bookStart.removeClass("clickable");
  239. }
  240. $bookStart.off("click");
  241. }
  242.  
  243. $navItems.removeClass('active').attr("disabled", true);
  244. setTimeout(function () {
  245. $navItemsToActive.addClass('active');
  246. }, 0);
  247.  
  248.  
  249. $extras.removeClass('active').css({ 'z-index': 1 });
  250.  
  251. $page.one(transitionEnd, function (e) {
  252. $navItems.attr("disabled", false);
  253. });
  254.  
  255. $active.removeClass('active');
  256. $page.addClass('active');
  257.  
  258. setTimeout(function () {
  259. $extraPage.css({ 'z-index': 2 }).addClass('active');
  260. $navItems.attr("disabled", false);
  261. $navItemsToActive.addClass('active');
  262. }, 250);
  263.  
  264. if (loop) {
  265. timer = setTimeout(function () {
  266. select($carousel, index !== len - 1 ? index + 1 : 0, loop);
  267. }, 10000);
  268. }
  269. };
  270.  
  271. $('.ui--carousel').each(heroCarousel);
  272.  
  273. $extra.find('.carousel--page').each(function () {
  274.  
  275. var $this = $(this),
  276. height = $this.outerHeight();
  277.  
  278. if (height > biggerHeight)
  279. biggerHeight = height;
  280.  
  281. });
  282.  
  283. $extra.height(biggerHeight);
  284.  
  285. if ($('.nav--carousel a').length == 1) {
  286. $('.nav--carousel').hide();
  287. }
  288.  
  289. //For banners
  290.  
  291. }());
  292.  
  293. $(".nav--carousel > a").bind('click', function () {
  294. $('.wrp-banner .start-banner, .wrp-banner .button').css({ 'visibility': 'hidden', 'opacity': '0' });
  295. });
  296.  
  297. /*show hide banner*/
  298. $('.switch-button').hide();
  299. setTimeout(function () {
  300. $('.wrp-banner .button').css({ 'visibility': 'visible', 'opacity': '1' });
  301. }, 10);
  302. setTimeout(function () {
  303. $('.switch-button').show();
  304. $('.wrp-banner .start-banner, .wrp-banner .button').css({ 'visibility': 'hidden', 'opacity': '0' });
  305. }, 15000);
  306.  
  307. });
  308.  
  309. WebFontConfig = {
  310. google: { families: ['Lato:400,300,700'] },
  311. active: function () {
  312. $(this).css('height', '100.01%');
  313. $(this).css('height', 'auto');
  314. }
  315. };
  316.  
  317. (function () {
  318. var wf = document.createElement('script');
  319. wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
  320. '://ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js';
  321. wf.type = 'text/javascript';
  322. wf.async = 'true';
  323. var s = document.getElementsByTagName('script')[0];
  324. s.parentNode.insertBefore(wf, s);
  325.  
  326. var location = 1;
  327. var divID = 'home-banner';
  328. var host = '@Url.Content("~/")';
  329.  
  330. $.get(host + 'app/webapi/generator/' + location + '/banner.js?t=' + Math.random(), function (data) {
  331. $("#" + divID).html(data);
  332. });
  333. })();
  334. </script>
  335. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement