Diligent web site
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. "use strict";
  2. function isOnScreen(elem) {
  3. // if the element doesn't exist, abort
  4. if( elem.length == 0 ) {
  5. return;
  6. }
  7. var $window = jQuery(window)
  8. var viewport_top = $window.scrollTop()
  9. var viewport_height = $window.height()
  10. var viewport_bottom = viewport_top + viewport_height
  11. var $elem = jQuery(elem)
  12. var top = $elem.offset().top
  13. var height = $elem.height()
  14. var bottom = top + height
  15. return (top >= viewport_top && top < viewport_bottom) ||
  16. (bottom > viewport_top && bottom <= viewport_bottom) ||
  17. (height > viewport_height && top <= viewport_top && bottom >= viewport_bottom)
  18. }
  19. // start custom scripts
  20. (function($) {
  21. jQuery(document).ready(function($){
  22. /*========== Swicher ==========*/
  23. /*========== Progress bar ==========*/
  24. function animate() {
  25. $(".progress-bar").each(function(){
  26. var progressValue = $(this).attr('data-value');
  27. $(this).animate({width: progressValue +'%'}, 6000);
  28. });
  29. }
  30. //career
  31. var expand = false;
  32. $('.position').on('click', function(ev) {
  33. //ev.preventDefault();
  34. $(this).find(".chev").toggleClass('chevron--down chevron--up');
  35. $(this).closest(".position-cont").find(".collapse").toggleClass("show");
  36. $(this).toggleClass("active"); //css({"background-color": "#993c95", "color": "white"});
  37. expand= !expand;
  38. });
  39. $('.chev').on('click', function(ev) {
  40. //ev.preventDefault();
  41. $(this).toggleClass('chevron--down chevron--up');
  42. $(this).closest(".position-cont").find(".collapse").toggleClass("show");
  43. $(this).closest(".position").toggleClass("active"); //css({"background-color": "#993c95", "color": "white"});
  44. expand= !expand;
  45. });
  46. //end career
  47. //apply
  48. // $(".resume-cont").click(function()
  49. // {
  50. // $(".resume-file").click();
  51. // });
  52. if( $("#positions").length)
  53. {
  54. $("#positions").selectize({
  55. create: true,
  56. sortField: {
  57. field: 'text',
  58. direction: 'asc'
  59. },
  60. });
  61. }
  62. var resume = "";
  63. $("input:file").change(function (event){
  64. var fileName = $(this).val();
  65. var reader = new FileReader();
  66. reader.onload = function(e)
  67. {
  68. resume = e.target.result;
  69. }
  70. reader.readAsDataURL(this.files[0]);
  71. var fileExtensionAt = fileName.lastIndexOf(".") + 1;
  72. console.log(fileName.substring(fileExtension, fileName.length));
  73. var fileExtension = fileName.substring(fileExtensionAt, fileName.length);
  74. if(fileName!="" && fileExtension == "doc" || fileExtension == "docx" || fileExtension == "pdf")
  75. {
  76. var from = fileName.lastIndexOf("\\") + 1;
  77. var to = fileName.length ;
  78. fileName = fileName.substring(from, to);
  79. }
  80. else{
  81. fileName="Choose file";
  82. }
  83. $(".resume-file-cont label").html(fileName);
  84. });
  85. $(".btn-delete-file").click(function(e)
  86. {
  87. e.preventDefault();
  88. $(".resume-file-cont label").html("Choose file");
  89. });
  90. var btn_apply = $("#apply-submit");
  91. var apply_form = $("#apply-form");
  92. apply_form.bind('submit', function(ev) {
  93. ev.preventDefault();
  94. var resume_file = document.getElementById("resume-file").files[0];
  95. console.log(resume.toString());
  96. var data = new FormData(document.getElementById("apply-form"));
  97. data.append("resume", "'" + resume + "'");
  98. data.append("resume-file", resume_file);
  99. $.ajax({
  100. url: "job_apply.php?call=upload",
  101. method: "POST",
  102. data: data,
  103. contentType: false,
  104. cache: false,
  105. processData:false,
  106. success : function(data) {
  107. console.log(data)
  108. $(".apply-msg").addClass("active");
  109. },
  110. error: function(error)
  111. {
  112. console.log(console.error);
  113. }
  114. });
  115. });
  116. //apply end
  117. //contact form
  118. var form = document.getElementById("contact-form");
  119. var button = jQuery("#contact-form #submit");
  120. var status = jQuery(".log");
  121. function success(data)
  122. {
  123. form.append(xhr.response);
  124. }
  125. function error()
  126. {
  127. form.append(xhr.response);
  128. }
  129. button.on("submit", function(ev)
  130. {
  131. var data = new FormData(form);
  132. ajax(form.method, form.action, data, success, error);
  133. });
  134. function ajax(method, url, data, success, error) {
  135. var xhr = new XMLHttpRequest();
  136. xhr.open(method, url);
  137. xhr.setRequestHeader("Accept", "application/json");
  138. xhr.onreadystatechange = function() {
  139. if (xhr.readyState !== XMLHttpRequest.DONE) return;
  140. if (xhr.status === 200) {
  141. success();
  142. } else {
  143. error();
  144. }
  145. };
  146. xhr.send(data);
  147. }
  148. //end contact form
  149. // $('#contact-wrap').waypoint(function() {
  150. // animate();
  151. // });
  152. //nikola
  153. $('.clear_storage').on('click', function(e){
  154. window.localStorage.clear();
  155. });
  156. var get_id = localStorage.getItem('pg_id');
  157. // check page id, then scroll to its div
  158. if(get_id)
  159. scrollToID(null, get_id, 300);
  160. // click event to scroll to div
  161. //section link in nav which refer to section on homepage
  162. $('.home_link').on('click', function(e){
  163. e.preventDefault();
  164. var id = '#'+$(this).data('id');
  165. localStorage.setItem('pg_id', id);
  166. var url = $(this).attr("href");
  167. scrollToID(url, id, 300);
  168. });
  169. //Link from our partners section on homepage which refer to section on portfolio page
  170. $('.partners_link').on('click', function(e){
  171. e.preventDefault();
  172. var id = '#'+$(this).data('id');
  173. localStorage.setItem('pg_id', id);
  174. var url = $(this).attr("href");
  175. scrollToID(url, id, 300);
  176. });
  177. function scrollToID(url, id, speed) {
  178. if(url!==null)
  179. {
  180. window.location.href = url;
  181. }
  182. var offSet = 50;
  183. var obj = jQuery(id).offset();
  184. var targetOffset = 0;
  185. if(jQuery(id).length)
  186. {
  187. targetOffset = jQuery(id).offset().top - offSet;
  188. }
  189. jQuery('html,body').animate({ scrollTop: targetOffset }, speed);
  190. }
  191. window.addEventListener('scroll', function(e) {
  192. var loc = window.location;
  193. if(loc.pathname.substring(loc.pathname.lastIndexOf('/') + 1, loc.pathname.length)=='index.html')
  194. {
  195. if( isOnScreen( $( '#intro-wrap' ) ) ) { /* Pass element id/class you want to check */
  196. $("nav li.active").removeClass("active").find('.nav-active-mark').remove();
  197. $("nav li.intro-wrap").addClass("active").append('<span class="nav-active-mark"></span>');
  198. }
  199. if( isOnScreen( $( '#about-wrap' ) ) ) { /* Pass element id/class you want to check */
  200. $("nav li.active").removeClass("active").find('.nav-active-mark').remove();
  201. $("nav li.about-wrap").addClass("active").append('<span class="nav-active-mark"></span>');
  202. }
  203. if( isOnScreen( $( '#our_partners-wrap' ) ) ) { /* Pass element id/class you want to check */
  204. $("nav li.active").removeClass("active").find('.nav-active-mark').remove();
  205. $("nav li.our_partners-wrap").addClass("active").append('<span class="nav-active-mark"></span>');
  206. }
  207. if( isOnScreen( $( '#services-wrap' ) ) ) { /* Pass element id/class you want to check */
  208. $("nav li.active").removeClass("active").find('.nav-active-mark').remove();
  209. $("nav li.services-wrap").addClass("active").append('<span class="nav-active-mark"></span>');
  210. }
  211. if( isOnScreen( $( '#teams-wrap' ) ) ) { /* Pass element id/class you want to check */
  212. $("nav li.active").removeClass("active").find('.nav-active-mark').remove();
  213. $("nav li.teams-wrap").addClass("active").append('<span class="nav-active-mark"></span>');
  214. }
  215. if( isOnScreen( $( '#contact-wrap' ) ) ) { /* Pass element id/class you want to check */
  216. $("nav li.active").removeClass("active").find('.nav-active-mark').remove();
  217. $("nav li.contact-wrap").addClass("active").append('<span class="nav-active-mark"></span>');
  218. }
  219. }
  220. });
  221. //nikola
  222. /*========== Disables ==========*/
  223. if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) {
  224. $('#animate_css_file, #wow_js_file').remove();
  225. } else {
  226. /*========== WOW Animations ==========*/
  227. var wow = new WOW(
  228. {
  229. animateClass: 'animated',
  230. offset: 100
  231. }
  232. );
  233. wow.init();
  234. }
  235. /*========== Logo Retina ==========*/
  236. if( window.devicePixelRatio > 1 ) {
  237. var logoWidth = $('#logo img').width();
  238. var logoHeight = $('#logo img').height();
  239. $('#logo img').attr("src", "images/logo@2x.png");
  240. $('#logo img').css({ 'width': logoWidth , 'height': logoHeight });
  241. }
  242. /*========== Team Item Hover ==========*/
  243. $('.team-item').each(function(){
  244. var memberImage = $(this).find('.member-face').attr('style');
  245. var current = $(this).find('.change-color');
  246. $(this).find('.hex-in2.outer-hex').first().hover(function(){
  247. $(this).find('.member-face').css('background','#000');
  248. $(current).css('background-color','#f3b202');
  249. $(this).find('.socials').show();
  250. },function(){
  251. $(this).find('.socials').hide();
  252. $(this).find('.member-face').attr('style', memberImage);
  253. $(current).css('background-color','#000');
  254. });
  255. });
  256. /*========== Gallery Item Hover ==========*/
  257. $('.gallery-item').hover(function(){
  258. $(this).find('.gallery-info').stop(true,true).animate({ "top": "0" } );
  259. },function(){
  260. $(this).find('.gallery-info').stop(true,true).animate({ "top": "-999" } );
  261. });
  262. /*========== FlexSlider ==========*/
  263. $('.flexslider').flexslider({
  264. animation: "fade",
  265. animationLoop: false,
  266. directionNav: false,
  267. slideshow: false
  268. });
  269. /*========== Pie Chart ==========*/
  270. $('.days').waypoint(function() {
  271. $('.chart').easyPieChart({
  272. easing: 'easeOutBounce',
  273. barColor: '#f3b202',
  274. trackColor: '#595959',
  275. lineWidth: '18',
  276. lineCap: 'butt',
  277. size: '160',
  278. scaleColor: false,
  279. onStep: function(from, to, percent) {
  280. $(this.el).find('.percent').text(Math.round(percent));
  281. }
  282. });
  283. });
  284. /*========== Smooth Scroll ==========*/
  285. $('a[href*=#]:not([href=#])').click(function() {
  286. $("li.active").removeClass("active").find('.nav-active-mark').remove();
  287. $(this).parent().addClass('active').end().append('<span class="nav-active-mark"></span>');
  288. if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
  289. var target = $(this.hash);
  290. target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
  291. if (target.length) {
  292. $('html,body').animate({
  293. scrollTop: target.offset().top - 53
  294. }, 1000);
  295. return false;
  296. }
  297. }
  298. });
  299. /*========== Graph Bars Animate ==========*/
  300. $('.days').waypoint(function() {
  301. $('.graph ul li.bar').each(function() {
  302. var curBarHeight = $(this).data('bar-height');
  303. $(this).animate({ height: curBarHeight }, 2000, "easeInOutBack");
  304. });
  305. });
  306. /*========== Intro Note Box Tooltip ==========*/
  307. /*$('.note-1').hover(function(){
  308. $(this).find('.note-tooltip').fadeIn();
  309. },function(){
  310. $(this).find('.note-tooltip').fadeOut();
  311. });
  312. */
  313. /*========== PrettyPhoto ==========*/
  314. $("a[data-rel^='prettyPhoto']").prettyPhoto({theme:'dark_rounded', hook: 'data-rel'});
  315. /*========== Flickr ==========*/
  316. var flickrImageSrc = [ ];
  317. var flickrLink = [ ];
  318. $('.flickr_badge_image').each(function(i){
  319. flickrImageSrc[i] = $(this).find('img').attr('src');
  320. flickrLink[i] = $(this).find('a').attr('href');
  321. });
  322. $('.flickr-item').each(function(i){
  323. $(this).find('.hex-area').css('background-image', 'url(' + flickrImageSrc[i] + ')');
  324. $(this).find('.flickr-link').attr('href', flickrLink[i] );
  325. });
  326. /*========== Window Resize ==========*/
  327. var windowWidth = $(window).width();
  328. var numberOfHexagon = windowWidth / 106;
  329. var offsetBackground = ((numberOfHexagon - 14) * 106 ) /2;
  330. $('#hexagon-overlay').css('background-position', offsetBackground + 'px' + ' ' + 'top');
  331. $(window).resize(function() {
  332. var currentWindowWidth = $(window).width();
  333. if(currentWindowWidth <= 940) return;
  334. $('#hexagon-overlay').css('background-position', - ( ( (windowWidth - currentWindowWidth)/2 ) - offsetBackground ) + 'px' + ' ' + 'top');
  335. });
  336. /*========== Mobile Menu ==========*/
  337. $('.mobile-nav-toggle').on('click',function(){
  338. if($(this).attr('class') == 'mobile-nav-toggle deactive') {
  339. $('#mobile-navigation').fadeIn();
  340. $(this).removeClass('deactive');
  341. } else {
  342. $('#mobile-navigation').fadeOut();
  343. $(this).addClass('deactive');
  344. }
  345. });
  346. $("#mobile-navigation li a").on("click", function(){
  347. $('#mobile-navigation').fadeOut();
  348. $(".mobile-nav-toggle").addClass('deactive');
  349. });
  350. $(window).resize(function(){
  351. var w = $(window).width();
  352. if(w > 767) {
  353. $('#mobile-navigation').fadeOut();
  354. $(".mobile-nav-toggle").addClass('deactive');
  355. }
  356. });
  357. /*========== Contact Form Validation ==========*/
  358. function isValidEmailAddress(emailAddress) {
  359. var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
  360. return pattern.test(emailAddress);
  361. }
  362. // $('.contact-form form').submit(function() {
  363. // var hasError = false;
  364. // var comment = $('#message-txt').val();
  365. // if ($.trim(comment) == '') {
  366. // $('#message-txt').addClass('error');
  367. // $('#message-txt').focus();
  368. // hasError = true;
  369. // }
  370. // else {
  371. // $('#message-txt').removeClass('error');
  372. // }
  373. // var subject = $('#subject-txt').val();
  374. // if ($.trim(subject) == '') {
  375. // $('#subject-txt').addClass('error');
  376. // $('#subject-txt').focus();
  377. // hasError = true;
  378. // }
  379. // else {
  380. // $('#subject-txt').removeClass('error');
  381. // }
  382. // var emailVal = $('#email-txt').val();
  383. // if ($.trim(emailVal) == '' || !isValidEmailAddress(emailVal)) {
  384. // $('#email-txt').addClass('error');
  385. // $('#email-txt').focus();
  386. // hasError = true;
  387. // }
  388. // else {
  389. // $('#email-txt').removeClass('error');
  390. // }
  391. // var name = $('#name-txt').val();
  392. // if ($.trim(name) == '') {
  393. // $('#name-txt').addClass('error');
  394. // $('#name-txt').focus();
  395. // hasError = true;
  396. // }
  397. // else {
  398. // $('#name-txt').removeClass('error');
  399. // }
  400. // if (!hasError) {
  401. // $('#submit').fadeOut('normal', function(){
  402. // $('.loading').css({
  403. // display: "block"
  404. // });
  405. // });
  406. // // $.post($('.contact-form form').attr('action'), $('.contact-form form').serialize(), function(data){
  407. // // $('.log').html(data);
  408. // // $('.loading').remove();
  409. // // $('.contact-form form').slideUp('slow');
  410. // // });
  411. // }
  412. // return false;
  413. // });
  414. }); // end jquery init
  415. })(jQuery);