Diligent web site
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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