123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- /*
- author: Boostraptheme
- author URL: https://boostraptheme.com
- License: Creative Commons Attribution 4.0 Unported
- License URL: https://creativecommons.org/licenses/by/4.0/
- */
- $(document).ready(function () {
- 'use strict';
- // ------------------------------------------------------- //
- // For demo purposes only
- // ------------------------------------------------------ //
- if ($.cookie("theme_csspath")) {
- $('link#theme-stylesheet').attr("href", $.cookie("theme_csspath"));
- }
- $("#colour").change(function () {
- if ($(this).val() !== '') {
- var theme_csspath = 'css/style.' + $(this).val() + '.css';
- $('link#theme-stylesheet').attr("href", theme_csspath);
- $.cookie("theme_csspath", theme_csspath, { expires: 365, path: document.URL.substr(0, document.URL.lastIndexOf('/')) });
- }
- return false;
- });
- // ------------------------------------------------------- //
- // Search Box
- // ------------------------------------------------------ //
- $('#search').on('click', function (e) {
- e.preventDefault();
- $('.search-box').fadeIn();
- });
- $('.dismiss').on('click', function () {
- $('.search-box').fadeOut();
- });
- // ------------------------------------------------------- //
- // Card Close
- // ------------------------------------------------------ //
- $('.card-close a.remove').on('click', function (e) {
- e.preventDefault();
- $(this).parents('.card').fadeOut();
- });
- // ------------------------------------------------------- //
- // Adding fade effect to dropdowns
- // ------------------------------------------------------ //
- $('.dropdown').on('show.bs.dropdown', function () {
- $(this).find('.dropdown-menu').first().stop(true, true).fadeIn();
- });
- $('.dropdown').on('hide.bs.dropdown', function () {
- $(this).find('.dropdown-menu').first().stop(true, true).fadeOut();
- });
- // ------------------------------------------------------- //
- // Login form validation
- // ------------------------------------------------------ //
- $('#login-form').validate({
- messages: {
- loginUsername: 'please enter your username',
- loginPassword: 'please enter your password'
- }
- });
- // ------------------------------------------------------- //
- // Right side navbar
- // ------------------------------------------------------ //
- $("#menu-close").click(function(e) {
- e.preventDefault();
- $("#sidebar-wrapper").toggleClass("active");
- });
- $("#menu-toggle-right").click(function(e) {
- e.preventDefault();
- $("#sidebar-wrapper").toggleClass("active");
- });
- // ------------------------------------------------------- //
- // Register form validation
- // ------------------------------------------------------ //
- $('#register-form').validate({
- messages: {
- registerUsername: 'please enter your first name',
- registerEmail: 'please enter a vaild Email Address',
- registerPassword: 'please enter your password'
- }
- });
- // ------------------------------------------------------- //
- // Sidebar Functionality
- // ------------------------------------------------------ //
- $('#toggle-btn').on('click', function (e) {
- e.preventDefault();
- $(this).toggleClass('active');
- $('.side-navbar').toggleClass('shrinked');
- $('.content-inner').toggleClass('active');
- if ($(window).outerWidth() > 1183) {
- if ($('#toggle-btn').hasClass('active')) {
- $('.navbar-header .brand-small').hide();
- $('.navbar-header .brand-big').show();
- } else {
- $('.navbar-header .brand-small').show();
- $('.navbar-header .brand-big').hide();
- }
- }
- if ($(window).outerWidth() < 1183) {
- $('.navbar-header .brand-small').show();
- }
- });
- // ------------------------------------------------------- //
- // Transition Placeholders
- // ------------------------------------------------------ //
- $('input.input-material').on('focus', function () {
- $(this).siblings('.label-material').addClass('active');
- });
- $('input.input-material').on('blur', function () {
- $(this).siblings('.label-material').removeClass('active');
- if ($(this).val() !== '') {
- $(this).siblings('.label-material').addClass('active');
- } else {
- $(this).siblings('.label-material').removeClass('active');
- }
- });
- // ------------------------------------------------------- //
- // External links to new window
- // ------------------------------------------------------ //
- $('.external').on('click', function (e) {
- e.preventDefault();
- window.open($(this).attr("href"));
- });
- });
- // ------------------------------------------------------- //
- // Extend window in fullscreen
- // ------------------------------------------------------ //
- function toggleFullScreen(elem) {
- if ((document.fullScreenElement !== undefined && document.fullScreenElement === null) || (document.msFullscreenElement !== undefined && document.msFullscreenElement === null) || (document.mozFullScreen !== undefined && !document.mozFullScreen) || (document.webkitIsFullScreen !== undefined && !document.webkitIsFullScreen)) {
- if (elem.requestFullScreen) {
- elem.requestFullScreen();
- } else if (elem.mozRequestFullScreen) {
- elem.mozRequestFullScreen();
- } else if (elem.webkitRequestFullScreen) {
- elem.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
- } else if (elem.msRequestFullscreen) {
- elem.msRequestFullscreen();
- }
- } else {
- if (document.cancelFullScreen) {
- document.cancelFullScreen();
- } else if (document.mozCancelFullScreen) {
- document.mozCancelFullScreen();
- } else if (document.webkitCancelFullScreen) {
- document.webkitCancelFullScreen();
- } else if (document.msExitFullscreen) {
- document.msExitFullscreen();
- }
- }
- }
|