From 8ec83cbf3dfc31a63e5c6eb37bdde00f05cbbc22 Mon Sep 17 00:00:00 2001 From: llj Date: Thu, 11 Apr 2013 15:25:37 +0800 Subject: [PATCH] [sf edit] use 'bootstrap-wysiwyg' as the editor, and rm 'experimental' --- media/css/sf_editor_toolbar.css | 77 ++++++++++++++ media/js/bootstrap-wysiwyg.js | 182 ++++++++++++++++++++++++++++++++ media/js/bootstrap.min.js | 7 ++ media/js/jq.min.js | 9 +- media/js/jquery.hotkeys.js | 100 ++++++++++++++++++ templates/file_edit.html | 130 +++++++++++++++++++---- templates/repo.html | 2 +- 7 files changed, 479 insertions(+), 28 deletions(-) create mode 100644 media/css/sf_editor_toolbar.css create mode 100644 media/js/bootstrap-wysiwyg.js create mode 100644 media/js/bootstrap.min.js create mode 100644 media/js/jquery.hotkeys.js diff --git a/media/css/sf_editor_toolbar.css b/media/css/sf_editor_toolbar.css new file mode 100644 index 0000000000..637b37e9d8 --- /dev/null +++ b/media/css/sf_editor_toolbar.css @@ -0,0 +1,77 @@ +/*! + * Bootstrap v2.3.1 + * + * Copyright 2012 Twitter, Inc + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Designed and built with all the love in the world @twitter by @mdo and @fat. + */ +/* modified according to the need of our project */ +a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;} +a:hover,a:active{outline:0;} +#sf img{max-width:100%;width:auto\9;height:auto;vertical-align:middle;border:0;-ms-interpolation-mode:bicubic;} +button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0;} +button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;} +button,input[type="button"],input[type="reset"],input[type="submit"],input[type="radio"],input[type="checkbox"]{cursor:pointer;} +input[type="file"],input[type="image"],input[type="submit"],input[type="reset"],input[type="button"],input[type="radio"],input[type="checkbox"]{width:auto;} +input[type="file"]{height:30px;*margin-top:4px;line-height:30px;} +.input-append input{position:relative;margin:0;*margin-left:0;vertical-align:top;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px; padding:3px; width:200px;}.input-append input:focus,.input-prepend input:focus,.input-append select:focus,.input-prepend select:focus,.input-append .uneditable-input:focus,.input-prepend .uneditable-input:focus{z-index:2;} +.input-append .btn,.input-prepend .btn,.input-append .btn-group>.dropdown-toggle,.input-prepend .btn-group>.dropdown-toggle{vertical-align:top;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.input-append .active,.input-prepend .active{background-color:#a9dba9;border-color:#46a546;} +.input-append .add-on,.input-append .btn,.input-append .btn-group{margin-left:-1px;} +.input-append .add-on:last-child,.input-append .btn:last-child,.input-append .btn-group:last-child>.dropdown-toggle{-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333333;text-shadow:0 1px 1px rgba(255, 255, 255, 0.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top, #ffffff, #e6e6e6);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));background-image:-webkit-linear-gradient(top, #ffffff, #e6e6e6);background-image:-o-linear-gradient(top, #ffffff, #e6e6e6);background-image:linear-gradient(to bottom, #ffffff, #e6e6e6);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);border:1px solid #cccccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);}.btn:hover,.btn:focus,.btn:active,.btn.active,.btn.disabled,.btn[disabled]{color:#333333;background-color:#e6e6e6;*background-color:#d9d9d9;} +.btn:active,.btn.active{background-color:#cccccc \9;} +.btn:first-child{*margin-left:0;} +.btn:hover,.btn:focus{color:#333333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position 0.1s linear;-moz-transition:background-position 0.1s linear;-o-transition:background-position 0.1s linear;transition:background-position 0.1s linear;} +.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;} +.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);} +input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%;} +button.btn,input[type="submit"].btn{*padding-top:3px;*padding-bottom:3px;}button.btn::-moz-focus-inner,input[type="submit"].btn::-moz-focus-inner{padding:0;border:0;} +.btn-group{position:relative;display:inline-block;*display:inline;*zoom:1;font-size:0;vertical-align:middle;white-space:nowrap;*margin-left:.3em;}.btn-group:first-child{*margin-left:0;} +.btn-group+.btn-group{margin-left:5px;} +.btn-toolbar{font-size:0;margin:5px 0;text-align:center;}.btn-toolbar>.btn+.btn,.btn-toolbar>.btn-group+.btn,.btn-toolbar>.btn+.btn-group{margin-left:5px;} +.btn-group>.btn{position:relative;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;} +.btn-group>.btn+.btn{margin-left:-1px;} +.btn-group>.btn,.btn-group>.dropdown-menu,.btn-group>.popover{font-size:14px;} +.btn-group>.btn-mini{font-size:10.5px;} +.btn-group>.btn-small{font-size:11.9px;} +.btn-group>.btn-large{font-size:17.5px;} +.btn-group>.btn:first-child{margin-left:0;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px;} +.btn-group>.btn:last-child,.btn-group>.dropdown-toggle{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;} +.btn-group>.btn.large:first-child{margin-left:0;-webkit-border-top-left-radius:6px;-moz-border-radius-topleft:6px;border-top-left-radius:6px;-webkit-border-bottom-left-radius:6px;-moz-border-radius-bottomleft:6px;border-bottom-left-radius:6px;} +.btn-group>.btn.large:last-child,.btn-group>.large.dropdown-toggle{-webkit-border-top-right-radius:6px;-moz-border-radius-topright:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;-moz-border-radius-bottomright:6px;border-bottom-right-radius:6px;} +.btn-group>.btn:hover,.btn-group>.btn:focus,.btn-group>.btn:active,.btn-group>.btn.active{z-index:2;} +.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0;} +.btn-group>.btn+.dropdown-toggle{padding-left:8px;padding-right:8px;-webkit-box-shadow:inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);*padding-top:5px;*padding-bottom:5px;} +.btn-group>.btn-mini+.dropdown-toggle{padding-left:5px;padding-right:5px;*padding-top:2px;*padding-bottom:2px;} +.btn-group>.btn-small+.dropdown-toggle{*padding-top:5px;*padding-bottom:4px;} +.btn-group>.btn-large+.dropdown-toggle{padding-left:12px;padding-right:12px;*padding-top:7px;*padding-bottom:7px;} +.btn-group.open .dropdown-toggle{background-image:none;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);} +.btn-group.open .btn.dropdown-toggle{background-color:#e6e6e6;} +.btn .caret{margin:8px 0 0 4px;} +.tooltip{position:absolute;z-index:1030;display:block;visibility:visible;font-size:11px;line-height:1.4;opacity:0;filter:alpha(opacity=0);}.tooltip.in{opacity:0.8;filter:alpha(opacity=80);} +.tooltip.top{margin-top:-3px;padding:5px 0;} +.tooltip.right{margin-left:3px;padding:0 5px;} +.tooltip.bottom{margin-top:3px;padding:5px 0;} +.tooltip.left{margin-left:-3px;padding:0 5px;} +.tooltip-inner{max-width:200px;padding:8px;color:#ffffff;text-align:center;text-decoration:none;background-color:#000000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;} +.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid;} +.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000000;} +.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000000;} +.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000000;} +.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000000;} +.dropup,.dropdown{position:relative;} +.dropdown-toggle{*margin-bottom:-3px;} +.dropdown-toggle:active,.open .dropdown-toggle{outline:0;} +.caret{display:inline-block;width:0;height:0;vertical-align:top;border-top:4px solid #000000;border-right:4px solid transparent;border-left:4px solid transparent;content:"";} +.dropdown .caret{margin-top:8px;margin-left:2px;} +.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;background-color:#ffffff;border:1px solid #ccc;border:1px solid rgba(0, 0, 0, 0.2);*border-right-width:2px;*border-bottom-width:2px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);box-shadow:0 5px 10px rgba(0, 0, 0, 0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box;}.dropdown-menu.pull-right{right:0;left:auto;} +.input-append {padding-left:5px; padding-right:5px;} +.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:20px;color:#333333;white-space:nowrap; text-align:left; cursor:pointer;} +.dropdown-menu>li>a .color-block { display:inline-block; width:100%; height:1.1em; } +.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus,.dropdown-submenu:hover>a,.dropdown-submenu:focus>a{text-decoration:none;color:#ffffff;background-color:#0081c2;background-image:-moz-linear-gradient(top, #0088cc, #0077b3);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));background-image:-webkit-linear-gradient(top, #0088cc, #0077b3);background-image:-o-linear-gradient(top, #0088cc, #0077b3);background-image:linear-gradient(to bottom, #0088cc, #0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);} +.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#ffffff;text-decoration:none;outline:0;background-color:#0081c2;background-image:-moz-linear-gradient(top, #0088cc, #0077b3);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));background-image:-webkit-linear-gradient(top, #0088cc, #0077b3);background-image:-o-linear-gradient(top, #0088cc, #0077b3);background-image:linear-gradient(to bottom, #0088cc, #0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);} +.open{*z-index:1000;}.open>.dropdown-menu{display:block;} +.fade{opacity:0;-webkit-transition:opacity 0.15s linear;-moz-transition:opacity 0.15s linear;-o-transition:opacity 0.15s linear;transition:opacity 0.15s linear;}.fade.in{opacity:1;} diff --git a/media/js/bootstrap-wysiwyg.js b/media/js/bootstrap-wysiwyg.js new file mode 100644 index 0000000000..71637c4c25 --- /dev/null +++ b/media/js/bootstrap-wysiwyg.js @@ -0,0 +1,182 @@ +/* http://github.com/mindmup/bootstrap-wysiwyg */ +/*global jQuery, $, FileReader*/ +/*jslint browser:true*/ +jQuery(function ($) { + 'use strict'; + var readFileIntoDataUrl = function (fileInfo) { + var loader = $.Deferred(), + fReader = new FileReader(); + fReader.onload = function (e) { + loader.resolve(e.target.result); + }; + fReader.onerror = loader.reject; + fReader.onprogress = loader.notify; + fReader.readAsDataURL(fileInfo); + return loader.promise(); + }; + $.fn.cleanHtml = function () { + var html = $(this).html(); + return html && html.replace(/(
|\s|

