Reac front end for psicometric app

init.js 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. Photon by HTML5 UP
  3. html5up.net | @n33co
  4. Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
  5. */
  6. (function($) {
  7. skel.init({
  8. reset: 'full',
  9. breakpoints: {
  10. global: { href: 'css/style.css', containers: '60em', grid: { gutters: ['2em', 0] } },
  11. xlarge: { media: '(max-width: 1680px)', href: 'css/style-xlarge.css' },
  12. large: { media: '(max-width: 1140px)', href: 'css/style-large.css', containers: '90%', grid: { gutters: ['1.5em', 0] } },
  13. medium: { media: '(max-width: 980px)', href: 'css/style-medium.css', containers: '100%!' },
  14. small: { media: '(max-width: 736px)', href: 'css/style-small.css', viewport: { scalable: false } },
  15. xsmall: { media: '(max-width: 480px)', href: 'css/style-xsmall.css' },
  16. xxsmall: { media: '(max-width: 320px)', href: 'css/style-xxsmall.css' }
  17. }
  18. });
  19. $(function() {
  20. var $window = $(window),
  21. $body = $('body');
  22. // Disable animations/transitions until the page has loaded.
  23. $body.addClass('is-loading');
  24. $window.on('load', function() {
  25. window.setTimeout(function() {
  26. $body.removeClass('is-loading');
  27. }, 250);
  28. });
  29. // Forms.
  30. var $form = $('form');
  31. if ($form.length > 0) {
  32. // Hack: Placeholder fix (IE<10).
  33. if (skel.vars.IEVersion < 10) {
  34. $.fn.n33_formerize=function(){var _fakes=new Array(),_form = $(this);_form.find('input[type=text],textarea').each(function() { var e = $(this); if (e.val() == '' || e.val() == e.attr('placeholder')) { e.addClass('formerize-placeholder'); e.val(e.attr('placeholder')); } }).blur(function() { var e = $(this); if (e.attr('name').match(/_fakeformerizefield$/)) return; if (e.val() == '') { e.addClass('formerize-placeholder'); e.val(e.attr('placeholder')); } }).focus(function() { var e = $(this); if (e.attr('name').match(/_fakeformerizefield$/)) return; if (e.val() == e.attr('placeholder')) { e.removeClass('formerize-placeholder'); e.val(''); } }); _form.find('input[type=password]').each(function() { var e = $(this); var x = $($('<div>').append(e.clone()).remove().html().replace(/type="password"/i, 'type="text"').replace(/type=password/i, 'type=text')); if (e.attr('id') != '') x.attr('id', e.attr('id') + '_fakeformerizefield'); if (e.attr('name') != '') x.attr('name', e.attr('name') + '_fakeformerizefield'); x.addClass('formerize-placeholder').val(x.attr('placeholder')).insertAfter(e); if (e.val() == '') e.hide(); else x.hide(); e.blur(function(event) { event.preventDefault(); var e = $(this); var x = e.parent().find('input[name=' + e.attr('name') + '_fakeformerizefield]'); if (e.val() == '') { e.hide(); x.show(); } }); x.focus(function(event) { event.preventDefault(); var x = $(this); var e = x.parent().find('input[name=' + x.attr('name').replace('_fakeformerizefield', '') + ']'); x.hide(); e.show().focus(); }); x.keypress(function(event) { event.preventDefault(); x.val(''); }); }); _form.submit(function() { $(this).find('input[type=text],input[type=password],textarea').each(function(event) { var e = $(this); if (e.attr('name').match(/_fakeformerizefield$/)) e.attr('name', ''); if (e.val() == e.attr('placeholder')) { e.removeClass('formerize-placeholder'); e.val(''); } }); }).bind("reset", function(event) { event.preventDefault(); $(this).find('select').val($('option:first').val()); $(this).find('input,textarea').each(function() { var e = $(this); var x; e.removeClass('formerize-placeholder'); switch (this.type) { case 'submit': case 'reset': break; case 'password': e.val(e.attr('defaultValue')); x = e.parent().find('input[name=' + e.attr('name') + '_fakeformerizefield]'); if (e.val() == '') { e.hide(); x.show(); } else { e.show(); x.hide(); } break; case 'checkbox': case 'radio': e.attr('checked', e.attr('defaultValue')); break; case 'text': case 'textarea': e.val(e.attr('defaultValue')); if (e.val() == '') { e.addClass('formerize-placeholder'); e.val(e.attr('placeholder')); } break; default: e.val(e.attr('defaultValue')); break; } }); window.setTimeout(function() { for (x in _fakes) _fakes[x].trigger('formerize_sync'); }, 10); }); return _form; };
  35. $form.n33_formerize();
  36. }
  37. }
  38. // Scrolly.
  39. $('.scrolly').scrolly();
  40. });
  41. })(jQuery);