init
This commit is contained in:
app
controllers
AuthController.goBaseController.goBlogController.goFileController.goIndexController.goMobileController.goNoteContentHistoryController.goNoteController.goNotebookController.goOauthController.goShareController.goUserController.goinit.go
db
i18n
info
BlogInfo.goNoteInfo.goNotebookInfo.goREADME.mdRe.goShareNotebookNoteInfo.goSuggestionInfo.goTagInfo.goTokenInfo.goUserInfo.gocommon.go
init.golea
release
routes
service
AuthService.goBlogService.goNoteContentHistoryService.goNoteService.goNotebookService.goPwdService.goREADME.mdShareService.goSuggestionService.goTagService.goTokenService.goTrashService.goUserService.gocommon.goinit.go
test
tmp
views
App
Blog
Errors
File
Home
find_password.htmlfind_password2.htmlfind_password2_timeout.htmlfooter.htmlheader.htmlheader_box.htmlindex.htmllogin.htmlmodal.htmlregister.html
Mobile
Note
Notebook
Oauth
Share
User
conf
messages
public
css
blog
blog.cssblog_daqi.cssblog_daqi.lessblog_default.cssblog_default.lessblog_default2.cssblog_left_fixed.cssblog_left_fixed.less
bootstrap-theme.cssbootstrap-theme.min.cssbootstrap.cssbootstrap.min.cssbootstrap修改editor.csseditor.lessfont-awesome-4.0.3
css
fonts
FontAwesome.otffontawesome-webfont.eotfontawesome-webfont.svgfontawesome-webfont.ttffontawesome-webfont.woff
less
bordered-pulled.lesscore.lessfixed-width.lessfont-awesome.lessicons.lesslarger.lesslist.lessmixins.lesspath.lessrotated-flipped.lessspinning.lessstacked.lessvariables.less
scss
theme
fonts
open-sans2
DXI1ORHCpsQm3Vp6mXoaTXhCUOGz7vYGh680lGh-uXM.woffcJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woffk3k702ZOKiLJc3WVjuplzHhCUOGz7vYGh680lGh-uXM.woffxjAJXh38I15wypJXxuGMBobN6UDyHWBl620a-IRfuBk.woff
weibo
images
favicon.icofavicon_ever.ico
home
leanote
logo-100.giflogo-120.giflogo-20-a-6.pnglogo-32-a-5.pnglogo-32-a-7.pnglogo-32.pnglogo-60-a-6.pnglogo-60.gifold-preview.png
loading-24.gifloading-30.gifloading-32.gifloading-a-20-2.gifloading-a-20.gifloading-a-24.giflogo.pngnoise.pngoutofcode.pngslider
js
ZeroClipboard
all.jsapp
blog
note-min.jsnote.jsnotebook-min.jsnotebook.jspage-min.jspage.jsshare-min.jsshare.jstag-min.jstag.jscontextmenu
ever
i18n
jQuery-slimScroll-1.3.0
jquery-1.9.0.min.jsjquery-cookie-min.jsjquery-cookie.jsobject_id-min.jsobject_id.jsmdeditor
css
bootstrap-responsive.cssbootstrap.cssindex2.html
smoothness
images
animated-overlay.gifui-bg_flat_0_aaaaaa_40x100.pngui-bg_flat_75_ffffff_40x100.pngui-bg_glass_55_fbf9ee_1x400.pngui-bg_glass_65_ffffff_1x400.pngui-bg_glass_75_dadada_1x400.pngui-bg_glass_75_e6e6e6_1x400.pngui-bg_glass_95_fef1ec_1x400.pngui-bg_highlight-soft_75_cccccc_1x100.pngui-icons_222222_256x240.pngui-icons_2e83ff_256x240.pngui-icons_454545_256x240.pngui-icons_888888_256x240.pngui-icons_cd0a0a_256x240.png
jquery-ui-1.10.2.custom.cssjquery-ui-1.10.2.custom.min.csseditor
Markdown.Extra-min.jsMarkdown.Extra.jscss_browser_selector.jseditor-min.jseditor.csseditor.jseditor2.csseditor2.js
google-code-prettify
lang-apollo.jslang-basic.jslang-clj.jslang-css.jslang-dart.jslang-erlang.jslang-go.jslang-hs.jslang-lisp.jslang-llvm.jslang-lua.jslang-matlab.jslang-ml.jslang-mumps.jslang-n.jslang-pascal.jslang-proto.jslang-r.jslang-rd.jslang-scala.jslang-sql.jslang-tcl.jslang-tex.jslang-vb.jslang-vhdl.jslang-wiki.jslang-xq.jslang-yaml.jsmine.cssprettify.cssprettify.jsrun_prettify.js
jquery.autosize-min.jsjquery.waitforimages-min.jsjquery.waitforimages.jsmathJax-min.jsmathJax.jsmd-helppagedown
LICENSE.txtMarkdown.Converter-min.jsMarkdown.Converter.jsMarkdown.Editor-min.jsMarkdown.Editor.jsMarkdown.Sanitizer-min.jsMarkdown.Sanitizer.jsREADME.txt
scrollLink-min.jsscrollLink.jsunderscore-min.jsunderscore.jsdemo
local
node-pagedown.jspackage.jsonresources
wmd-buttons.pngfont-awesome
css
font
FontAwesome.otffontawesome-webfont.eotfontawesome-webfont.svgfontawesome-webfont.ttffontawesome-webfont.woff
scss
img
mobile
tinymce
classes
AddOnManager.jsCompat.jsEditor.jsEditorCommands.jsEditorManager.jsEnterKey.jsEnv.jsFocusManager.jsForceBlocks.jsFormatter.jsLegacyInput.jsShortcuts.jsUndoManager.jsWindowManager.js
index.htmljquery.tinymce.min.jsdom
ControlSelection.jsDOMUtils.jsDomQuery.jsEventUtils.jsRange.jsRangeUtils.jsScriptLoader.jsSelection.jsSerializer.jsSizzle.jQuery.jsSizzle.jsTreeWalker.jsTridentSelection.js
html
jquery.tinymce.jsui
AbsoluteLayout.jsButton.jsButtonGroup.jsCheckbox.jsCollection.jsColorButton.jsComboBox.jsContainer.jsControl.jsDomUtils.jsDragHelper.jsElementPath.jsFactory.jsFieldSet.jsFilePicker.jsFitLayout.jsFlexLayout.jsFloatPanel.jsFlowLayout.jsForm.jsFormItem.jsFormatControls.jsGridLayout.jsIframe.jsKeyboardNavigation.jsLabel.jsLayout.jsListBox.jsMenu.jsMenuBar.jsMenuButton.jsMenuItem.jsMessageBox.jsMovable.jsPanel.jsPanelButton.jsPath.jsRadio.jsResizable.jsResizeHandle.jsScrollable.jsSelector.jsSpacer.jsSplitButton.jsStackLayout.jsTabPanel.jsTextBox.jsThrobber.jsToolbar.jsTooltip.jsWidget.jsWindow.js
util
langs
plugins
advlist
anchor
autolink
autoresize
autosave
bbcode
charmap
code
codemirror
CodeMirror
.gitattributes.gitignore.travis.ymlAUTHORSCONTRIBUTING.mdLICENSEREADME.mdpackage.json
LICENSE.txtREADME.txtaddon
comment
dialog
display
edit
fold
hint
anyword-hint.jscss-hint.jshtml-hint.jsjavascript-hint.jspig-hint.jspython-hint.jsshow-hint.cssshow-hint.jssql-hint.jsxml-hint.js
lint
merge
mode
runmode
scroll
search
selection
tern
wrap
bin
bower.jsondemo
activeline.htmlanywordhint.htmlbidi.htmlbtree.htmlbuffers.htmlchangemode.htmlclosebrackets.htmlclosetag.htmlcomplete.htmlemacs.htmlfolding.htmlfullscreen.htmlhardwrap.htmlhtml5complete.htmlindentwrap.htmllint.htmlloadmode.htmlmarker.htmlmarkselection.htmlmatchhighlighter.htmlmatchtags.htmlmerge.htmlmultiplex.htmlmustache.htmlplaceholder.htmlpreview.htmlresize.htmlrunmode.htmlsearch.htmlspanaffectswrapping_shim.htmltern.htmltheme.htmltrailingspace.htmlvariableheight.htmlvim.htmlvisibletabs.htmlwidget.htmlxmlcomplete.html
doc
activebookmark.jscompress.htmldocs.cssinternals.htmllogo.pnglogo.svgmanual.htmlrealworld.htmlreleases.htmlreporting.htmlupgrade_v2.2.htmlupgrade_v3.html
index.htmlkeymap
lib
mode
apl
asterisk
clike
clojure
cobol
coffeescript
commonlisp
css
d
diff
dtd
ecl
eiffel
erlang
fortran
gas
gfm
gherkin
go
groovy
haml
haskell
haxe
htmlembedded
htmlmixed
http
index.htmljade
javascript
jinja2
julia
less
livescript
lua
markdown
meta.jsmirc
mllike
nginx
ntriples
octave
pascal
pegjs
perl
php
pig
properties
python
q
r
rpm
rst
ruby
rust
sass
scheme
shell
sieve
smalltalk
smarty
smartymixed
sparql
sql
stex
tcl
tiddlywiki
tiki
toml
turtle
vb
vbscript
velocity
verilog
xml
xquery
yaml
z80
test
comment_test.jsdoc_test.jsdriver.jsemacs_test.jsindex.html
lint
mode_test.cssmode_test.jsphantom_driver.jsrun.jssearch_test.jstest.jsvim_test.jstheme
3024-day.css3024-night.cssambiance-mobile.cssambiance.cssbase16-dark.cssbase16-light.cssblackboard.csscobalt.csseclipse.csselegant.csserlang-dark.csslesser-dark.cssmbo.cssmidnight.cssmonokai.cssneat.cssnight.cssparaiso-dark.cssparaiso-light.csspastel-on-dark.cssrubyblue.csssolarized.cssthe-matrix.csstomorrow-night-eighties.csstwilight.cssvibrant-ink.cssxq-dark.cssxq-light.css
img
langs
plugin.jsplugin.min.jssource.htmlcodesyntax
compat3x
contextmenu
directionality
emoticons
img
smiley-cool.gifsmiley-cry.gifsmiley-embarassed.gifsmiley-foot-in-mouth.gifsmiley-frown.gifsmiley-innocent.gifsmiley-kiss.gifsmiley-laughing.gifsmiley-money-mouth.gifsmiley-sealed.gifsmiley-smile.gifsmiley-surprised.gifsmiley-tongue-out.gifsmiley-undecided.gifsmiley-wink.gifsmiley-yell.gif
plugin.jsplugin.min.jsexample
example_dependency
fullpage
fullscreen
hr
image
importcss
insertdatetime
layer
leanote_code
leanote_image
leanote_nav
legacyoutput
link
lists
media
nonbreaking
noneditable
pagebreak
paste
preview
print
save
searchreplace
spellchecker
tabfocus
table
template
textcolor
upload_image
visualblocks
css
img
address.gifarticle.gifaside.gifblockquote.gifdiv.giffigure.gifh1.gifh2.gifh3.gifh4.gifh5.gifh6.gifhgroup.gifol.gifp.gifpre.gifsection.giful.gif
plugin.jsplugin.min.jsvisualchars
wordcount
skins
custom
content.inline.min.csscontent.min.css
fonts
icomoon-small.eoticomoon-small.svgicomoon-small.ttficomoon-small.wofficomoon.eoticomoon.svgicomoon.ttficomoon.woffreadme.md
img
skin.ie7.min.cssskin.jsonskin.min.csslightgray
AbsoluteLayout.lessAnimations.lessButton.lessButtonGroup.lessCheckbox.lessColorButton.lessComboBox.lessContainer.lessContent.Inline.lessContent.Objects.lessContent.lessFieldSet.lessFitLayout.lessFloatPanel.lessFlowLayout.lessIcons.Ie7.lessIcons.lessIframe.lessLabel.lessListBox.lessMenu.lessMenuBar.lessMenuButton.lessMenuItem.lessMixins.lessPanel.lessPath.lessRadio.lessReset.lessResizeHandle.lessScrollable.lessSpacer.lessSplitButton.lessStackLayout.lessTabPanel.lessTextBox.lessThrobber.lessTinyMCE.lessToolTip.lessVariables.lessWindow.lesscontent.inline.min.csscontent.min.css
fonts
readme.mdtinymce-small.dev.svgtinymce-small.eottinymce-small.svgtinymce-small.ttftinymce-small.wofftinymce.dev.svgtinymce.eottinymce.svgtinymce.ttftinymce.woff
img
skin.dev.lessskin.ie7.lessskin.ie7.min.cssskin.lessskin.min.cssthemes
modern
upload
52d3e8ac99c37b7f0d000001
5368c9fc99c37b095a000006
images
252
public/tinymce/plugins/template/plugin.js
Normal file
252
public/tinymce/plugins/template/plugin.js
Normal file
@ -0,0 +1,252 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('template', function(editor) {
|
||||
var each = tinymce.each;
|
||||
|
||||
function createTemplateList(callback) {
|
||||
return function() {
|
||||
var templateList = editor.settings.templates;
|
||||
|
||||
if (typeof(templateList) == "string") {
|
||||
tinymce.util.XHR.send({
|
||||
url: templateList,
|
||||
success: function(text) {
|
||||
callback(tinymce.util.JSON.parse(text));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
callback(templateList);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function showDialog(templateList) {
|
||||
var win, values = [], templateHtml;
|
||||
|
||||
if (!templateList || templateList.length === 0) {
|
||||
editor.windowManager.alert('No templates defined');
|
||||
return;
|
||||
}
|
||||
|
||||
tinymce.each(templateList, function(template) {
|
||||
values.push({
|
||||
selected: !values.length,
|
||||
text: template.title,
|
||||
value: {
|
||||
url: template.url,
|
||||
content: template.content,
|
||||
description: template.description
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function onSelectTemplate(e) {
|
||||
var value = e.control.value();
|
||||
|
||||
function insertIframeHtml(html) {
|
||||
if (html.indexOf('<html>') == -1) {
|
||||
var contentCssLinks = '';
|
||||
|
||||
tinymce.each(editor.contentCSS, function(url) {
|
||||
contentCssLinks += '<link type="text/css" rel="stylesheet" href="' + editor.documentBaseURI.toAbsolute(url) + '">';
|
||||
});
|
||||
|
||||
html = (
|
||||
'<!DOCTYPE html>' +
|
||||
'<html>' +
|
||||
'<head>' +
|
||||
contentCssLinks +
|
||||
'</head>' +
|
||||
'<body>' +
|
||||
html +
|
||||
'</body>' +
|
||||
'</html>'
|
||||
);
|
||||
}
|
||||
|
||||
html = replaceTemplateValues(html, 'template_preview_replace_values');
|
||||
|
||||
var doc = win.find('iframe')[0].getEl().contentWindow.document;
|
||||
doc.open();
|
||||
doc.write(html);
|
||||
doc.close();
|
||||
}
|
||||
|
||||
if (value.url) {
|
||||
tinymce.util.XHR.send({
|
||||
url: value.url,
|
||||
success: function(html) {
|
||||
templateHtml = html;
|
||||
insertIframeHtml(templateHtml);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
templateHtml = value.content;
|
||||
insertIframeHtml(templateHtml);
|
||||
}
|
||||
|
||||
win.find('#description')[0].text(e.control.value().description);
|
||||
}
|
||||
|
||||
win = editor.windowManager.open({
|
||||
title: 'Insert template',
|
||||
|
||||
body: [
|
||||
{type: 'container', label: 'Templates', items: {
|
||||
type: 'listbox', name: 'template', values: values, onselect: onSelectTemplate
|
||||
}},
|
||||
{type: 'label', name: 'description', label: 'Description', text: '\u00a0'},
|
||||
{type: 'iframe', minWidth: 600, minHeight: 400, border: 1}
|
||||
],
|
||||
|
||||
onsubmit: function() {
|
||||
insertTemplate(false, templateHtml);
|
||||
}
|
||||
});
|
||||
|
||||
win.find('listbox')[0].fire('select');
|
||||
}
|
||||
|
||||
function getDateTime(fmt, date) {
|
||||
var daysShort = "Sun Mon Tue Wed Thu Fri Sat Sun".split(' ');
|
||||
var daysLong = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(' ');
|
||||
var monthsShort = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(' ');
|
||||
var monthsLong = "January February March April May June July August September October November December".split(' ');
|
||||
|
||||
function addZeros(value, len) {
|
||||
value = "" + value;
|
||||
|
||||
if (value.length < len) {
|
||||
for (var i = 0; i < (len - value.length); i++) {
|
||||
value = "0" + value;
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
date = date || new Date();
|
||||
|
||||
fmt = fmt.replace("%D", "%m/%d/%Y");
|
||||
fmt = fmt.replace("%r", "%I:%M:%S %p");
|
||||
fmt = fmt.replace("%Y", "" + date.getFullYear());
|
||||
fmt = fmt.replace("%y", "" + date.getYear());
|
||||
fmt = fmt.replace("%m", addZeros(date.getMonth() + 1, 2));
|
||||
fmt = fmt.replace("%d", addZeros(date.getDate(), 2));
|
||||
fmt = fmt.replace("%H", "" + addZeros(date.getHours(), 2));
|
||||
fmt = fmt.replace("%M", "" + addZeros(date.getMinutes(), 2));
|
||||
fmt = fmt.replace("%S", "" + addZeros(date.getSeconds(), 2));
|
||||
fmt = fmt.replace("%I", "" + ((date.getHours() + 11) % 12 + 1));
|
||||
fmt = fmt.replace("%p", "" + (date.getHours() < 12 ? "AM" : "PM"));
|
||||
fmt = fmt.replace("%B", "" + editor.translate(monthsLong[date.getMonth()]));
|
||||
fmt = fmt.replace("%b", "" + editor.translate(monthsShort[date.getMonth()]));
|
||||
fmt = fmt.replace("%A", "" + editor.translate(daysLong[date.getDay()]));
|
||||
fmt = fmt.replace("%a", "" + editor.translate(daysShort[date.getDay()]));
|
||||
fmt = fmt.replace("%%", "%");
|
||||
|
||||
return fmt;
|
||||
}
|
||||
|
||||
function replaceVals(e) {
|
||||
var dom = editor.dom, vl = editor.getParam('template_replace_values');
|
||||
|
||||
each(dom.select('*', e), function(e) {
|
||||
each(vl, function(v, k) {
|
||||
if (dom.hasClass(e, k)) {
|
||||
if (typeof(vl[k]) == 'function') {
|
||||
vl[k](e);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function replaceTemplateValues(html, templateValuesOptionName) {
|
||||
each(editor.getParam(templateValuesOptionName), function(v, k) {
|
||||
if (typeof(v) != 'function') {
|
||||
html = html.replace(new RegExp('\\{\\$' + k + '\\}', 'g'), v);
|
||||
}
|
||||
});
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function insertTemplate(ui, html) {
|
||||
var el, n, dom = editor.dom, sel = editor.selection.getContent();
|
||||
|
||||
html = replaceTemplateValues(html, 'template_replace_values');
|
||||
el = dom.create('div', null, html);
|
||||
|
||||
// Find template element within div
|
||||
n = dom.select('.mceTmpl', el);
|
||||
if (n && n.length > 0) {
|
||||
el = dom.create('div', null);
|
||||
el.appendChild(n[0].cloneNode(true));
|
||||
}
|
||||
|
||||
function hasClass(n, c) {
|
||||
return new RegExp('\\b' + c + '\\b', 'g').test(n.className);
|
||||
}
|
||||
|
||||
each(dom.select('*', el), function(n) {
|
||||
// Replace cdate
|
||||
if (hasClass(n, editor.getParam('template_cdate_classes', 'cdate').replace(/\s+/g, '|'))) {
|
||||
n.innerHTML = getDateTime(editor.getParam("template_cdate_format", editor.getLang("template.cdate_format")));
|
||||
}
|
||||
|
||||
// Replace mdate
|
||||
if (hasClass(n, editor.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|'))) {
|
||||
n.innerHTML = getDateTime(editor.getParam("template_mdate_format", editor.getLang("template.mdate_format")));
|
||||
}
|
||||
|
||||
// Replace selection
|
||||
if (hasClass(n, editor.getParam('template_selected_content_classes', 'selcontent').replace(/\s+/g, '|'))) {
|
||||
n.innerHTML = sel;
|
||||
}
|
||||
});
|
||||
|
||||
replaceVals(el);
|
||||
|
||||
editor.execCommand('mceInsertContent', false, el.innerHTML);
|
||||
editor.addVisual();
|
||||
}
|
||||
|
||||
editor.addCommand('mceInsertTemplate', insertTemplate);
|
||||
|
||||
editor.addButton('template', {
|
||||
title: 'Insert template',
|
||||
onclick: createTemplateList(showDialog)
|
||||
});
|
||||
|
||||
editor.addMenuItem('template', {
|
||||
text: 'Insert template',
|
||||
onclick: createTemplateList(showDialog),
|
||||
context: 'insert'
|
||||
});
|
||||
|
||||
editor.on('PreProcess', function(o) {
|
||||
var dom = editor.dom;
|
||||
|
||||
each(dom.select('div', o.node), function(e) {
|
||||
if (dom.hasClass(e, 'mceTmpl')) {
|
||||
each(dom.select('*', e), function(e) {
|
||||
if (dom.hasClass(e, editor.getParam('template_mdate_classes', 'mdate').replace(/\s+/g, '|'))) {
|
||||
e.innerHTML = getDateTime(editor.getParam("template_mdate_format", editor.getLang("template.mdate_format")));
|
||||
}
|
||||
});
|
||||
|
||||
replaceVals(e);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
1
public/tinymce/plugins/template/plugin.min.js
vendored
Normal file
1
public/tinymce/plugins/template/plugin.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("template",function(e){function t(t){return function(){var a=e.settings.templates;"string"==typeof a?tinymce.util.XHR.send({url:a,success:function(e){t(tinymce.util.JSON.parse(e))}}):t(a)}}function a(t){function a(t){function a(t){if(-1==t.indexOf("<html>")){var a="";tinymce.each(e.contentCSS,function(t){a+='<link type="text/css" rel="stylesheet" href="'+e.documentBaseURI.toAbsolute(t)+'">'}),t="<!DOCTYPE html><html><head>"+a+"</head>"+"<body>"+t+"</body>"+"</html>"}t=r(t,"template_preview_replace_values");var l=n.find("iframe")[0].getEl().contentWindow.document;l.open(),l.write(t),l.close()}var c=t.control.value();c.url?tinymce.util.XHR.send({url:c.url,success:function(e){l=e,a(l)}}):(l=c.content,a(l)),n.find("#description")[0].text(t.control.value().description)}var n,l,o=[];return t&&0!==t.length?(tinymce.each(t,function(e){o.push({selected:!o.length,text:e.title,value:{url:e.url,content:e.content,description:e.description}})}),n=e.windowManager.open({title:"Insert template",body:[{type:"container",label:"Templates",items:{type:"listbox",name:"template",values:o,onselect:a}},{type:"label",name:"description",label:"Description",text:" "},{type:"iframe",minWidth:600,minHeight:400,border:1}],onsubmit:function(){c(!1,l)}}),n.find("listbox")[0].fire("select"),void 0):(e.windowManager.alert("No templates defined"),void 0)}function n(t,a){function n(e,t){if(e=""+e,e.length<t)for(var a=0;a<t-e.length;a++)e="0"+e;return e}var l="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),r="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),c="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),o="January February March April May June July August September October November December".split(" ");return a=a||new Date,t=t.replace("%D","%m/%d/%Y"),t=t.replace("%r","%I:%M:%S %p"),t=t.replace("%Y",""+a.getFullYear()),t=t.replace("%y",""+a.getYear()),t=t.replace("%m",n(a.getMonth()+1,2)),t=t.replace("%d",n(a.getDate(),2)),t=t.replace("%H",""+n(a.getHours(),2)),t=t.replace("%M",""+n(a.getMinutes(),2)),t=t.replace("%S",""+n(a.getSeconds(),2)),t=t.replace("%I",""+((a.getHours()+11)%12+1)),t=t.replace("%p",""+(a.getHours()<12?"AM":"PM")),t=t.replace("%B",""+e.translate(o[a.getMonth()])),t=t.replace("%b",""+e.translate(c[a.getMonth()])),t=t.replace("%A",""+e.translate(r[a.getDay()])),t=t.replace("%a",""+e.translate(l[a.getDay()])),t=t.replace("%%","%")}function l(t){var a=e.dom,n=e.getParam("template_replace_values");o(a.select("*",t),function(e){o(n,function(t,l){a.hasClass(e,l)&&"function"==typeof n[l]&&n[l](e)})})}function r(t,a){return o(e.getParam(a),function(e,a){"function"!=typeof e&&(t=t.replace(new RegExp("\\{\\$"+a+"\\}","g"),e))}),t}function c(t,a){function c(e,t){return new RegExp("\\b"+t+"\\b","g").test(e.className)}var i,s,m=e.dom,u=e.selection.getContent();a=r(a,"template_replace_values"),i=m.create("div",null,a),s=m.select(".mceTmpl",i),s&&s.length>0&&(i=m.create("div",null),i.appendChild(s[0].cloneNode(!0))),o(m.select("*",i),function(t){c(t,e.getParam("template_cdate_classes","cdate").replace(/\s+/g,"|"))&&(t.innerHTML=n(e.getParam("template_cdate_format",e.getLang("template.cdate_format")))),c(t,e.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))&&(t.innerHTML=n(e.getParam("template_mdate_format",e.getLang("template.mdate_format")))),c(t,e.getParam("template_selected_content_classes","selcontent").replace(/\s+/g,"|"))&&(t.innerHTML=u)}),l(i),e.execCommand("mceInsertContent",!1,i.innerHTML),e.addVisual()}var o=tinymce.each;e.addCommand("mceInsertTemplate",c),e.addButton("template",{title:"Insert template",onclick:t(a)}),e.addMenuItem("template",{text:"Insert template",onclick:t(a),context:"insert"}),e.on("PreProcess",function(t){var a=e.dom;o(a.select("div",t.node),function(t){a.hasClass(t,"mceTmpl")&&(o(a.select("*",t),function(t){a.hasClass(t,e.getParam("template_mdate_classes","mdate").replace(/\s+/g,"|"))&&(t.innerHTML=n(e.getParam("template_mdate_format",e.getLang("template.mdate_format"))))}),l(t))})})});
|
Reference in New Issue
Block a user