<\/div>| )*$/, ''); + }; + $.fn.wysiwyg = function (userOptions) { + var editor = this, + selectedRange, + defaultOptions = { + hotKeys: { + 'ctrl+b meta+b': 'bold', + 'ctrl+i meta+i': 'italic', + 'ctrl+u meta+u': 'underline', + 'ctrl+z meta+z': 'undo', + 'ctrl+y meta+y meta+shift+z': 'redo', + 'ctrl+l meta+l': 'justifyleft', + 'ctrl+r meta+r': 'justifyright', + 'ctrl+e meta+e': 'justifycenter', + 'ctrl+j meta+j': 'justifyfull', + 'shift+tab': 'outdent', + 'tab': 'indent' + }, + toolbarSelector: '[data-role=editor-toolbar]', + commandRole: 'edit', + activeToolbarClass: 'btn-info', + selectionMarker: 'edit-focus-marker', + selectionColor: 'darkgrey' + }, + options, + updateToolbar = function () { + if (options.activeToolbarClass) { + $(options.toolbarSelector).find('.btn[data-' + options.commandRole + ']').each(function () { + var command = $(this).data(options.commandRole); + if (document.queryCommandState(command)) { + $(this).addClass(options.activeToolbarClass); + } else { + $(this).removeClass(options.activeToolbarClass); + } + }); + } + }, + execCommand = function (commandWithArgs, valueArg) { + var commandArr = commandWithArgs.split(' '), + command = commandArr.shift(), + args = commandArr.join(' ') + (valueArg || ''); + document.execCommand(command, 0, args); + updateToolbar(); + }, + bindHotkeys = function (hotKeys) { + $.each(hotKeys, function (hotkey, command) { + editor.keydown(hotkey, function (e) { + if (editor.attr('contenteditable') && editor.is(':visible')) { + e.preventDefault(); + e.stopPropagation(); + execCommand(command); + } + }).keyup(hotkey, function (e) { + if (editor.attr('contenteditable') && editor.is(':visible')) { + e.preventDefault(); + e.stopPropagation(); + } + }); + }); + }, + getCurrentRange = function () { + var sel = window.getSelection(); + if (sel.getRangeAt && sel.rangeCount) { + return sel.getRangeAt(0); + } + }, + saveSelection = function () { + selectedRange = getCurrentRange(); + }, + restoreSelection = function () { + var selection = window.getSelection(); + if (selectedRange) { + selection.removeAllRanges(); + selection.addRange(selectedRange); + } + }, + insertFiles = function (files) { + editor.focus(); + $.each(files, function (idx, fileInfo) { + if (/^image\//.test(fileInfo.type)) { + $.when(readFileIntoDataUrl(fileInfo)).done(function (dataUrl) { + execCommand('insertimage', dataUrl); + }); + } + }); + }, + markSelection = function (input, color) { + restoreSelection(); + document.execCommand('hiliteColor', 0, color || 'transparent'); + saveSelection(); + input.data(options.selectionMarker, color); + }, + bindToolbar = function (toolbar, options) { + toolbar.find('a[data-' + options.commandRole + ']').click(function () { + restoreSelection(); + editor.focus(); + execCommand($(this).data(options.commandRole)); + saveSelection(); + }); + toolbar.find('[data-toggle=dropdown]').click(restoreSelection); + + toolbar.find('input[type=text][data-' + options.commandRole + ']').on('webkitspeechchange change', function () { + var newValue = this.value; /* ugly but prevents fake double-calls due to selection restoration */ + this.value = ''; + restoreSelection(); + if (newValue) { + editor.focus(); + execCommand($(this).data(options.commandRole), newValue); + } + saveSelection(); + }).on('focus', function () { + var input = $(this); + if (!input.data(options.selectionMarker)) { + markSelection(input, options.selectionColor); + input.focus(); + } + }).on('blur', function () { + var input = $(this); + if (input.data(options.selectionMarker)) { + markSelection(input, false); + } + }); + toolbar.find('input[type=file][data-' + options.commandRole + ']').change(function () { + restoreSelection(); + if (this.type === 'file' && this.files && this.files.length > 0) { + insertFiles(this.files); + } + saveSelection(); + this.value = ''; + }); + }, + initFileDrops = function () { + editor.on('dragenter dragover', false) + .on('drop', function (e) { + var dataTransfer = e.originalEvent.dataTransfer; + e.stopPropagation(); + e.preventDefault(); + if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) { + insertFiles(dataTransfer.files); + } + }); + }; + options = $.extend({}, defaultOptions, userOptions); + bindHotkeys(options.hotKeys); + initFileDrops(); + bindToolbar($(options.toolbarSelector), options); + editor.attr('contenteditable', true) + .on('mouseup keyup mouseout', function () { + saveSelection(); + updateToolbar(); + }); + $(window).bind('touchend', function (e) { + var isInside = (editor.is(e.target) || editor.has(e.target).length > 0), + currentRange = getCurrentRange(), + clear = currentRange && (currentRange.startContainer === currentRange.endContainer && currentRange.startOffset === currentRange.endOffset); + if (!clear || isInside) { + saveSelection(); + updateToolbar(); + } + }); + return this; + }; +}); diff --git a/media/js/bootstrap.min.js b/media/js/bootstrap.min.js new file mode 100644 index 0000000000..f6736a8608 --- /dev/null +++ b/media/js/bootstrap.min.js @@ -0,0 +1,7 @@ +/** +* Bootstrap.js by @fat & @mdo +* plugins: bootstrap-transition.js, bootstrap-modal.js, bootstrap-dropdown.js, bootstrap-scrollspy.js, bootstrap-tab.js, bootstrap-tooltip.js, bootstrap-popover.js, bootstrap-affix.js, bootstrap-alert.js, bootstrap-button.js, bootstrap-collapse.js, bootstrap-carousel.js, bootstrap-typeahead.js +* Copyright 2012 Twitter, Inc. +* http://www.apache.org/licenses/LICENSE-2.0.txt +*/ +!function(a){a(function(){a.support.transition=function(){var a=function(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},c;for(c in b)if(a.style[c]!==undefined)return b[c]}();return a&&{end:a}}()})}(window.jQuery),!function(a){var b=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this,c=a.Event("show");this.$element.trigger(c);if(this.isShown||c.isDefaultPrevented())return;this.isShown=!0,this.escape(),this.backdrop(function(){var c=a.support.transition&&b.$element.hasClass("fade");b.$element.parent().length||b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in").attr("aria-hidden",!1),b.enforceFocus(),c?b.$element.one(a.support.transition.end,function(){b.$element.focus().trigger("shown")}):b.$element.focus().trigger("shown")})},hide:function(b){b&&b.preventDefault();var c=this;b=a.Event("hide"),this.$element.trigger(b);if(!this.isShown||b.isDefaultPrevented())return;this.isShown=!1,this.escape(),a(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),a.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal()},enforceFocus:function(){var b=this;a(document).on("focusin.modal",function(a){b.$element[0]!==a.target&&!b.$element.has(a.target).length&&b.$element.focus()})},escape:function(){var a=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(b){b.which==27&&a.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),b.hideModal()},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),b.hideModal()})},hideModal:function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden")})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},backdrop:function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('