diff --git a/js/app.js b/js/app.js index df982a8e..16a8e40c 100644 --- a/js/app.js +++ b/js/app.js @@ -48,7 +48,7 @@ requirejs.config({ blueImpGallery: 'lib/blueimp-gallery', // v2.21.3 Image Gallery - https://github.com/blueimp/Gallery blueImpGalleryHelper: 'lib/blueimp-helper', // helper function for Blue Imp Gallery blueImpGalleryBootstrap: 'lib/bootstrap-image-gallery', // v3.4.2 Bootstrap extension for Blue Imp Gallery - https://blueimp.github.io/Bootstrap-Image-Gallery - bootstrapConfirmation: 'lib/bootstrap-confirmation', // v1.0.1 Bootstrap extension for inline confirm dialog - https://github.com/tavicu/bs-confirmation + bootstrapConfirmation: 'lib/bootstrap-confirmation', // v1.0.5 Bootstrap extension for inline confirm dialog - https://github.com/tavicu/bs-confirmation bootstrapToggle: 'lib/bootstrap2-toggle.min', // v2.2.0 Bootstrap Toggle (Checkbox) - http://www.bootstraptoggle.com lazyload: 'lib/jquery.lazyload.min', // v1.9.5 LazyLoader images - http://www.appelsiini.net/projects/lazyload diff --git a/js/app/login.js b/js/app/login.js index 1f044500..1c588d76 100644 --- a/js/app/login.js +++ b/js/app/login.js @@ -46,6 +46,9 @@ define([ // cookie hint cookieHintId: 'pf-cookie-hint', // id for "cookie hint" element + // login + ssoButtonClass: 'pf-sso-login-button', // class for SSO login button + // character select characterSelectionClass: 'pf-character-selection', // class for character panel wrapper characterRowAnimateClass: 'pf-character-row-animate', // class for character panel row during animation @@ -66,7 +69,9 @@ define([ serverPanelId: 'pf-server-panel', // id for EVE Online server status panel // animation - animateElementClass: 'pf-animate-on-visible' // class for elements that will be animated to show + animateElementClass: 'pf-animate-on-visible', // class for elements that will be animated to show + + defaultAcceptCookieExpire: 365 // default expire for "accept coolies" cookie }; /** @@ -123,10 +128,39 @@ define([ if(getCookie('cookie') !== '1'){ // hint not excepted $('#' + config.cookieHintId).collapse('show'); + + // show Cookie accept hint on SSO login button + let confirmationSettings = { + container: 'body', + placement: 'bottom', + btnOkClass: 'btn btn-sm btn-default', + btnOkLabel: 'dismiss', + btnOkIcon: 'fa fa-fw fa-sign-in', + title: 'Accept cookies', + btnCancelClass: 'btn btn-sm btn-success', + btnCancelLabel: 'accept', + btnCancelIcon: 'fa fa-fw fa-check', + onCancel: function(e, target){ + // "Accept cookies" + setCookie('cookie', 1, config.defaultAcceptCookieExpire); + + // set "default" href + let href = $(target).data('bs.confirmation').getHref(); + $(e.target).attr('href', href); + }, + onConfirm : function(e, target){ + // "NO cookies" => trigger "default" href link action + }, + href: function(target){ + return $(target).attr('href'); + } + }; + + $('.' + config.ssoButtonClass).confirmation(confirmationSettings); } $('#' + config.cookieHintId + ' .btn-success').on('click', function(){ - setCookie('cookie', 1, 365); + setCookie('cookie', 1, config.defaultAcceptCookieExpire); }); // manual ------------------------------------------------------------- diff --git a/js/app/ui/system_signature.js b/js/app/ui/system_signature.js index 66ae8d80..6640d1e8 100644 --- a/js/app/ui/system_signature.js +++ b/js/app/ui/system_signature.js @@ -2252,7 +2252,7 @@ define([ btnOkClass: 'btn btn-sm btn-danger', btnOkLabel: 'delete', btnOkIcon: 'fa fa-fw fa-close', - onConfirm : function(e, target){ + onConfirm: function(e, target){ // top scroll to top e.preventDefault(); diff --git a/js/lib/bootstrap-confirmation.js b/js/lib/bootstrap-confirmation.js index 78611936..08d46a33 100644 --- a/js/lib/bootstrap-confirmation.js +++ b/js/lib/bootstrap-confirmation.js @@ -1,249 +1,263 @@ +/*! + * Bootstrap Confirmation v1.0.5 + * https://github.com/tavicu/bs-confirmation + */ +function ($) { - 'use strict'; + 'use strict'; - //var for check event at body can have only one. - var event_body = false; + //var for check event at body can have only one. + var event_body = false; - // CONFIRMATION PUBLIC CLASS DEFINITION - // =============================== - var Confirmation = function (element, options) { - var that = this; + // CONFIRMATION PUBLIC CLASS DEFINITION + // =============================== + var Confirmation = function (element, options) { + var that = this; - this.init('confirmation', element, options); + this.init('confirmation', element, options); + + $(element).on('show.bs.confirmation', function(e) { + that.options.onShow(e, this); + + $(this).addClass('open'); + + var options = that.options; + var all = options.all_selector; + + if(options.singleton) + { + $(all).not(that.$element).each(function() + { + if( $(this).hasClass('open') ) + { + $(this).confirmation('hide'); + } + }); + } + }); + + $(element).on('hide.bs.confirmation', function(e) { + that.options.onHide(e, this); + + $(this).removeClass('open'); + }); + + $(element).on('shown.bs.confirmation', function(e) { + var options = that.options; + var all = options.all_selector; + + if(that.isPopout()) { + if(!event_body) { + event_body = $('body').on('click', function (e) { + if(that.$element.is(e.target)) return; + if(that.$element.has(e.target).length) return; + if($('.popover').has(e.target).length) return; + + that.hide(); + that.inState.click = false; + + $('body').unbind(e); + + event_body = false; + + return; + }); + } + } + }); + + if(options.selector) { + $(element).on('click.bs.confirmation', options.selector, function(e) { + e.preventDefault(); + }); + } else { + $(element).on('click.bs.confirmation', function(e) { + e.preventDefault(); + }); + } + } + + if (!$.fn.popover || !$.fn.tooltip) throw new Error('Confirmation requires popover.js and tooltip.js'); + + Confirmation.VERSION = '1.0.5' + + Confirmation.DEFAULTS = $.extend({}, $.fn.popover.Constructor.DEFAULTS, { + placement : 'right', + title : 'Are you sure?', + btnOkClass : 'btn btn-sm btn-danger', + btnOkLabel : 'Delete', + btnOkIcon : 'glyphicon glyphicon-ok', + btnCancelClass : 'btn btn-sm btn-default', + btnCancelLabel : 'Cancel', + btnCancelIcon : 'glyphicon glyphicon-remove', + href : '#', + target : '_self', + singleton : true, + popout : true, + onShow : function(event, element){}, + onHide : function(event, element){}, + onConfirm : function(event, element){}, + onCancel : function(event, element){}, + template : '
' + }); - $(element).on('show.bs.confirmation', function(e) { - that.options.onShow(e, this); + // NOTE: CONFIRMATION EXTENDS popover.js + // ================================ + Confirmation.prototype = $.extend({}, $.fn.popover.Constructor.prototype); - $(this).addClass('open'); + Confirmation.prototype.constructor = Confirmation; - var options = that.options; - var all = options.all_selector; + Confirmation.prototype.getDefaults = function () { + return Confirmation.DEFAULTS; + } - if(options.singleton) - { - $(all).not(that.$element).each(function() - { - if( $(this).hasClass('open') ) - { - $(this).confirmation('hide'); - } - }); - } - }); + Confirmation.prototype.setContent = function () { + var that = this; + var $tip = this.tip(); + var title = this.getTitle(); + var $btnOk = $tip.find('[data-apply="confirmation"]'); + var $btnCancel = $tip.find('[data-dismiss="confirmation"]'); + var options = this.options - $(element).on('hide.bs.confirmation', function(e) { - that.options.onHide(e, this); + $btnOk.addClass(this.getBtnOkClass()) + .html(this.getBtnOkLabel()) + .prepend($('').addClass(this.getBtnOkIcon()), " ") + .attr('href', this.getHref()) + .attr('target', this.getTarget()) + .off('click').on('click', function(event) { + options.onConfirm(event, that.$element); - $(this).removeClass('open'); - }); + // If the button is a submit one + if (that.$element.attr('type') == 'submit') + that.$element.closest('form:first').submit(); - $(element).on('shown.bs.confirmation', function(e) { - var options = that.options; - var all = options.all_selector; + that.hide(); + that.inState.click = false; + }); - that.$element.on('click.dismiss.bs.confirmation', '[data-dismiss="confirmation"]', $.proxy(that.hide, that)); + $btnCancel.addClass(this.getBtnCancelClass()) + .html(this.getBtnCancelLabel()) + .prepend($('').addClass(this.getBtnCancelIcon()), " ") + .off('click').on('click', function(event){ + options.onCancel(event, that.$element); - if(that.isPopout()) { - if(!event_body) { - event_body = $('body').on('click', function (e) { - if(that.$element.is(e.target)) return; - if(that.$element.has(e.target).length) return; - if($('.popover').has(e.target).length) return; + that.hide(); + that.inState.click = false; + }); - that.$element.confirmation('hide'); + $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title); - $('body').unbind(e); + $tip.removeClass('fade top bottom left right in'); - event_body = false; + // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do + // this manually by checking the contents. + if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide(); + } - return; - }); - } - } - }); + Confirmation.prototype.getBtnOkClass = function () { + var $e = this.$element; + var o = this.options; - $(element).on('click', function(e) { - e.preventDefault(); - }); - } + return $e.attr('data-btnOkClass') || (typeof o.btnOkClass == 'function' ? o.btnOkClass.call(this, $e[0]) : o.btnOkClass); + } - if (!$.fn.popover || !$.fn.tooltip) throw new Error('Confirmation requires popover.js and tooltip.js'); + Confirmation.prototype.getBtnOkLabel = function () { + var $e = this.$element; + var o = this.options; - Confirmation.DEFAULTS = $.extend({}, $.fn.popover.Constructor.DEFAULTS, { - placement : 'right', - title : 'Are you sure?', - btnOkClass : 'btn btn-sm btn-danger', - btnOkLabel : 'Delete', - btnOkIcon : 'glyphicon glyphicon-ok', - btnCancelClass : 'btn btn-sm btn-default', - btnCancelLabel : 'Cancel', - btnCancelIcon : 'glyphicon glyphicon-remove', - href : '#', - target : '_self', - singleton : true, - popout : true, - onShow : function(event, element){}, - onHide : function(event, element){}, - onConfirm : function(event, element){}, - onCancel : function(event, element){}, - template : '' - }); + return $e.attr('data-btnOkLabel') || (typeof o.btnOkLabel == 'function' ? o.btnOkLabel.call(this, $e[0]) : o.btnOkLabel); + } + + Confirmation.prototype.getBtnOkIcon = function () { + var $e = this.$element; + var o = this.options; + + return $e.attr('data-btnOkIcon') || (typeof o.btnOkIcon == 'function' ? o.btnOkIcon.call(this, $e[0]) : o.btnOkIcon); + } + + Confirmation.prototype.getBtnCancelClass = function () { + var $e = this.$element; + var o = this.options; + + return $e.attr('data-btnCancelClass') || (typeof o.btnCancelClass == 'function' ? o.btnCancelClass.call(this, $e[0]) : o.btnCancelClass); + } + + Confirmation.prototype.getBtnCancelLabel = function () { + var $e = this.$element; + var o = this.options; + + return $e.attr('data-btnCancelLabel') || (typeof o.btnCancelLabel == 'function' ? o.btnCancelLabel.call(this, $e[0]) : o.btnCancelLabel); + } + + Confirmation.prototype.getBtnCancelIcon = function () { + var $e = this.$element; + var o = this.options; + + return $e.attr('data-btnCancelIcon') || (typeof o.btnCancelIcon == 'function' ? o.btnCancelIcon.call(this, $e[0]) : o.btnCancelIcon); + } + + Confirmation.prototype.getHref = function () { + var $e = this.$element; + var o = this.options; + + return $e.attr('data-href') || (typeof o.href == 'function' ? o.href.call(this, $e[0]) : o.href); + } + + Confirmation.prototype.getTarget = function () { + var $e = this.$element; + var o = this.options; + + return $e.attr('data-target') || (typeof o.target == 'function' ? o.target.call(this, $e[0]) : o.target); + } + + Confirmation.prototype.isPopout = function () { + var popout; + var $e = this.$element; + var o = this.options; + + popout = $e.attr('data-popout') || (typeof o.popout == 'function' ? o.popout.call(this, $e[0]) : o.popout); + + if(popout == 'false') popout = false; + + return popout + } - // NOTE: CONFIRMATION EXTENDS popover.js - // ================================ - Confirmation.prototype = $.extend({}, $.fn.popover.Constructor.prototype); + // CONFIRMATION PLUGIN DEFINITION + // ========================= + var old = $.fn.confirmation; - Confirmation.prototype.constructor = Confirmation; + $.fn.confirmation = function (option) { + var that = this; - Confirmation.prototype.getDefaults = function () { - return Confirmation.DEFAULTS; - } + return this.each(function () { + var $this = $(this); + var data = $this.data('bs.confirmation'); + var options = typeof option == 'object' && option; - Confirmation.prototype.setContent = function () { - var that = this; - var $tip = this.tip(); - var title = this.getTitle(); - var $btnOk = $tip.find('[data-apply="confirmation"]'); - var $btnCancel = $tip.find('[data-dismiss="confirmation"]'); - var options = this.options + options = options || {}; + options.all_selector = that.selector; - $btnOk.addClass(this.getBtnOkClass()) - .html(this.getBtnOkLabel()) - .prepend($('').addClass(this.getBtnOkIcon()), " ") - .attr('href', this.getHref()) - .attr('target', this.getTarget()) - .off('click').on('click', function(event) { - that.$element.confirmation('hide'); + if (!data && option == 'destroy') return; + if (!data) $this.data('bs.confirmation', (data = new Confirmation(this, options))); + if (typeof option == 'string') data[option](); + }); + } - options.onConfirm(event, that.$element); - }); - - $btnCancel.addClass(this.getBtnCancelClass()) - .html(this.getBtnCancelLabel()) - .prepend($('').addClass(this.getBtnCancelIcon()), " ") - .off('click').on('click', function(event){ - options.onCancel(event, that.$element); - - that.$element.confirmation('hide'); - }); - - $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title); - - $tip.removeClass('fade top bottom left right in'); - - // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do - // this manually by checking the contents. - if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide(); - } - - Confirmation.prototype.getBtnOkClass = function () { - var $e = this.$element; - var o = this.options; - - return $e.attr('data-btnOkClass') || (typeof o.btnOkClass == 'function' ? o.btnOkClass.call($e[0]) : o.btnOkClass); - } - - Confirmation.prototype.getBtnOkLabel = function () { - var $e = this.$element; - var o = this.options; - - return $e.attr('data-btnOkLabel') || (typeof o.btnOkLabel == 'function' ? o.btnOkLabel.call($e[0]) : o.btnOkLabel); - } - - Confirmation.prototype.getBtnOkIcon = function () { - var $e = this.$element; - var o = this.options; - - return $e.attr('data-btnOkIcon') || (typeof o.btnOkIcon == 'function' ? o.btnOkIcon.call($e[0]) : o.btnOkIcon); - } - - Confirmation.prototype.getBtnCancelClass = function () { - var $e = this.$element; - var o = this.options; - - return $e.attr('data-btnCancelClass') || (typeof o.btnCancelClass == 'function' ? o.btnCancelClass.call($e[0]) : o.btnCancelClass); - } - - Confirmation.prototype.getBtnCancelLabel = function () { - var $e = this.$element; - var o = this.options; - - return $e.attr('data-btnCancelLabel') || (typeof o.btnCancelLabel == 'function' ? o.btnCancelLabel.call($e[0]) : o.btnCancelLabel); - } - - Confirmation.prototype.getBtnCancelIcon = function () { - var $e = this.$element; - var o = this.options; - - return $e.attr('data-btnCancelIcon') || (typeof o.btnCancelIcon == 'function' ? o.btnCancelIcon.call($e[0]) : o.btnCancelIcon); - } - - Confirmation.prototype.getHref = function () { - var $e = this.$element; - var o = this.options; - - return $e.attr('data-href') || (typeof o.href == 'function' ? o.href.call($e[0]) : o.href); - } - - Confirmation.prototype.getTarget = function () { - var $e = this.$element; - var o = this.options; - - return $e.attr('data-target') || (typeof o.target == 'function' ? o.target.call($e[0]) : o.target); - } - - Confirmation.prototype.isPopout = function () { - var popout; - var $e = this.$element; - var o = this.options; - - popout = $e.attr('data-popout') || (typeof o.popout == 'function' ? o.popout.call($e[0]) : o.popout); - - if(popout == 'false') popout = false; - - return popout - } + $.fn.confirmation.Constructor = Confirmation - // CONFIRMATION PLUGIN DEFINITION - // ========================= - var old = $.fn.confirmation; + // CONFIRMATION NO CONFLICT + // =================== + $.fn.confirmation.noConflict = function () { + $.fn.confirmation = old; - $.fn.confirmation = function (option) { - var that = this; - - return this.each(function () { - var $this = $(this); - var data = $this.data('bs.confirmation'); - var options = typeof option == 'object' && option; - - options = options || {}; - options.all_selector = that.selector; - - if (!data && option == 'destroy') return; - if (!data) $this.data('bs.confirmation', (data = new Confirmation(this, options))); - if (typeof option == 'string') data[option](); - }); - } - - $.fn.confirmation.Constructor = Confirmation - - - // CONFIRMATION NO CONFLICT - // =================== - $.fn.confirmation.noConflict = function () { - $.fn.confirmation = old; - - return this; - } -}(jQuery); \ No newline at end of file + return this; + } +}(jQuery); diff --git a/public/js/v1.2.2/app.js b/public/js/v1.2.2/app.js index df982a8e..16a8e40c 100644 --- a/public/js/v1.2.2/app.js +++ b/public/js/v1.2.2/app.js @@ -48,7 +48,7 @@ requirejs.config({ blueImpGallery: 'lib/blueimp-gallery', // v2.21.3 Image Gallery - https://github.com/blueimp/Gallery blueImpGalleryHelper: 'lib/blueimp-helper', // helper function for Blue Imp Gallery blueImpGalleryBootstrap: 'lib/bootstrap-image-gallery', // v3.4.2 Bootstrap extension for Blue Imp Gallery - https://blueimp.github.io/Bootstrap-Image-Gallery - bootstrapConfirmation: 'lib/bootstrap-confirmation', // v1.0.1 Bootstrap extension for inline confirm dialog - https://github.com/tavicu/bs-confirmation + bootstrapConfirmation: 'lib/bootstrap-confirmation', // v1.0.5 Bootstrap extension for inline confirm dialog - https://github.com/tavicu/bs-confirmation bootstrapToggle: 'lib/bootstrap2-toggle.min', // v2.2.0 Bootstrap Toggle (Checkbox) - http://www.bootstraptoggle.com lazyload: 'lib/jquery.lazyload.min', // v1.9.5 LazyLoader images - http://www.appelsiini.net/projects/lazyload diff --git a/public/js/v1.2.2/app/login.js b/public/js/v1.2.2/app/login.js index 1f044500..1c588d76 100644 --- a/public/js/v1.2.2/app/login.js +++ b/public/js/v1.2.2/app/login.js @@ -46,6 +46,9 @@ define([ // cookie hint cookieHintId: 'pf-cookie-hint', // id for "cookie hint" element + // login + ssoButtonClass: 'pf-sso-login-button', // class for SSO login button + // character select characterSelectionClass: 'pf-character-selection', // class for character panel wrapper characterRowAnimateClass: 'pf-character-row-animate', // class for character panel row during animation @@ -66,7 +69,9 @@ define([ serverPanelId: 'pf-server-panel', // id for EVE Online server status panel // animation - animateElementClass: 'pf-animate-on-visible' // class for elements that will be animated to show + animateElementClass: 'pf-animate-on-visible', // class for elements that will be animated to show + + defaultAcceptCookieExpire: 365 // default expire for "accept coolies" cookie }; /** @@ -123,10 +128,39 @@ define([ if(getCookie('cookie') !== '1'){ // hint not excepted $('#' + config.cookieHintId).collapse('show'); + + // show Cookie accept hint on SSO login button + let confirmationSettings = { + container: 'body', + placement: 'bottom', + btnOkClass: 'btn btn-sm btn-default', + btnOkLabel: 'dismiss', + btnOkIcon: 'fa fa-fw fa-sign-in', + title: 'Accept cookies', + btnCancelClass: 'btn btn-sm btn-success', + btnCancelLabel: 'accept', + btnCancelIcon: 'fa fa-fw fa-check', + onCancel: function(e, target){ + // "Accept cookies" + setCookie('cookie', 1, config.defaultAcceptCookieExpire); + + // set "default" href + let href = $(target).data('bs.confirmation').getHref(); + $(e.target).attr('href', href); + }, + onConfirm : function(e, target){ + // "NO cookies" => trigger "default" href link action + }, + href: function(target){ + return $(target).attr('href'); + } + }; + + $('.' + config.ssoButtonClass).confirmation(confirmationSettings); } $('#' + config.cookieHintId + ' .btn-success').on('click', function(){ - setCookie('cookie', 1, 365); + setCookie('cookie', 1, config.defaultAcceptCookieExpire); }); // manual ------------------------------------------------------------- diff --git a/public/js/v1.2.2/app/ui/system_signature.js b/public/js/v1.2.2/app/ui/system_signature.js index 66ae8d80..6640d1e8 100644 --- a/public/js/v1.2.2/app/ui/system_signature.js +++ b/public/js/v1.2.2/app/ui/system_signature.js @@ -2252,7 +2252,7 @@ define([ btnOkClass: 'btn btn-sm btn-danger', btnOkLabel: 'delete', btnOkIcon: 'fa fa-fw fa-close', - onConfirm : function(e, target){ + onConfirm: function(e, target){ // top scroll to top e.preventDefault(); diff --git a/public/js/v1.2.2/lib/bootstrap-confirmation.js b/public/js/v1.2.2/lib/bootstrap-confirmation.js index 78611936..08d46a33 100644 --- a/public/js/v1.2.2/lib/bootstrap-confirmation.js +++ b/public/js/v1.2.2/lib/bootstrap-confirmation.js @@ -1,249 +1,263 @@ +/*! + * Bootstrap Confirmation v1.0.5 + * https://github.com/tavicu/bs-confirmation + */ +function ($) { - 'use strict'; + 'use strict'; - //var for check event at body can have only one. - var event_body = false; + //var for check event at body can have only one. + var event_body = false; - // CONFIRMATION PUBLIC CLASS DEFINITION - // =============================== - var Confirmation = function (element, options) { - var that = this; + // CONFIRMATION PUBLIC CLASS DEFINITION + // =============================== + var Confirmation = function (element, options) { + var that = this; - this.init('confirmation', element, options); + this.init('confirmation', element, options); + + $(element).on('show.bs.confirmation', function(e) { + that.options.onShow(e, this); + + $(this).addClass('open'); + + var options = that.options; + var all = options.all_selector; + + if(options.singleton) + { + $(all).not(that.$element).each(function() + { + if( $(this).hasClass('open') ) + { + $(this).confirmation('hide'); + } + }); + } + }); + + $(element).on('hide.bs.confirmation', function(e) { + that.options.onHide(e, this); + + $(this).removeClass('open'); + }); + + $(element).on('shown.bs.confirmation', function(e) { + var options = that.options; + var all = options.all_selector; + + if(that.isPopout()) { + if(!event_body) { + event_body = $('body').on('click', function (e) { + if(that.$element.is(e.target)) return; + if(that.$element.has(e.target).length) return; + if($('.popover').has(e.target).length) return; + + that.hide(); + that.inState.click = false; + + $('body').unbind(e); + + event_body = false; + + return; + }); + } + } + }); + + if(options.selector) { + $(element).on('click.bs.confirmation', options.selector, function(e) { + e.preventDefault(); + }); + } else { + $(element).on('click.bs.confirmation', function(e) { + e.preventDefault(); + }); + } + } + + if (!$.fn.popover || !$.fn.tooltip) throw new Error('Confirmation requires popover.js and tooltip.js'); + + Confirmation.VERSION = '1.0.5' + + Confirmation.DEFAULTS = $.extend({}, $.fn.popover.Constructor.DEFAULTS, { + placement : 'right', + title : 'Are you sure?', + btnOkClass : 'btn btn-sm btn-danger', + btnOkLabel : 'Delete', + btnOkIcon : 'glyphicon glyphicon-ok', + btnCancelClass : 'btn btn-sm btn-default', + btnCancelLabel : 'Cancel', + btnCancelIcon : 'glyphicon glyphicon-remove', + href : '#', + target : '_self', + singleton : true, + popout : true, + onShow : function(event, element){}, + onHide : function(event, element){}, + onConfirm : function(event, element){}, + onCancel : function(event, element){}, + template : '' + }); - $(element).on('show.bs.confirmation', function(e) { - that.options.onShow(e, this); + // NOTE: CONFIRMATION EXTENDS popover.js + // ================================ + Confirmation.prototype = $.extend({}, $.fn.popover.Constructor.prototype); - $(this).addClass('open'); + Confirmation.prototype.constructor = Confirmation; - var options = that.options; - var all = options.all_selector; + Confirmation.prototype.getDefaults = function () { + return Confirmation.DEFAULTS; + } - if(options.singleton) - { - $(all).not(that.$element).each(function() - { - if( $(this).hasClass('open') ) - { - $(this).confirmation('hide'); - } - }); - } - }); + Confirmation.prototype.setContent = function () { + var that = this; + var $tip = this.tip(); + var title = this.getTitle(); + var $btnOk = $tip.find('[data-apply="confirmation"]'); + var $btnCancel = $tip.find('[data-dismiss="confirmation"]'); + var options = this.options - $(element).on('hide.bs.confirmation', function(e) { - that.options.onHide(e, this); + $btnOk.addClass(this.getBtnOkClass()) + .html(this.getBtnOkLabel()) + .prepend($('').addClass(this.getBtnOkIcon()), " ") + .attr('href', this.getHref()) + .attr('target', this.getTarget()) + .off('click').on('click', function(event) { + options.onConfirm(event, that.$element); - $(this).removeClass('open'); - }); + // If the button is a submit one + if (that.$element.attr('type') == 'submit') + that.$element.closest('form:first').submit(); - $(element).on('shown.bs.confirmation', function(e) { - var options = that.options; - var all = options.all_selector; + that.hide(); + that.inState.click = false; + }); - that.$element.on('click.dismiss.bs.confirmation', '[data-dismiss="confirmation"]', $.proxy(that.hide, that)); + $btnCancel.addClass(this.getBtnCancelClass()) + .html(this.getBtnCancelLabel()) + .prepend($('').addClass(this.getBtnCancelIcon()), " ") + .off('click').on('click', function(event){ + options.onCancel(event, that.$element); - if(that.isPopout()) { - if(!event_body) { - event_body = $('body').on('click', function (e) { - if(that.$element.is(e.target)) return; - if(that.$element.has(e.target).length) return; - if($('.popover').has(e.target).length) return; + that.hide(); + that.inState.click = false; + }); - that.$element.confirmation('hide'); + $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title); - $('body').unbind(e); + $tip.removeClass('fade top bottom left right in'); - event_body = false; + // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do + // this manually by checking the contents. + if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide(); + } - return; - }); - } - } - }); + Confirmation.prototype.getBtnOkClass = function () { + var $e = this.$element; + var o = this.options; - $(element).on('click', function(e) { - e.preventDefault(); - }); - } + return $e.attr('data-btnOkClass') || (typeof o.btnOkClass == 'function' ? o.btnOkClass.call(this, $e[0]) : o.btnOkClass); + } - if (!$.fn.popover || !$.fn.tooltip) throw new Error('Confirmation requires popover.js and tooltip.js'); + Confirmation.prototype.getBtnOkLabel = function () { + var $e = this.$element; + var o = this.options; - Confirmation.DEFAULTS = $.extend({}, $.fn.popover.Constructor.DEFAULTS, { - placement : 'right', - title : 'Are you sure?', - btnOkClass : 'btn btn-sm btn-danger', - btnOkLabel : 'Delete', - btnOkIcon : 'glyphicon glyphicon-ok', - btnCancelClass : 'btn btn-sm btn-default', - btnCancelLabel : 'Cancel', - btnCancelIcon : 'glyphicon glyphicon-remove', - href : '#', - target : '_self', - singleton : true, - popout : true, - onShow : function(event, element){}, - onHide : function(event, element){}, - onConfirm : function(event, element){}, - onCancel : function(event, element){}, - template : '' - }); + return $e.attr('data-btnOkLabel') || (typeof o.btnOkLabel == 'function' ? o.btnOkLabel.call(this, $e[0]) : o.btnOkLabel); + } + + Confirmation.prototype.getBtnOkIcon = function () { + var $e = this.$element; + var o = this.options; + + return $e.attr('data-btnOkIcon') || (typeof o.btnOkIcon == 'function' ? o.btnOkIcon.call(this, $e[0]) : o.btnOkIcon); + } + + Confirmation.prototype.getBtnCancelClass = function () { + var $e = this.$element; + var o = this.options; + + return $e.attr('data-btnCancelClass') || (typeof o.btnCancelClass == 'function' ? o.btnCancelClass.call(this, $e[0]) : o.btnCancelClass); + } + + Confirmation.prototype.getBtnCancelLabel = function () { + var $e = this.$element; + var o = this.options; + + return $e.attr('data-btnCancelLabel') || (typeof o.btnCancelLabel == 'function' ? o.btnCancelLabel.call(this, $e[0]) : o.btnCancelLabel); + } + + Confirmation.prototype.getBtnCancelIcon = function () { + var $e = this.$element; + var o = this.options; + + return $e.attr('data-btnCancelIcon') || (typeof o.btnCancelIcon == 'function' ? o.btnCancelIcon.call(this, $e[0]) : o.btnCancelIcon); + } + + Confirmation.prototype.getHref = function () { + var $e = this.$element; + var o = this.options; + + return $e.attr('data-href') || (typeof o.href == 'function' ? o.href.call(this, $e[0]) : o.href); + } + + Confirmation.prototype.getTarget = function () { + var $e = this.$element; + var o = this.options; + + return $e.attr('data-target') || (typeof o.target == 'function' ? o.target.call(this, $e[0]) : o.target); + } + + Confirmation.prototype.isPopout = function () { + var popout; + var $e = this.$element; + var o = this.options; + + popout = $e.attr('data-popout') || (typeof o.popout == 'function' ? o.popout.call(this, $e[0]) : o.popout); + + if(popout == 'false') popout = false; + + return popout + } - // NOTE: CONFIRMATION EXTENDS popover.js - // ================================ - Confirmation.prototype = $.extend({}, $.fn.popover.Constructor.prototype); + // CONFIRMATION PLUGIN DEFINITION + // ========================= + var old = $.fn.confirmation; - Confirmation.prototype.constructor = Confirmation; + $.fn.confirmation = function (option) { + var that = this; - Confirmation.prototype.getDefaults = function () { - return Confirmation.DEFAULTS; - } + return this.each(function () { + var $this = $(this); + var data = $this.data('bs.confirmation'); + var options = typeof option == 'object' && option; - Confirmation.prototype.setContent = function () { - var that = this; - var $tip = this.tip(); - var title = this.getTitle(); - var $btnOk = $tip.find('[data-apply="confirmation"]'); - var $btnCancel = $tip.find('[data-dismiss="confirmation"]'); - var options = this.options + options = options || {}; + options.all_selector = that.selector; - $btnOk.addClass(this.getBtnOkClass()) - .html(this.getBtnOkLabel()) - .prepend($('').addClass(this.getBtnOkIcon()), " ") - .attr('href', this.getHref()) - .attr('target', this.getTarget()) - .off('click').on('click', function(event) { - that.$element.confirmation('hide'); + if (!data && option == 'destroy') return; + if (!data) $this.data('bs.confirmation', (data = new Confirmation(this, options))); + if (typeof option == 'string') data[option](); + }); + } - options.onConfirm(event, that.$element); - }); - - $btnCancel.addClass(this.getBtnCancelClass()) - .html(this.getBtnCancelLabel()) - .prepend($('').addClass(this.getBtnCancelIcon()), " ") - .off('click').on('click', function(event){ - options.onCancel(event, that.$element); - - that.$element.confirmation('hide'); - }); - - $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title); - - $tip.removeClass('fade top bottom left right in'); - - // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do - // this manually by checking the contents. - if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide(); - } - - Confirmation.prototype.getBtnOkClass = function () { - var $e = this.$element; - var o = this.options; - - return $e.attr('data-btnOkClass') || (typeof o.btnOkClass == 'function' ? o.btnOkClass.call($e[0]) : o.btnOkClass); - } - - Confirmation.prototype.getBtnOkLabel = function () { - var $e = this.$element; - var o = this.options; - - return $e.attr('data-btnOkLabel') || (typeof o.btnOkLabel == 'function' ? o.btnOkLabel.call($e[0]) : o.btnOkLabel); - } - - Confirmation.prototype.getBtnOkIcon = function () { - var $e = this.$element; - var o = this.options; - - return $e.attr('data-btnOkIcon') || (typeof o.btnOkIcon == 'function' ? o.btnOkIcon.call($e[0]) : o.btnOkIcon); - } - - Confirmation.prototype.getBtnCancelClass = function () { - var $e = this.$element; - var o = this.options; - - return $e.attr('data-btnCancelClass') || (typeof o.btnCancelClass == 'function' ? o.btnCancelClass.call($e[0]) : o.btnCancelClass); - } - - Confirmation.prototype.getBtnCancelLabel = function () { - var $e = this.$element; - var o = this.options; - - return $e.attr('data-btnCancelLabel') || (typeof o.btnCancelLabel == 'function' ? o.btnCancelLabel.call($e[0]) : o.btnCancelLabel); - } - - Confirmation.prototype.getBtnCancelIcon = function () { - var $e = this.$element; - var o = this.options; - - return $e.attr('data-btnCancelIcon') || (typeof o.btnCancelIcon == 'function' ? o.btnCancelIcon.call($e[0]) : o.btnCancelIcon); - } - - Confirmation.prototype.getHref = function () { - var $e = this.$element; - var o = this.options; - - return $e.attr('data-href') || (typeof o.href == 'function' ? o.href.call($e[0]) : o.href); - } - - Confirmation.prototype.getTarget = function () { - var $e = this.$element; - var o = this.options; - - return $e.attr('data-target') || (typeof o.target == 'function' ? o.target.call($e[0]) : o.target); - } - - Confirmation.prototype.isPopout = function () { - var popout; - var $e = this.$element; - var o = this.options; - - popout = $e.attr('data-popout') || (typeof o.popout == 'function' ? o.popout.call($e[0]) : o.popout); - - if(popout == 'false') popout = false; - - return popout - } + $.fn.confirmation.Constructor = Confirmation - // CONFIRMATION PLUGIN DEFINITION - // ========================= - var old = $.fn.confirmation; + // CONFIRMATION NO CONFLICT + // =================== + $.fn.confirmation.noConflict = function () { + $.fn.confirmation = old; - $.fn.confirmation = function (option) { - var that = this; - - return this.each(function () { - var $this = $(this); - var data = $this.data('bs.confirmation'); - var options = typeof option == 'object' && option; - - options = options || {}; - options.all_selector = that.selector; - - if (!data && option == 'destroy') return; - if (!data) $this.data('bs.confirmation', (data = new Confirmation(this, options))); - if (typeof option == 'string') data[option](); - }); - } - - $.fn.confirmation.Constructor = Confirmation - - - // CONFIRMATION NO CONFLICT - // =================== - $.fn.confirmation.noConflict = function () { - $.fn.confirmation = old; - - return this; - } -}(jQuery); \ No newline at end of file + return this; + } +}(jQuery); diff --git a/public/templates/view/login.html b/public/templates/view/login.html index 0fcac607..db405c3d 100644 --- a/public/templates/view/login.html +++ b/public/templates/view/login.html @@ -905,7 +905,8 @@ Pathfinder requires cookies to maintain your login state between browser sessions. Read more.