| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655 |
- $(document).ready(function(){
- /* --------------------------------------------------------
- Template Settings
- -----------------------------------------------------------*/
-
- var settings = '<a id="settings" href="#changeSkin" data-toggle="modal">' +
- '<i class="fa fa-gear"></i> Change Skin' +
- '</a>' +
- '<div class="modal fade" id="changeSkin" tabindex="-1" role="dialog" aria-hidden="true">' +
- '<div class="modal-dialog modal-lg">' +
- '<div class="modal-content">' +
- '<div class="modal-header">' +
- '<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>' +
- '<h4 class="modal-title">Change Template Skin</h4>' +
- '</div>' +
- '<div class="modal-body">' +
- '<div class="row template-skins">' +
- '<a data-skin="skin-blur-violate" class="col-sm-2 col-xs-4" href="">' +
- '<img src="img/skin-violate.jpg" alt="">' +
- '</a>' +
- '<a data-skin="skin-blur-lights" class="col-sm-2 col-xs-4" href="">' +
- '<img src="img/skin-lights.jpg" alt="">' +
- '</a>' +
- '<a data-skin="skin-blur-city" class="col-sm-2 col-xs-4" href="">' +
- '<img src="img/skin-city.jpg" alt="">' +
- '</a>' +
- '<a data-skin="skin-blur-greenish" class="col-sm-2 col-xs-4" href="">' +
- '<img src="img/skin-greenish.jpg" alt="">' +
- '</a>' +
- '<a data-skin="skin-blur-night" class="col-sm-2 col-xs-4" href="">' +
- '<img src="img/skin-night.jpg" alt="">' +
- '</a>' +
- '<a data-skin="skin-blur-blue" class="col-sm-2 col-xs-4" href="">' +
- '<img src="img/skin-blue.jpg" alt="">' +
- '</a>' +
- '<a data-skin="skin-blur-sunny" class="col-sm-2 col-xs-4" href="">' +
- '<img src="img/skin-sunny.jpg" alt="">' +
- '</a>' +
- '<a data-skin="skin-cloth" class="col-sm-2 col-xs-4" href="">' +
- '<img src="img/skin-cloth.jpg" alt="">' +
- '</a>' +
- '<a data-skin="skin-tectile" class="col-sm-2 col-xs-4" href="">' +
- '<img src="img/skin-tectile.jpg" alt="">' +
- '</a>' +
- '<a data-skin="skin-blur-chrome" class="col-sm-2 col-xs-4" href="">' +
- '<img src="img/skin-chrome.jpg" alt="">' +
- '</a>' +
- '<a data-skin="skin-blur-ocean" class="col-sm-2 col-xs-4" href="">' +
- '<img src="img/skin-ocean.jpg" alt="">' +
- '</a>' +
- '<a data-skin="skin-blur-sunset" class="col-sm-2 col-xs-4" href="">' +
- '<img src="img/skin-sunset.jpg" alt="">' +
- '</a>' +
- '<a data-skin="skin-blur-yellow" class="col-sm-2 col-xs-4" href="">' +
- '<img src="img/skin-yellow.jpg" alt="">' +
- '</a>' +
- '<a data-skin="skin-blur-kiwi"class="col-sm-2 col-xs-4" href="">' +
- '<img src="img/skin-kiwi.jpg" alt="">' +
- '</a>' +
- '</div>' +
- '</div>' +
- '</div>' +
- '</div>' +
- '</div>';
- $('#main').prepend(settings);
-
- $('body').on('click', '.template-skins > a', function(e){
- e.preventDefault();
- var skin = $(this).data('skin');
- $('body').attr('id', skin);
- $('#changeSkin').modal('hide');
- });
-
- /* --------------------------------------------------------
- Components
- -----------------------------------------------------------*/
- (function(){
- /* Textarea */
- if($('.auto-size')[0]) {
- $('.auto-size').autosize();
- }
- //Select
- if($('.select')[0]) {
- $('.select').selectpicker();
- }
-
- //Sortable
- if($('.sortable')[0]) {
- $('.sortable').sortable();
- }
-
- //Tag Select
- if($('.tag-select')[0]) {
- $('.tag-select').chosen();
- }
-
- /* Tab */
- if($('.tab')[0]) {
- $('.tab a').click(function(e) {
- e.preventDefault();
- $(this).tab('show');
- });
- }
-
- /* Collapse */
- if($('.collapse')[0]) {
- $('.collapse').collapse();
- }
-
- /* Accordion */
- $('.panel-collapse').on('shown.bs.collapse', function () {
- $(this).prev().find('.panel-title a').removeClass('active');
- });
- $('.panel-collapse').on('hidden.bs.collapse', function () {
- $(this).prev().find('.panel-title a').addClass('active');
- });
- //Popover
- if($('.pover')[0]) {
- $('.pover').popover();
- }
- })();
- /* --------------------------------------------------------
- Sidebar + Menu
- -----------------------------------------------------------*/
- (function(){
- /* Menu Toggle */
- $('body').on('click touchstart', '#menu-toggle', function(e){
- e.preventDefault();
- $('html').toggleClass('menu-active');
- $('#sidebar').toggleClass('toggled');
- //$('#content').toggleClass('m-0');
- });
-
- /* Active Menu */
- $('#sidebar .menu-item').hover(function(){
- $(this).closest('.dropdown').addClass('hovered');
- }, function(){
- $(this).closest('.dropdown').removeClass('hovered');
- });
- /* Prevent */
- $('.side-menu .dropdown > a').click(function(e){
- e.preventDefault();
- });
-
- })();
- /* --------------------------------------------------------
- Chart Info
- -----------------------------------------------------------*/
- (function(){
- $('body').on('click touchstart', '.tile .tile-info-toggle', function(e){
- e.preventDefault();
- $(this).closest('.tile').find('.chart-info').toggle();
- });
- })();
- /* --------------------------------------------------------
- Todo List
- -----------------------------------------------------------*/
- (function(){
- setTimeout(function(){
- //Add line-through for alreadt checked items
- $('.todo-list .media .checked').each(function(){
- $(this).closest('.media').find('.checkbox label').css('text-decoration', 'line-through')
- });
- //Add line-through when checking
- $('.todo-list .media input').on('ifChecked', function(){
- $(this).closest('.media').find('.checkbox label').css('text-decoration', 'line-through');
- });
- $('.todo-list .media input').on('ifUnchecked', function(){
- $(this).closest('.media').find('.checkbox label').removeAttr('style');
- });
- })
- })();
- /* --------------------------------------------------------
- Custom Scrollbar
- -----------------------------------------------------------*/
- (function() {
- if($('.overflow')[0]) {
- var overflowRegular, overflowInvisible = false;
- overflowRegular = $('.overflow').niceScroll();
- }
- })();
- /* --------------------------------------------------------
- Messages + Notifications
- -----------------------------------------------------------*/
- (function(){
- $('body').on('click touchstart', '.drawer-toggle', function(e){
- e.preventDefault();
- var drawer = $(this).attr('data-drawer');
- $('.drawer:not("#'+drawer+'")').removeClass('toggled');
- if ($('#'+drawer).hasClass('toggled')) {
- $('#'+drawer).removeClass('toggled');
- }
- else{
- $('#'+drawer).addClass('toggled');
- }
- });
- //Close when click outside
- $(document).on('mouseup touchstart', function (e) {
- var container = $('.drawer, .tm-icon');
- if (container.has(e.target).length === 0) {
- $('.drawer').removeClass('toggled');
- $('.drawer-toggle').removeClass('open');
- }
- });
- //Close
- $('body').on('click touchstart', '.drawer-close', function(){
- $(this).closest('.drawer').removeClass('toggled');
- $('.drawer-toggle').removeClass('open');
- });
- })();
- /* --------------------------------------------------------
- Calendar
- -----------------------------------------------------------*/
- (function(){
-
- //Sidebar
- if ($('#sidebar-calendar')[0]) {
- var date = new Date();
- var d = date.getDate();
- var m = date.getMonth();
- var y = date.getFullYear();
- $('#sidebar-calendar').fullCalendar({
- editable: false,
- events: [],
- header: {
- left: 'title'
- }
- });
- }
- //Content widget
- if ($('#calendar-widget')[0]) {
- $('#calendar-widget').fullCalendar({
- header: {
- left: 'title',
- right: 'prev, next',
- //right: 'month,basicWeek,basicDay'
- },
- editable: true,
- events: [
- {
- title: 'All Day Event',
- start: new Date(y, m, 1)
- },
- {
- title: 'Long Event',
- start: new Date(y, m, d-5),
- end: new Date(y, m, d-2)
- },
- {
- title: 'Repeat Event',
- start: new Date(y, m, 3),
- allDay: false
- },
- {
- title: 'Repeat Event',
- start: new Date(y, m, 4),
- allDay: false
- }
- ]
- });
- }
- })();
- /* --------------------------------------------------------
- RSS Feed widget
- -----------------------------------------------------------*/
- //(function(){
- //if($('#news-feed')[0]){
- // $('#news-feed').FeedEk({
- //FeedUrl: 'http://rss.cnn.com/rss/edition.rss',
- //MaxCount: 5,
- //ShowDesc: false,
- //ShowPubDate: true,
- //DescCharacterLimit: 0
- // });
- //}
- //})();
- /* --------------------------------------------------------
- Chat
- -----------------------------------------------------------*/
- $(function() {
- $('body').on('click touchstart', '.chat-list-toggle', function(){
- $(this).closest('.chat').find('.chat-list').toggleClass('toggled');
- });
- $('body').on('click touchstart', '.chat .chat-header .btn', function(e){
- e.preventDefault();
- $('.chat .chat-list').removeClass('toggled');
- $(this).closest('.chat').toggleClass('toggled');
- });
- $(document).on('mouseup touchstart', function (e) {
- var container = $('.chat, .chat .chat-list');
- if (container.has(e.target).length === 0) {
- container.removeClass('toggled');
- }
- });
- });
- /* --------------------------------------------------------
- Form Validation
- -----------------------------------------------------------*/
- (function(){
- if($("[class*='form-validation']")[0]) {
- $("[class*='form-validation']").validationEngine();
- //Clear Prompt
- $('body').on('click', '.validation-clear', function(e){
- e.preventDefault();
- $(this).closest('form').validationEngine('hide');
- });
- }
- })();
- /* --------------------------------------------------------
- `Color Picker
- -----------------------------------------------------------*/
- (function(){
- //Default - hex
- if($('.color-picker')[0]) {
- $('.color-picker').colorpicker();
- }
-
- //RGB
- if($('.color-picker-rgb')[0]) {
- $('.color-picker-rgb').colorpicker({
- format: 'rgb'
- });
- }
-
- //RGBA
- if($('.color-picker-rgba')[0]) {
- $('.color-picker-rgba').colorpicker({
- format: 'rgba'
- });
- }
-
- //Output Color
- if($('[class*="color-picker"]')[0]) {
- $('[class*="color-picker"]').colorpicker().on('changeColor', function(e){
- var colorThis = $(this).val();
- $(this).closest('.color-pick').find('.color-preview').css('background',e.color.toHex());
- });
- }
- })();
- /* --------------------------------------------------------
- Date Time Picker
- -----------------------------------------------------------*/
- (function(){
- //Date Only
- if($('.date-only')[0]) {
- $('.date-only').datetimepicker({
- pickTime: false
- });
- }
- //Time only
- if($('.time-only')[0]) {
- $('.time-only').datetimepicker({
- pickDate: false
- });
- }
- //12 Hour Time
- if($('.time-only-12')[0]) {
- $('.time-only-12').datetimepicker({
- pickDate: false,
- pick12HourFormat: true
- });
- }
-
- $('.datetime-pick input:text').on('click', function(){
- $(this).closest('.datetime-pick').find('.add-on i').click();
- });
- })();
- /* --------------------------------------------------------
- Input Slider
- -----------------------------------------------------------*/
- (function(){
- if($('.input-slider')[0]) {
- $('.input-slider').slider().on('slide', function(ev){
- $(this).closest('.slider-container').find('.slider-value').val(ev.value);
- });
- }
- })();
- /* --------------------------------------------------------
- WYSIWYE Editor + Markedown
- -----------------------------------------------------------*/
- (function(){
- //Markedown
- if($('.markdown-editor')[0]) {
- $('.markdown-editor').markdown({
- autofocus:false,
- savable:false
- });
- }
-
- //WYSIWYE Editor
- if($('.wysiwye-editor')[0]) {
- $('.wysiwye-editor').summernote({
- height: 200
- });
- }
-
- })();
- /* --------------------------------------------------------
- Media Player
- -----------------------------------------------------------*/
- (function(){
- if($('audio, video')[0]) {
- $('audio,video').mediaelementplayer({
- success: function(player, node) {
- $('#' + node.id + '-mode').html('mode: ' + player.pluginType);
- }
- });
- }
- })();
- /* ---------------------------
- Image Popup [Pirobox]
- --------------------------- */
- (function() {
- if($('.pirobox_gall')[0]) {
- //Fix IE
- jQuery.browser = {};
- (function () {
- jQuery.browser.msie = false;
- jQuery.browser.version = 0;
- if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
- jQuery.browser.msie = true;
- jQuery.browser.version = RegExp.$1;
- }
- })();
-
- //Lightbox
- $().piroBox_ext({
- piro_speed : 700,
- bg_alpha : 0.5,
- piro_scroll : true // pirobox always positioned at the center of the page
- });
- }
- })();
- /* ---------------------------
- Vertical tab
- --------------------------- */
- (function(){
- $('.tab-vertical').each(function(){
- var tabHeight = $(this).outerHeight();
- var tabContentHeight = $(this).closest('.tab-container').find('.tab-content').outerHeight();
- if ((tabContentHeight) > (tabHeight)) {
- $(this).height(tabContentHeight);
- }
- })
- $('body').on('click touchstart', '.tab-vertical li', function(){
- var tabVertical = $(this).closest('.tab-vertical');
- tabVertical.height('auto');
- var tabHeight = tabVertical.outerHeight();
- var tabContentHeight = $(this).closest('.tab-container').find('.tab-content').outerHeight();
- if ((tabContentHeight) > (tabHeight)) {
- tabVertical.height(tabContentHeight);
- }
- });
- })();
-
- /* --------------------------------------------------------
- Login + Sign up
- -----------------------------------------------------------*/
- (function(){
- $('body').on('click touchstart', '.box-switcher', function(e){
- e.preventDefault();
- var box = $(this).attr('data-switch');
- $(this).closest('.box').toggleClass('active');
- $('#'+box).closest('.box').addClass('active');
- });
- })();
-
-
-
- /* --------------------------------------------------------
- Checkbox + Radio
- -----------------------------------------------------------*/
- if($('input:checkbox, input:radio')[0]) {
-
- //Checkbox + Radio skin
- $('input:checkbox:not([data-toggle="buttons"] input, .make-switch input), input:radio:not([data-toggle="buttons"] input)').iCheck({
- checkboxClass: 'icheckbox_minimal',
- radioClass: 'iradio_minimal',
- increaseArea: '20%' // optional
- });
-
- //Checkbox listing
- var parentCheck = $('.list-parent-check');
- var listCheck = $('.list-check');
-
- parentCheck.on('ifChecked', function(){
- $(this).closest('.list-container').find('.list-check').iCheck('check');
- });
-
- parentCheck.on('ifClicked', function(){
- $(this).closest('.list-container').find('.list-check').iCheck('uncheck');
- });
-
- listCheck.on('ifChecked', function(){
- var parent = $(this).closest('.list-container').find('.list-parent-check');
- var thisCheck = $(this).closest('.list-container').find('.list-check');
- var thisChecked = $(this).closest('.list-container').find('.list-check:checked');
-
- if(thisCheck.length == thisChecked.length) {
- parent.iCheck('check');
- }
- });
-
- listCheck.on('ifUnchecked', function(){
- var parent = $(this).closest('.list-container').find('.list-parent-check');
- parent.iCheck('uncheck');
- });
-
- listCheck.on('ifChanged', function(){
- var thisChecked = $(this).closest('.list-container').find('.list-check:checked');
- var showon = $(this).closest('.list-container').find('.show-on');
- if(thisChecked.length > 0 ) {
- showon.show();
- }
- else {
- showon.hide();
- }
- });
-
- }
-
- /* --------------------------------------------------------
- MAC Hack
- -----------------------------------------------------------*/
- (function(){
- //Mac only
- if(navigator.userAgent.indexOf('Mac') > 0) {
- $('body').addClass('mac-os');
- }
- })();
-
- });
- $(window).load(function(){
- /* --------------------------------------------------------
- Tooltips
- -----------------------------------------------------------*/
- (function(){
- if($('.tooltips')[0]) {
- $('.tooltips').tooltip();
- }
- })();
- /* --------------------------------------------------------
- Animate numbers
- -----------------------------------------------------------*/
- $('.quick-stats').each(function(){
- var target = $(this).find('h2');
- var toAnimate = $(this).find('h2').attr('data-value');
- // Animate the element's value from x to y:
- $({someValue: 0}).animate({someValue: toAnimate}, {
- duration: 1000,
- easing:'swing', // can be anything
- step: function() { // called on every step
- // Update the element's text with rounded-up value:
- target.text(commaSeparateNumber(Math.round(this.someValue)));
- }
- });
- function commaSeparateNumber(val){
- while (/(\d+)(\d{3})/.test(val.toString())){
- val = val.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
- }
- return val;
- }
- });
-
- });
- /* --------------------------------------------------------
- Date Time Widget
- -----------------------------------------------------------*/
- (function(){
- var monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
- var dayNames= ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
- // Create a newDate() object
- var newDate = new Date();
- // Extract the current date from Date object
- newDate.setDate(newDate.getDate());
- // Output the day, date, month and year
- $('#date').html(dayNames[newDate.getDay()] + " " + newDate.getDate() + ' ' + monthNames[newDate.getMonth()] + ' ' + newDate.getFullYear());
- setInterval( function() {
- // Create a newDate() object and extract the seconds of the current time on the visitor's
- var seconds = new Date().getSeconds();
- // Add a leading zero to seconds value
- $("#sec").html(( seconds < 10 ? "0":"" ) + seconds);
- },1000);
- setInterval( function() {
- // Create a newDate() object and extract the minutes of the current time on the visitor's
- var minutes = new Date().getMinutes();
- // Add a leading zero to the minutes value
- $("#min").html(( minutes < 10 ? "0":"" ) + minutes);
- },1000);
- setInterval( function() {
- // Create a newDate() object and extract the hours of the current time on the visitor's
- var hours = new Date().getHours();
- // Add a leading zero to the hours value
- $("#hours").html(( hours < 10 ? "0" : "" ) + hours);
- }, 1000);
- })();
|