Advertisement
Guest User

Untitled

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