spud_core 0.8.28 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/spud/admin/application.js +80 -39
- data/app/assets/javascripts/spud/admin/editor.js +91 -0
- data/app/assets/libs/bootstrap/css/bootstrap-responsive.css +799 -397
- data/app/assets/libs/bootstrap/css/bootstrap.css +3275 -1372
- data/app/assets/libs/bootstrap/img/glyphicons-halflings-white.png +0 -0
- data/app/assets/libs/bootstrap/img/glyphicons-halflings.png +0 -0
- data/app/assets/libs/bootstrap/js/bootstrap.js +716 -417
- data/app/assets/libs/datepicker/css/datepicker.css +223 -0
- data/app/assets/libs/datepicker/js/bootstrap-datepicker.js +779 -0
- data/app/assets/libs/datepicker/less/datepicker.less +122 -0
- data/app/assets/libs/jquery-ui/css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/libs/jquery-ui/css/flick/images/ui-bg_flat_0_eeeeee_40x100.png +0 -0
- data/app/assets/libs/jquery-ui/css/flick/images/ui-bg_flat_55_ffffff_40x100.png +0 -0
- data/app/assets/libs/jquery-ui/css/flick/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/libs/jquery-ui/css/flick/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/libs/jquery-ui/css/flick/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png +0 -0
- data/app/assets/libs/jquery-ui/css/flick/images/ui-bg_highlight-soft_25_0073ea_1x100.png +0 -0
- data/app/assets/libs/jquery-ui/css/flick/images/ui-bg_highlight-soft_50_dddddd_1x100.png +0 -0
- data/app/assets/libs/jquery-ui/css/flick/images/ui-icons_0073ea_256x240.png +0 -0
- data/app/assets/libs/jquery-ui/css/flick/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/libs/jquery-ui/css/flick/images/ui-icons_666666_256x240.png +0 -0
- data/app/assets/libs/jquery-ui/css/flick/images/ui-icons_ff0084_256x240.png +0 -0
- data/app/assets/libs/jquery-ui/css/flick/images/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/libs/jquery-ui/css/flick/jquery-ui-1.9.1.custom.css +297 -0
- data/app/assets/libs/jquery-ui/css/flick/jquery-ui-1.9.1.custom.min.css +5 -0
- data/app/assets/libs/jquery-ui/js/jquery-ui-1.9.1.custom.js +4870 -0
- data/app/assets/libs/jquery-ui/js/jquery-ui-1.9.1.custom.min.js +6 -0
- data/app/assets/stylesheets/spud/admin/application.css +22 -4
- data/app/controllers/spud/admin/application_controller.rb +13 -4
- data/app/controllers/spud/admin/dashboard_controller.rb +1 -1
- data/app/controllers/spud/admin/users_controller.rb +4 -9
- data/app/controllers/spud/setup_controller.rb +3 -4
- data/app/models/spud_admin_permission.rb +1 -1
- data/app/models/spud_user.rb +4 -2
- data/app/views/layouts/spud/admin/application.html.erb +24 -5
- data/app/views/spud/admin/users/_edit.html.erb +2 -4
- data/app/views/spud/admin/users/_new.html.erb +3 -5
- data/app/views/spud/admin/users/index.html.erb +6 -5
- data/lib/spud_core/belongs_to_app.rb +9 -6
- data/lib/spud_core/configuration.rb +23 -1
- data/lib/spud_core/engine.rb +20 -28
- data/lib/spud_core/version.rb +1 -1
- data/spec/dummy/log/development.log +15 -37
- data/spec/dummy/log/test.log +72841 -25918
- metadata +25 -101
- data/app/assets/libs/bootstrap/css/bootstrap-responsive.min.css +0 -12
- data/app/assets/libs/bootstrap/css/bootstrap.min.css +0 -689
- data/app/assets/libs/bootstrap/js/bootstrap.min.js +0 -6
- data/app/assets/libs/tiny_mce/plugins/autosave/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/autosave/editor_plugin_src.js +0 -431
- data/app/assets/libs/tiny_mce/plugins/autosave/langs/en.js +0 -4
- data/app/assets/libs/tiny_mce/plugins/bbcode/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/bbcode/editor_plugin_src.js +0 -120
- data/app/assets/libs/tiny_mce/plugins/emotions/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/emotions/editor_plugin_src.js +0 -43
- data/app/assets/libs/tiny_mce/plugins/emotions/emotions.htm +0 -42
- data/app/assets/libs/tiny_mce/plugins/emotions/img/smiley-cool.gif +0 -0
- data/app/assets/libs/tiny_mce/plugins/emotions/img/smiley-cry.gif +0 -0
- data/app/assets/libs/tiny_mce/plugins/emotions/img/smiley-embarassed.gif +0 -0
- data/app/assets/libs/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
- data/app/assets/libs/tiny_mce/plugins/emotions/img/smiley-frown.gif +0 -0
- data/app/assets/libs/tiny_mce/plugins/emotions/img/smiley-innocent.gif +0 -0
- data/app/assets/libs/tiny_mce/plugins/emotions/img/smiley-kiss.gif +0 -0
- data/app/assets/libs/tiny_mce/plugins/emotions/img/smiley-laughing.gif +0 -0
- data/app/assets/libs/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
- data/app/assets/libs/tiny_mce/plugins/emotions/img/smiley-sealed.gif +0 -0
- data/app/assets/libs/tiny_mce/plugins/emotions/img/smiley-smile.gif +0 -0
- data/app/assets/libs/tiny_mce/plugins/emotions/img/smiley-surprised.gif +0 -0
- data/app/assets/libs/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
- data/app/assets/libs/tiny_mce/plugins/emotions/img/smiley-undecided.gif +0 -0
- data/app/assets/libs/tiny_mce/plugins/emotions/img/smiley-wink.gif +0 -0
- data/app/assets/libs/tiny_mce/plugins/emotions/img/smiley-yell.gif +0 -0
- data/app/assets/libs/tiny_mce/plugins/emotions/js/emotions.js +0 -43
- data/app/assets/libs/tiny_mce/plugins/emotions/langs/en_dlg.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/fullpage/css/fullpage.css +0 -143
- data/app/assets/libs/tiny_mce/plugins/fullpage/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/fullpage/editor_plugin_src.js +0 -405
- data/app/assets/libs/tiny_mce/plugins/fullpage/fullpage.htm +0 -259
- data/app/assets/libs/tiny_mce/plugins/fullpage/js/fullpage.js +0 -232
- data/app/assets/libs/tiny_mce/plugins/fullpage/langs/en_dlg.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/fullscreen/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/fullscreen/editor_plugin_src.js +0 -159
- data/app/assets/libs/tiny_mce/plugins/fullscreen/fullscreen.htm +0 -110
- data/app/assets/libs/tiny_mce/plugins/insertdatetime/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/insertdatetime/editor_plugin_src.js +0 -83
- data/app/assets/libs/tiny_mce/plugins/legacyoutput/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/legacyoutput/editor_plugin_src.js +0 -139
- data/app/assets/libs/tiny_mce/plugins/nonbreaking/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/nonbreaking/editor_plugin_src.js +0 -54
- data/app/assets/libs/tiny_mce/plugins/noneditable/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/noneditable/editor_plugin_src.js +0 -454
- data/app/assets/libs/tiny_mce/plugins/pagebreak/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/pagebreak/editor_plugin_src.js +0 -74
- data/app/assets/libs/tiny_mce/plugins/preview/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/preview/editor_plugin_src.js +0 -53
- data/app/assets/libs/tiny_mce/plugins/preview/example.html +0 -28
- data/app/assets/libs/tiny_mce/plugins/preview/jscripts/embed.js +0 -73
- data/app/assets/libs/tiny_mce/plugins/preview/preview.html +0 -17
- data/app/assets/libs/tiny_mce/plugins/print/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/print/editor_plugin_src.js +0 -34
- data/app/assets/libs/tiny_mce/plugins/save/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/save/editor_plugin_src.js +0 -101
- data/app/assets/libs/tiny_mce/plugins/searchreplace/css/searchreplace.css +0 -6
- data/app/assets/libs/tiny_mce/plugins/searchreplace/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/searchreplace/editor_plugin_src.js +0 -61
- data/app/assets/libs/tiny_mce/plugins/searchreplace/js/searchreplace.js +0 -142
- data/app/assets/libs/tiny_mce/plugins/searchreplace/langs/en_dlg.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/searchreplace/searchreplace.htm +0 -100
- data/app/assets/libs/tiny_mce/plugins/tabfocus/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/tabfocus/editor_plugin_src.js +0 -122
- data/app/assets/libs/tiny_mce/plugins/template/blank.htm +0 -12
- data/app/assets/libs/tiny_mce/plugins/template/css/template.css +0 -23
- data/app/assets/libs/tiny_mce/plugins/template/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/template/editor_plugin_src.js +0 -159
- data/app/assets/libs/tiny_mce/plugins/template/js/template.js +0 -106
- data/app/assets/libs/tiny_mce/plugins/template/langs/en_dlg.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/template/template.htm +0 -31
- data/app/assets/libs/tiny_mce/plugins/visualblocks/css/visualblocks.css +0 -21
- data/app/assets/libs/tiny_mce/plugins/visualblocks/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/visualblocks/editor_plugin_src.js +0 -63
- data/app/assets/libs/tiny_mce/plugins/visualchars/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/visualchars/editor_plugin_src.js +0 -83
- data/app/assets/libs/tiny_mce/plugins/wordcount/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/wordcount/editor_plugin_src.js +0 -122
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/abbr.htm +0 -142
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/acronym.htm +0 -142
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/attributes.htm +0 -149
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/cite.htm +0 -142
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/css/attributes.css +0 -11
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/css/popup.css +0 -9
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/del.htm +0 -162
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/editor_plugin.js +0 -1
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js +0 -132
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/ins.htm +0 -162
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/js/abbr.js +0 -28
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/js/acronym.js +0 -28
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/js/attributes.js +0 -111
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/js/cite.js +0 -28
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/js/del.js +0 -53
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/js/element_common.js +0 -229
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/js/ins.js +0 -53
- data/app/assets/libs/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js +0 -1
@@ -1,6 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Bootstrap.js by @fat & @mdo
|
3
|
-
* Copyright 2012 Twitter, Inc.
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0.txt
|
5
|
-
*/
|
6
|
-
!function(a){a(function(){"use strict",a.support.transition=function(){var b=document.body||document.documentElement,c=b.style,d=c.transition!==undefined||c.WebkitTransition!==undefined||c.MozTransition!==undefined||c.MsTransition!==undefined||c.OTransition!==undefined;return d&&{end:function(){var b="TransitionEnd";return a.browser.webkit?b="webkitTransitionEnd":a.browser.mozilla?b="transitionend":a.browser.opera&&(b="oTransitionEnd"),b}()}}()})}(window.jQuery),!function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype={constructor:c,close:function(b){function f(){e.trigger("closed").remove()}var c=a(this),d=c.attr("data-target"),e;d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),e=a(d),e.trigger("close"),b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.trigger("close").removeClass("in"),a.support.transition&&e.hasClass("fade")?e.on(a.support.transition.end,f):f()}},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype={constructor:b,setState:function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},toggle:function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")}},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.carousel.defaults,c),this.options.slide&&this.slide(this.options.slide),this.options.pause=="hover"&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.prototype={cycle:function(){return this.interval=setInterval(a.proxy(this.next,this),this.options.interval),this},to:function(b){var c=this.$element.find(".active"),d=c.parent().children(),e=d.index(c),f=this;if(b>d.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){f.to(b)}):e==b?this.pause().cycle():this.slide(b>e?"next":"prev",a(d[b]))},pause:function(){return clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(b,c){var d=this.$element.find(".active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this;this.sliding=!0,f&&this.pause(),e=e.length?e:this.$element.find(".item")[h]();if(e.hasClass("active"))return;return!a.support.transition&&this.$element.hasClass("slide")?(this.$element.trigger("slide"),d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")):(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),this.$element.trigger("slide"),this.$element.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)})),f&&this.cycle(),this}},a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("carousel"),f=typeof c=="object"&&c;e||d.data("carousel",e=new b(this,f)),typeof c=="number"?e.to(c):typeof c=="string"||(c=f.slide)?e[c]():e.cycle()})},a.fn.carousel.defaults={interval:5e3,pause:"hover"},a.fn.carousel.Constructor=b,a(function(){a("body").on("click.carousel.data-api","[data-slide]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=!e.data("modal")&&a.extend({},e.data(),c.data());e.carousel(f),b.preventDefault()})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find(".in"),e;d&&d.length&&(e=d.data("collapse"),d.collapse("hide"),e||d.data("collapse",null)),this.$element[b](0),this.transition("addClass","show","shown"),this.$element[b](this.$element[0][c])},hide:function(){var a=this.dimension();this.reset(this.$element[a]()),this.transition("removeClass","hide","hidden"),this.$element[a](0)},reset:function(a){var b=this.dimension();return this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element[a?"addClass":"removeClass"]("collapse"),this},transition:function(b,c,d){var e=this,f=function(){c=="show"&&e.reset(),e.$element.trigger(d)};this.$element.trigger(c)[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){function d(){a(b).parent().removeClass("open")}"use strict";var b='[data-toggle="dropdown"]',c=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};c.prototype={constructor:c,toggle:function(b){var c=a(this),e=c.attr("data-target"),f,g;return e||(e=c.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,"")),f=a(e),f.length||(f=c.parent()),g=f.hasClass("open"),d(),!g&&f.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var d=a(this),e=d.data("dropdown");e||d.data("dropdown",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.dropdown.Constructor=c,a(function(){a("html").on("click.dropdown.data-api",d),a("body").on("click.dropdown.data-api",b,c.prototype.toggle)})}(window.jQuery),!function(a){function c(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),d.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),d.call(b)})}function d(a){this.$element.hide().trigger("hidden"),e.call(this)}function e(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('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),e?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(f,this)):f.call(this)):b&&b()}function f(){this.$backdrop.remove(),this.$backdrop=null}function g(){var b=this;this.isShown&&this.options.keyboard?a(document).on("keyup.dismiss.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).off("keyup.dismiss.modal")}"use strict";var b=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this))};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this;if(this.isShown)return;a("body").addClass("modal-open"),this.isShown=!0,this.$element.trigger("show"),g.call(this),e.call(this,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"),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(b){b&&b.preventDefault();if(!this.isShown)return;var e=this;this.isShown=!1,a("body").removeClass("modal-open"),g.call(this),this.$element.trigger("hide").removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?c.call(this):d.call(this)}},a.fn.modal=function(c){return this.each(function(){var d=a(this),e=d.data("modal"),f=a.extend({},a.fn.modal.defaults,d.data(),typeof c=="object"&&c);e||d.data("modal",e=new b(this,f)),typeof c=="string"?e[c]():f.show&&e.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},a.fn.modal.Constructor=b,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({},e.data(),c.data());b.preventDefault(),e.modal(f)})})}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);!c.options.delay||!c.options.delay.show?c.show():(c.hoverState="in",setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show))},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);!c.options.delay||!c.options.delay.hide?c.hide():(c.hoverState="out",setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide))},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},setContent:function(){var a=this.tip();a.find(".tooltip-inner").html(this.getTitle()),a.removeClass("fade in top bottom left right")},hide:function(){function d(){var b=setTimeout(function(){c.off(a.support.transition.end).remove()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.remove()})}var b=this,c=this.tip();c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d():c.remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a=(a||"").toString().replace(/(^\s*|\s*$)/,""),a},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,delay:0,selector:!1,placement:"top",trigger:"hover",title:"",template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'}}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var b=this.tip(),c=this.getTitle(),d=this.getContent();b.find(".popover-title")[a.type(c)=="object"?"append":"html"](c),b.find(".popover-content > *")[a.type(d)=="object"?"append":"html"](d),b.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-content")||(typeof c.content=="function"?c.content.call(b[0]):c.content),a=a.toString().replace(/(^\s*|\s*$)/,""),a},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip}}),a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("popover"),f=typeof c=="object"&&c;e||d.data("popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.defaults=a.extend({},a.fn.tooltip.defaults,{placement:"right",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),!function(a){function b(b,c){var d=a.proxy(this.process,this),e=a(b).is("body")?a(window):a(b),f;this.options=a.extend({},a.fn.scrollspy.defaults,c),this.$scrollElement=e.on("scroll.scroll.data-api",d),this.selector=(this.options.target||(f=a(b).attr("href"))&&f.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=a("body").on("click.scroll.data-api",this.selector,d),this.refresh(),this.process()}"use strict",b.prototype={constructor:b,refresh:function(){this.targets=this.$body.find(this.selector).map(function(){var b=a(this).attr("href");return/^#\w/.test(b)&&a(b).length?b:null}),this.offsets=a.map(this.targets,function(b){return a(b).position().top})},process:function(){var a=this.$scrollElement.scrollTop()+this.options.offset,b=this.offsets,c=this.targets,d=this.activeTarget,e;for(e=b.length;e--;)d!=c[e]&&a>=b[e]&&(!b[e+1]||a<=b[e+1])&&this.activate(c[e])},activate:function(a){var b;this.activeTarget=a,this.$body.find(this.selector).parent(".active").removeClass("active"),b=this.$body.find(this.selector+'[href="'+a+'"]').parent("li").addClass("active"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active")}},a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("scrollspy"),f=typeof c=="object"&&c;e||d.data("scrollspy",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.defaults={offset:10},a(function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),!function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype={constructor:b,show:function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target"),e,f;d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));if(b.parent("li").hasClass("active"))return;e=c.find(".active a").last()[0],b.trigger({type:"show",relatedTarget:e}),f=a(d),this.activate(b.parent("li"),c),this.activate(f,f.parent(),function(){b.trigger({type:"shown",relatedTarget:e})})},activate:function(b,c,d){function g(){e.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),f?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var e=c.find("> .active"),f=d&&a.support.transition&&e.hasClass("fade");f?e.one(a.support.transition.end,g):g(),e.removeClass("in")}},a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("tab");e||d.data("tab",e=new b(this)),typeof c=="string"&&e[c]()})},a.fn.tab.Constructor=b,a(function(){a("body").on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.$menu=a(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(a),this.$element.change(),this.hide()},show:function(){var b=a.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c=this,d,e;return this.query=this.$element.val(),this.query?(d=a.grep(this.source,function(a){if(c.matcher(a))return a}),d=this.sorter(d),d.length?this.render(d.slice(0,this.options.items)).show():this.shown?this.hide():this):this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){var b=[],c=[],d=[],e;while(e=a.shift())e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?c.push(e):d.push(e):b.push(e);return b.concat(c,d)},highlighter:function(a){return a.replace(new RegExp("("+this.query+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){switch(a.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}a.stopPropagation(),a.preventDefault()},keypress:function(a){if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:a.preventDefault(),this.prev();break;case 40:a.preventDefault(),this.next()}a.stopPropagation()},blur:function(a){var b=this;setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(c){return this.each(function(){var d=a(this),e=d.data("typeahead"),f=typeof c=="object"&&c;e||d.data("typeahead",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>'},a.fn.typeahead.Constructor=b,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);if(c.data("typeahead"))return;b.preventDefault(),c.typeahead(c.data())})})}(window.jQuery);
|
@@ -1 +0,0 @@
|
|
1
|
-
(function(e){var c="autosave",g="restoredraft",b=true,f,d,a=e.util.Dispatcher;e.create("tinymce.plugins.AutoSave",{init:function(i,j){var h=this,l=i.settings;h.editor=i;function k(n){var m={s:1000,m:60000};n=/^(\d+)([ms]?)$/.exec(""+n);return(n[2]?m[n[2]]:1)*parseInt(n)}e.each({ask_before_unload:b,interval:"30s",retention:"20m",minlength:50},function(n,m){m=c+"_"+m;if(l[m]===f){l[m]=n}});l.autosave_interval=k(l.autosave_interval);l.autosave_retention=k(l.autosave_retention);i.addButton(g,{title:c+".restore_content",onclick:function(){if(i.getContent({draft:true}).replace(/\s| |<\/?p[^>]*>|<br[^>]*>/gi,"").length>0){i.windowManager.confirm(c+".warning_message",function(m){if(m){h.restoreDraft()}})}else{h.restoreDraft()}}});i.onNodeChange.add(function(){var m=i.controlManager;if(m.get(g)){m.setDisabled(g,!h.hasDraft())}});i.onInit.add(function(){if(i.controlManager.get(g)){h.setupStorage(i);setInterval(function(){h.storeDraft();i.nodeChanged()},l.autosave_interval)}});h.onStoreDraft=new a(h);h.onRestoreDraft=new a(h);h.onRemoveDraft=new a(h);if(!d){window.onbeforeunload=e.plugins.AutoSave._beforeUnloadHandler;d=b}},getInfo:function(){return{longname:"Auto save",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave",version:e.majorVersion+"."+e.minorVersion}},getExpDate:function(){return new Date(new Date().getTime()+this.editor.settings.autosave_retention).toUTCString()},setupStorage:function(i){var h=this,k=c+"_test",j="OK";h.key=c+i.id;e.each([function(){if(localStorage){localStorage.setItem(k,j);if(localStorage.getItem(k)===j){localStorage.removeItem(k);return localStorage}}},function(){if(sessionStorage){sessionStorage.setItem(k,j);if(sessionStorage.getItem(k)===j){sessionStorage.removeItem(k);return sessionStorage}}},function(){if(e.isIE){i.getElement().style.behavior="url('#default#userData')";return{autoExpires:b,setItem:function(l,n){var m=i.getElement();m.setAttribute(l,n);m.expires=h.getExpDate();try{m.save("TinyMCE")}catch(o){}},getItem:function(l){var m=i.getElement();try{m.load("TinyMCE");return m.getAttribute(l)}catch(n){return null}},removeItem:function(l){i.getElement().removeAttribute(l)}}}},],function(l){try{h.storage=l();if(h.storage){return false}}catch(m){}})},storeDraft:function(){var i=this,l=i.storage,j=i.editor,h,k;if(l){if(!l.getItem(i.key)&&!j.isDirty()){return}k=j.getContent({draft:true});if(k.length>j.settings.autosave_minlength){h=i.getExpDate();if(!i.storage.autoExpires){i.storage.setItem(i.key+"_expires",h)}i.storage.setItem(i.key,k);i.onStoreDraft.dispatch(i,{expires:h,content:k})}}},restoreDraft:function(){var h=this,j=h.storage,i;if(j){i=j.getItem(h.key);if(i){h.editor.setContent(i);h.onRestoreDraft.dispatch(h,{content:i})}}},hasDraft:function(){var h=this,k=h.storage,i,j;if(k){j=!!k.getItem(h.key);if(j){if(!h.storage.autoExpires){i=new Date(k.getItem(h.key+"_expires"));if(new Date().getTime()<i.getTime()){return b}h.removeDraft()}else{return b}}}return false},removeDraft:function(){var h=this,k=h.storage,i=h.key,j;if(k){j=k.getItem(i);k.removeItem(i);k.removeItem(i+"_expires");if(j){h.onRemoveDraft.dispatch(h,{content:j})}}},"static":{_beforeUnloadHandler:function(h){var i;e.each(tinyMCE.editors,function(j){if(j.plugins.autosave){j.plugins.autosave.storeDraft()}if(j.getParam("fullscreen_is_enabled")){return}if(!i&&j.isDirty()&&j.getParam("autosave_ask_before_unload")){i=j.getLang("autosave.unload_msg")}});return i}}});e.PluginManager.add("autosave",e.plugins.AutoSave)})(tinymce);
|
@@ -1,431 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* editor_plugin_src.js
|
3
|
-
*
|
4
|
-
* Copyright 2009, Moxiecode Systems AB
|
5
|
-
* Released under LGPL License.
|
6
|
-
*
|
7
|
-
* License: http://tinymce.moxiecode.com/license
|
8
|
-
* Contributing: http://tinymce.moxiecode.com/contributing
|
9
|
-
*
|
10
|
-
* Adds auto-save capability to the TinyMCE text editor to rescue content
|
11
|
-
* inadvertently lost. This plugin was originally developed by Speednet
|
12
|
-
* and that project can be found here: http://code.google.com/p/tinyautosave/
|
13
|
-
*
|
14
|
-
* TECHNOLOGY DISCUSSION:
|
15
|
-
*
|
16
|
-
* The plugin attempts to use the most advanced features available in the current browser to save
|
17
|
-
* as much content as possible. There are a total of four different methods used to autosave the
|
18
|
-
* content. In order of preference, they are:
|
19
|
-
*
|
20
|
-
* 1. localStorage - A new feature of HTML 5, localStorage can store megabytes of data per domain
|
21
|
-
* on the client computer. Data stored in the localStorage area has no expiration date, so we must
|
22
|
-
* manage expiring the data ourselves. localStorage is fully supported by IE8, and it is supposed
|
23
|
-
* to be working in Firefox 3 and Safari 3.2, but in reality is is flaky in those browsers. As
|
24
|
-
* HTML 5 gets wider support, the AutoSave plugin will use it automatically. In Windows Vista/7,
|
25
|
-
* localStorage is stored in the following folder:
|
26
|
-
* C:\Users\[username]\AppData\Local\Microsoft\Internet Explorer\DOMStore\[tempFolder]
|
27
|
-
*
|
28
|
-
* 2. sessionStorage - A new feature of HTML 5, sessionStorage works similarly to localStorage,
|
29
|
-
* except it is designed to expire after a certain amount of time. Because the specification
|
30
|
-
* around expiration date/time is very loosely-described, it is preferrable to use locaStorage and
|
31
|
-
* manage the expiration ourselves. sessionStorage has similar storage characteristics to
|
32
|
-
* localStorage, although it seems to have better support by Firefox 3 at the moment. (That will
|
33
|
-
* certainly change as Firefox continues getting better at HTML 5 adoption.)
|
34
|
-
*
|
35
|
-
* 3. UserData - A very under-exploited feature of Microsoft Internet Explorer, UserData is a
|
36
|
-
* way to store up to 128K of data per "document", or up to 1MB of data per domain, on the client
|
37
|
-
* computer. The feature is available for IE 5+, which makes it available for every version of IE
|
38
|
-
* supported by TinyMCE. The content is persistent across browser restarts and expires on the
|
39
|
-
* date/time specified, just like a cookie. However, the data is not cleared when the user clears
|
40
|
-
* cookies on the browser, which makes it well-suited for rescuing autosaved content. UserData,
|
41
|
-
* like other Microsoft IE browser technologies, is implemented as a behavior attached to a
|
42
|
-
* specific DOM object, so in this case we attach the behavior to the same DOM element that the
|
43
|
-
* TinyMCE editor instance is attached to.
|
44
|
-
*/
|
45
|
-
|
46
|
-
(function(tinymce) {
|
47
|
-
// Setup constants to help the compressor to reduce script size
|
48
|
-
var PLUGIN_NAME = 'autosave',
|
49
|
-
RESTORE_DRAFT = 'restoredraft',
|
50
|
-
TRUE = true,
|
51
|
-
undefined,
|
52
|
-
unloadHandlerAdded,
|
53
|
-
Dispatcher = tinymce.util.Dispatcher;
|
54
|
-
|
55
|
-
/**
|
56
|
-
* This plugin adds auto-save capability to the TinyMCE text editor to rescue content
|
57
|
-
* inadvertently lost. By using localStorage.
|
58
|
-
*
|
59
|
-
* @class tinymce.plugins.AutoSave
|
60
|
-
*/
|
61
|
-
tinymce.create('tinymce.plugins.AutoSave', {
|
62
|
-
/**
|
63
|
-
* Initializes the plugin, this will be executed after the plugin has been created.
|
64
|
-
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
65
|
-
* of the editor instance to intercept that event.
|
66
|
-
*
|
67
|
-
* @method init
|
68
|
-
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
69
|
-
* @param {string} url Absolute URL to where the plugin is located.
|
70
|
-
*/
|
71
|
-
init : function(ed, url) {
|
72
|
-
var self = this, settings = ed.settings;
|
73
|
-
|
74
|
-
self.editor = ed;
|
75
|
-
|
76
|
-
// Parses the specified time string into a milisecond number 10m, 10s etc.
|
77
|
-
function parseTime(time) {
|
78
|
-
var multipels = {
|
79
|
-
s : 1000,
|
80
|
-
m : 60000
|
81
|
-
};
|
82
|
-
|
83
|
-
time = /^(\d+)([ms]?)$/.exec('' + time);
|
84
|
-
|
85
|
-
return (time[2] ? multipels[time[2]] : 1) * parseInt(time);
|
86
|
-
};
|
87
|
-
|
88
|
-
// Default config
|
89
|
-
tinymce.each({
|
90
|
-
ask_before_unload : TRUE,
|
91
|
-
interval : '30s',
|
92
|
-
retention : '20m',
|
93
|
-
minlength : 50
|
94
|
-
}, function(value, key) {
|
95
|
-
key = PLUGIN_NAME + '_' + key;
|
96
|
-
|
97
|
-
if (settings[key] === undefined)
|
98
|
-
settings[key] = value;
|
99
|
-
});
|
100
|
-
|
101
|
-
// Parse times
|
102
|
-
settings.autosave_interval = parseTime(settings.autosave_interval);
|
103
|
-
settings.autosave_retention = parseTime(settings.autosave_retention);
|
104
|
-
|
105
|
-
// Register restore button
|
106
|
-
ed.addButton(RESTORE_DRAFT, {
|
107
|
-
title : PLUGIN_NAME + ".restore_content",
|
108
|
-
onclick : function() {
|
109
|
-
if (ed.getContent({draft: true}).replace(/\s| |<\/?p[^>]*>|<br[^>]*>/gi, "").length > 0) {
|
110
|
-
// Show confirm dialog if the editor isn't empty
|
111
|
-
ed.windowManager.confirm(
|
112
|
-
PLUGIN_NAME + ".warning_message",
|
113
|
-
function(ok) {
|
114
|
-
if (ok)
|
115
|
-
self.restoreDraft();
|
116
|
-
}
|
117
|
-
);
|
118
|
-
} else
|
119
|
-
self.restoreDraft();
|
120
|
-
}
|
121
|
-
});
|
122
|
-
|
123
|
-
// Enable/disable restoredraft button depending on if there is a draft stored or not
|
124
|
-
ed.onNodeChange.add(function() {
|
125
|
-
var controlManager = ed.controlManager;
|
126
|
-
|
127
|
-
if (controlManager.get(RESTORE_DRAFT))
|
128
|
-
controlManager.setDisabled(RESTORE_DRAFT, !self.hasDraft());
|
129
|
-
});
|
130
|
-
|
131
|
-
ed.onInit.add(function() {
|
132
|
-
// Check if the user added the restore button, then setup auto storage logic
|
133
|
-
if (ed.controlManager.get(RESTORE_DRAFT)) {
|
134
|
-
// Setup storage engine
|
135
|
-
self.setupStorage(ed);
|
136
|
-
|
137
|
-
// Auto save contents each interval time
|
138
|
-
setInterval(function() {
|
139
|
-
self.storeDraft();
|
140
|
-
ed.nodeChanged();
|
141
|
-
}, settings.autosave_interval);
|
142
|
-
}
|
143
|
-
});
|
144
|
-
|
145
|
-
/**
|
146
|
-
* This event gets fired when a draft is stored to local storage.
|
147
|
-
*
|
148
|
-
* @event onStoreDraft
|
149
|
-
* @param {tinymce.plugins.AutoSave} sender Plugin instance sending the event.
|
150
|
-
* @param {Object} draft Draft object containing the HTML contents of the editor.
|
151
|
-
*/
|
152
|
-
self.onStoreDraft = new Dispatcher(self);
|
153
|
-
|
154
|
-
/**
|
155
|
-
* This event gets fired when a draft is restored from local storage.
|
156
|
-
*
|
157
|
-
* @event onStoreDraft
|
158
|
-
* @param {tinymce.plugins.AutoSave} sender Plugin instance sending the event.
|
159
|
-
* @param {Object} draft Draft object containing the HTML contents of the editor.
|
160
|
-
*/
|
161
|
-
self.onRestoreDraft = new Dispatcher(self);
|
162
|
-
|
163
|
-
/**
|
164
|
-
* This event gets fired when a draft removed/expired.
|
165
|
-
*
|
166
|
-
* @event onRemoveDraft
|
167
|
-
* @param {tinymce.plugins.AutoSave} sender Plugin instance sending the event.
|
168
|
-
* @param {Object} draft Draft object containing the HTML contents of the editor.
|
169
|
-
*/
|
170
|
-
self.onRemoveDraft = new Dispatcher(self);
|
171
|
-
|
172
|
-
// Add ask before unload dialog only add one unload handler
|
173
|
-
if (!unloadHandlerAdded) {
|
174
|
-
window.onbeforeunload = tinymce.plugins.AutoSave._beforeUnloadHandler;
|
175
|
-
unloadHandlerAdded = TRUE;
|
176
|
-
}
|
177
|
-
},
|
178
|
-
|
179
|
-
/**
|
180
|
-
* Returns information about the plugin as a name/value array.
|
181
|
-
* The current keys are longname, author, authorurl, infourl and version.
|
182
|
-
*
|
183
|
-
* @method getInfo
|
184
|
-
* @return {Object} Name/value array containing information about the plugin.
|
185
|
-
*/
|
186
|
-
getInfo : function() {
|
187
|
-
return {
|
188
|
-
longname : 'Auto save',
|
189
|
-
author : 'Moxiecode Systems AB',
|
190
|
-
authorurl : 'http://tinymce.moxiecode.com',
|
191
|
-
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave',
|
192
|
-
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
193
|
-
};
|
194
|
-
},
|
195
|
-
|
196
|
-
/**
|
197
|
-
* Returns an expiration date UTC string.
|
198
|
-
*
|
199
|
-
* @method getExpDate
|
200
|
-
* @return {String} Expiration date UTC string.
|
201
|
-
*/
|
202
|
-
getExpDate : function() {
|
203
|
-
return new Date(
|
204
|
-
new Date().getTime() + this.editor.settings.autosave_retention
|
205
|
-
).toUTCString();
|
206
|
-
},
|
207
|
-
|
208
|
-
/**
|
209
|
-
* This method will setup the storage engine. If the browser has support for it.
|
210
|
-
*
|
211
|
-
* @method setupStorage
|
212
|
-
*/
|
213
|
-
setupStorage : function(ed) {
|
214
|
-
var self = this, testKey = PLUGIN_NAME + '_test', testVal = "OK";
|
215
|
-
|
216
|
-
self.key = PLUGIN_NAME + ed.id;
|
217
|
-
|
218
|
-
// Loop though each storage engine type until we find one that works
|
219
|
-
tinymce.each([
|
220
|
-
function() {
|
221
|
-
// Try HTML5 Local Storage
|
222
|
-
if (localStorage) {
|
223
|
-
localStorage.setItem(testKey, testVal);
|
224
|
-
|
225
|
-
if (localStorage.getItem(testKey) === testVal) {
|
226
|
-
localStorage.removeItem(testKey);
|
227
|
-
|
228
|
-
return localStorage;
|
229
|
-
}
|
230
|
-
}
|
231
|
-
},
|
232
|
-
|
233
|
-
function() {
|
234
|
-
// Try HTML5 Session Storage
|
235
|
-
if (sessionStorage) {
|
236
|
-
sessionStorage.setItem(testKey, testVal);
|
237
|
-
|
238
|
-
if (sessionStorage.getItem(testKey) === testVal) {
|
239
|
-
sessionStorage.removeItem(testKey);
|
240
|
-
|
241
|
-
return sessionStorage;
|
242
|
-
}
|
243
|
-
}
|
244
|
-
},
|
245
|
-
|
246
|
-
function() {
|
247
|
-
// Try IE userData
|
248
|
-
if (tinymce.isIE) {
|
249
|
-
ed.getElement().style.behavior = "url('#default#userData')";
|
250
|
-
|
251
|
-
// Fake localStorage on old IE
|
252
|
-
return {
|
253
|
-
autoExpires : TRUE,
|
254
|
-
|
255
|
-
setItem : function(key, value) {
|
256
|
-
var userDataElement = ed.getElement();
|
257
|
-
|
258
|
-
userDataElement.setAttribute(key, value);
|
259
|
-
userDataElement.expires = self.getExpDate();
|
260
|
-
|
261
|
-
try {
|
262
|
-
userDataElement.save("TinyMCE");
|
263
|
-
} catch (e) {
|
264
|
-
// Ignore, saving might fail if "Userdata Persistence" is disabled in IE
|
265
|
-
}
|
266
|
-
},
|
267
|
-
|
268
|
-
getItem : function(key) {
|
269
|
-
var userDataElement = ed.getElement();
|
270
|
-
|
271
|
-
try {
|
272
|
-
userDataElement.load("TinyMCE");
|
273
|
-
return userDataElement.getAttribute(key);
|
274
|
-
} catch (e) {
|
275
|
-
// Ignore, loading might fail if "Userdata Persistence" is disabled in IE
|
276
|
-
return null;
|
277
|
-
}
|
278
|
-
},
|
279
|
-
|
280
|
-
removeItem : function(key) {
|
281
|
-
ed.getElement().removeAttribute(key);
|
282
|
-
}
|
283
|
-
};
|
284
|
-
}
|
285
|
-
},
|
286
|
-
], function(setup) {
|
287
|
-
// Try executing each function to find a suitable storage engine
|
288
|
-
try {
|
289
|
-
self.storage = setup();
|
290
|
-
|
291
|
-
if (self.storage)
|
292
|
-
return false;
|
293
|
-
} catch (e) {
|
294
|
-
// Ignore
|
295
|
-
}
|
296
|
-
});
|
297
|
-
},
|
298
|
-
|
299
|
-
/**
|
300
|
-
* This method will store the current contents in the the storage engine.
|
301
|
-
*
|
302
|
-
* @method storeDraft
|
303
|
-
*/
|
304
|
-
storeDraft : function() {
|
305
|
-
var self = this, storage = self.storage, editor = self.editor, expires, content;
|
306
|
-
|
307
|
-
// Is the contents dirty
|
308
|
-
if (storage) {
|
309
|
-
// If there is no existing key and the contents hasn't been changed since
|
310
|
-
// it's original value then there is no point in saving a draft
|
311
|
-
if (!storage.getItem(self.key) && !editor.isDirty())
|
312
|
-
return;
|
313
|
-
|
314
|
-
// Store contents if the contents if longer than the minlength of characters
|
315
|
-
content = editor.getContent({draft: true});
|
316
|
-
if (content.length > editor.settings.autosave_minlength) {
|
317
|
-
expires = self.getExpDate();
|
318
|
-
|
319
|
-
// Store expiration date if needed IE userData has auto expire built in
|
320
|
-
if (!self.storage.autoExpires)
|
321
|
-
self.storage.setItem(self.key + "_expires", expires);
|
322
|
-
|
323
|
-
self.storage.setItem(self.key, content);
|
324
|
-
self.onStoreDraft.dispatch(self, {
|
325
|
-
expires : expires,
|
326
|
-
content : content
|
327
|
-
});
|
328
|
-
}
|
329
|
-
}
|
330
|
-
},
|
331
|
-
|
332
|
-
/**
|
333
|
-
* This method will restore the contents from the storage engine back to the editor.
|
334
|
-
*
|
335
|
-
* @method restoreDraft
|
336
|
-
*/
|
337
|
-
restoreDraft : function() {
|
338
|
-
var self = this, storage = self.storage, content;
|
339
|
-
|
340
|
-
if (storage) {
|
341
|
-
content = storage.getItem(self.key);
|
342
|
-
|
343
|
-
if (content) {
|
344
|
-
self.editor.setContent(content);
|
345
|
-
self.onRestoreDraft.dispatch(self, {
|
346
|
-
content : content
|
347
|
-
});
|
348
|
-
}
|
349
|
-
}
|
350
|
-
},
|
351
|
-
|
352
|
-
/**
|
353
|
-
* This method will return true/false if there is a local storage draft available.
|
354
|
-
*
|
355
|
-
* @method hasDraft
|
356
|
-
* @return {boolean} true/false state if there is a local draft.
|
357
|
-
*/
|
358
|
-
hasDraft : function() {
|
359
|
-
var self = this, storage = self.storage, expDate, exists;
|
360
|
-
|
361
|
-
if (storage) {
|
362
|
-
// Does the item exist at all
|
363
|
-
exists = !!storage.getItem(self.key);
|
364
|
-
if (exists) {
|
365
|
-
// Storage needs autoexpire
|
366
|
-
if (!self.storage.autoExpires) {
|
367
|
-
expDate = new Date(storage.getItem(self.key + "_expires"));
|
368
|
-
|
369
|
-
// Contents hasn't expired
|
370
|
-
if (new Date().getTime() < expDate.getTime())
|
371
|
-
return TRUE;
|
372
|
-
|
373
|
-
// Remove it if it has
|
374
|
-
self.removeDraft();
|
375
|
-
} else
|
376
|
-
return TRUE;
|
377
|
-
}
|
378
|
-
}
|
379
|
-
|
380
|
-
return false;
|
381
|
-
},
|
382
|
-
|
383
|
-
/**
|
384
|
-
* Removes the currently stored draft.
|
385
|
-
*
|
386
|
-
* @method removeDraft
|
387
|
-
*/
|
388
|
-
removeDraft : function() {
|
389
|
-
var self = this, storage = self.storage, key = self.key, content;
|
390
|
-
|
391
|
-
if (storage) {
|
392
|
-
// Get current contents and remove the existing draft
|
393
|
-
content = storage.getItem(key);
|
394
|
-
storage.removeItem(key);
|
395
|
-
storage.removeItem(key + "_expires");
|
396
|
-
|
397
|
-
// Dispatch remove event if we had any contents
|
398
|
-
if (content) {
|
399
|
-
self.onRemoveDraft.dispatch(self, {
|
400
|
-
content : content
|
401
|
-
});
|
402
|
-
}
|
403
|
-
}
|
404
|
-
},
|
405
|
-
|
406
|
-
"static" : {
|
407
|
-
// Internal unload handler will be called before the page is unloaded
|
408
|
-
_beforeUnloadHandler : function(e) {
|
409
|
-
var msg;
|
410
|
-
|
411
|
-
tinymce.each(tinyMCE.editors, function(ed) {
|
412
|
-
// Store a draft for each editor instance
|
413
|
-
if (ed.plugins.autosave)
|
414
|
-
ed.plugins.autosave.storeDraft();
|
415
|
-
|
416
|
-
// Never ask in fullscreen mode
|
417
|
-
if (ed.getParam("fullscreen_is_enabled"))
|
418
|
-
return;
|
419
|
-
|
420
|
-
// Setup a return message if the editor is dirty
|
421
|
-
if (!msg && ed.isDirty() && ed.getParam("autosave_ask_before_unload"))
|
422
|
-
msg = ed.getLang("autosave.unload_msg");
|
423
|
-
});
|
424
|
-
|
425
|
-
return msg;
|
426
|
-
}
|
427
|
-
}
|
428
|
-
});
|
429
|
-
|
430
|
-
tinymce.PluginManager.add('autosave', tinymce.plugins.AutoSave);
|
431
|
-
})(tinymce);
|
@@ -1 +0,0 @@
|
|
1
|
-
(function(){tinymce.create("tinymce.plugins.BBCodePlugin",{init:function(a,b){var d=this,c=a.getParam("bbcode_dialect","punbb").toLowerCase();a.onBeforeSetContent.add(function(e,f){f.content=d["_"+c+"_bbcode2html"](f.content)});a.onPostProcess.add(function(e,f){if(f.set){f.content=d["_"+c+"_bbcode2html"](f.content)}if(f.get){f.content=d["_"+c+"_html2bbcode"](f.content)}})},getInfo:function(){return{longname:"BBCode Plugin",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_punbb_html2bbcode:function(a){a=tinymce.trim(a);function b(c,d){a=a.replace(c,d)}b(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");b(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");b(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");b(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");b(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");b(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");b(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]");b(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");b(/<font>(.*?)<\/font>/gi,"$1");b(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");b(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]");b(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]");b(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");b(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");b(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");b(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");b(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");b(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");b(/<\/(strong|b)>/gi,"[/b]");b(/<(strong|b)>/gi,"[b]");b(/<\/(em|i)>/gi,"[/i]");b(/<(em|i)>/gi,"[i]");b(/<\/u>/gi,"[/u]");b(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");b(/<u>/gi,"[u]");b(/<blockquote[^>]*>/gi,"[quote]");b(/<\/blockquote>/gi,"[/quote]");b(/<br \/>/gi,"\n");b(/<br\/>/gi,"\n");b(/<br>/gi,"\n");b(/<p>/gi,"");b(/<\/p>/gi,"\n");b(/ |\u00a0/gi," ");b(/"/gi,'"');b(/</gi,"<");b(/>/gi,">");b(/&/gi,"&");return a},_punbb_bbcode2html:function(a){a=tinymce.trim(a);function b(c,d){a=a.replace(c,d)}b(/\n/gi,"<br />");b(/\[b\]/gi,"<strong>");b(/\[\/b\]/gi,"</strong>");b(/\[i\]/gi,"<em>");b(/\[\/i\]/gi,"</em>");b(/\[u\]/gi,"<u>");b(/\[\/u\]/gi,"</u>");b(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,'<a href="$1">$2</a>');b(/\[url\](.*?)\[\/url\]/gi,'<a href="$1">$1</a>');b(/\[img\](.*?)\[\/img\]/gi,'<img src="$1" />');b(/\[color=(.*?)\](.*?)\[\/color\]/gi,'<font color="$1">$2</font>');b(/\[code\](.*?)\[\/code\]/gi,'<span class="codeStyle">$1</span> ');b(/\[quote.*?\](.*?)\[\/quote\]/gi,'<span class="quoteStyle">$1</span> ');return a}});tinymce.PluginManager.add("bbcode",tinymce.plugins.BBCodePlugin)})();
|
@@ -1,120 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* editor_plugin_src.js
|
3
|
-
*
|
4
|
-
* Copyright 2009, Moxiecode Systems AB
|
5
|
-
* Released under LGPL License.
|
6
|
-
*
|
7
|
-
* License: http://tinymce.moxiecode.com/license
|
8
|
-
* Contributing: http://tinymce.moxiecode.com/contributing
|
9
|
-
*/
|
10
|
-
|
11
|
-
(function() {
|
12
|
-
tinymce.create('tinymce.plugins.BBCodePlugin', {
|
13
|
-
init : function(ed, url) {
|
14
|
-
var t = this, dialect = ed.getParam('bbcode_dialect', 'punbb').toLowerCase();
|
15
|
-
|
16
|
-
ed.onBeforeSetContent.add(function(ed, o) {
|
17
|
-
o.content = t['_' + dialect + '_bbcode2html'](o.content);
|
18
|
-
});
|
19
|
-
|
20
|
-
ed.onPostProcess.add(function(ed, o) {
|
21
|
-
if (o.set)
|
22
|
-
o.content = t['_' + dialect + '_bbcode2html'](o.content);
|
23
|
-
|
24
|
-
if (o.get)
|
25
|
-
o.content = t['_' + dialect + '_html2bbcode'](o.content);
|
26
|
-
});
|
27
|
-
},
|
28
|
-
|
29
|
-
getInfo : function() {
|
30
|
-
return {
|
31
|
-
longname : 'BBCode Plugin',
|
32
|
-
author : 'Moxiecode Systems AB',
|
33
|
-
authorurl : 'http://tinymce.moxiecode.com',
|
34
|
-
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/bbcode',
|
35
|
-
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
36
|
-
};
|
37
|
-
},
|
38
|
-
|
39
|
-
// Private methods
|
40
|
-
|
41
|
-
// HTML -> BBCode in PunBB dialect
|
42
|
-
_punbb_html2bbcode : function(s) {
|
43
|
-
s = tinymce.trim(s);
|
44
|
-
|
45
|
-
function rep(re, str) {
|
46
|
-
s = s.replace(re, str);
|
47
|
-
};
|
48
|
-
|
49
|
-
// example: <strong> to [b]
|
50
|
-
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");
|
51
|
-
rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
|
52
|
-
rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
|
53
|
-
rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
|
54
|
-
rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
|
55
|
-
rep(/<span style=\"color: ?(.*?);\">(.*?)<\/span>/gi,"[color=$1]$2[/color]");
|
56
|
-
rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]");
|
57
|
-
rep(/<span style=\"font-size:(.*?);\">(.*?)<\/span>/gi,"[size=$1]$2[/size]");
|
58
|
-
rep(/<font>(.*?)<\/font>/gi,"$1");
|
59
|
-
rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");
|
60
|
-
rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]");
|
61
|
-
rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]");
|
62
|
-
rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");
|
63
|
-
rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");
|
64
|
-
rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");
|
65
|
-
rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");
|
66
|
-
rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");
|
67
|
-
rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");
|
68
|
-
rep(/<\/(strong|b)>/gi,"[/b]");
|
69
|
-
rep(/<(strong|b)>/gi,"[b]");
|
70
|
-
rep(/<\/(em|i)>/gi,"[/i]");
|
71
|
-
rep(/<(em|i)>/gi,"[i]");
|
72
|
-
rep(/<\/u>/gi,"[/u]");
|
73
|
-
rep(/<span style=\"text-decoration: ?underline;\">(.*?)<\/span>/gi,"[u]$1[/u]");
|
74
|
-
rep(/<u>/gi,"[u]");
|
75
|
-
rep(/<blockquote[^>]*>/gi,"[quote]");
|
76
|
-
rep(/<\/blockquote>/gi,"[/quote]");
|
77
|
-
rep(/<br \/>/gi,"\n");
|
78
|
-
rep(/<br\/>/gi,"\n");
|
79
|
-
rep(/<br>/gi,"\n");
|
80
|
-
rep(/<p>/gi,"");
|
81
|
-
rep(/<\/p>/gi,"\n");
|
82
|
-
rep(/ |\u00a0/gi," ");
|
83
|
-
rep(/"/gi,"\"");
|
84
|
-
rep(/</gi,"<");
|
85
|
-
rep(/>/gi,">");
|
86
|
-
rep(/&/gi,"&");
|
87
|
-
|
88
|
-
return s;
|
89
|
-
},
|
90
|
-
|
91
|
-
// BBCode -> HTML from PunBB dialect
|
92
|
-
_punbb_bbcode2html : function(s) {
|
93
|
-
s = tinymce.trim(s);
|
94
|
-
|
95
|
-
function rep(re, str) {
|
96
|
-
s = s.replace(re, str);
|
97
|
-
};
|
98
|
-
|
99
|
-
// example: [b] to <strong>
|
100
|
-
rep(/\n/gi,"<br />");
|
101
|
-
rep(/\[b\]/gi,"<strong>");
|
102
|
-
rep(/\[\/b\]/gi,"</strong>");
|
103
|
-
rep(/\[i\]/gi,"<em>");
|
104
|
-
rep(/\[\/i\]/gi,"</em>");
|
105
|
-
rep(/\[u\]/gi,"<u>");
|
106
|
-
rep(/\[\/u\]/gi,"</u>");
|
107
|
-
rep(/\[url=([^\]]+)\](.*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");
|
108
|
-
rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");
|
109
|
-
rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");
|
110
|
-
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<font color=\"$1\">$2</font>");
|
111
|
-
rep(/\[code\](.*?)\[\/code\]/gi,"<span class=\"codeStyle\">$1</span> ");
|
112
|
-
rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<span class=\"quoteStyle\">$1</span> ");
|
113
|
-
|
114
|
-
return s;
|
115
|
-
}
|
116
|
-
});
|
117
|
-
|
118
|
-
// Register plugin
|
119
|
-
tinymce.PluginManager.add('bbcode', tinymce.plugins.BBCodePlugin);
|
120
|
-
})();
|