v1.0
只读模式 group, 分享 评论更多问题 博客标签总是存在一个
This commit is contained in:
app
conf
messages
public
admin
js
min
blog
css
blog
css
index.cssindex.lesstheme
basic.lessdefault.cssdefault.lessdefault.min.cssmobile.lesssimple.csssimple.lesswritting-overwrite.csswritting-overwrite.lesswritting.css
toImage.csstoImage.lessdist
images
blog
favicon_ever.icofavicon_ever2.icoleanote
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
logo.pnglogo
slider
themes
js
all.js
app
bootstrap修改common-min.jscommon.jsfastclick.jsi18n
jquery.mobile-1.4.4.min.jsjquery.ztree.all-3.5.min.jsupload_paste
mdeditor
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.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
font-awesome
css
font
FontAwesome.otffontawesome-webfont.eotfontawesome-webfont.svgfontawesome-webfont.ttffontawesome-webfont.woff
scss
img
member
js
ace
ace.js
ck
ace-min.jsext-beautify-min.jsext-chromevox-min.jsext-elastic_tabstops_lite-min.jsext-emmet-min.jsext-error_marker-min.jsext-keybinding_menu-min.jsext-language_tools-min.jsext-linking-min.jsext-modelist-min.jsext-old_ie-min.jsext-prompt-min.jsext-searchbox-min.jsext-settings_menu-min.jsext-spellcheck-min.jsext-split-min.jsext-static_highlight-min.jsext-statusbar-min.jsext-textarea-min.jsext-themelist-min.jsext-whitespace-min.jskeybinding-emacs-min.jskeybinding-vim-min.jsmode-abap-min.jsmode-actionscript-min.jsmode-ada-min.jsmode-apache_conf-min.jsmode-applescript-min.jsmode-asciidoc-min.jsmode-assembly_x86-min.jsmode-autohotkey-min.jsmode-batchfile-min.jsmode-c9search-min.jsmode-c_cpp-min.jsmode-cirru-min.jsmode-clojure-min.jsmode-cobol-min.jsmode-coffee-min.jsmode-coldfusion-min.jsmode-csharp-min.jsmode-css-min.jsmode-curly-min.jsmode-d-min.jsmode-dart-min.jsmode-diff-min.jsmode-django-min.jsmode-dockerfile-min.jsmode-dot-min.jsmode-ejs-min.jsmode-erlang-min.jsmode-forth-min.jsmode-ftl-min.jsmode-gherkin-min.jsmode-glsl-min.jsmode-golang-min.jsmode-groovy-min.jsmode-haml-min.jsmode-handlebars-min.jsmode-haskell-min.jsmode-haxe-min.jsmode-html-min.jsmode-html_completions-min.jsmode-html_ruby-min.jsmode-ini-min.jsmode-jack-min.jsmode-jade-min.jsmode-java-min.jsmode-javascript-min.jsmode-json-min.jsmode-jsoniq-min.jsmode-jsp-min.jsmode-jsx-min.jsmode-julia-min.jsmode-latex-min.jsmode-less-min.jsmode-liquid-min.jsmode-lisp-min.jsmode-livescript-min.jsmode-logiql-min.jsmode-lsl-min.jsmode-lua-min.jsmode-luapage-min.jsmode-lucene-min.jsmode-makefile-min.jsmode-markdown-min.jsmode-matlab-min.jsmode-mel-min.jsmode-mushcode-min.jsmode-mushcode_high_rules-min.jsmode-mysql-min.jsmode-nix-min.jsmode-objectivec-min.jsmode-ocaml-min.jsmode-pascal-min.jsmode-perl-min.jsmode-pgsql-min.jsmode-php-min.jsmode-plain_text-min.jsmode-powershell-min.jsmode-prolog-min.jsmode-properties-min.jsmode-protobuf-min.jsmode-python-min.jsmode-r-min.jsmode-rdoc-min.jsmode-rhtml-min.jsmode-ruby-min.jsmode-rust-min.jsmode-sass-min.jsmode-scad-min.jsmode-scala-min.jsmode-scheme-min.jsmode-scss-min.jsmode-sh-min.jsmode-sjs-min.jsmode-smarty-min.jsmode-snippets-min.jsmode-soy_template-min.jsmode-space-min.jsmode-sql-min.jsmode-stylus-min.jsmode-svg-min.jsmode-tcl-min.jsmode-tex-min.jsmode-textile-min.jsmode-toml-min.jsmode-twig-min.jsmode-typescript-min.jsmode-vala-min.jsmode-vbscript-min.jsmode-verilog-min.jsmode-vhdl-min.jsmode-xml-min.jsmode-yaml-min.js
ext-beautify.jsext-chromevox.jsext-elastic_tabstops_lite.jsext-emmet.jsext-error_marker.jsext-keybinding_menu.jsext-language_tools.jsext-linking.jsext-modelist.jsext-old_ie.jsext-prompt.jsext-searchbox.jsext-settings_menu.jsext-spellcheck.jsext-split.jsext-static_highlight.jsext-statusbar.jsext-textarea.jsext-themelist.jsext-whitespace.jskeybinding-emacs.jskeybinding-vim.jsmode-abap.jsmode-actionscript.jsmode-ada.jsmode-apache_conf.jsmode-applescript.jsmode-asciidoc.jsmode-assembly_x86.jsmode-autohotkey.jsmode-batchfile.jsmode-c9search.jsmode-c_cpp.jsmode-cirru.jsmode-clojure.jsmode-cobol.jsmode-coffee.jsmode-coldfusion.jsmode-csharp.jsmode-css.jsmode-curly.jsmode-d.jsmode-dart.jsmode-diff.jsmode-django.jsmode-dockerfile.jsmode-dot.jsmode-ejs.jsmode-erlang.jsmode-forth.jsmode-ftl.jsmode-gherkin.jsmode-glsl.jsmode-golang.jsmode-groovy.jsmode-haml.jsmode-handlebars.jsmode-haskell.jsmode-haxe.jsmode-html.jsmode-html_completions.jsmode-html_ruby.jsmode-ini.jsmode-jack.jsmode-jade.jsmode-java.jsmode-javascript.jsmode-json.jsmode-jsoniq.jsmode-jsp.jsmode-jsx.jsmode-julia.jsmode-latex.jsmode-less.jsmode-liquid.jsmode-lisp.jsmode-livescript.jsmode-logiql.jsmode-lsl.jsmode-lua.jsmode-luapage.jsmode-lucene.jsmode-makefile.jsmode-markdown.jsmode-matlab.jsmode-mel.jsmode-mushcode.jsmode-mushcode_high_rules.jsmode-mysql.jsmode-nix.jsmode-objectivec.jsmode-ocaml.jsmode-pascal.jsmode-perl.jsmode-pgsql.jsmode-php.jsmode-plain_text.jsmode-powershell.jsmode-prolog.jsmode-properties.jsmode-protobuf.jsmode-python.jsmode-r.jsmode-rdoc.jsmode-rhtml.jsmode-ruby.jsmode-rust.jsmode-sass.jsmode-scad.jsmode-scala.jsmode-scheme.jsmode-scss.jsmode-sh.jsmode-sjs.jsmode-smarty.jsmode-snippets.jsmode-soy_template.jsmode-space.jsmode-sql.jsmode-stylus.jsmode-svg.jsmode-tcl.jsmode-tex.jsmode-text.jsmode-textile.jsmode-toml.jsmode-twig.jsmode-typescript.jsmode-vala.jsmode-vbscript.jsmode-velocity.jsmode-verilog.jsmode-vhdl.jsmode-xml.jsmode-xquery.jsmode-yaml.jssnippets
abap.jsactionscript.jsada.jsapache_conf.jsapplescript.jsasciidoc.jsassembly_x86.jsautohotkey.jsbatchfile.jsc9search.jsc_cpp.jscirru.js
theme-ambiance.jstheme-chaos.jstheme-chrome.jstheme-cloud9_day.jstheme-cloud9_night.jstheme-cloud9_night_low_color.jstheme-clouds.jstheme-clouds_midnight.jstheme-cobalt.jstheme-crimson_editor.jstheme-dawn.jstheme-dreamweaver.jstheme-eclipse.jstheme-github.jstheme-idle_fingers.jstheme-katzenmilch.jstheme-kr.jstheme-kuroir.jstheme-merbivore.jstheme-merbivore_soft.jstheme-mono_industrial.jstheme-monokai.jstheme-pastel_on_dark.jstheme-solarized_dark.jstheme-solarized_light.jstheme-terminal.jstheme-textmate.jstheme-tomorrow.jstheme-tomorrow_night.jstheme-tomorrow_night_blue.jstheme-tomorrow_night_bright.jstheme-tomorrow_night_eighties.jstheme-twilight.jstheme-vibrant_ink.jstheme-xcode.jsworker-coffee.jsworker-css.jsworker-html.jsworker-javascript.jsworker-json.jsworker-lua.jsworker-php.jsworker-xquery.jsck
abap-min.jsactionscript-min.jsada-min.jsapache_conf-min.jsapplescript-min.jsasciidoc-min.jsassembly_x86-min.jsautohotkey-min.jsbatchfile-min.jsc9search-min.jsc_cpp-min.jscirru-min.jsclojure-min.jscobol-min.jscoffee-min.jscoldfusion-min.jscsharp-min.jscss-min.jscurly-min.jsd-min.jsdart-min.jsdiff-min.jsdjango-min.jsdockerfile-min.jsdot-min.jsejs-min.jserlang-min.jsforth-min.jsftl-min.jsgherkin-min.jsglsl-min.jsgolang-min.jsgroovy-min.jshaml-min.jshandlebars-min.jshaskell-min.jshaxe-min.jshtml-min.jshtml_completions-min.jshtml_ruby-min.jsini-min.jsjack-min.jsjade-min.jsjava-min.jsjavascript-min.jsjson-min.jsjsoniq-min.jsjsp-min.jsjsx-min.jsjulia-min.jslatex-min.jsless-min.jsliquid-min.jslisp-min.jslivescript-min.jslogiql-min.jslsl-min.jslua-min.jsluapage-min.jslucene-min.jsmakefile-min.jsmarkdown-min.jsmatlab-min.jsmel-min.jsmushcode-min.jsmushcode_high_rules-min.jsmysql-min.jsnix-min.jsocaml-min.jspascal-min.jsperl-min.jspgsql-min.jsplain_text-min.jspowershell-min.jsprolog-min.jsproperties-min.jspython-min.jsr-min.jsrdoc-min.jsrhtml-min.jsruby-min.jsrust-min.jsscad-min.jsscheme-min.jsscss-min.jssh-min.jssmarty-min.jssnippets-min.jssoy_template-min.jsspace-min.jsstylus-min.jssvg-min.js
clojure.jscobol.jscoffee.jscoldfusion.jscsharp.jscss.jscurly.jsd.jsdart.jsdiff.jsdjango.jsdockerfile.jsdot.jsejs.jserlang.jsforth.jsftl.jsgherkin.jsglsl.jsgolang.jsgroovy.jshaml.jshandlebars.jshaskell.jshaxe.jshtml.jshtml_completions.jshtml_ruby.jsini.jsjack.jsjade.jsjava.jsjavascript.jsjson.jsjsoniq.jsjsp.jsjsx.jsjulia.jslatex.jsless.jsliquid.jslisp.jslivescript.jslogiql.jslsl.jslua.jsluapage.jslucene.jsmakefile.jsmarkdown.jsmatlab.jsmel.jsmushcode.jsmushcode_high_rules.jsmysql.jsnix.jsobjectivec.jsocaml.jspascal.jsperl.jspgsql.jsphp.jsplain_text.jspowershell.jsprolog.jsproperties.jsprotobuf.jspython.jsr.jsrdoc.jsrhtml.jsruby.jsrust.jssass.jsscad.jsscala.jsscheme.jsscss.jssh.jssjs.jssmarty.jssnippets.jssoy_template.jsspace.jssql.jsstylus.jssvg.jstcl.jstex.jstext.jstextile.jstoml.jstwig.jstypescript.jsvala.jsvbscript.jsvelocity.jsverilog.jsvhdl.jsxml.jsxquery.jsyaml.jstinymce
classes
AddOnManager.jsCompat.jsEditor.jsEditorCommands.jsEditorManager.jsEditorObservable.jsEnterKey.jsEnv.jsFocusManager.jsForceBlocks.jsFormatter.jsLegacyInput.jsNodeChange.jsShortcuts.jsUndoManager.jsWindowManager.js
demo.htmlindex.htmljquery.tinymce.min.jsdom
BookmarkManager.jsControlSelection.jsDOMUtils.jsDomQuery.jsElementUtils.jsEventUtils.jsRange.jsRangeUtils.jsScriptLoader.jsSelection.jsSerializer.jsSizzle.jQuery.jsSizzle.jsStyleSheetLoader.jsTreeWalker.jsTridentSelection.js
fmt
html
jquery.tinymce.jsui
AbsoluteLayout.jsButton.jsButtonGroup.jsCheckbox.jsCollection.jsColorBox.jsColorButton.jsColorPicker.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
license.txtplugins
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
colorpicker
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_code2
leanote_image
leanote_nav
leanote_nav2
leaui_image
legacyoutput
link
lists
media
nonbreaking
noneditable
pagebreak
paste
backup
classes
plugin.dev.jsplugin.jsplugin.min.jspaste_raw
preview
print
save
searchreplace
spellchecker
tabfocus
table
template
textcolor
textpattern
upload_image
visualblocks
css
img
address.gifarticle.gifaside.gifblockquote.gifdiv.gifdl.giffigure.gifh1.gifh2.gifh3.gifh4.gifh5.gifh6.gifhgroup.gifol.gifp.gifpre.gifsection.giful.gif
plugin.jsplugin.min.jsvisualchars
wordcount
skins
lightgray
AbsoluteLayout.lessAnimations.lessButton.lessButtonGroup.lessCheckbox.lessColorBox.lessColorButton.lessColorPicker.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.jsontinymce-small.svgtinymce-small.ttftinymce-small.wofftinymce.dev.svgtinymce.eottinymce.jsontinymce.svgtinymce.ttftinymce.woff
img
skin.dev.lessskin.ie7.dev.lessskin.ie7.lessskin.ie7.min.cssskin.lessskin.min.cssskin.modern.dev.lessthemes
tinymce updates.txttinymce-min.jstinymce.dev.jstinymce.jquery.dev.jstinymce.jquery.jstinymce.jquery.min.jstinymce.jstinymce.min.jstinymce修改
File diff suppressed because one or more lines are too long
3
public/js/app/note-min.js
vendored
3
public/js/app/note-min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
2
public/js/app/notebook-min.js
vendored
2
public/js/app/notebook-min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
||||
Notebook.curNotebookId = "";
|
||||
Notebook.cache = {}; // notebookId => {};
|
||||
Notebook.notebooks = []; // 按次序
|
||||
// <li role="presentation"><a role="menuitem" tabindex="-1" href="#">CSS</a></li>
|
||||
// <li role="presentation"><a role="menuitem" tabindex="-1" href="#">CSS</a></li>
|
||||
Notebook.notebookNavForListNote = ""; // html 为了note list上面和新建时的ul
|
||||
Notebook.notebookNavForNewNote = ""; // html 为了note list上面和新建时的ul
|
||||
|
||||
@ -58,7 +58,7 @@ Notebook.getNotebook = function(notebookId) {
|
||||
Notebook.getNotebookTitle = function(notebookId) {
|
||||
var notebook = Notebook.cache[notebookId];
|
||||
if(notebook) {
|
||||
return toHtmlEntity(notebook.Title);
|
||||
return notebook.Title;
|
||||
} else {
|
||||
return "未知";
|
||||
}
|
||||
@ -72,10 +72,10 @@ Notebook.getNotebookTitle = function(notebookId) {
|
||||
<li><a>August 13, 2013</a></li>
|
||||
</ul>
|
||||
*/
|
||||
|
||||
Notebook.getTreeSetting = function(isSearch, isShare){
|
||||
|
||||
Notebook.getTreeSetting = function(isSearch, isShare){
|
||||
var noSearch = !isSearch;
|
||||
|
||||
|
||||
var self = this;
|
||||
// 添加自定义dom
|
||||
function addDiyDom(treeId, treeNode) {
|
||||
@ -120,15 +120,15 @@ Notebook.getTreeSetting = function(isSearch, isShare){
|
||||
var parentNode;
|
||||
var treeObj = self.tree;
|
||||
var ajaxData = {curNotebookId: treeNode.NotebookId};
|
||||
|
||||
|
||||
// 成为子节点, 那么只需要得到targetNode下所有的子结点即可
|
||||
if(moveType == "inner") {
|
||||
parentNode = targetNode;
|
||||
} else {
|
||||
parentNode = targetNode.getParentNode();
|
||||
}
|
||||
|
||||
// 在targetNode之前或之后,
|
||||
|
||||
// 在targetNode之前或之后,
|
||||
// 那么: 1) 需要将该parentNode下所有的node重新排序即可; 2) treeNodes[0]为parentNode的子
|
||||
if(!parentNode) {
|
||||
var nodes = treeObj.getNodes(); // 得到所有nodes
|
||||
@ -140,7 +140,7 @@ Notebook.getTreeSetting = function(isSearch, isShare){
|
||||
}
|
||||
var nodes = treeObj.getNodesByFilter(filter, false, parentNode);
|
||||
}
|
||||
|
||||
|
||||
ajaxData.siblings = [];
|
||||
for(var i in nodes) {
|
||||
var notebookId = nodes[i].NotebookId;
|
||||
@ -148,15 +148,15 @@ Notebook.getTreeSetting = function(isSearch, isShare){
|
||||
ajaxData.siblings.push(notebookId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ajaxPost("/notebook/dragNotebooks", {data: JSON.stringify(ajaxData)});
|
||||
|
||||
|
||||
// 这里慢!
|
||||
setTimeout(function() {
|
||||
Notebook.changeNav();
|
||||
}, 100);
|
||||
}
|
||||
|
||||
|
||||
if(!isShare) {
|
||||
var onClick = function(e, treeId, treeNode) {
|
||||
var notebookId = treeNode.NotebookId;
|
||||
@ -176,7 +176,7 @@ Notebook.getTreeSetting = function(isSearch, isShare){
|
||||
};
|
||||
var onDblClick = null;
|
||||
}
|
||||
|
||||
|
||||
var setting = {
|
||||
view: {
|
||||
showLine: false,
|
||||
@ -220,12 +220,12 @@ Notebook.getTreeSetting = function(isSearch, isShare){
|
||||
if(treeNode.Title == newName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// 如果是新添加的
|
||||
if(treeNode.IsNew) {
|
||||
var parentNode = treeNode.getParentNode();
|
||||
var parentNotebookId = parentNode ? parentNode.NotebookId : "";
|
||||
|
||||
|
||||
self.doAddNotebook(treeNode.NotebookId, newName, parentNotebookId);
|
||||
} else {
|
||||
self.doUpdateNotebookTitle(treeNode.NotebookId, newName);
|
||||
@ -234,11 +234,11 @@ Notebook.getTreeSetting = function(isSearch, isShare){
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 搜索不能拖拽
|
||||
if(isSearch) {
|
||||
}
|
||||
|
||||
|
||||
return setting;
|
||||
}
|
||||
Notebook.allNotebookId = "0";
|
||||
@ -258,13 +258,13 @@ Notebook.renderNotebooks = function(notebooks) {
|
||||
var notebook = notebooks[i];
|
||||
notebook.Title = trimTitle(notebook.Title);
|
||||
}
|
||||
|
||||
|
||||
notebooks = [{NotebookId: Notebook.allNotebookId, Title: getMsg("all"), drop:false, drag: false}].concat(notebooks);
|
||||
notebooks.push({NotebookId: Notebook.trashNotebookId, Title: getMsg("trash"), drop:false, drag: false});
|
||||
Notebook.notebooks = notebooks; // 缓存之
|
||||
|
||||
|
||||
self.tree = $.fn.zTree.init($("#notebookList"), self.getTreeSetting(), notebooks);
|
||||
|
||||
|
||||
// 展开/折叠图标
|
||||
var $notebookList = $("#notebookList");
|
||||
$notebookList.hover(function () {
|
||||
@ -274,16 +274,16 @@ Notebook.renderNotebooks = function(notebooks) {
|
||||
}, function() {
|
||||
$(this).removeClass("showIcon");
|
||||
});
|
||||
|
||||
|
||||
// 缓存所有notebooks信息
|
||||
if(!isEmpty(notebooks)) {
|
||||
Notebook.curNotebookId = notebooks[0].NotebookId;
|
||||
self.cacheAllNotebooks(notebooks);
|
||||
}
|
||||
|
||||
|
||||
// 渲染nav
|
||||
Notebook.renderNav();
|
||||
|
||||
|
||||
// 渲染第一个notebook作为当前
|
||||
Notebook.changeNotebookNavForNewNote(notebooks[0].NotebookId);
|
||||
}
|
||||
@ -304,7 +304,7 @@ Notebook.expandNotebookTo = function(notebookId, userId) {
|
||||
var me = this;
|
||||
var selected = false;
|
||||
var tree = me.tree;
|
||||
|
||||
|
||||
// 共享的
|
||||
if(userId) {
|
||||
tree = Share.trees[userId];
|
||||
@ -335,7 +335,7 @@ Notebook.expandNotebookTo = function(notebookId, userId) {
|
||||
}
|
||||
|
||||
|
||||
// RenderNotebooks调用,
|
||||
// RenderNotebooks调用,
|
||||
// nav 为了新建, 快速选择, 移动笔记
|
||||
// 这些在添加,修改,删除notebooks都要变动!!!
|
||||
Notebook.renderNav = function(nav) {
|
||||
@ -375,7 +375,7 @@ Notebook.searchNotebookForList = function(key) {
|
||||
if(key) {
|
||||
$search.show();
|
||||
$notebookList.hide();
|
||||
|
||||
|
||||
var notebooks = self.tree.getNodesByParamFuzzy("Title", key);
|
||||
log('search');
|
||||
log(notebooks);
|
||||
@ -400,25 +400,25 @@ Notebook.searchNotebookForList = function(key) {
|
||||
Notebook.getChangedNotebooks = function(notebooks) {
|
||||
var self = this;
|
||||
var navForNewNote = "";
|
||||
|
||||
|
||||
var len = notebooks.length;
|
||||
for(var i = 0; i < len; ++i) {
|
||||
var notebook = notebooks[i];
|
||||
|
||||
|
||||
var classes = "";
|
||||
if(!isEmpty(notebook.Subs)) {
|
||||
classes = "dropdown-submenu";
|
||||
}
|
||||
var eachForNew = tt('<li role="presentation" class="clearfix ?"><div class="new-note-left pull-left" title="为该笔记本新建笔记" href="#" notebookId="?">?</div><div title="为该笔记本新建markdown笔记" class="new-note-right pull-left" notebookId="?">M</div>', classes, notebook.NotebookId, toHtmlEntity(notebook.Title), notebook.NotebookId);
|
||||
|
||||
var eachForNew = tt('<li role="presentation" class="clearfix ?"><div class="new-note-left pull-left" title="为该笔记本新建笔记" href="#" notebookId="?">?</div><div title="为该笔记本新建markdown笔记" class="new-note-right pull-left" notebookId="?">M</div>', classes, notebook.NotebookId, notebook.Title, notebook.NotebookId);
|
||||
|
||||
if(!isEmpty(notebook.Subs)) {
|
||||
eachForNew += "<ul class='dropdown-menu'>";
|
||||
eachForNew += self.getChangedNotebooks(notebook.Subs);
|
||||
eachForNew += "</ul>";
|
||||
}
|
||||
|
||||
|
||||
eachForNew += '</li>';
|
||||
|
||||
|
||||
navForNewNote += eachForNew;
|
||||
}
|
||||
return navForNewNote;
|
||||
@ -431,12 +431,12 @@ Notebook.changeNav = function() {
|
||||
var notebooks = Notebook.tree.getNodes();
|
||||
var pureNotebooks = notebooks.slice(1, -1); // 不含新和垃圾
|
||||
var html = self.getChangedNotebooks(pureNotebooks);
|
||||
|
||||
|
||||
self.everNavForNewNote = html;
|
||||
self.everNotebooks = pureNotebooks;
|
||||
|
||||
|
||||
$("#notebookNavForNewNote").html(html);
|
||||
|
||||
|
||||
// 移动, 复制重新来, 因为nav变了, 移动至-----的notebook导航也变了
|
||||
// 这里速度很慢
|
||||
var t1 = (new Date()).getTime();
|
||||
@ -447,13 +447,13 @@ Notebook.changeNav = function() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的共享notebooks
|
||||
* 我的共享notebooks
|
||||
<div id="shareNotebooks">
|
||||
<div class="folderNote closed">
|
||||
<div class="folderHeader">
|
||||
<a>
|
||||
<h1>
|
||||
<i class="fa fa-angle-right"></i>
|
||||
<i class="fa fa-angle-right"></i>
|
||||
Life's</h1>
|
||||
</a>
|
||||
</div>
|
||||
@ -470,11 +470,11 @@ Notebook.renderShareNotebooks = function(sharedUserInfos, shareNotebooks) {
|
||||
if(isEmpty(sharedUserInfos)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!shareNotebooks || typeof shareNotebooks != "object" || shareNotebooks.length < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var $shareNotebooks = $("#shareNotebooks");
|
||||
var user2ShareNotebooks = {};
|
||||
for(var i in shareNotebooks) {
|
||||
@ -484,18 +484,18 @@ Notebook.renderShareNotebooks = function(sharedUserInfos, shareNotebooks) {
|
||||
for(var i in sharedUserInfos) {
|
||||
var userInfo = sharedUserInfos[i];
|
||||
var userNotebooks = user2ShareNotebooks[userInfo.UserId] || {ShareNotebooks:[]};
|
||||
|
||||
|
||||
userNotebooks.ShareNotebooks = [{NotebookId: "-2", Title: "默认共享"}].concat(userNotebooks.ShareNotebooks)
|
||||
|
||||
var username = toHtmlEntity(userInfo.Username || userInfo.Email);
|
||||
var username = userInfo.Username || userInfo.Email;
|
||||
var header = tt('<div class="folderNote closed"><div class="folderHeader"><a><h1 title="? 的共享"><i class="fa fa-angle-right"></i>?</h1></a></div>', username, username);
|
||||
var body = '<ul class="folderBody">';
|
||||
for(var j in userNotebooks.ShareNotebooks) {
|
||||
var notebook = userNotebooks.ShareNotebooks[j];
|
||||
body += tt('<li><a notebookId="?">?</a></li>', notebook.NotebookId, toHtmlEntity(notebook.Title))
|
||||
body += tt('<li><a notebookId="?">?</a></li>', notebook.NotebookId, notebook.Title)
|
||||
}
|
||||
body += "</ul>";
|
||||
|
||||
|
||||
$shareNotebooks.append(header + body + "</div>")
|
||||
}
|
||||
}
|
||||
@ -519,9 +519,9 @@ Notebook.changeNotebookNavForNewNote = function(notebookId, title) {
|
||||
var notebook = Notebook.cache[0];
|
||||
title = notebook.Title;
|
||||
}
|
||||
|
||||
|
||||
if(!Notebook.isAllNotebookId(notebookId) && !Notebook.isTrashNotebookId(notebookId)) {
|
||||
$("#curNotebookForNewNote").text(title).attr("notebookId", notebookId);
|
||||
$("#curNotebookForNewNote").html(title).attr("notebookId", notebookId);
|
||||
} else if(!$("#curNotebookForNewNote").attr("notebookId")) {
|
||||
// 但又没有一个笔记, 默认选第一个吧
|
||||
// 这里很可能会死循环, 万一用户没有其它笔记呢?
|
||||
@ -537,36 +537,36 @@ Notebook.changeNotebookNavForNewNote = function(notebookId, title) {
|
||||
|
||||
// 改变导航, 两处
|
||||
// 单击左侧, 单击新建下拉时调用
|
||||
// 1 选中左侧导航,
|
||||
// 1 选中左侧导航,
|
||||
// 2 notelist上面 >
|
||||
// 3 新建笔记 - js >
|
||||
// 转成我的nav <-> 共享
|
||||
Notebook.toggleToMyNav = function(userId, notebookId) {
|
||||
$("#sharedNotebookNavForListNav").hide();
|
||||
$("#myNotebookNavForListNav").show();
|
||||
|
||||
|
||||
$("#newMyNote").show();
|
||||
$("#newSharedNote").hide();
|
||||
|
||||
|
||||
// 搜索tag隐藏
|
||||
$("#tagSearch").hide();
|
||||
}
|
||||
Notebook.changeNotebookNav = function(notebookId) {
|
||||
Notebook.curNotebookId = notebookId;
|
||||
Notebook.toggleToMyNav();
|
||||
|
||||
|
||||
// 1 改变当前的notebook
|
||||
Notebook.selectNotebook($(tt('#notebook [notebookId="?"]', notebookId)));
|
||||
|
||||
|
||||
var notebook = Notebook.cache[notebookId];
|
||||
|
||||
|
||||
if(!notebook) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 2
|
||||
$("#curNotebookForListNote").text(notebook.Title);
|
||||
|
||||
$("#curNotebookForListNote").html(notebook.Title);
|
||||
|
||||
// 3
|
||||
Notebook.changeNotebookNavForNewNote(notebookId, notebook.Title);
|
||||
}
|
||||
@ -593,18 +593,18 @@ Notebook.changeNotebookSeq = 1;
|
||||
Notebook.changeNotebook = function(notebookId, callback) {
|
||||
var me = this;
|
||||
Notebook.changeNotebookNav(notebookId);
|
||||
|
||||
|
||||
Notebook.curNotebookId = notebookId;
|
||||
|
||||
|
||||
// 1
|
||||
Note.curChangedSaveIt();
|
||||
|
||||
|
||||
// 2 先清空所有
|
||||
Note.clearAll();
|
||||
|
||||
|
||||
var url = "/note/listNotes/";
|
||||
var param = {notebookId: notebookId};
|
||||
|
||||
|
||||
// 废纸篓
|
||||
if(Notebook.isTrashNotebookId(notebookId)) {
|
||||
url = "/note/listTrashNotes";
|
||||
@ -639,12 +639,11 @@ Notebook.changeNotebook = function(notebookId, callback) {
|
||||
log('数量不一致');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 2 得到笔记本
|
||||
// 这里可以缓存起来, note按notebookId缓存
|
||||
// 这里可能点击过快导致前面点击的后来才返回
|
||||
me.showNoteAndEditorLoading();
|
||||
|
||||
me.changeNotebookSeq++;
|
||||
(function(seq) {
|
||||
ajaxGet(url, param, function(cacheNotes) {
|
||||
@ -686,13 +685,13 @@ Notebook.changeNotebookForNewNote = function(notebookId) {
|
||||
if(Notebook.isTrashNotebookId(notebookId) || Notebook.isAllNotebookId(notebookId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Notebook.changeNotebookNav(notebookId, true);
|
||||
Notebook.curNotebookId = notebookId;
|
||||
|
||||
|
||||
var url = "/note/listNotes/";
|
||||
var param = {notebookId: notebookId};
|
||||
|
||||
|
||||
// 2 得到笔记本
|
||||
// 这里可以缓存起来, note按notebookId缓存
|
||||
ajaxGet(url, param, function(ret) {
|
||||
@ -715,7 +714,7 @@ Notebook.shareNotebooks= function(target) {
|
||||
$("#friendsEmail").focus();
|
||||
}, 500);
|
||||
var notebookId = $(target).attr("notebookId");
|
||||
|
||||
|
||||
shareNoteOrNotebook(notebookId, false);
|
||||
}
|
||||
|
||||
@ -728,7 +727,7 @@ Notebook.setNotebook2Blog = function(target) {
|
||||
if(notebook.IsBlog != undefined) {
|
||||
isBlog = !notebook.IsBlog;
|
||||
}
|
||||
|
||||
|
||||
// 那么, 如果当前是该notebook下, 重新渲染之
|
||||
if(Notebook.curNotebookId == notebookId) {
|
||||
if(isBlog) {
|
||||
@ -736,7 +735,7 @@ Notebook.setNotebook2Blog = function(target) {
|
||||
} else {
|
||||
$("#noteList .item-blog").hide();
|
||||
}
|
||||
|
||||
|
||||
// 如果当前在所有笔记本下
|
||||
} else if(Notebook.curNotebookId == Notebook.allNotebookId){
|
||||
$("#noteItemList .item").each(function(){
|
||||
@ -763,7 +762,7 @@ Notebook.setNotebook2Blog = function(target) {
|
||||
Notebook.updateNotebookTitle = function(target) {
|
||||
var self = Notebook;
|
||||
var notebookId = $(target).attr("notebookId");
|
||||
|
||||
|
||||
if(self.tree2) {
|
||||
self.tree2.editName(self.tree2.getNodeByTId(notebookId));
|
||||
} else {
|
||||
@ -777,7 +776,7 @@ Notebook.doUpdateNotebookTitle = function(notebookId, newTitle) {
|
||||
Notebook.cache[notebookId].Title = newTitle;
|
||||
// 改变nav
|
||||
Notebook.changeNav();
|
||||
|
||||
|
||||
// 同步
|
||||
if(self.tree2) {
|
||||
var notebook = self.tree.getNodeByTId(notebookId);
|
||||
@ -797,7 +796,7 @@ Notebook.addNotebook = function() {
|
||||
if($("#myNotebooks").hasClass("closed")) {
|
||||
$("#myNotebooks .folderHeader").trigger("click");
|
||||
}
|
||||
|
||||
|
||||
// 添加并修改
|
||||
self.tree.addNodes(null, {Title: "", NotebookId: getObjectId(), IsNew: true}, true, true);
|
||||
}
|
||||
@ -811,10 +810,10 @@ Notebook.doAddNotebook = function(notebookId, title, parentNotebookId) {
|
||||
var notebook = self.tree.getNodeByTId(notebookId);
|
||||
$.extend(notebook, ret);
|
||||
notebook.IsNew = false;
|
||||
|
||||
|
||||
// 选中之
|
||||
Notebook.changeNotebook(notebookId);
|
||||
|
||||
|
||||
// 改变nav
|
||||
Notebook.changeNav();
|
||||
}
|
||||
@ -828,9 +827,9 @@ Notebook.addChildNotebook = function(target) {
|
||||
if($("#myNotebooks").hasClass("closed")) {
|
||||
$("#myNotebooks .folderHeader").trigger("click");
|
||||
}
|
||||
|
||||
|
||||
var notebookId = $(target).attr("notebookId");
|
||||
|
||||
|
||||
// 添加并修改
|
||||
self.tree.addNodes(self.tree.getNodeByTId(notebookId), {Title: "", NotebookId: getObjectId(), IsNew: true}, false, true);
|
||||
}
|
||||
@ -839,12 +838,12 @@ Notebook.addChildNotebook = function(target) {
|
||||
// 删除
|
||||
Notebook.deleteNotebook = function(target) {
|
||||
var self = Notebook;
|
||||
|
||||
|
||||
var notebookId = $(target).attr("notebookId");
|
||||
if(!notebookId) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ajaxGet("/notebook/deleteNotebook", {notebookId: notebookId}, function(ret) {
|
||||
if(ret.Ok) {
|
||||
/*
|
||||
@ -855,7 +854,7 @@ Notebook.deleteNotebook = function(target) {
|
||||
self.tree2.removeNode(self.tree2.getNodeByTId(notebookId));
|
||||
}
|
||||
delete Notebook.cache[notebookId];
|
||||
|
||||
|
||||
// 改变nav
|
||||
Notebook.changeNav();
|
||||
} else {
|
||||
@ -878,17 +877,17 @@ $(function() {
|
||||
var notebookId = $(this).find("a").attr("notebookId");
|
||||
Notebook.changeNotebook(notebookId);
|
||||
});
|
||||
|
||||
|
||||
// 修改笔记本标题, blur后修改标题之
|
||||
/*
|
||||
enterBlur("#notebookList", "input#editNotebookTitle");
|
||||
$("#notebookList").on("blur", "input#editNotebookTitle", Notebook.doUpdateNotebookTitle);
|
||||
*/
|
||||
|
||||
|
||||
//-------------------
|
||||
// 右键菜单
|
||||
var notebookListMenu = {
|
||||
width: 180,
|
||||
width: 180,
|
||||
items: [
|
||||
{ text: getMsg("shareToFriends"), alias: 'shareToFriends', icon: "", faIcon: "fa-share-square-o", action: Notebook.listNotebookShareUserInfo},
|
||||
{ type: "splitLine" },
|
||||
@ -904,10 +903,10 @@ $(function() {
|
||||
parent: "#notebookList ",
|
||||
children: "li a"
|
||||
}
|
||||
|
||||
|
||||
// for search
|
||||
var notebookListMenu2 = {
|
||||
width: 180,
|
||||
width: 180,
|
||||
items: [
|
||||
{ text: getMsg("shareToFriends"), alias: 'shareToFriends', icon: "", faIcon: "fa-share-square-o", action: Notebook.listNotebookShareUserInfo},
|
||||
{ type: "splitLine" },
|
||||
@ -922,7 +921,7 @@ $(function() {
|
||||
parent: "#notebookListForSearch ",
|
||||
children: "li a"
|
||||
}
|
||||
|
||||
|
||||
function applyrule(menu) {
|
||||
var notebookId = $(this).attr("notebookId");
|
||||
var notebook = Notebook.cache[notebookId];
|
||||
@ -952,17 +951,17 @@ $(function() {
|
||||
var notebookId = $(this).attr("notebookId");
|
||||
return !Notebook.isTrashNotebookId(notebookId) && !Notebook.isAllNotebookId(notebookId);
|
||||
}
|
||||
|
||||
|
||||
Notebook.contextmenu = $("#notebookList li a").contextmenu(notebookListMenu);
|
||||
|
||||
|
||||
Notebook.contextmenuSearch = $("#notebookListForSearch li a").contextmenu(notebookListMenu2);
|
||||
|
||||
|
||||
// 添加笔记本
|
||||
$("#addNotebookPlus").click(function(e) {
|
||||
e.stopPropagation();
|
||||
Notebook.addNotebook();
|
||||
});
|
||||
|
||||
|
||||
// notebook setting
|
||||
$("#notebookList").on("click", ".notebook-setting", function(e) {
|
||||
e.preventDefault();
|
||||
|
2
public/js/app/page-min.js
vendored
2
public/js/app/page-min.js
vendored
File diff suppressed because one or more lines are too long
@ -25,9 +25,13 @@ editorMode.prototype.toggleAText = function(isWriting) {
|
||||
}, 0);
|
||||
}
|
||||
editorMode.prototype.isWriting = function(hash) {
|
||||
if(!hash) {
|
||||
hash = location.hash;
|
||||
}
|
||||
return hash.indexOf(this.writingHash) >= 0
|
||||
}
|
||||
editorMode.prototype.init = function() {
|
||||
this.$themeLink = $("#themeLink");
|
||||
this.changeMode(this.isWritingMode);
|
||||
var self = this;
|
||||
$(".toggle-editor-mode").click(function(e) {
|
||||
@ -54,8 +58,6 @@ editorMode.prototype.changeMode = function(isWritingMode) {
|
||||
} else {
|
||||
this.normalMode();
|
||||
}
|
||||
|
||||
$("#moreBtn i").removeClass("fa-angle-up").addClass("fa-angle-down");
|
||||
}
|
||||
|
||||
editorMode.prototype.resizeEditor = function() {
|
||||
@ -71,42 +73,39 @@ editorMode.prototype.resizeEditor = function() {
|
||||
}, 500);
|
||||
}
|
||||
editorMode.prototype.normalMode = function() {
|
||||
// 最开始的时候就调用?
|
||||
/*
|
||||
var w = $(document).width();
|
||||
var h = $(document).height();
|
||||
$("#lock").css({right:0, bottom:0});
|
||||
*/
|
||||
|
||||
var $c = $("#editorContent_ifr").contents();
|
||||
|
||||
$c.contents().find("#writtingMode").remove();
|
||||
$c.contents().find('link[href$="editor-writting-mode.css"]').remove();
|
||||
|
||||
*/
|
||||
|
||||
$("#noteItemListWrap, #notesAndSort").show();
|
||||
$("#noteList").unbind("mouseenter").unbind("mouseleave");
|
||||
|
||||
var theme = UserInfo.Theme || "default";
|
||||
theme += ".css";
|
||||
$("#themeLink").attr("href", "/css/theme/" + theme);
|
||||
|
||||
$("#mceToolbar").css("height", "30px");
|
||||
|
||||
// $("#lock").animate({right:w},1000);
|
||||
|
||||
this.resizeEditor();
|
||||
var $themeLink = $("#themeLink");
|
||||
// 如果之前不是normal才换
|
||||
if(this.$themeLink.attr('href').indexOf('writting-overwrite.css') != -1) {
|
||||
this.$themeLink.attr("href", "/css/theme/" + theme);
|
||||
}
|
||||
|
||||
$("#noteList").width(UserInfo.NoteListWidth);
|
||||
$("#note").css("left", UserInfo.NoteListWidth);
|
||||
}
|
||||
|
||||
editorMode.prototype.writtingMode = function() {
|
||||
// $("#pageInner").removeClass("animated fadeInUp");
|
||||
|
||||
$("#themeLink").attr("href", "/css/theme/writting-overwrite.css");
|
||||
if(this.$themeLink.attr('href').indexOf('writting-overwrite.css') == -1) {
|
||||
this.$themeLink.attr("href", "/css/theme/writting-overwrite.css");
|
||||
}
|
||||
|
||||
/*
|
||||
setTimeout(function() {
|
||||
var $c = $("#editorContent_ifr").contents();
|
||||
$c.contents().find("head").append('<link type="text/css" rel="stylesheet" href="/css/editor/editor-writting-mode.css" id="writtingMode">');
|
||||
}, 0);
|
||||
*/
|
||||
|
||||
$("#noteItemListWrap, #notesAndSort").fadeOut();
|
||||
$("#noteList").hover(function() {
|
||||
@ -116,7 +115,7 @@ editorMode.prototype.writtingMode = function() {
|
||||
});
|
||||
|
||||
// 点击扩展会使html的height生成, 切换后会覆盖css文件的
|
||||
$("#mceToolbar").css("height", "40px");
|
||||
// $("#mceToolbar").css("height", "40px");
|
||||
|
||||
//$("#pageInner").addClass("animated fadeInUp");
|
||||
|
||||
@ -124,6 +123,9 @@ editorMode.prototype.writtingMode = function() {
|
||||
|
||||
$("#noteList").width(250);
|
||||
$("#note").css("left", 0);
|
||||
|
||||
// 切换到写模式
|
||||
Note.toggleWriteable();
|
||||
}
|
||||
|
||||
editorMode.prototype.getWritingCss = function() {
|
||||
@ -133,6 +135,7 @@ editorMode.prototype.getWritingCss = function() {
|
||||
return [];
|
||||
}
|
||||
var em = new editorMode();
|
||||
LEA.em = em;
|
||||
|
||||
//----------------
|
||||
// 拖拉改变变宽度
|
||||
@ -444,28 +447,20 @@ function initEditor() {
|
||||
var mceToobarEverHeight = 0;
|
||||
$("#moreBtn").click(function() {
|
||||
saveBookmark();
|
||||
|
||||
var height = $("#mceToolbar").height();
|
||||
|
||||
// 现在是折叠的
|
||||
if (height < $("#popularToolbar").height()) {
|
||||
$("#mceToolbar").height($("#popularToolbar").height());
|
||||
$(this).find("i").removeClass("fa-angle-down").addClass("fa-angle-up");
|
||||
mceToobarEverHeight = height;
|
||||
var $editor = $('#editor');
|
||||
if($editor.hasClass('all-tool')) {
|
||||
$editor.removeClass('all-tool');
|
||||
} else {
|
||||
$("#mceToolbar").height(mceToobarEverHeight);
|
||||
$(this).find("i").removeClass("fa-angle-up").addClass("fa-angle-down");
|
||||
$editor.addClass('all-tool');
|
||||
}
|
||||
|
||||
resizeEditor();
|
||||
|
||||
|
||||
restoreBookmark();
|
||||
});
|
||||
|
||||
// 初始化编辑器
|
||||
tinymce.init({
|
||||
inline: true,
|
||||
// theme: 'leanote',
|
||||
theme: 'leanote',
|
||||
valid_children: "+pre[div|#text|p|span|textarea|i|b|strong]", // ace
|
||||
/*
|
||||
protect: [
|
||||
@ -477,7 +472,16 @@ function initEditor() {
|
||||
],
|
||||
*/
|
||||
setup: function(ed) {
|
||||
ed.on('keydown', Note.saveNote);
|
||||
ed.on('keydown', function(e) {
|
||||
// 如果是readony, 则不能做任何操作
|
||||
var num = e.which ? e.which : e.keyCode;
|
||||
// 如果是readony, 则不能做任何操作, 除了复制
|
||||
if(Note.readOnly && !((e.ctrlKey || e.metaKey) && num == 67)) {
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
Note.saveNote(e);
|
||||
});
|
||||
|
||||
// 为了把下拉菜单关闭
|
||||
ed.on("click", function(e) {
|
||||
@ -496,7 +500,7 @@ function initEditor() {
|
||||
// height: 100,//这个应该是文档的高度, 而其上层的高度是$("#content").height(),
|
||||
// parentHeight: $("#content").height(),
|
||||
// content_css : ["/css/bootstrap.css", "/css/editor/editor.css"].concat(em.getWritingCss()),
|
||||
content_css : ["/css/editor/editor.css"].concat(em.getWritingCss()),
|
||||
content_css : ["/css/editor/editor.css"], // .concat(em.getWritingCss()),
|
||||
skin : "custom",
|
||||
language: LEA.locale, // 语言
|
||||
plugins : [
|
||||
@ -983,9 +987,11 @@ LeaAce = {
|
||||
me.disableAddHistory();
|
||||
|
||||
// 本身就有格式的, 防止之前有格式的显示为<span>(ace下)
|
||||
if($pre.attr('style') || $pre.html().indexOf('style') != -1) {
|
||||
var classes = $pre.attr('class') || '';
|
||||
var isHtml = classes.indexOf('brush:html') != -1;
|
||||
if($pre.attr('style') ||
|
||||
(!isHtml && $pre.html().indexOf('style') != -1)) { // 如果是html就不用考虑了, 因为html格式的支持有style
|
||||
$pre.html($pre.text());
|
||||
// return;
|
||||
}
|
||||
$pre.find('.toggle-raw').remove();
|
||||
var preHtml = $pre.html();
|
||||
@ -1018,6 +1024,9 @@ LeaAce = {
|
||||
aceEditor.setShowInvisibles(false); // OK 不显示空格
|
||||
aceEditor.setOption("wrap", "free");
|
||||
aceEditor.setShowInvisibles(false);
|
||||
|
||||
aceEditor.setReadOnly(Note.readOnly);
|
||||
|
||||
aceEditor.setAutoScrollEditorIntoView(true);
|
||||
aceEditor.setOption("maxLines", 10000);
|
||||
aceEditor.commands.addCommand({
|
||||
@ -1077,10 +1086,17 @@ LeaAce = {
|
||||
var pres = content.find('pre');
|
||||
for(var i = 0 ; i < pres.length; ++i) {
|
||||
var pre = pres.eq(i);
|
||||
// 如果不是ace
|
||||
if(me.isInAce(pre)) {
|
||||
break;
|
||||
|
||||
var aceAndNode = me.isInAce(pre);
|
||||
if(aceAndNode) {
|
||||
if(isAceError(aceAndNode[0].getValue())) {
|
||||
console.error('之前有些没有destroy掉');
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout((function(pre) {
|
||||
return function() {
|
||||
pre.find('.toggle-raw').remove();
|
||||
@ -1183,6 +1199,19 @@ LeaAce = {
|
||||
}
|
||||
return this._aceEditors[id];
|
||||
},
|
||||
setAceReadOnly: function(pre, readOnly) {
|
||||
var me = this;
|
||||
if(typeof pre == 'object') {
|
||||
var id = pre.attr('id');
|
||||
}
|
||||
else {
|
||||
var id = pre;
|
||||
}
|
||||
var ace = me.getAce(id);
|
||||
if(ace) {
|
||||
ace.setReadOnly(readOnly);
|
||||
}
|
||||
},
|
||||
// 当前焦点是否在aceEditor中
|
||||
nowIsInAce: function () {
|
||||
if(!this.canAce()) {
|
||||
@ -1275,6 +1304,10 @@ LeaAce = {
|
||||
var aceEditor = aceEditorAndPre[0];
|
||||
var $pre = aceEditorAndPre[1];
|
||||
var value = aceEditor.getValue();
|
||||
// 表示有错
|
||||
if(isAceError(value)) {
|
||||
value = $pre.html();
|
||||
}
|
||||
value = value.replace(/</g, '<').replace(/>/g, '>');
|
||||
// var id = getAceId();
|
||||
var replacePre = $('<pre class="' + $pre.attr('class') + ' ace-to-pre">' + value + "</pre>");
|
||||
|
2
public/js/app/tag-min.js
vendored
2
public/js/app/tag-min.js
vendored
File diff suppressed because one or more lines are too long
@ -86,7 +86,7 @@ function showTagList(event) {
|
||||
Tag.renderReadOnlyTags = function(tags) {
|
||||
// 先清空
|
||||
$("#noteReadTags").html("");
|
||||
if(isEmpty(tags)) {
|
||||
if(isEmpty(tags) || (tags.length == 1 && tags[0] == "")) {
|
||||
$("#noteReadTags").html(getMsg("noTag"));
|
||||
}
|
||||
|
||||
@ -104,13 +104,11 @@ Tag.renderReadOnlyTags = function(tags) {
|
||||
for(var i in tags) {
|
||||
var text = tags[i];
|
||||
text = Tag.mapEn2Cn[text] || text;
|
||||
text = text.replace(/[\r\n]/g, '');
|
||||
|
||||
var classes = Tag.classes[text];
|
||||
if(!classes) {
|
||||
classes = getNextDefaultClasses();
|
||||
}
|
||||
tag = tt('<span class="?">?</span>', classes, toHtmlEntity(text));
|
||||
tag = tt('<span class="?">?</span>', classes, text);
|
||||
|
||||
$("#noteReadTags").append(tag);
|
||||
}
|
||||
@ -147,9 +145,7 @@ Tag.appendTag = function(tag, save) {
|
||||
text = Tag.mapEn2Cn[text] || text;
|
||||
rawText = Tag.mapCn2En[rawText] || rawText;
|
||||
}
|
||||
text = text.replace(/[\r\n]/g, '');
|
||||
|
||||
tag = tt('<span class="?" data-tag="?">?<i title="' + getMsg("delete") + '">X</i></span>', classes, text, toHtmlEntity(text));
|
||||
tag = tt('<span class="?" data-tag="?">?<i title="' + getMsg("delete") + '">X</i></span>', classes, text, text);
|
||||
|
||||
// 避免重复
|
||||
var isExists = false;
|
||||
@ -239,9 +235,8 @@ Tag.renderTagNav = function(tags) {
|
||||
if(LEA.locale == "zh") {
|
||||
var text = Tag.mapEn2Cn[tag] || text;
|
||||
}
|
||||
text = text.replace(/[\r\n]/g, '');
|
||||
var classes = Tag.classes[tag] || "label label-default";
|
||||
$("#tagNav").append(tt('<li data-tag="?"><a> <span class="?">?</span> <span class="tag-delete">X</span></li>', tag, classes, toHtmlEntity(text)));
|
||||
$("#tagNav").append(tt('<li data-tag="?"><a> <span class="?">?</span> <span class="tag-delete">X</span></li>', tag, classes, text));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
|
||||
= modal =
|
||||
bootstrap.js modal 缓存修改, 不缓存remote的数据
|
||||
添加postShow
|
2
public/js/common-min.js
vendored
2
public/js/common-min.js
vendored
File diff suppressed because one or more lines are too long
@ -343,7 +343,7 @@ function switchEditor(isMarkdown) {
|
||||
// 可能是tinymce还没有渲染成功
|
||||
var previewToken = "<div style='display: none'>FORTOKEN</div>"
|
||||
var clearIntervalForSetContent;
|
||||
function setEditorContent(content, isMarkdown, preview) {
|
||||
function setEditorContent(content, isMarkdown, preview, callback) {
|
||||
if(!content) {
|
||||
content = "";
|
||||
}
|
||||
@ -366,6 +366,7 @@ function setEditorContent(content, isMarkdown, preview) {
|
||||
if(typeof tinymce != "undefined" && tinymce.activeEditor) {
|
||||
var editor = tinymce.activeEditor;
|
||||
editor.setContent(content);
|
||||
callback && callback();
|
||||
/*
|
||||
if(LeaAce.canAce() && LeaAce.isAce) {
|
||||
try {
|
||||
@ -382,7 +383,7 @@ function setEditorContent(content, isMarkdown, preview) {
|
||||
} else {
|
||||
// 等下再设置
|
||||
clearIntervalForSetContent = setTimeout(function() {
|
||||
setEditorContent(content, false);
|
||||
setEditorContent(content, false, false, callback);
|
||||
}, 100);
|
||||
}
|
||||
} else {
|
||||
@ -409,9 +410,10 @@ function setEditorContent(content, isMarkdown, preview) {
|
||||
*/
|
||||
if(MD) {
|
||||
MD.setContent(content);
|
||||
callback && callback();
|
||||
} else {
|
||||
clearIntervalForSetContent = setTimeout(function() {
|
||||
setEditorContent(content, true);
|
||||
setEditorContent(content, true, false, callback);
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
@ -425,6 +427,14 @@ function previewIsEmpty(preview) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ace的值有误?
|
||||
function isAceError(val) {
|
||||
if(!val) {
|
||||
return false;
|
||||
}
|
||||
return val.indexOf('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') != -1;
|
||||
}
|
||||
|
||||
// 有tinymce得到的content有<html>包围
|
||||
function getEditorContent(isMarkdown) {
|
||||
if(!isMarkdown) {
|
||||
@ -434,17 +444,24 @@ function getEditorContent(isMarkdown) {
|
||||
// 删除toggle raw
|
||||
content.find('.toggle-raw').remove();
|
||||
|
||||
// 替换掉ace editor
|
||||
var pres = content.find('pre');
|
||||
for(var i = 0 ; i < pres.length; ++i) {
|
||||
var pre = pres.eq(i);
|
||||
var id = pre.attr('id');
|
||||
var aceEditor = LeaAce.getAce(id);
|
||||
if(aceEditor) {
|
||||
var val = aceEditor.getValue();
|
||||
val = val.replace(/</g, '<').replace(/>/g, '>');
|
||||
pre.removeAttr('style', '').removeAttr('contenteditable').removeClass('ace_editor');
|
||||
pre.html(val);
|
||||
// single页面没有LeaAce
|
||||
if(window.LeaAce && LeaAce.getAce) {
|
||||
// 替换掉ace editor
|
||||
var pres = content.find('pre');
|
||||
for(var i = 0 ; i < pres.length; ++i) {
|
||||
var pre = pres.eq(i);
|
||||
var id = pre.attr('id');
|
||||
var aceEditor = LeaAce.getAce(id);
|
||||
if(aceEditor) {
|
||||
var val = aceEditor.getValue();
|
||||
// 表示有错
|
||||
if(isAceError(val)) {
|
||||
val = pre.html();
|
||||
}
|
||||
val = val.replace(/</g, '<').replace(/>/g, '>');
|
||||
pre.removeAttr('style', '').removeAttr('contenteditable').removeClass('ace_editor');
|
||||
pre.html(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -674,6 +691,8 @@ function getObjectId() {
|
||||
|
||||
//-----------------------------------------
|
||||
function resizeEditor(second) {
|
||||
return;
|
||||
|
||||
var ifrParent = $("#editorContent_ifr").parent();
|
||||
ifrParent.css("overflow", "auto");
|
||||
var height = $("#editorContent").height();
|
||||
@ -683,7 +702,7 @@ function resizeEditor(second) {
|
||||
|
||||
// life 12.9
|
||||
// inline editor
|
||||
$("#editorContent").css("top", $("#mceToolbar").height());
|
||||
// $("#editorContent").css("top", $("#mceToolbar").height());
|
||||
|
||||
/*
|
||||
// 第一次时可能会被改变
|
||||
@ -1278,16 +1297,6 @@ function setHash(key, value) {
|
||||
location.href = "#" + str;
|
||||
}
|
||||
|
||||
// 防止js注入
|
||||
function trimTitle(title) {
|
||||
if(!title) {
|
||||
return '';
|
||||
}
|
||||
var trimTitle = function(title) {
|
||||
return title.replace(/<.*?script.*?>/g, '');
|
||||
};
|
||||
function toHtmlEntity(html) {
|
||||
if(!html) {
|
||||
return '';
|
||||
}
|
||||
return (html + '').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||||
};
|
@ -1,822 +0,0 @@
|
||||
/**
|
||||
* @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
|
||||
*
|
||||
* @version 1.0.3
|
||||
* @codingstandard ftlabs-jsv2
|
||||
* @copyright The Financial Times Limited [All Rights Reserved]
|
||||
* @license MIT License (see LICENSE.txt)
|
||||
*/
|
||||
|
||||
/*jslint browser:true, node:true*/
|
||||
/*global define, Event, Node*/
|
||||
|
||||
|
||||
/**
|
||||
* Instantiate fast-clicking listeners on the specified layer.
|
||||
*
|
||||
* @constructor
|
||||
* @param {Element} layer The layer to listen on
|
||||
* @param {Object} options The options to override the defaults
|
||||
*/
|
||||
function FastClick(layer, options) {
|
||||
'use strict';
|
||||
var oldOnClick;
|
||||
|
||||
options = options || {};
|
||||
|
||||
/**
|
||||
* Whether a click is currently being tracked.
|
||||
*
|
||||
* @type boolean
|
||||
*/
|
||||
this.trackingClick = false;
|
||||
|
||||
|
||||
/**
|
||||
* Timestamp for when click tracking started.
|
||||
*
|
||||
* @type number
|
||||
*/
|
||||
this.trackingClickStart = 0;
|
||||
|
||||
|
||||
/**
|
||||
* The element being tracked for a click.
|
||||
*
|
||||
* @type EventTarget
|
||||
*/
|
||||
this.targetElement = null;
|
||||
|
||||
|
||||
/**
|
||||
* X-coordinate of touch start event.
|
||||
*
|
||||
* @type number
|
||||
*/
|
||||
this.touchStartX = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Y-coordinate of touch start event.
|
||||
*
|
||||
* @type number
|
||||
*/
|
||||
this.touchStartY = 0;
|
||||
|
||||
|
||||
/**
|
||||
* ID of the last touch, retrieved from Touch.identifier.
|
||||
*
|
||||
* @type number
|
||||
*/
|
||||
this.lastTouchIdentifier = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Touchmove boundary, beyond which a click will be cancelled.
|
||||
*
|
||||
* @type number
|
||||
*/
|
||||
this.touchBoundary = options.touchBoundary || 10;
|
||||
|
||||
|
||||
/**
|
||||
* The FastClick layer.
|
||||
*
|
||||
* @type Element
|
||||
*/
|
||||
this.layer = layer;
|
||||
|
||||
/**
|
||||
* The minimum time between tap(touchstart and touchend) events
|
||||
*
|
||||
* @type number
|
||||
*/
|
||||
this.tapDelay = options.tapDelay || 200;
|
||||
|
||||
if (FastClick.notNeeded(layer)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Some old versions of Android don't have Function.prototype.bind
|
||||
function bind(method, context) {
|
||||
return function() { return method.apply(context, arguments); };
|
||||
}
|
||||
|
||||
|
||||
var methods = ['onMouse', 'onClick', 'onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'];
|
||||
var context = this;
|
||||
for (var i = 0, l = methods.length; i < l; i++) {
|
||||
context[methods[i]] = bind(context[methods[i]], context);
|
||||
}
|
||||
|
||||
// Set up event handlers as required
|
||||
if (deviceIsAndroid) {
|
||||
layer.addEventListener('mouseover', this.onMouse, true);
|
||||
layer.addEventListener('mousedown', this.onMouse, true);
|
||||
layer.addEventListener('mouseup', this.onMouse, true);
|
||||
}
|
||||
|
||||
layer.addEventListener('click', this.onClick, true);
|
||||
layer.addEventListener('touchstart', this.onTouchStart, false);
|
||||
layer.addEventListener('touchmove', this.onTouchMove, false);
|
||||
layer.addEventListener('touchend', this.onTouchEnd, false);
|
||||
layer.addEventListener('touchcancel', this.onTouchCancel, false);
|
||||
|
||||
// Hack is required for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
|
||||
// which is how FastClick normally stops click events bubbling to callbacks registered on the FastClick
|
||||
// layer when they are cancelled.
|
||||
if (!Event.prototype.stopImmediatePropagation) {
|
||||
layer.removeEventListener = function(type, callback, capture) {
|
||||
var rmv = Node.prototype.removeEventListener;
|
||||
if (type === 'click') {
|
||||
rmv.call(layer, type, callback.hijacked || callback, capture);
|
||||
} else {
|
||||
rmv.call(layer, type, callback, capture);
|
||||
}
|
||||
};
|
||||
|
||||
layer.addEventListener = function(type, callback, capture) {
|
||||
var adv = Node.prototype.addEventListener;
|
||||
if (type === 'click') {
|
||||
adv.call(layer, type, callback.hijacked || (callback.hijacked = function(event) {
|
||||
if (!event.propagationStopped) {
|
||||
callback(event);
|
||||
}
|
||||
}), capture);
|
||||
} else {
|
||||
adv.call(layer, type, callback, capture);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// If a handler is already declared in the element's onclick attribute, it will be fired before
|
||||
// FastClick's onClick handler. Fix this by pulling out the user-defined handler function and
|
||||
// adding it as listener.
|
||||
if (typeof layer.onclick === 'function') {
|
||||
|
||||
// Android browser on at least 3.2 requires a new reference to the function in layer.onclick
|
||||
// - the old one won't work if passed to addEventListener directly.
|
||||
oldOnClick = layer.onclick;
|
||||
layer.addEventListener('click', function(event) {
|
||||
oldOnClick(event);
|
||||
}, false);
|
||||
layer.onclick = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Android requires exceptions.
|
||||
*
|
||||
* @type boolean
|
||||
*/
|
||||
var deviceIsAndroid = navigator.userAgent.indexOf('Android') > 0;
|
||||
|
||||
|
||||
/**
|
||||
* iOS requires exceptions.
|
||||
*
|
||||
* @type boolean
|
||||
*/
|
||||
var deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent);
|
||||
|
||||
|
||||
/**
|
||||
* iOS 4 requires an exception for select elements.
|
||||
*
|
||||
* @type boolean
|
||||
*/
|
||||
var deviceIsIOS4 = deviceIsIOS && (/OS 4_\d(_\d)?/).test(navigator.userAgent);
|
||||
|
||||
|
||||
/**
|
||||
* iOS 6.0(+?) requires the target element to be manually derived
|
||||
*
|
||||
* @type boolean
|
||||
*/
|
||||
var deviceIsIOSWithBadTarget = deviceIsIOS && (/OS ([6-9]|\d{2})_\d/).test(navigator.userAgent);
|
||||
|
||||
/**
|
||||
* BlackBerry requires exceptions.
|
||||
*
|
||||
* @type boolean
|
||||
*/
|
||||
var deviceIsBlackBerry10 = navigator.userAgent.indexOf('BB10') > 0;
|
||||
|
||||
/**
|
||||
* Determine whether a given element requires a native click.
|
||||
*
|
||||
* @param {EventTarget|Element} target Target DOM element
|
||||
* @returns {boolean} Returns true if the element needs a native click
|
||||
*/
|
||||
FastClick.prototype.needsClick = function(target) {
|
||||
'use strict';
|
||||
switch (target.nodeName.toLowerCase()) {
|
||||
|
||||
// Don't send a synthetic click to disabled inputs (issue #62)
|
||||
case 'button':
|
||||
case 'select':
|
||||
case 'textarea':
|
||||
if (target.disabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'input':
|
||||
|
||||
// File inputs need real clicks on iOS 6 due to a browser bug (issue #68)
|
||||
if ((deviceIsIOS && target.type === 'file') || target.disabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'label':
|
||||
case 'video':
|
||||
return true;
|
||||
}
|
||||
|
||||
return (/\bneedsclick\b/).test(target.className);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether a given element requires a call to focus to simulate click into element.
|
||||
*
|
||||
* @param {EventTarget|Element} target Target DOM element
|
||||
* @returns {boolean} Returns true if the element requires a call to focus to simulate native click.
|
||||
*/
|
||||
FastClick.prototype.needsFocus = function(target) {
|
||||
'use strict';
|
||||
switch (target.nodeName.toLowerCase()) {
|
||||
case 'textarea':
|
||||
return true;
|
||||
case 'select':
|
||||
return !deviceIsAndroid;
|
||||
case 'input':
|
||||
switch (target.type) {
|
||||
case 'button':
|
||||
case 'checkbox':
|
||||
case 'file':
|
||||
case 'image':
|
||||
case 'radio':
|
||||
case 'submit':
|
||||
return false;
|
||||
}
|
||||
|
||||
// No point in attempting to focus disabled inputs
|
||||
return !target.disabled && !target.readOnly;
|
||||
default:
|
||||
return (/\bneedsfocus\b/).test(target.className);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Send a click event to the specified element.
|
||||
*
|
||||
* @param {EventTarget|Element} targetElement
|
||||
* @param {Event} event
|
||||
*/
|
||||
FastClick.prototype.sendClick = function(targetElement, event) {
|
||||
'use strict';
|
||||
var clickEvent, touch;
|
||||
|
||||
// On some Android devices activeElement needs to be blurred otherwise the synthetic click will have no effect (#24)
|
||||
if (document.activeElement && document.activeElement !== targetElement) {
|
||||
document.activeElement.blur();
|
||||
// $("#editorContent_ifr").blur();
|
||||
}
|
||||
|
||||
touch = event.changedTouches[0];
|
||||
|
||||
// Synthesise a click event, with an extra attribute so it can be tracked
|
||||
clickEvent = document.createEvent('MouseEvents');
|
||||
clickEvent.initMouseEvent(this.determineEventType(targetElement), true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);
|
||||
clickEvent.forwardedTouchEvent = true;
|
||||
targetElement.dispatchEvent(clickEvent);
|
||||
};
|
||||
|
||||
FastClick.prototype.determineEventType = function(targetElement) {
|
||||
'use strict';
|
||||
|
||||
//Issue #159: Android Chrome Select Box does not open with a synthetic click event
|
||||
if (deviceIsAndroid && targetElement.tagName.toLowerCase() === 'select') {
|
||||
return 'mousedown';
|
||||
}
|
||||
|
||||
return 'click';
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {EventTarget|Element} targetElement
|
||||
*/
|
||||
FastClick.prototype.focus = function(targetElement) {
|
||||
'use strict';
|
||||
var length;
|
||||
|
||||
// Issue #160: on iOS 7, some input elements (e.g. date datetime) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724.
|
||||
if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time') {
|
||||
length = targetElement.value.length;
|
||||
targetElement.setSelectionRange(length, length);
|
||||
} else {
|
||||
targetElement.focus();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Check whether the given target element is a child of a scrollable layer and if so, set a flag on it.
|
||||
*
|
||||
* @param {EventTarget|Element} targetElement
|
||||
*/
|
||||
FastClick.prototype.updateScrollParent = function(targetElement) {
|
||||
'use strict';
|
||||
var scrollParent, parentElement;
|
||||
|
||||
scrollParent = targetElement.fastClickScrollParent;
|
||||
|
||||
// Attempt to discover whether the target element is contained within a scrollable layer. Re-check if the
|
||||
// target element was moved to another parent.
|
||||
if (!scrollParent || !scrollParent.contains(targetElement)) {
|
||||
parentElement = targetElement;
|
||||
do {
|
||||
if (parentElement.scrollHeight > parentElement.offsetHeight) {
|
||||
scrollParent = parentElement;
|
||||
targetElement.fastClickScrollParent = parentElement;
|
||||
break;
|
||||
}
|
||||
|
||||
parentElement = parentElement.parentElement;
|
||||
} while (parentElement);
|
||||
}
|
||||
|
||||
// Always update the scroll top tracker if possible.
|
||||
if (scrollParent) {
|
||||
scrollParent.fastClickLastScrollTop = scrollParent.scrollTop;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {EventTarget} targetElement
|
||||
* @returns {Element|EventTarget}
|
||||
*/
|
||||
FastClick.prototype.getTargetElementFromEventTarget = function(eventTarget) {
|
||||
'use strict';
|
||||
|
||||
// On some older browsers (notably Safari on iOS 4.1 - see issue #56) the event target may be a text node.
|
||||
if (eventTarget.nodeType === Node.TEXT_NODE) {
|
||||
return eventTarget.parentNode;
|
||||
}
|
||||
|
||||
return eventTarget;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* On touch start, record the position and scroll offset.
|
||||
*
|
||||
* @param {Event} event
|
||||
* @returns {boolean}
|
||||
*/
|
||||
FastClick.prototype.onTouchStart = function(event) {
|
||||
'use strict';
|
||||
var targetElement, touch, selection;
|
||||
|
||||
// Ignore multiple touches, otherwise pinch-to-zoom is prevented if both fingers are on the FastClick element (issue #111).
|
||||
if (event.targetTouches.length > 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
targetElement = this.getTargetElementFromEventTarget(event.target);
|
||||
touch = event.targetTouches[0];
|
||||
|
||||
if (deviceIsIOS) {
|
||||
|
||||
// Only trusted events will deselect text on iOS (issue #49)
|
||||
selection = window.getSelection();
|
||||
if (selection.rangeCount && !selection.isCollapsed) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!deviceIsIOS4) {
|
||||
|
||||
// Weird things happen on iOS when an alert or confirm dialog is opened from a click event callback (issue #23):
|
||||
// when the user next taps anywhere else on the page, new touchstart and touchend events are dispatched
|
||||
// with the same identifier as the touch event that previously triggered the click that triggered the alert.
|
||||
// Sadly, there is an issue on iOS 4 that causes some normal touch events to have the same identifier as an
|
||||
// immediately preceeding touch event (issue #52), so this fix is unavailable on that platform.
|
||||
// Issue 120: touch.identifier is 0 when Chrome dev tools 'Emulate touch events' is set with an iOS device UA string,
|
||||
// which causes all touch events to be ignored. As this block only applies to iOS, and iOS identifiers are always long,
|
||||
// random integers, it's safe to to continue if the identifier is 0 here.
|
||||
if (touch.identifier && touch.identifier === this.lastTouchIdentifier) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
this.lastTouchIdentifier = touch.identifier;
|
||||
|
||||
// If the target element is a child of a scrollable layer (using -webkit-overflow-scrolling: touch) and:
|
||||
// 1) the user does a fling scroll on the scrollable layer
|
||||
// 2) the user stops the fling scroll with another tap
|
||||
// then the event.target of the last 'touchend' event will be the element that was under the user's finger
|
||||
// when the fling scroll was started, causing FastClick to send a click event to that layer - unless a check
|
||||
// is made to ensure that a parent layer was not scrolled before sending a synthetic click (issue #42).
|
||||
this.updateScrollParent(targetElement);
|
||||
}
|
||||
}
|
||||
|
||||
this.trackingClick = true;
|
||||
this.trackingClickStart = event.timeStamp;
|
||||
this.targetElement = targetElement;
|
||||
|
||||
this.touchStartX = touch.pageX;
|
||||
this.touchStartY = touch.pageY;
|
||||
|
||||
// Prevent phantom clicks on fast double-tap (issue #36)
|
||||
if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Based on a touchmove event object, check whether the touch has moved past a boundary since it started.
|
||||
*
|
||||
* @param {Event} event
|
||||
* @returns {boolean}
|
||||
*/
|
||||
FastClick.prototype.touchHasMoved = function(event) {
|
||||
'use strict';
|
||||
var touch = event.changedTouches[0], boundary = this.touchBoundary;
|
||||
|
||||
if (Math.abs(touch.pageX - this.touchStartX) > boundary || Math.abs(touch.pageY - this.touchStartY) > boundary) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Update the last position.
|
||||
*
|
||||
* @param {Event} event
|
||||
* @returns {boolean}
|
||||
*/
|
||||
FastClick.prototype.onTouchMove = function(event) {
|
||||
'use strict';
|
||||
if (!this.trackingClick) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If the touch has moved, cancel the click tracking
|
||||
if (this.targetElement !== this.getTargetElementFromEventTarget(event.target) || this.touchHasMoved(event)) {
|
||||
this.trackingClick = false;
|
||||
this.targetElement = null;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Attempt to find the labelled control for the given label element.
|
||||
*
|
||||
* @param {EventTarget|HTMLLabelElement} labelElement
|
||||
* @returns {Element|null}
|
||||
*/
|
||||
FastClick.prototype.findControl = function(labelElement) {
|
||||
'use strict';
|
||||
|
||||
// Fast path for newer browsers supporting the HTML5 control attribute
|
||||
if (labelElement.control !== undefined) {
|
||||
return labelElement.control;
|
||||
}
|
||||
|
||||
// All browsers under test that support touch events also support the HTML5 htmlFor attribute
|
||||
if (labelElement.htmlFor) {
|
||||
return document.getElementById(labelElement.htmlFor);
|
||||
}
|
||||
|
||||
// If no for attribute exists, attempt to retrieve the first labellable descendant element
|
||||
// the list of which is defined here: http://www.w3.org/TR/html5/forms.html#category-label
|
||||
return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* On touch end, determine whether to send a click event at once.
|
||||
*
|
||||
* @param {Event} event
|
||||
* @returns {boolean}
|
||||
*/
|
||||
FastClick.prototype.onTouchEnd = function(event) {
|
||||
'use strict';
|
||||
var forElement, trackingClickStart, targetTagName, scrollParent, touch, targetElement = this.targetElement;
|
||||
|
||||
if (!this.trackingClick) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Prevent phantom clicks on fast double-tap (issue #36)
|
||||
if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
|
||||
this.cancelNextClick = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Reset to prevent wrong click cancel on input (issue #156).
|
||||
this.cancelNextClick = false;
|
||||
|
||||
this.lastClickTime = event.timeStamp;
|
||||
|
||||
trackingClickStart = this.trackingClickStart;
|
||||
this.trackingClick = false;
|
||||
this.trackingClickStart = 0;
|
||||
|
||||
// On some iOS devices, the targetElement supplied with the event is invalid if the layer
|
||||
// is performing a transition or scroll, and has to be re-detected manually. Note that
|
||||
// for this to function correctly, it must be called *after* the event target is checked!
|
||||
// See issue #57; also filed as rdar://13048589 .
|
||||
if (deviceIsIOSWithBadTarget) {
|
||||
touch = event.changedTouches[0];
|
||||
|
||||
// In certain cases arguments of elementFromPoint can be negative, so prevent setting targetElement to null
|
||||
targetElement = document.elementFromPoint(touch.pageX - window.pageXOffset, touch.pageY - window.pageYOffset) || targetElement;
|
||||
targetElement.fastClickScrollParent = this.targetElement.fastClickScrollParent;
|
||||
}
|
||||
|
||||
targetTagName = targetElement.tagName.toLowerCase();
|
||||
if (targetTagName === 'label') {
|
||||
forElement = this.findControl(targetElement);
|
||||
if (forElement) {
|
||||
this.focus(targetElement);
|
||||
if (deviceIsAndroid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
targetElement = forElement;
|
||||
}
|
||||
} else if (this.needsFocus(targetElement)) {
|
||||
|
||||
// Case 1: If the touch started a while ago (best guess is 100ms based on tests for issue #36) then focus will be triggered anyway. Return early and unset the target element reference so that the subsequent click will be allowed through.
|
||||
// Case 2: Without this exception for input elements tapped when the document is contained in an iframe, then any inputted text won't be visible even though the value attribute is updated as the user types (issue #37).
|
||||
if ((event.timeStamp - trackingClickStart) > 100 || (deviceIsIOS && window.top !== window && targetTagName === 'input')) {
|
||||
this.targetElement = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
this.focus(targetElement);
|
||||
this.sendClick(targetElement, event);
|
||||
|
||||
// Select elements need the event to go through on iOS 4, otherwise the selector menu won't open.
|
||||
// Also this breaks opening selects when VoiceOver is active on iOS6, iOS7 (and possibly others)
|
||||
if (!deviceIsIOS || targetTagName !== 'select') {
|
||||
this.targetElement = null;
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (deviceIsIOS && !deviceIsIOS4) {
|
||||
|
||||
// Don't send a synthetic click event if the target element is contained within a parent layer that was scrolled
|
||||
// and this tap is being used to stop the scrolling (usually initiated by a fling - issue #42).
|
||||
scrollParent = targetElement.fastClickScrollParent;
|
||||
if (scrollParent && scrollParent.fastClickLastScrollTop !== scrollParent.scrollTop) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent the actual click from going though - unless the target node is marked as requiring
|
||||
// real clicks or if it is in the whitelist in which case only non-programmatic clicks are permitted.
|
||||
if (!this.needsClick(targetElement)) {
|
||||
event.preventDefault();
|
||||
this.sendClick(targetElement, event);
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* On touch cancel, stop tracking the click.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
FastClick.prototype.onTouchCancel = function() {
|
||||
'use strict';
|
||||
this.trackingClick = false;
|
||||
this.targetElement = null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Determine mouse events which should be permitted.
|
||||
*
|
||||
* @param {Event} event
|
||||
* @returns {boolean}
|
||||
*/
|
||||
FastClick.prototype.onMouse = function(event) {
|
||||
'use strict';
|
||||
|
||||
// If a target element was never set (because a touch event was never fired) allow the event
|
||||
if (!this.targetElement) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (event.forwardedTouchEvent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Programmatically generated events targeting a specific element should be permitted
|
||||
if (!event.cancelable) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Derive and check the target element to see whether the mouse event needs to be permitted;
|
||||
// unless explicitly enabled, prevent non-touch click events from triggering actions,
|
||||
// to prevent ghost/doubleclicks.
|
||||
if (!this.needsClick(this.targetElement) || this.cancelNextClick) {
|
||||
|
||||
// Prevent any user-added listeners declared on FastClick element from being fired.
|
||||
if (event.stopImmediatePropagation) {
|
||||
event.stopImmediatePropagation();
|
||||
} else {
|
||||
|
||||
// Part of the hack for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
|
||||
event.propagationStopped = true;
|
||||
}
|
||||
|
||||
// Cancel the event
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the mouse event is permitted, return true for the action to go through.
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* On actual clicks, determine whether this is a touch-generated click, a click action occurring
|
||||
* naturally after a delay after a touch (which needs to be cancelled to avoid duplication), or
|
||||
* an actual click which should be permitted.
|
||||
*
|
||||
* @param {Event} event
|
||||
* @returns {boolean}
|
||||
*/
|
||||
FastClick.prototype.onClick = function(event) {
|
||||
'use strict';
|
||||
var permitted;
|
||||
|
||||
// It's possible for another FastClick-like library delivered with third-party code to fire a click event before FastClick does (issue #44). In that case, set the click-tracking flag back to false and return early. This will cause onTouchEnd to return early.
|
||||
if (this.trackingClick) {
|
||||
this.targetElement = null;
|
||||
this.trackingClick = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Very odd behaviour on iOS (issue #18): if a submit element is present inside a form and the user hits enter in the iOS simulator or clicks the Go button on the pop-up OS keyboard the a kind of 'fake' click event will be triggered with the submit-type input element as the target.
|
||||
if (event.target.type === 'submit' && event.detail === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
permitted = this.onMouse(event);
|
||||
|
||||
// Only unset targetElement if the click is not permitted. This will ensure that the check for !targetElement in onMouse fails and the browser's click doesn't go through.
|
||||
if (!permitted) {
|
||||
this.targetElement = null;
|
||||
}
|
||||
|
||||
// If clicks are permitted, return true for the action to go through.
|
||||
return permitted;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Remove all FastClick's event listeners.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
FastClick.prototype.destroy = function() {
|
||||
'use strict';
|
||||
var layer = this.layer;
|
||||
|
||||
if (deviceIsAndroid) {
|
||||
layer.removeEventListener('mouseover', this.onMouse, true);
|
||||
layer.removeEventListener('mousedown', this.onMouse, true);
|
||||
layer.removeEventListener('mouseup', this.onMouse, true);
|
||||
}
|
||||
|
||||
layer.removeEventListener('click', this.onClick, true);
|
||||
layer.removeEventListener('touchstart', this.onTouchStart, false);
|
||||
layer.removeEventListener('touchmove', this.onTouchMove, false);
|
||||
layer.removeEventListener('touchend', this.onTouchEnd, false);
|
||||
layer.removeEventListener('touchcancel', this.onTouchCancel, false);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Check whether FastClick is needed.
|
||||
*
|
||||
* @param {Element} layer The layer to listen on
|
||||
*/
|
||||
FastClick.notNeeded = function(layer) {
|
||||
'use strict';
|
||||
var metaViewport;
|
||||
var chromeVersion;
|
||||
var blackberryVersion;
|
||||
|
||||
// Devices that don't support touch don't need FastClick
|
||||
if (typeof window.ontouchstart === 'undefined') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Chrome version - zero for other browsers
|
||||
chromeVersion = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1];
|
||||
|
||||
if (chromeVersion) {
|
||||
|
||||
if (deviceIsAndroid) {
|
||||
metaViewport = document.querySelector('meta[name=viewport]');
|
||||
|
||||
if (metaViewport) {
|
||||
// Chrome on Android with user-scalable="no" doesn't need FastClick (issue #89)
|
||||
if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
|
||||
return true;
|
||||
}
|
||||
// Chrome 32 and above with width=device-width or less don't need FastClick
|
||||
if (chromeVersion > 31 && document.documentElement.scrollWidth <= window.outerWidth) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Chrome desktop doesn't need FastClick (issue #15)
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (deviceIsBlackBerry10) {
|
||||
blackberryVersion = navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/);
|
||||
|
||||
// BlackBerry 10.3+ does not require Fastclick library.
|
||||
// https://github.com/ftlabs/fastclick/issues/251
|
||||
if (blackberryVersion[1] >= 10 && blackberryVersion[2] >= 3) {
|
||||
metaViewport = document.querySelector('meta[name=viewport]');
|
||||
|
||||
if (metaViewport) {
|
||||
// user-scalable=no eliminates click delay.
|
||||
if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
|
||||
return true;
|
||||
}
|
||||
// width=device-width (or less than device-width) eliminates click delay.
|
||||
if (document.documentElement.scrollWidth <= window.outerWidth) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// IE10 with -ms-touch-action: none, which disables double-tap-to-zoom (issue #97)
|
||||
if (layer.style.msTouchAction === 'none') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Factory method for creating a FastClick object
|
||||
*
|
||||
* @param {Element} layer The layer to listen on
|
||||
* @param {Object} options The options to override the defaults
|
||||
*/
|
||||
FastClick.attach = function(layer, options) {
|
||||
'use strict';
|
||||
return new FastClick(layer, options);
|
||||
};
|
||||
|
||||
|
||||
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define(function() {
|
||||
'use strict';
|
||||
return FastClick;
|
||||
});
|
||||
} else if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = FastClick.attach;
|
||||
module.exports.FastClick = FastClick;
|
||||
} else {
|
||||
window.FastClick = FastClick;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
var MSG = {"a":"a","aboutMe":"About me","author":"Author","baseInfoSet":"Base info","blog":"Blog","blogClass":"Classification","blogDesc":"Description","blogLogo":"Logo","blogLogoTips":"Upload image to replace blog title","blogName":"Title","blogNav":"Blog nav","blogNavs":"Navs","blogSet":"Set blog","cancel":"Cancel","chooseReason":"请选择举报理由","comment":"Comment","commentSet":"Comment","commentSys":"leanote use \u003ca href=\"http://disqus.com\" target=\"_blank\"\u003eDisqus\u003c/a\u003e as comment system","comments":"Comments","community":"Community","confirm":"Confirm","confirmDeleteComment":"Are you sure?","createdTime":"Created at","daysAgo":"days ago","delete":"Delete","disqusHelp":"Please input your Disqus Id or use \"leanote\"","elegant":"Elegant","error":"Error","fullBlog":"Full blog","home":"Home","hoursAgo":"hours ago","justNow":"Just now","latestPosts":"Latest posts","like":"Like","minutesAgo":"minutes ago","monthsAgo":"months ago","moreShare":"More","navFixed":"Nav fixed at left side","needHelp":"Need help?","noBlog":"No blog","noTag":"No tag","none":"None","openComment":"Open comment?","other":"Other","qqZone":"QQ Zone","quickLinks":"Quick links","renren":"Renren","reply":"Reply","report":"Report","reportBlog?":"举报该博客?","reportComment?":"举报该评论?","reportReason":"Reason","reportReason1":"不友善内容","reportReason2":"广告等垃圾信息","reportReason3":"违法违规内容","reportReason4":"不宜公开讨论的政治内容","reportSuccess":"举报成功, 我们处理后会通知作者, 感谢您的监督","saveSuccess":"Save success","scanQRCode":"Open weichat and scan the QR code","signIn":"Sign In","signUp":"Sign Up","sinaWeibo":"Weibo","submitComment":"Submit","tencentWeibo":"Tencent Weibo","theme":"Theme","themeSet":"Theme","unlike":"Unlike","updatedTime":"Updated at","viewers":"Viewers","weeksAgo":"weeks ago","weixin":"Weichat"};
|
||||
var MSG = {"a":"a","aboutMe":"About Me","author":"Author","baseInfoSet":"Base info","blogClass":"Category","blogDesc":"Description","blogLogo":"Logo","blogLogoTips":"Upload image to replace blog title","blogName":"Title","blogNav":"Blog nav","blogNavs":"Navs","blogSet":"Blog configuration","cancel":"Cancel","chooseComment":"Comment System","chooseReason":"请选择举报理由","comment":"Comment","commentSet":"Comment","comments":"Comments","community":"Community","confirm":"Confirm","confirmDeleteComment":"Are you sure?","createdTime":"Created at","daysAgo":"days ago","delete":"Delete","disqusHelp":"Please input your Disqus Id","domain":"Custom domain","domainSet":"Domain","elegant":"Elegant","error":"Error","fullBlog":"Full blog","home":"Home","hoursAgo":"hours ago","justNow":"Just now","latestPosts":"Latest posts","like":"Like","minutesAgo":"minutes ago","monthsAgo":"months ago","more":"More...","moreShare":"More","navFixed":"Nav fixed at left side","needHelp":"Need help?","next":"Next","noBlog":"No blog","noTag":"No tag","none":"None","openComment":"Open comment?","other":"Other","previous":"Previous","qqZone":"QQ Zone","quickLinks":"Quick links","renren":"Renren","reply":"Reply","report":"Report","reportBlog?":"举报该博客?","reportComment?":"举报该评论?","reportReason":"Reason","reportReason1":"不友善内容","reportReason2":"广告等垃圾信息","reportReason3":"违法违规内容","reportReason4":"不宜公开讨论的政治内容","reportSuccess":"举报成功, 我们处理后会通知作者, 感谢您的监督","saveSuccess":"Save success","scanQRCode":"Open weichat and scan the QR code","signIn":"Sign In","signUp":"Sign Up","sinaWeibo":"Weibo","subDomain":"Sub domain","submitComment":"Submit","tencentWeibo":"Tencent Weibo","theme":"Theme","themeSet":"Theme","unlike":"Unlike","updatedTime":"Updated at","viewers":"Viewers","weeksAgo":"weeks ago","weixin":"Weichat"};
|
||||
function getMsg(key, data) {
|
||||
var msg = MSG[key]
|
||||
if(msg) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
var MSG = {"a":"a","aboutMe":"关于我","author":"作者","baseInfoSet":"基本设置","blog":"博客","blogClass":"分类","blogDesc":"博客描述","blogLogo":"博客Logo","blogLogoTips":"上传logo将显示logo(替代博客标题)","blogName":"博客标题","blogNav":"导航","blogNavs":"导航","blogSet":"博客设置","cancel":"取消","chooseReason":"请选择举报理由","comment":"评论","commentSet":"评论设置","commentSys":"leanote 使用 \u003ca href=\"http://disqus.com\" target=\"_blank\"\u003eDisqus\u003c/a\u003e 作为评论系统","comments":"条评论","community":"社区","confirm":"确认","confirmDeleteComment":"确定删除该评论?","createdTime":"创建","daysAgo":"天前","delete":"删除","disqusHelp":"请填写您申请的Disqus唯一url前缀. 建议您申请Disqus帐号, 这样可以自己管理评论. 或使用leanote的默认Disqus Id. ","elegant":"大气","error":"错误","fullBlog":"全文","home":"主页","hoursAgo":"个小时前","justNow":"刚刚","latestPosts":"最近发表","like":"赞","minutesAgo":"分钟前","monthsAgo":"个月前","moreShare":"更多分享","navFixed":"导航左侧固定","needHelp":"需要帮助?","noBlog":"无博客","noTag":"无","none":"无","openComment":"开启评论?","other":"其它","qqZone":"QQ空间","quickLinks":"快速链接","renren":"人人网","reply":"回复","report":"举报","reportBlog?":"举报该博客?","reportComment?":"举报该评论?","reportReason":"举报理由","reportReason1":"不友善内容","reportReason2":"广告等垃圾信息","reportReason3":"违法违规内容","reportReason4":"不宜公开讨论的政治内容","reportSuccess":"举报成功, 我们处理后会通知作者, 感谢您的监督","saveSuccess":"保存成功","scanQRCode":"打开微信扫一扫二维码","signIn":"登录","signUp":"注册","sinaWeibo":"新浪微博","submitComment":"发表评论","tencentWeibo":"腾讯微博","theme":"主题","themeSet":"主题设置","unlike":"取消赞","updatedTime":"更新","viewers":"人读过","weeksAgo":"周前","weixin":"微信"};
|
||||
var MSG = {"a":"a","aboutMe":"关于我","author":"作者","baseInfoSet":"基本设置","blog":"博客","blogClass":"分类","blogDesc":"博客描述","blogLogo":"博客Logo","blogLogoTips":"上传logo将显示logo(替代博客标题)","blogName":"博客标题","blogNav":"导航","blogNavs":"导航","blogSet":"博客设置","cancel":"取消","chooseComment":"选择评论系统","chooseReason":"请选择举报理由","comment":"评论","commentSet":"评论设置","comments":"条评论","community":"社区","confirm":"确认","confirmDeleteComment":"确定删除该评论?","createdTime":"创建","daysAgo":"天前","delete":"删除","disqusHelp":"请填写您申请的Disqus唯一url前缀. 建议您申请Disqus帐号, 这样可以自己管理评论. 或使用leanote的默认Disqus Id. ","domain":"自定义域名","domainSet":"域名设置","elegant":"大气","error":"错误","fullBlog":"全文","home":"主页","hoursAgo":"个小时前","justNow":"刚刚","latestPosts":"最近发表","like":"赞","minutesAgo":"分钟前","monthsAgo":"个月前","more":"更多...","moreShare":"更多分享","navFixed":"导航左侧固定","needHelp":"需要帮助?","next":"下一页","noBlog":"无博客","noTag":"无","none":"无","openComment":"开启评论?","other":"其它","previous":"上一页","qqZone":"QQ空间","quickLinks":"快速链接","renren":"人人网","reply":"回复","report":"举报","reportBlog?":"举报该博客?","reportComment?":"举报该评论?","reportReason":"举报理由","reportReason1":"不友善内容","reportReason2":"广告等垃圾信息","reportReason3":"违法违规内容","reportReason4":"不宜公开讨论的政治内容","reportSuccess":"举报成功, 我们处理后会通知作者, 感谢您的监督","saveSuccess":"保存成功","scanQRCode":"打开微信扫一扫二维码","signIn":"登录","signUp":"注册","sinaWeibo":"新浪微博","subDomain":"博客子域名","submitComment":"发表评论","tencentWeibo":"腾讯微博","theme":"主题","themeSet":"主题设置","unlike":"取消赞","updatedTime":"更新","viewers":"人读过","weeksAgo":"周前","weixin":"微信"};
|
||||
function getMsg(key, data) {
|
||||
var msg = MSG[key]
|
||||
if(msg) {
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
10
public/js/jquery.mobile-1.4.4.min.js
vendored
10
public/js/jquery.mobile-1.4.4.min.js
vendored
File diff suppressed because one or more lines are too long
160
public/js/jquery.ztree.all-3.5.min.js
vendored
160
public/js/jquery.ztree.all-3.5.min.js
vendored
@ -1,160 +0,0 @@
|
||||
|
||||
/*
|
||||
* JQuery zTree core v3.5.17-beta.2
|
||||
* http://zTree.me/
|
||||
*
|
||||
* Copyright (c) 2010 Hunter.z
|
||||
*
|
||||
* Licensed same as jquery - MIT License
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* email: hunter.z@263.net
|
||||
* Date: 2014-05-08
|
||||
*/
|
||||
(function(p){var G,H,I,J,K,L,r={},u={},v={},M={treeId:"",treeObj:null,view:{addDiyDom:null,autoCancelSelected:!0,dblClickExpand:!0,expandSpeed:"fast",fontCss:{},nameIsHTML:!1,selectedMulti:!0,showIcon:!0,showLine:!0,showTitle:!0,txtSelectedEnable:!1},data:{key:{children:"children",name:"name",title:"",url:"url"},simpleData:{enable:!1,idKey:"id",pIdKey:"pId",rootPId:null},keep:{parent:!1,leaf:!1}},async:{enable:!1,contentType:"application/x-www-form-urlencoded",type:"post",dataType:"text",url:"",autoParam:[],
|
||||
otherParam:[],dataFilter:null},callback:{beforeAsync:null,beforeClick:null,beforeDblClick:null,beforeRightClick:null,beforeMouseDown:null,beforeMouseUp:null,beforeExpand:null,beforeCollapse:null,beforeRemove:null,onAsyncError:null,onAsyncSuccess:null,onNodeCreated:null,onClick:null,onDblClick:null,onRightClick:null,onMouseDown:null,onMouseUp:null,onExpand:null,onCollapse:null,onRemove:null}},w=[function(b){var a=b.treeObj,c=e.event;a.bind(c.NODECREATED,function(a,c,g){j.apply(b.callback.onNodeCreated,
|
||||
[a,c,g])});a.bind(c.CLICK,function(a,c,g,l,h){j.apply(b.callback.onClick,[c,g,l,h])});a.bind(c.EXPAND,function(a,c,g){j.apply(b.callback.onExpand,[a,c,g])});a.bind(c.COLLAPSE,function(a,c,g){j.apply(b.callback.onCollapse,[a,c,g])});a.bind(c.ASYNC_SUCCESS,function(a,c,g,l){j.apply(b.callback.onAsyncSuccess,[a,c,g,l])});a.bind(c.ASYNC_ERROR,function(a,c,g,l,h,e){j.apply(b.callback.onAsyncError,[a,c,g,l,h,e])});a.bind(c.REMOVE,function(a,c,g){j.apply(b.callback.onRemove,[a,c,g])})}],x=[function(b){var a=
|
||||
e.event;b.treeObj.unbind(a.NODECREATED).unbind(a.CLICK).unbind(a.EXPAND).unbind(a.COLLAPSE).unbind(a.ASYNC_SUCCESS).unbind(a.ASYNC_ERROR).unbind(a.REMOVE)}],y=[function(b){var a=h.getCache(b);a||(a={},h.setCache(b,a));a.nodes=[];a.doms=[]}],z=[function(b,a,c,d,f,g){if(c){var l=h.getRoot(b),e=b.data.key.children;c.level=a;c.tId=b.treeId+"_"+ ++l.zId;c.parentTId=d?d.tId:null;c.open=typeof c.open=="string"?j.eqs(c.open,"true"):!!c.open;c[e]&&c[e].length>0?(c.isParent=!0,c.zAsync=!0):(c.isParent=typeof c.isParent==
|
||||
"string"?j.eqs(c.isParent,"true"):!!c.isParent,c.open=c.isParent&&!b.async.enable?c.open:!1,c.zAsync=!c.isParent);c.isFirstNode=f;c.isLastNode=g;c.getParentNode=function(){return h.getNodeCache(b,c.parentTId)};c.getPreNode=function(){return h.getPreNode(b,c)};c.getNextNode=function(){return h.getNextNode(b,c)};c.isAjaxing=!1;h.fixPIdKeyValue(b,c)}}],s=[function(b){var a=b.target,c=h.getSetting(b.data.treeId),d="",f=null,g="",l="",i=null,n=null,k=null;if(j.eqs(b.type,"mousedown"))l="mousedown";else if(j.eqs(b.type,
|
||||
"mouseup"))l="mouseup";else if(j.eqs(b.type,"contextmenu"))l="contextmenu";else if(j.eqs(b.type,"click"))if(j.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+e.id.SWITCH)!==null)d=j.getNodeMainDom(a).id,g="switchNode";else{if(k=j.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+e.id.A}]))d=j.getNodeMainDom(k).id,g="clickNode"}else if(j.eqs(b.type,"dblclick")&&(l="dblclick",k=j.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+e.id.A}])))d=j.getNodeMainDom(k).id,g="switchNode";if(l.length>0&&d.length==0&&
|
||||
(k=j.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+e.id.A}])))d=j.getNodeMainDom(k).id;if(d.length>0)switch(f=h.getNodeCache(c,d),g){case "switchNode":f.isParent?j.eqs(b.type,"click")||j.eqs(b.type,"dblclick")&&j.apply(c.view.dblClickExpand,[c.treeId,f],c.view.dblClickExpand)?i=G:g="":g="";break;case "clickNode":i=H}switch(l){case "mousedown":n=I;break;case "mouseup":n=J;break;case "dblclick":n=K;break;case "contextmenu":n=L}return{stop:!1,node:f,nodeEventType:g,nodeEventCallback:i,treeEventType:l,
|
||||
treeEventCallback:n}}],A=[function(b){var a=h.getRoot(b);a||(a={},h.setRoot(b,a));a[b.data.key.children]=[];a.expandTriggerFlag=!1;a.curSelectedList=[];a.noSelection=!0;a.createdNodes=[];a.zId=0;a._ver=(new Date).getTime()}],B=[],C=[],D=[],E=[],F=[],h={addNodeCache:function(b,a){h.getCache(b).nodes[h.getNodeCacheId(a.tId)]=a},getNodeCacheId:function(b){return b.substring(b.lastIndexOf("_")+1)},addAfterA:function(b){C.push(b)},addBeforeA:function(b){B.push(b)},addInnerAfterA:function(b){E.push(b)},
|
||||
addInnerBeforeA:function(b){D.push(b)},addInitBind:function(b){w.push(b)},addInitUnBind:function(b){x.push(b)},addInitCache:function(b){y.push(b)},addInitNode:function(b){z.push(b)},addInitProxy:function(b,a){a?s.splice(0,0,b):s.push(b)},addInitRoot:function(b){A.push(b)},addNodesData:function(b,a,c){var d=b.data.key.children;a[d]||(a[d]=[]);if(a[d].length>0)a[d][a[d].length-1].isLastNode=!1,i.setNodeLineIcos(b,a[d][a[d].length-1]);a.isParent=!0;a[d]=a[d].concat(c)},addSelectedNode:function(b,a){var c=
|
||||
h.getRoot(b);h.isSelectedNode(b,a)||c.curSelectedList.push(a)},addCreatedNode:function(b,a){(b.callback.onNodeCreated||b.view.addDiyDom)&&h.getRoot(b).createdNodes.push(a)},addZTreeTools:function(b){F.push(b)},exSetting:function(b){p.extend(!0,M,b)},fixPIdKeyValue:function(b,a){b.data.simpleData.enable&&(a[b.data.simpleData.pIdKey]=a.parentTId?a.getParentNode()[b.data.simpleData.idKey]:b.data.simpleData.rootPId)},getAfterA:function(b,a,c){for(var d=0,f=C.length;d<f;d++)C[d].apply(this,arguments)},
|
||||
getBeforeA:function(b,a,c){for(var d=0,f=B.length;d<f;d++)B[d].apply(this,arguments)},getInnerAfterA:function(b,a,c){for(var d=0,f=E.length;d<f;d++)E[d].apply(this,arguments)},getInnerBeforeA:function(b,a,c){for(var d=0,f=D.length;d<f;d++)D[d].apply(this,arguments)},getCache:function(b){return v[b.treeId]},getNextNode:function(b,a){if(!a)return null;for(var c=b.data.key.children,d=a.parentTId?a.getParentNode():h.getRoot(b),f=0,g=d[c].length-1;f<=g;f++)if(d[c][f]===a)return f==g?null:d[c][f+1];return null},
|
||||
getNodeByParam:function(b,a,c,d){if(!a||!c)return null;for(var f=b.data.key.children,g=0,l=a.length;g<l;g++){if(a[g][c]==d)return a[g];var e=h.getNodeByParam(b,a[g][f],c,d);if(e)return e}return null},getNodeCache:function(b,a){if(!a)return null;var c=v[b.treeId].nodes[h.getNodeCacheId(a)];return c?c:null},getNodeName:function(b,a){return""+a[b.data.key.name]},getNodeTitle:function(b,a){return""+a[b.data.key.title===""?b.data.key.name:b.data.key.title]},getNodes:function(b){return h.getRoot(b)[b.data.key.children]},
|
||||
getNodesByParam:function(b,a,c,d){if(!a||!c)return[];for(var f=b.data.key.children,g=[],l=0,e=a.length;l<e;l++)a[l][c]==d&&g.push(a[l]),g=g.concat(h.getNodesByParam(b,a[l][f],c,d));return g},getNodesByParamFuzzy:function(b,a,c,d){if(!a||!c)return[];for(var f=b.data.key.children,g=[],d=d.toLowerCase(),l=0,e=a.length;l<e;l++)typeof a[l][c]=="string"&&a[l][c].toLowerCase().indexOf(d)>-1&&g.push(a[l]),g=g.concat(h.getNodesByParamFuzzy(b,a[l][f],c,d));return g},getNodesByFilter:function(b,a,c,d,f){if(!a)return d?
|
||||
null:[];for(var g=b.data.key.children,e=d?null:[],i=0,n=a.length;i<n;i++){if(j.apply(c,[a[i],f],!1)){if(d)return a[i];e.push(a[i])}var k=h.getNodesByFilter(b,a[i][g],c,d,f);if(d&&k)return k;e=d?k:e.concat(k)}return e},getPreNode:function(b,a){if(!a)return null;for(var c=b.data.key.children,d=a.parentTId?a.getParentNode():h.getRoot(b),f=0,g=d[c].length;f<g;f++)if(d[c][f]===a)return f==0?null:d[c][f-1];return null},getRoot:function(b){return b?u[b.treeId]:null},getRoots:function(){return u},getSetting:function(b){return r[b]},
|
||||
getSettings:function(){return r},getZTreeTools:function(b){return(b=this.getRoot(this.getSetting(b)))?b.treeTools:null},initCache:function(b){for(var a=0,c=y.length;a<c;a++)y[a].apply(this,arguments)},initNode:function(b,a,c,d,f,g){for(var e=0,h=z.length;e<h;e++)z[e].apply(this,arguments)},initRoot:function(b){for(var a=0,c=A.length;a<c;a++)A[a].apply(this,arguments)},isSelectedNode:function(b,a){for(var c=h.getRoot(b),d=0,f=c.curSelectedList.length;d<f;d++)if(a===c.curSelectedList[d])return!0;return!1},
|
||||
removeNodeCache:function(b,a){var c=b.data.key.children;if(a[c])for(var d=0,f=a[c].length;d<f;d++)arguments.callee(b,a[c][d]);h.getCache(b).nodes[h.getNodeCacheId(a.tId)]=null},removeSelectedNode:function(b,a){for(var c=h.getRoot(b),d=0,f=c.curSelectedList.length;d<f;d++)if(a===c.curSelectedList[d]||!h.getNodeCache(b,c.curSelectedList[d].tId))c.curSelectedList.splice(d,1),d--,f--},setCache:function(b,a){v[b.treeId]=a},setRoot:function(b,a){u[b.treeId]=a},setZTreeTools:function(b,a){for(var c=0,d=
|
||||
F.length;c<d;c++)F[c].apply(this,arguments)},transformToArrayFormat:function(b,a){if(!a)return[];var c=b.data.key.children,d=[];if(j.isArray(a))for(var f=0,g=a.length;f<g;f++)d.push(a[f]),a[f][c]&&(d=d.concat(h.transformToArrayFormat(b,a[f][c])));else d.push(a),a[c]&&(d=d.concat(h.transformToArrayFormat(b,a[c])));return d},transformTozTreeFormat:function(b,a){var c,d,f=b.data.simpleData.idKey,g=b.data.simpleData.pIdKey,e=b.data.key.children;if(!f||f==""||!a)return[];if(j.isArray(a)){var h=[],i=[];
|
||||
for(c=0,d=a.length;c<d;c++)i[a[c][f]]=a[c];for(c=0,d=a.length;c<d;c++)i[a[c][g]]&&a[c][f]!=a[c][g]?(i[a[c][g]][e]||(i[a[c][g]][e]=[]),i[a[c][g]][e].push(a[c])):h.push(a[c]);return h}else return[a]}},m={bindEvent:function(b){for(var a=0,c=w.length;a<c;a++)w[a].apply(this,arguments)},unbindEvent:function(b){for(var a=0,c=x.length;a<c;a++)x[a].apply(this,arguments)},bindTree:function(b){var a={treeId:b.treeId},c=b.treeObj;b.view.txtSelectedEnable||c.bind("selectstart",function(a){a=a.originalEvent.srcElement.nodeName.toLowerCase();
|
||||
return a==="input"||a==="textarea"}).css({"-moz-user-select":"-moz-none"});c.bind("click",a,m.proxy);c.bind("dblclick",a,m.proxy);c.bind("mouseover",a,m.proxy);c.bind("mouseout",a,m.proxy);c.bind("mousedown",a,m.proxy);c.bind("mouseup",a,m.proxy);c.bind("contextmenu",a,m.proxy)},unbindTree:function(b){b.treeObj.unbind("click",m.proxy).unbind("dblclick",m.proxy).unbind("mouseover",m.proxy).unbind("mouseout",m.proxy).unbind("mousedown",m.proxy).unbind("mouseup",m.proxy).unbind("contextmenu",m.proxy)},
|
||||
doProxy:function(b){for(var a=[],c=0,d=s.length;c<d;c++){var f=s[c].apply(this,arguments);a.push(f);if(f.stop)break}return a},proxy:function(b){var a=h.getSetting(b.data.treeId);if(!j.uCanDo(a,b))return!0;for(var a=m.doProxy(b),c=!0,d=0,f=a.length;d<f;d++){var g=a[d];g.nodeEventCallback&&(c=g.nodeEventCallback.apply(g,[b,g.node])&&c);g.treeEventCallback&&(c=g.treeEventCallback.apply(g,[b,g.node])&&c)}return c}};G=function(b,a){var c=h.getSetting(b.data.treeId);if(a.open){if(j.apply(c.callback.beforeCollapse,
|
||||
[c.treeId,a],!0)==!1)return!0}else if(j.apply(c.callback.beforeExpand,[c.treeId,a],!0)==!1)return!0;h.getRoot(c).expandTriggerFlag=!0;i.switchNode(c,a);return!0};H=function(b,a){var c=h.getSetting(b.data.treeId),d=c.view.autoCancelSelected&&(b.ctrlKey||b.metaKey)&&h.isSelectedNode(c,a)?0:c.view.autoCancelSelected&&(b.ctrlKey||b.metaKey)&&c.view.selectedMulti?2:1;if(j.apply(c.callback.beforeClick,[c.treeId,a,d],!0)==!1)return!0;d===0?i.cancelPreSelectedNode(c,a):i.selectNode(c,a,d===2);c.treeObj.trigger(e.event.CLICK,
|
||||
[b,c.treeId,a,d]);return!0};I=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeMouseDown,[c.treeId,a],!0)&&j.apply(c.callback.onMouseDown,[b,c.treeId,a]);return!0};J=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeMouseUp,[c.treeId,a],!0)&&j.apply(c.callback.onMouseUp,[b,c.treeId,a]);return!0};K=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeDblClick,[c.treeId,a],!0)&&j.apply(c.callback.onDblClick,[b,c.treeId,a]);return!0};
|
||||
L=function(b,a){var c=h.getSetting(b.data.treeId);j.apply(c.callback.beforeRightClick,[c.treeId,a],!0)&&j.apply(c.callback.onRightClick,[b,c.treeId,a]);return typeof c.callback.onRightClick!="function"};var j={apply:function(b,a,c){return typeof b=="function"?b.apply(N,a?a:[]):c},canAsync:function(b,a){var c=b.data.key.children;return b.async.enable&&a&&a.isParent&&!(a.zAsync||a[c]&&a[c].length>0)},clone:function(b){if(b===null)return null;var a=j.isArray(b)?[]:{},c;for(c in b)a[c]=b[c]instanceof
|
||||
Date?new Date(b[c].getTime()):typeof b[c]==="object"?arguments.callee(b[c]):b[c];return a},eqs:function(b,a){return b.toLowerCase()===a.toLowerCase()},isArray:function(b){return Object.prototype.toString.apply(b)==="[object Array]"},$:function(b,a,c){a&&typeof a!="string"&&(c=a,a="");return typeof b=="string"?p(b,c?c.treeObj.get(0).ownerDocument:null):p("#"+b.tId+a,c?c.treeObj:null)},getMDom:function(b,a,c){if(!a)return null;for(;a&&a.id!==b.treeId;){for(var d=0,f=c.length;a.tagName&&d<f;d++)if(j.eqs(a.tagName,
|
||||
c[d].tagName)&&a.getAttribute(c[d].attrName)!==null)return a;a=a.parentNode}return null},getNodeMainDom:function(b){return p(b).parent("li").get(0)||p(b).parentsUntil("li").parent().get(0)},isChildOrSelf:function(b,a){return p(b).closest("#"+a).length>0},uCanDo:function(){return!0}},i={addNodes:function(b,a,c,d){if(!b.data.keep.leaf||!a||a.isParent)if(j.isArray(c)||(c=[c]),b.data.simpleData.enable&&(c=h.transformTozTreeFormat(b,c)),a){var f=k(a,e.id.SWITCH,b),g=k(a,e.id.ICON,b),l=k(a,e.id.UL,b);if(!a.open)i.replaceSwitchClass(a,
|
||||
f,e.folder.CLOSE),i.replaceIcoClass(a,g,e.folder.CLOSE),a.open=!1,l.css({display:"none"});h.addNodesData(b,a,c);i.createNodes(b,a.level+1,c,a);d||i.expandCollapseParentNode(b,a,!0)}else h.addNodesData(b,h.getRoot(b),c),i.createNodes(b,0,c,null)},appendNodes:function(b,a,c,d,f,g){if(!c)return[];for(var e=[],j=b.data.key.children,k=0,m=c.length;k<m;k++){var o=c[k];if(f){var t=(d?d:h.getRoot(b))[j].length==c.length&&k==0;h.initNode(b,a,o,d,t,k==c.length-1,g);h.addNodeCache(b,o)}t=[];o[j]&&o[j].length>
|
||||
0&&(t=i.appendNodes(b,a+1,o[j],o,f,g&&o.open));g&&(i.makeDOMNodeMainBefore(e,b,o),i.makeDOMNodeLine(e,b,o),h.getBeforeA(b,o,e),i.makeDOMNodeNameBefore(e,b,o),h.getInnerBeforeA(b,o,e),i.makeDOMNodeIcon(e,b,o),h.getInnerAfterA(b,o,e),i.makeDOMNodeNameAfter(e,b,o),h.getAfterA(b,o,e),o.isParent&&o.open&&i.makeUlHtml(b,o,e,t.join("")),i.makeDOMNodeMainAfter(e,b,o),h.addCreatedNode(b,o))}return e},appendParentULDom:function(b,a){var c=[],d=k(a,b);!d.get(0)&&a.parentTId&&(i.appendParentULDom(b,a.getParentNode()),
|
||||
d=k(a,b));var f=k(a,e.id.UL,b);f.get(0)&&f.remove();f=i.appendNodes(b,a.level+1,a[b.data.key.children],a,!1,!0);i.makeUlHtml(b,a,c,f.join(""));d.append(c.join(""))},asyncNode:function(b,a,c,d){var f,g;if(a&&!a.isParent)return j.apply(d),!1;else if(a&&a.isAjaxing)return!1;else if(j.apply(b.callback.beforeAsync,[b.treeId,a],!0)==!1)return j.apply(d),!1;if(a)a.isAjaxing=!0,k(a,e.id.ICON,b).attr({style:"","class":e.className.BUTTON+" "+e.className.ICO_LOADING});var l={};for(f=0,g=b.async.autoParam.length;a&&
|
||||
f<g;f++){var q=b.async.autoParam[f].split("="),n=q;q.length>1&&(n=q[1],q=q[0]);l[n]=a[q]}if(j.isArray(b.async.otherParam))for(f=0,g=b.async.otherParam.length;f<g;f+=2)l[b.async.otherParam[f]]=b.async.otherParam[f+1];else for(var m in b.async.otherParam)l[m]=b.async.otherParam[m];var o=h.getRoot(b)._ver;p.ajax({contentType:b.async.contentType,type:b.async.type,url:j.apply(b.async.url,[b.treeId,a],b.async.url),data:l,dataType:b.async.dataType,success:function(f){if(o==h.getRoot(b)._ver){var g=[];try{g=
|
||||
!f||f.length==0?[]:typeof f=="string"?eval("("+f+")"):f}catch(l){g=f}if(a)a.isAjaxing=null,a.zAsync=!0;i.setNodeLineIcos(b,a);g&&g!==""?(g=j.apply(b.async.dataFilter,[b.treeId,a,g],g),i.addNodes(b,a,g?j.clone(g):[],!!c)):i.addNodes(b,a,[],!!c);b.treeObj.trigger(e.event.ASYNC_SUCCESS,[b.treeId,a,f]);j.apply(d)}},error:function(c,d,f){if(o==h.getRoot(b)._ver){if(a)a.isAjaxing=null;i.setNodeLineIcos(b,a);b.treeObj.trigger(e.event.ASYNC_ERROR,[b.treeId,a,c,d,f])}}});return!0},cancelPreSelectedNode:function(b,
|
||||
a){for(var c=h.getRoot(b).curSelectedList,d=c.length-1;d>=0;d--)if(!a||a===c[d])if(k(c[d],e.id.A,b).removeClass(e.node.CURSELECTED),a){h.removeSelectedNode(b,a);break}if(!a)h.getRoot(b).curSelectedList=[]},createNodeCallback:function(b){if(b.callback.onNodeCreated||b.view.addDiyDom)for(var a=h.getRoot(b);a.createdNodes.length>0;){var c=a.createdNodes.shift();j.apply(b.view.addDiyDom,[b.treeId,c]);b.callback.onNodeCreated&&b.treeObj.trigger(e.event.NODECREATED,[b.treeId,c])}},createNodes:function(b,
|
||||
a,c,d){if(c&&c.length!=0){var f=h.getRoot(b),g=b.data.key.children,g=!d||d.open||!!k(d[g][0],b).get(0);f.createdNodes=[];a=i.appendNodes(b,a,c,d,!0,g);d?(d=k(d,e.id.UL,b),d.get(0)&&d.append(a.join(""))):b.treeObj.append(a.join(""));i.createNodeCallback(b)}},destroy:function(b){b&&(h.initCache(b),h.initRoot(b),m.unbindTree(b),m.unbindEvent(b),b.treeObj.empty(),delete r[b.treeId])},expandCollapseNode:function(b,a,c,d,f){var g=h.getRoot(b),l=b.data.key.children;if(a){if(g.expandTriggerFlag){var q=f,
|
||||
f=function(){q&&q();a.open?b.treeObj.trigger(e.event.EXPAND,[b.treeId,a]):b.treeObj.trigger(e.event.COLLAPSE,[b.treeId,a])};g.expandTriggerFlag=!1}if(!a.open&&a.isParent&&(!k(a,e.id.UL,b).get(0)||a[l]&&a[l].length>0&&!k(a[l][0],b).get(0)))i.appendParentULDom(b,a),i.createNodeCallback(b);if(a.open==c)j.apply(f,[]);else{var c=k(a,e.id.UL,b),g=k(a,e.id.SWITCH,b),n=k(a,e.id.ICON,b);a.isParent?(a.open=!a.open,a.iconOpen&&a.iconClose&&n.attr("style",i.makeNodeIcoStyle(b,a)),a.open?(i.replaceSwitchClass(a,
|
||||
g,e.folder.OPEN),i.replaceIcoClass(a,n,e.folder.OPEN),d==!1||b.view.expandSpeed==""?(c.show(),j.apply(f,[])):a[l]&&a[l].length>0?c.slideDown(b.view.expandSpeed,f):(c.show(),j.apply(f,[]))):(i.replaceSwitchClass(a,g,e.folder.CLOSE),i.replaceIcoClass(a,n,e.folder.CLOSE),d==!1||b.view.expandSpeed==""||!(a[l]&&a[l].length>0)?(c.hide(),j.apply(f,[])):c.slideUp(b.view.expandSpeed,f))):j.apply(f,[])}}else j.apply(f,[])},expandCollapseParentNode:function(b,a,c,d,f){a&&(a.parentTId?(i.expandCollapseNode(b,
|
||||
a,c,d),a.parentTId&&i.expandCollapseParentNode(b,a.getParentNode(),c,d,f)):i.expandCollapseNode(b,a,c,d,f))},expandCollapseSonNode:function(b,a,c,d,f){var g=h.getRoot(b),e=b.data.key.children,g=a?a[e]:g[e],e=a?!1:d,j=h.getRoot(b).expandTriggerFlag;h.getRoot(b).expandTriggerFlag=!1;if(g)for(var k=0,m=g.length;k<m;k++)g[k]&&i.expandCollapseSonNode(b,g[k],c,e);h.getRoot(b).expandTriggerFlag=j;i.expandCollapseNode(b,a,c,d,f)},makeDOMNodeIcon:function(b,a,c){var d=h.getNodeName(a,c),d=a.view.nameIsHTML?
|
||||
d:d.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");b.push("<span id='",c.tId,e.id.ICON,"' title='' treeNode",e.id.ICON," class='",i.makeNodeIcoClass(a,c),"' style='",i.makeNodeIcoStyle(a,c),"'></span><span id='",c.tId,e.id.SPAN,"'>",d,"</span>")},makeDOMNodeLine:function(b,a,c){b.push("<span id='",c.tId,e.id.SWITCH,"' title='' class='",i.makeNodeLineClass(a,c),"' treeNode",e.id.SWITCH,"></span>")},makeDOMNodeMainAfter:function(b){b.push("</li>")},makeDOMNodeMainBefore:function(b,
|
||||
a,c){b.push("<li id='",c.tId,"' class='",e.className.LEVEL,c.level,"' tabindex='0' hidefocus='true' treenode>")},makeDOMNodeNameAfter:function(b){b.push("</a>")},makeDOMNodeNameBefore:function(b,a,c){var d=h.getNodeTitle(a,c),f=i.makeNodeUrl(a,c),g=i.makeNodeFontCss(a,c),l=[],k;for(k in g)l.push(k,":",g[k],";");b.push("<a id='",c.tId,e.id.A,"' class='",e.className.LEVEL,c.level,"' treeNode",e.id.A,' onclick="',c.click||"",'" ',f!=null&&f.length>0?"href='"+f+"'":""," target='",i.makeNodeTarget(c),
|
||||
"' style='",l.join(""),"'");j.apply(a.view.showTitle,[a.treeId,c],a.view.showTitle)&&d&&b.push("title='",d.replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">"),"'");b.push(">")},makeNodeFontCss:function(b,a){var c=j.apply(b.view.fontCss,[b.treeId,a],b.view.fontCss);return c&&typeof c!="function"?c:{}},makeNodeIcoClass:function(b,a){var c=["ico"];a.isAjaxing||(c[0]=(a.iconSkin?a.iconSkin+"_":"")+c[0],a.isParent?c.push(a.open?e.folder.OPEN:e.folder.CLOSE):c.push(e.folder.DOCU));return e.className.BUTTON+
|
||||
" "+c.join("_")},makeNodeIcoStyle:function(b,a){var c=[];if(!a.isAjaxing){var d=a.isParent&&a.iconOpen&&a.iconClose?a.open?a.iconOpen:a.iconClose:a.icon;d&&c.push("background:url(",d,") 0 0 no-repeat;");(b.view.showIcon==!1||!j.apply(b.view.showIcon,[b.treeId,a],!0))&&c.push("width:0px;height:0px;")}return c.join("")},makeNodeLineClass:function(b,a){var c=[];b.view.showLine?a.level==0&&a.isFirstNode&&a.isLastNode?c.push(e.line.ROOT):a.level==0&&a.isFirstNode?c.push(e.line.ROOTS):a.isLastNode?c.push(e.line.BOTTOM):
|
||||
c.push(e.line.CENTER):c.push(e.line.NOLINE);a.isParent?c.push(a.open?e.folder.OPEN:e.folder.CLOSE):c.push(e.folder.DOCU);return i.makeNodeLineClassEx(a)+c.join("_")},makeNodeLineClassEx:function(b){return e.className.BUTTON+" "+e.className.LEVEL+b.level+" "+e.className.SWITCH+" "},makeNodeTarget:function(b){return b.target||"_blank"},makeNodeUrl:function(b,a){var c=b.data.key.url;return a[c]?a[c]:null},makeUlHtml:function(b,a,c,d){c.push("<ul id='",a.tId,e.id.UL,"' class='",e.className.LEVEL,a.level,
|
||||
" ",i.makeUlLineClass(b,a),"' style='display:",a.open?"block":"none","'>");c.push(d);c.push("</ul>")},makeUlLineClass:function(b,a){return b.view.showLine&&!a.isLastNode?e.line.LINE:""},removeChildNodes:function(b,a){if(a){var c=b.data.key.children,d=a[c];if(d){for(var f=0,g=d.length;f<g;f++)h.removeNodeCache(b,d[f]);h.removeSelectedNode(b);delete a[c];b.data.keep.parent?k(a,e.id.UL,b).empty():(a.isParent=!1,a.open=!1,c=k(a,e.id.SWITCH,b),d=k(a,e.id.ICON,b),i.replaceSwitchClass(a,c,e.folder.DOCU),
|
||||
i.replaceIcoClass(a,d,e.folder.DOCU),k(a,e.id.UL,b).remove())}}},setFirstNode:function(b,a){var c=b.data.key.children;if(a[c].length>0)a[c][0].isFirstNode=!0},setLastNode:function(b,a){var c=b.data.key.children,d=a[c].length;if(d>0)a[c][d-1].isLastNode=!0},removeNode:function(b,a){var c=h.getRoot(b),d=b.data.key.children,f=a.parentTId?a.getParentNode():c;a.isFirstNode=!1;a.isLastNode=!1;a.getPreNode=function(){return null};a.getNextNode=function(){return null};if(h.getNodeCache(b,a.tId)){k(a,b).remove();
|
||||
h.removeNodeCache(b,a);h.removeSelectedNode(b,a);for(var g=0,l=f[d].length;g<l;g++)if(f[d][g].tId==a.tId){f[d].splice(g,1);break}i.setFirstNode(b,f);i.setLastNode(b,f);var j,g=f[d].length;if(!b.data.keep.parent&&g==0)f.isParent=!1,f.open=!1,g=k(f,e.id.UL,b),l=k(f,e.id.SWITCH,b),j=k(f,e.id.ICON,b),i.replaceSwitchClass(f,l,e.folder.DOCU),i.replaceIcoClass(f,j,e.folder.DOCU),g.css("display","none");else if(b.view.showLine&&g>0){var n=f[d][g-1],g=k(n,e.id.UL,b),l=k(n,e.id.SWITCH,b);j=k(n,e.id.ICON,b);
|
||||
f==c?f[d].length==1?i.replaceSwitchClass(n,l,e.line.ROOT):(c=k(f[d][0],e.id.SWITCH,b),i.replaceSwitchClass(f[d][0],c,e.line.ROOTS),i.replaceSwitchClass(n,l,e.line.BOTTOM)):i.replaceSwitchClass(n,l,e.line.BOTTOM);g.removeClass(e.line.LINE)}}},replaceIcoClass:function(b,a,c){if(a&&!b.isAjaxing&&(b=a.attr("class"),b!=void 0)){b=b.split("_");switch(c){case e.folder.OPEN:case e.folder.CLOSE:case e.folder.DOCU:b[b.length-1]=c}a.attr("class",b.join("_"))}},replaceSwitchClass:function(b,a,c){if(a){var d=
|
||||
a.attr("class");if(d!=void 0){d=d.split("_");switch(c){case e.line.ROOT:case e.line.ROOTS:case e.line.CENTER:case e.line.BOTTOM:case e.line.NOLINE:d[0]=i.makeNodeLineClassEx(b)+c;break;case e.folder.OPEN:case e.folder.CLOSE:case e.folder.DOCU:d[1]=c}a.attr("class",d.join("_"));c!==e.folder.DOCU?a.removeAttr("disabled"):a.attr("disabled","disabled")}}},selectNode:function(b,a,c){c||i.cancelPreSelectedNode(b);k(a,e.id.A,b).addClass(e.node.CURSELECTED);h.addSelectedNode(b,a)},setNodeFontCss:function(b,
|
||||
a){var c=k(a,e.id.A,b),d=i.makeNodeFontCss(b,a);d&&c.css(d)},setNodeLineIcos:function(b,a){if(a){var c=k(a,e.id.SWITCH,b),d=k(a,e.id.UL,b),f=k(a,e.id.ICON,b),g=i.makeUlLineClass(b,a);g.length==0?d.removeClass(e.line.LINE):d.addClass(g);c.attr("class",i.makeNodeLineClass(b,a));a.isParent?c.removeAttr("disabled"):c.attr("disabled","disabled");f.removeAttr("style");f.attr("style",i.makeNodeIcoStyle(b,a));f.attr("class",i.makeNodeIcoClass(b,a))}},setNodeName:function(b,a){var c=h.getNodeTitle(b,a),d=
|
||||
k(a,e.id.SPAN,b);d.empty();b.view.nameIsHTML?d.html(h.getNodeName(b,a)):d.text(h.getNodeName(b,a));j.apply(b.view.showTitle,[b.treeId,a],b.view.showTitle)&&k(a,e.id.A,b).attr("title",!c?"":c)},setNodeTarget:function(b,a){k(a,e.id.A,b).attr("target",i.makeNodeTarget(a))},setNodeUrl:function(b,a){var c=k(a,e.id.A,b),d=i.makeNodeUrl(b,a);d==null||d.length==0?c.removeAttr("href"):c.attr("href",d)},switchNode:function(b,a){a.open||!j.canAsync(b,a)?i.expandCollapseNode(b,a,!a.open):b.async.enable?i.asyncNode(b,
|
||||
a)||i.expandCollapseNode(b,a,!a.open):a&&i.expandCollapseNode(b,a,!a.open)}};p.fn.zTree={consts:{className:{BUTTON:"button",LEVEL:"level",ICO_LOADING:"ico_loading",SWITCH:"switch"},event:{NODECREATED:"ztree_nodeCreated",CLICK:"ztree_click",EXPAND:"ztree_expand",COLLAPSE:"ztree_collapse",ASYNC_SUCCESS:"ztree_async_success",ASYNC_ERROR:"ztree_async_error",REMOVE:"ztree_remove"},id:{A:"_a",ICON:"_ico",SPAN:"_span",SWITCH:"_switch",UL:"_ul"},line:{ROOT:"root",ROOTS:"roots",CENTER:"center",BOTTOM:"bottom",
|
||||
NOLINE:"noline",LINE:"line"},folder:{OPEN:"open",CLOSE:"close",DOCU:"docu"},node:{CURSELECTED:"curSelectedNode"}},_z:{tools:j,view:i,event:m,data:h},getZTreeObj:function(b){return(b=h.getZTreeTools(b))?b:null},destroy:function(b){if(b&&b.length>0)i.destroy(h.getSetting(b));else for(var a in r)i.destroy(r[a])},init:function(b,a,c){var d=j.clone(M);p.extend(!0,d,a);d.treeId=b.attr("id");d.treeObj=b;d.treeObj.empty();r[d.treeId]=d;if(typeof document.body.style.maxHeight==="undefined")d.view.expandSpeed=
|
||||
"";h.initRoot(d);b=h.getRoot(d);a=d.data.key.children;c=c?j.clone(j.isArray(c)?c:[c]):[];b[a]=d.data.simpleData.enable?h.transformTozTreeFormat(d,c):c;h.initCache(d);m.unbindTree(d);m.bindTree(d);m.unbindEvent(d);m.bindEvent(d);c={setting:d,addNodes:function(a,b,c){function e(){i.addNodes(d,a,h,c==!0)}if(!b)return null;a||(a=null);if(a&&!a.isParent&&d.data.keep.leaf)return null;var h=j.clone(j.isArray(b)?b:[b]);j.canAsync(d,a)?i.asyncNode(d,a,c,e):e();return h},cancelSelectedNode:function(a){i.cancelPreSelectedNode(d,
|
||||
a)},destroy:function(){i.destroy(d)},expandAll:function(a){a=!!a;i.expandCollapseSonNode(d,null,a,!0);return a},expandNode:function(a,b,c,e,n){if(!a||!a.isParent)return null;b!==!0&&b!==!1&&(b=!a.open);if((n=!!n)&&b&&j.apply(d.callback.beforeExpand,[d.treeId,a],!0)==!1)return null;else if(n&&!b&&j.apply(d.callback.beforeCollapse,[d.treeId,a],!0)==!1)return null;b&&a.parentTId&&i.expandCollapseParentNode(d,a.getParentNode(),b,!1);if(b===a.open&&!c)return null;h.getRoot(d).expandTriggerFlag=n;if(!j.canAsync(d,
|
||||
a)&&c)i.expandCollapseSonNode(d,a,b,!0,function(){if(e!==!1)try{k(a,d).focus().blur()}catch(b){}});else if(a.open=!b,i.switchNode(this.setting,a),e!==!1)try{k(a,d).focus().blur()}catch(m){}return b},getNodes:function(){return h.getNodes(d)},getNodeByParam:function(a,b,c){return!a?null:h.getNodeByParam(d,c?c[d.data.key.children]:h.getNodes(d),a,b)},getNodeByTId:function(a){return h.getNodeCache(d,a)},getNodesByParam:function(a,b,c){return!a?null:h.getNodesByParam(d,c?c[d.data.key.children]:h.getNodes(d),
|
||||
a,b)},getNodesByParamFuzzy:function(a,b,c){return!a?null:h.getNodesByParamFuzzy(d,c?c[d.data.key.children]:h.getNodes(d),a,b)},getNodesByFilter:function(a,b,c,e){b=!!b;return!a||typeof a!="function"?b?null:[]:h.getNodesByFilter(d,c?c[d.data.key.children]:h.getNodes(d),a,b,e)},getNodeIndex:function(a){if(!a)return null;for(var b=d.data.key.children,c=a.parentTId?a.getParentNode():h.getRoot(d),e=0,i=c[b].length;e<i;e++)if(c[b][e]==a)return e;return-1},getSelectedNodes:function(){for(var a=[],b=h.getRoot(d).curSelectedList,
|
||||
c=0,e=b.length;c<e;c++)a.push(b[c]);return a},isSelectedNode:function(a){return h.isSelectedNode(d,a)},reAsyncChildNodes:function(a,b,c){if(this.setting.async.enable){var j=!a;j&&(a=h.getRoot(d));if(b=="refresh"){for(var b=this.setting.data.key.children,m=0,p=a[b]?a[b].length:0;m<p;m++)h.removeNodeCache(d,a[b][m]);h.removeSelectedNode(d);a[b]=[];j?this.setting.treeObj.empty():k(a,e.id.UL,d).empty()}i.asyncNode(this.setting,j?null:a,!!c)}},refresh:function(){this.setting.treeObj.empty();var a=h.getRoot(d),
|
||||
b=a[d.data.key.children];h.initRoot(d);a[d.data.key.children]=b;h.initCache(d);i.createNodes(d,0,a[d.data.key.children])},removeChildNodes:function(a){if(!a)return null;var b=a[d.data.key.children];i.removeChildNodes(d,a);return b?b:null},removeNode:function(a,b){a&&(b=!!b,b&&j.apply(d.callback.beforeRemove,[d.treeId,a],!0)==!1||(i.removeNode(d,a),b&&this.setting.treeObj.trigger(e.event.REMOVE,[d.treeId,a])))},selectNode:function(a,b){if(a&&j.uCanDo(d)){b=d.view.selectedMulti&&b;if(a.parentTId)i.expandCollapseParentNode(d,
|
||||
a.getParentNode(),!0,!1,function(){try{k(a,d).focus().blur()}catch(b){}});else try{k(a,d).focus().blur()}catch(c){}i.selectNode(d,a,b)}},transformTozTreeNodes:function(a){return h.transformTozTreeFormat(d,a)},transformToArray:function(a){return h.transformToArrayFormat(d,a)},updateNode:function(a){a&&k(a,d).get(0)&&j.uCanDo(d)&&(i.setNodeName(d,a),i.setNodeTarget(d,a),i.setNodeUrl(d,a),i.setNodeLineIcos(d,a),i.setNodeFontCss(d,a))}};b.treeTools=c;h.setZTreeTools(d,c);b[a]&&b[a].length>0?i.createNodes(d,
|
||||
0,b[a]):d.async.enable&&d.async.url&&d.async.url!==""&&i.asyncNode(d);return c}};var N=p.fn.zTree,k=j.$,e=N.consts})(jQuery);
|
||||
|
||||
/*
|
||||
* JQuery zTree excheck v3.5.17-beta.2
|
||||
* http://zTree.me/
|
||||
*
|
||||
* Copyright (c) 2010 Hunter.z
|
||||
*
|
||||
* Licensed same as jquery - MIT License
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* email: hunter.z@263.net
|
||||
* Date: 2014-05-08
|
||||
*/
|
||||
(function(m){var p,q,r,o={event:{CHECK:"ztree_check"},id:{CHECK:"_check"},checkbox:{STYLE:"checkbox",DEFAULT:"chk",DISABLED:"disable",FALSE:"false",TRUE:"true",FULL:"full",PART:"part",FOCUS:"focus"},radio:{STYLE:"radio",TYPE_ALL:"all",TYPE_LEVEL:"level"}},v={check:{enable:!1,autoCheckTrigger:!1,chkStyle:o.checkbox.STYLE,nocheckInherit:!1,chkDisabledInherit:!1,radioType:o.radio.TYPE_LEVEL,chkboxType:{Y:"ps",N:"ps"}},data:{key:{checked:"checked"}},callback:{beforeCheck:null,onCheck:null}};p=function(c,
|
||||
a){if(a.chkDisabled===!0)return!1;var b=f.getSetting(c.data.treeId),d=b.data.key.checked;if(k.apply(b.callback.beforeCheck,[b.treeId,a],!0)==!1)return!0;a[d]=!a[d];e.checkNodeRelation(b,a);d=n(a,j.id.CHECK,b);e.setChkClass(b,d,a);e.repairParentChkClassWithSelf(b,a);b.treeObj.trigger(j.event.CHECK,[c,b.treeId,a]);return!0};q=function(c,a){if(a.chkDisabled===!0)return!1;var b=f.getSetting(c.data.treeId),d=n(a,j.id.CHECK,b);a.check_Focus=!0;e.setChkClass(b,d,a);return!0};r=function(c,a){if(a.chkDisabled===
|
||||
!0)return!1;var b=f.getSetting(c.data.treeId),d=n(a,j.id.CHECK,b);a.check_Focus=!1;e.setChkClass(b,d,a);return!0};m.extend(!0,m.fn.zTree.consts,o);m.extend(!0,m.fn.zTree._z,{tools:{},view:{checkNodeRelation:function(c,a){var b,d,h,i=c.data.key.children,l=c.data.key.checked;b=j.radio;if(c.check.chkStyle==b.STYLE){var g=f.getRadioCheckedList(c);if(a[l])if(c.check.radioType==b.TYPE_ALL){for(d=g.length-1;d>=0;d--)b=g[d],b[l]&&b!=a&&(b[l]=!1,g.splice(d,1),e.setChkClass(c,n(b,j.id.CHECK,c),b),b.parentTId!=
|
||||
a.parentTId&&e.repairParentChkClassWithSelf(c,b));g.push(a)}else{g=a.parentTId?a.getParentNode():f.getRoot(c);for(d=0,h=g[i].length;d<h;d++)b=g[i][d],b[l]&&b!=a&&(b[l]=!1,e.setChkClass(c,n(b,j.id.CHECK,c),b))}else if(c.check.radioType==b.TYPE_ALL)for(d=0,h=g.length;d<h;d++)if(a==g[d]){g.splice(d,1);break}}else a[l]&&(!a[i]||a[i].length==0||c.check.chkboxType.Y.indexOf("s")>-1)&&e.setSonNodeCheckBox(c,a,!0),!a[l]&&(!a[i]||a[i].length==0||c.check.chkboxType.N.indexOf("s")>-1)&&e.setSonNodeCheckBox(c,
|
||||
a,!1),a[l]&&c.check.chkboxType.Y.indexOf("p")>-1&&e.setParentNodeCheckBox(c,a,!0),!a[l]&&c.check.chkboxType.N.indexOf("p")>-1&&e.setParentNodeCheckBox(c,a,!1)},makeChkClass:function(c,a){var b=c.data.key.checked,d=j.checkbox,h=j.radio,i="",i=a.chkDisabled===!0?d.DISABLED:a.halfCheck?d.PART:c.check.chkStyle==h.STYLE?a.check_Child_State<1?d.FULL:d.PART:a[b]?a.check_Child_State===2||a.check_Child_State===-1?d.FULL:d.PART:a.check_Child_State<1?d.FULL:d.PART,b=c.check.chkStyle+"_"+(a[b]?d.TRUE:d.FALSE)+
|
||||
"_"+i,b=a.check_Focus&&a.chkDisabled!==!0?b+"_"+d.FOCUS:b;return j.className.BUTTON+" "+d.DEFAULT+" "+b},repairAllChk:function(c,a){if(c.check.enable&&c.check.chkStyle===j.checkbox.STYLE)for(var b=c.data.key.checked,d=c.data.key.children,h=f.getRoot(c),i=0,l=h[d].length;i<l;i++){var g=h[d][i];g.nocheck!==!0&&g.chkDisabled!==!0&&(g[b]=a);e.setSonNodeCheckBox(c,g,a)}},repairChkClass:function(c,a){if(a&&(f.makeChkFlag(c,a),a.nocheck!==!0)){var b=n(a,j.id.CHECK,c);e.setChkClass(c,b,a)}},repairParentChkClass:function(c,
|
||||
a){if(a&&a.parentTId){var b=a.getParentNode();e.repairChkClass(c,b);e.repairParentChkClass(c,b)}},repairParentChkClassWithSelf:function(c,a){if(a){var b=c.data.key.children;a[b]&&a[b].length>0?e.repairParentChkClass(c,a[b][0]):e.repairParentChkClass(c,a)}},repairSonChkDisabled:function(c,a,b,d){if(a){var h=c.data.key.children;if(a.chkDisabled!=b)a.chkDisabled=b;e.repairChkClass(c,a);if(a[h]&&d)for(var i=0,l=a[h].length;i<l;i++)e.repairSonChkDisabled(c,a[h][i],b,d)}},repairParentChkDisabled:function(c,
|
||||
a,b,d){if(a){if(a.chkDisabled!=b&&d)a.chkDisabled=b;e.repairChkClass(c,a);e.repairParentChkDisabled(c,a.getParentNode(),b,d)}},setChkClass:function(c,a,b){a&&(b.nocheck===!0?a.hide():a.show(),a.attr("class",e.makeChkClass(c,b)))},setParentNodeCheckBox:function(c,a,b,d){var h=c.data.key.children,i=c.data.key.checked,l=n(a,j.id.CHECK,c);d||(d=a);f.makeChkFlag(c,a);a.nocheck!==!0&&a.chkDisabled!==!0&&(a[i]=b,e.setChkClass(c,l,a),c.check.autoCheckTrigger&&a!=d&&c.treeObj.trigger(j.event.CHECK,[null,c.treeId,
|
||||
a]));if(a.parentTId){l=!0;if(!b)for(var h=a.getParentNode()[h],g=0,k=h.length;g<k;g++)if(h[g].nocheck!==!0&&h[g].chkDisabled!==!0&&h[g][i]||(h[g].nocheck===!0||h[g].chkDisabled===!0)&&h[g].check_Child_State>0){l=!1;break}l&&e.setParentNodeCheckBox(c,a.getParentNode(),b,d)}},setSonNodeCheckBox:function(c,a,b,d){if(a){var h=c.data.key.children,i=c.data.key.checked,l=n(a,j.id.CHECK,c);d||(d=a);var g=!1;if(a[h])for(var k=0,m=a[h].length;k<m&&a.chkDisabled!==!0;k++){var o=a[h][k];e.setSonNodeCheckBox(c,
|
||||
o,b,d);o.chkDisabled===!0&&(g=!0)}if(a!=f.getRoot(c)&&a.chkDisabled!==!0){g&&a.nocheck!==!0&&f.makeChkFlag(c,a);if(a.nocheck!==!0&&a.chkDisabled!==!0){if(a[i]=b,!g)a.check_Child_State=a[h]&&a[h].length>0?b?2:0:-1}else a.check_Child_State=-1;e.setChkClass(c,l,a);c.check.autoCheckTrigger&&a!=d&&a.nocheck!==!0&&a.chkDisabled!==!0&&c.treeObj.trigger(j.event.CHECK,[null,c.treeId,a])}}}},event:{},data:{getRadioCheckedList:function(c){for(var a=f.getRoot(c).radioCheckedList,b=0,d=a.length;b<d;b++)f.getNodeCache(c,
|
||||
a[b].tId)||(a.splice(b,1),b--,d--);return a},getCheckStatus:function(c,a){if(!c.check.enable||a.nocheck||a.chkDisabled)return null;var b=c.data.key.checked;return{checked:a[b],half:a.halfCheck?a.halfCheck:c.check.chkStyle==j.radio.STYLE?a.check_Child_State===2:a[b]?a.check_Child_State>-1&&a.check_Child_State<2:a.check_Child_State>0}},getTreeCheckedNodes:function(c,a,b,d){if(!a)return[];for(var h=c.data.key.children,i=c.data.key.checked,e=b&&c.check.chkStyle==j.radio.STYLE&&c.check.radioType==j.radio.TYPE_ALL,
|
||||
d=!d?[]:d,g=0,k=a.length;g<k;g++){if(a[g].nocheck!==!0&&a[g].chkDisabled!==!0&&a[g][i]==b&&(d.push(a[g]),e))break;f.getTreeCheckedNodes(c,a[g][h],b,d);if(e&&d.length>0)break}return d},getTreeChangeCheckedNodes:function(c,a,b){if(!a)return[];for(var d=c.data.key.children,h=c.data.key.checked,b=!b?[]:b,i=0,e=a.length;i<e;i++)a[i].nocheck!==!0&&a[i].chkDisabled!==!0&&a[i][h]!=a[i].checkedOld&&b.push(a[i]),f.getTreeChangeCheckedNodes(c,a[i][d],b);return b},makeChkFlag:function(c,a){if(a){var b=c.data.key.children,
|
||||
d=c.data.key.checked,h=-1;if(a[b])for(var i=0,e=a[b].length;i<e;i++){var g=a[b][i],f=-1;if(c.check.chkStyle==j.radio.STYLE)if(f=g.nocheck===!0||g.chkDisabled===!0?g.check_Child_State:g.halfCheck===!0?2:g[d]?2:g.check_Child_State>0?2:0,f==2){h=2;break}else f==0&&(h=0);else if(c.check.chkStyle==j.checkbox.STYLE)if(f=g.nocheck===!0||g.chkDisabled===!0?g.check_Child_State:g.halfCheck===!0?1:g[d]?g.check_Child_State===-1||g.check_Child_State===2?2:1:g.check_Child_State>0?1:0,f===1){h=1;break}else if(f===
|
||||
2&&h>-1&&i>0&&f!==h){h=1;break}else if(h===2&&f>-1&&f<2){h=1;break}else f>-1&&(h=f)}a.check_Child_State=h}}}});var m=m.fn.zTree,k=m._z.tools,j=m.consts,e=m._z.view,f=m._z.data,n=k.$;f.exSetting(v);f.addInitBind(function(c){c.treeObj.bind(j.event.CHECK,function(a,b,d,h){a.srcEvent=b;k.apply(c.callback.onCheck,[a,d,h])})});f.addInitUnBind(function(c){c.treeObj.unbind(j.event.CHECK)});f.addInitCache(function(){});f.addInitNode(function(c,a,b,d){if(b){a=c.data.key.checked;typeof b[a]=="string"&&(b[a]=
|
||||
k.eqs(b[a],"true"));b[a]=!!b[a];b.checkedOld=b[a];if(typeof b.nocheck=="string")b.nocheck=k.eqs(b.nocheck,"true");b.nocheck=!!b.nocheck||c.check.nocheckInherit&&d&&!!d.nocheck;if(typeof b.chkDisabled=="string")b.chkDisabled=k.eqs(b.chkDisabled,"true");b.chkDisabled=!!b.chkDisabled||c.check.chkDisabledInherit&&d&&!!d.chkDisabled;if(typeof b.halfCheck=="string")b.halfCheck=k.eqs(b.halfCheck,"true");b.halfCheck=!!b.halfCheck;b.check_Child_State=-1;b.check_Focus=!1;b.getCheckStatus=function(){return f.getCheckStatus(c,
|
||||
b)};c.check.chkStyle==j.radio.STYLE&&c.check.radioType==j.radio.TYPE_ALL&&b[a]&&f.getRoot(c).radioCheckedList.push(b)}});f.addInitProxy(function(c){var a=c.target,b=f.getSetting(c.data.treeId),d="",h=null,e="",l=null;if(k.eqs(c.type,"mouseover")){if(b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=k.getNodeMainDom(a).id,e="mouseoverCheck"}else if(k.eqs(c.type,"mouseout")){if(b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=
|
||||
k.getNodeMainDom(a).id,e="mouseoutCheck"}else if(k.eqs(c.type,"click")&&b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=k.getNodeMainDom(a).id,e="checkNode";if(d.length>0)switch(h=f.getNodeCache(b,d),e){case "checkNode":l=p;break;case "mouseoverCheck":l=q;break;case "mouseoutCheck":l=r}return{stop:e==="checkNode",node:h,nodeEventType:e,nodeEventCallback:l,treeEventType:"",treeEventCallback:null}},!0);f.addInitRoot(function(c){f.getRoot(c).radioCheckedList=[]});
|
||||
f.addBeforeA(function(c,a,b){c.check.enable&&(f.makeChkFlag(c,a),b.push("<span ID='",a.tId,j.id.CHECK,"' class='",e.makeChkClass(c,a),"' treeNode",j.id.CHECK,a.nocheck===!0?" style='display:none;'":"","></span>"))});f.addZTreeTools(function(c,a){a.checkNode=function(a,b,c,f){var g=this.setting.data.key.checked;if(a.chkDisabled!==!0&&(b!==!0&&b!==!1&&(b=!a[g]),f=!!f,(a[g]!==b||c)&&!(f&&k.apply(this.setting.callback.beforeCheck,[this.setting.treeId,a],!0)==!1)&&k.uCanDo(this.setting)&&this.setting.check.enable&&
|
||||
a.nocheck!==!0))a[g]=b,b=n(a,j.id.CHECK,this.setting),(c||this.setting.check.chkStyle===j.radio.STYLE)&&e.checkNodeRelation(this.setting,a),e.setChkClass(this.setting,b,a),e.repairParentChkClassWithSelf(this.setting,a),f&&this.setting.treeObj.trigger(j.event.CHECK,[null,this.setting.treeId,a])};a.checkAllNodes=function(a){e.repairAllChk(this.setting,!!a)};a.getCheckedNodes=function(a){var b=this.setting.data.key.children;return f.getTreeCheckedNodes(this.setting,f.getRoot(this.setting)[b],a!==!1)};
|
||||
a.getChangeCheckedNodes=function(){var a=this.setting.data.key.children;return f.getTreeChangeCheckedNodes(this.setting,f.getRoot(this.setting)[a])};a.setChkDisabled=function(a,b,c,f){b=!!b;c=!!c;e.repairSonChkDisabled(this.setting,a,b,!!f);e.repairParentChkDisabled(this.setting,a.getParentNode(),b,c)};var b=a.updateNode;a.updateNode=function(c,f){b&&b.apply(a,arguments);if(c&&this.setting.check.enable&&n(c,this.setting).get(0)&&k.uCanDo(this.setting)){var i=n(c,j.id.CHECK,this.setting);(f==!0||this.setting.check.chkStyle===
|
||||
j.radio.STYLE)&&e.checkNodeRelation(this.setting,c);e.setChkClass(this.setting,i,c);e.repairParentChkClassWithSelf(this.setting,c)}}});var s=e.createNodes;e.createNodes=function(c,a,b,d){s&&s.apply(e,arguments);b&&e.repairParentChkClassWithSelf(c,d)};var t=e.removeNode;e.removeNode=function(c,a){var b=a.getParentNode();t&&t.apply(e,arguments);a&&b&&(e.repairChkClass(c,b),e.repairParentChkClass(c,b))};var u=e.appendNodes;e.appendNodes=function(c,a,b,d,h,i){var j="";u&&(j=u.apply(e,arguments));d&&f.makeChkFlag(c,
|
||||
d);return j}})(jQuery);
|
||||
|
||||
/*
|
||||
* JQuery zTree exedit v3.5.17-beta.2
|
||||
* http://zTree.me/
|
||||
*
|
||||
* Copyright (c) 2010 Hunter.z
|
||||
*
|
||||
* Licensed same as jquery - MIT License
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* email: hunter.z@263.net
|
||||
* Date: 2014-05-08
|
||||
*/
|
||||
(function(w){var I={event:{DRAG:"ztree_drag",DROP:"ztree_drop",RENAME:"ztree_rename",DRAGMOVE:"ztree_dragmove"},id:{EDIT:"_edit",INPUT:"_input",REMOVE:"_remove"},move:{TYPE_INNER:"inner",TYPE_PREV:"prev",TYPE_NEXT:"next"},node:{CURSELECTED_EDIT:"curSelectedNode_Edit",TMPTARGET_TREE:"tmpTargetzTree",TMPTARGET_NODE:"tmpTargetNode"}},x={onHoverOverNode:function(b,a){var c=m.getSetting(b.data.treeId),d=m.getRoot(c);if(d.curHoverNode!=a)x.onHoverOutNode(b);d.curHoverNode=a;f.addHoverDom(c,a)},onHoverOutNode:function(b){var b=
|
||||
m.getSetting(b.data.treeId),a=m.getRoot(b);if(a.curHoverNode&&!m.isSelectedNode(b,a.curHoverNode))f.removeTreeDom(b,a.curHoverNode),a.curHoverNode=null},onMousedownNode:function(b,a){function c(b){if(C.dragFlag==0&&Math.abs(N-b.clientX)<e.edit.drag.minMoveSize&&Math.abs(O-b.clientY)<e.edit.drag.minMoveSize)return!0;var a,c,n,k,i;i=e.data.key.children;M.css("cursor","pointer");if(C.dragFlag==0){if(g.apply(e.callback.beforeDrag,[e.treeId,l],!0)==!1)return r(b),!0;for(a=0,c=l.length;a<c;a++){if(a==0)C.dragNodeShowBefore=
|
||||
[];n=l[a];n.isParent&&n.open?(f.expandCollapseNode(e,n,!n.open),C.dragNodeShowBefore[n.tId]=!0):C.dragNodeShowBefore[n.tId]=!1}C.dragFlag=1;t.showHoverDom=!1;g.showIfameMask(e,!0);n=!0;k=-1;if(l.length>1){var j=l[0].parentTId?l[0].getParentNode()[i]:m.getNodes(e);i=[];for(a=0,c=j.length;a<c;a++)if(C.dragNodeShowBefore[j[a].tId]!==void 0&&(n&&k>-1&&k+1!==a&&(n=!1),i.push(j[a]),k=a),l.length===i.length){l=i;break}}n&&(H=l[0].getPreNode(),R=l[l.length-1].getNextNode());D=o("<ul class='zTreeDragUL'></ul>",
|
||||
e);for(a=0,c=l.length;a<c;a++)n=l[a],n.editNameFlag=!1,f.selectNode(e,n,a>0),f.removeTreeDom(e,n),a>e.edit.drag.maxShowNodeNum-1||(k=o("<li id='"+n.tId+"_tmp'></li>",e),k.append(o(n,d.id.A,e).clone()),k.css("padding","0"),k.children("#"+n.tId+d.id.A).removeClass(d.node.CURSELECTED),D.append(k),a==e.edit.drag.maxShowNodeNum-1&&(k=o("<li id='"+n.tId+"_moretmp'><a> ... </a></li>",e),D.append(k)));D.attr("id",l[0].tId+d.id.UL+"_tmp");D.addClass(e.treeObj.attr("class"));D.appendTo(M);B=o("<span class='tmpzTreeMove_arrow'></span>",
|
||||
e);B.attr("id","zTreeMove_arrow_tmp");B.appendTo(M);e.treeObj.trigger(d.event.DRAG,[b,e.treeId,l])}if(C.dragFlag==1){s&&B.attr("id")==b.target.id&&u&&b.clientX+F.scrollLeft()+2>w("#"+u+d.id.A,s).offset().left?(n=w("#"+u+d.id.A,s),b.target=n.length>0?n.get(0):b.target):s&&(s.removeClass(d.node.TMPTARGET_TREE),u&&w("#"+u+d.id.A,s).removeClass(d.node.TMPTARGET_NODE+"_"+d.move.TYPE_PREV).removeClass(d.node.TMPTARGET_NODE+"_"+I.move.TYPE_NEXT).removeClass(d.node.TMPTARGET_NODE+"_"+I.move.TYPE_INNER));
|
||||
u=s=null;J=!1;h=e;n=m.getSettings();for(var y in n)if(n[y].treeId&&n[y].edit.enable&&n[y].treeId!=e.treeId&&(b.target.id==n[y].treeId||w(b.target).parents("#"+n[y].treeId).length>0))J=!0,h=n[y];y=F.scrollTop();k=F.scrollLeft();i=h.treeObj.offset();a=h.treeObj.get(0).scrollHeight;n=h.treeObj.get(0).scrollWidth;c=b.clientY+y-i.top;var p=h.treeObj.height()+i.top-b.clientY-y,q=b.clientX+k-i.left,x=h.treeObj.width()+i.left-b.clientX-k;i=c<e.edit.drag.borderMax&&c>e.edit.drag.borderMin;var j=p<e.edit.drag.borderMax&&
|
||||
p>e.edit.drag.borderMin,K=q<e.edit.drag.borderMax&&q>e.edit.drag.borderMin,G=x<e.edit.drag.borderMax&&x>e.edit.drag.borderMin,p=c>e.edit.drag.borderMin&&p>e.edit.drag.borderMin&&q>e.edit.drag.borderMin&&x>e.edit.drag.borderMin,q=i&&h.treeObj.scrollTop()<=0,x=j&&h.treeObj.scrollTop()+h.treeObj.height()+10>=a,P=K&&h.treeObj.scrollLeft()<=0,Q=G&&h.treeObj.scrollLeft()+h.treeObj.width()+10>=n;if(b.target&&g.isChildOrSelf(b.target,h.treeId)){for(var E=b.target;E&&E.tagName&&!g.eqs(E.tagName,"li")&&E.id!=
|
||||
h.treeId;)E=E.parentNode;var S=!0;for(a=0,c=l.length;a<c;a++)if(n=l[a],E.id===n.tId){S=!1;break}else if(o(n,e).find("#"+E.id).length>0){S=!1;break}if(S&&b.target&&g.isChildOrSelf(b.target,E.id+d.id.A))s=w(E),u=E.id}n=l[0];if(p&&g.isChildOrSelf(b.target,h.treeId)){if(!s&&(b.target.id==h.treeId||q||x||P||Q)&&(J||!J&&n.parentTId))s=h.treeObj;i?h.treeObj.scrollTop(h.treeObj.scrollTop()-10):j&&h.treeObj.scrollTop(h.treeObj.scrollTop()+10);K?h.treeObj.scrollLeft(h.treeObj.scrollLeft()-10):G&&h.treeObj.scrollLeft(h.treeObj.scrollLeft()+
|
||||
10);s&&s!=h.treeObj&&s.offset().left<h.treeObj.offset().left&&h.treeObj.scrollLeft(h.treeObj.scrollLeft()+s.offset().left-h.treeObj.offset().left)}D.css({top:b.clientY+y+3+"px",left:b.clientX+k+3+"px"});i=a=0;if(s&&s.attr("id")!=h.treeId){var z=u==null?null:m.getNodeCache(h,u);c=(b.ctrlKey||b.metaKey)&&e.edit.drag.isMove&&e.edit.drag.isCopy||!e.edit.drag.isMove&&e.edit.drag.isCopy;a=!!(H&&u===H.tId);i=!!(R&&u===R.tId);k=n.parentTId&&n.parentTId==u;n=(c||!i)&&g.apply(h.edit.drag.prev,[h.treeId,l,z],
|
||||
!!h.edit.drag.prev);a=(c||!a)&&g.apply(h.edit.drag.next,[h.treeId,l,z],!!h.edit.drag.next);G=(c||!k)&&!(h.data.keep.leaf&&!z.isParent)&&g.apply(h.edit.drag.inner,[h.treeId,l,z],!!h.edit.drag.inner);if(!n&&!a&&!G){if(s=null,u="",v=d.move.TYPE_INNER,B.css({display:"none"}),window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null}else{c=w("#"+u+d.id.A,s);i=z.isLastNode?null:w("#"+z.getNextNode().tId+d.id.A,s.next());j=c.offset().top;k=c.offset().left;K=n?G?0.25:a?
|
||||
0.5:1:-1;G=a?G?0.75:n?0.5:0:-1;y=(b.clientY+y-j)/c.height();(K==1||y<=K&&y>=-0.2)&&n?(a=1-B.width(),i=j-B.height()/2,v=d.move.TYPE_PREV):(G==0||y>=G&&y<=1.2)&&a?(a=1-B.width(),i=i==null||z.isParent&&z.open?j+c.height()-B.height()/2:i.offset().top-B.height()/2,v=d.move.TYPE_NEXT):(a=5-B.width(),i=j,v=d.move.TYPE_INNER);B.css({display:"block",top:i+"px",left:k+a+"px"});c.addClass(d.node.TMPTARGET_NODE+"_"+v);if(T!=u||U!=v)L=(new Date).getTime();if(z&&z.isParent&&v==d.move.TYPE_INNER&&(y=!0,window.zTreeMoveTimer&&
|
||||
window.zTreeMoveTargetNodeTId!==z.tId?(clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null):window.zTreeMoveTimer&&window.zTreeMoveTargetNodeTId===z.tId&&(y=!1),y))window.zTreeMoveTimer=setTimeout(function(){v==d.move.TYPE_INNER&&z&&z.isParent&&!z.open&&(new Date).getTime()-L>h.edit.drag.autoOpenTime&&g.apply(h.callback.beforeDragOpen,[h.treeId,z],!0)&&(f.switchNode(h,z),h.edit.drag.autoExpandTrigger&&h.treeObj.trigger(d.event.EXPAND,[h.treeId,z]))},h.edit.drag.autoOpenTime+50),
|
||||
window.zTreeMoveTargetNodeTId=z.tId}}else if(v=d.move.TYPE_INNER,s&&g.apply(h.edit.drag.inner,[h.treeId,l,null],!!h.edit.drag.inner)?s.addClass(d.node.TMPTARGET_TREE):s=null,B.css({display:"none"}),window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null;T=u;U=v;e.treeObj.trigger(d.event.DRAGMOVE,[b,e.treeId,l])}return!1}function r(b){if(window.zTreeMoveTimer)clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null;U=T=null;F.unbind("mousemove",c);
|
||||
F.unbind("mouseup",r);F.unbind("selectstart",k);M.css("cursor","auto");s&&(s.removeClass(d.node.TMPTARGET_TREE),u&&w("#"+u+d.id.A,s).removeClass(d.node.TMPTARGET_NODE+"_"+d.move.TYPE_PREV).removeClass(d.node.TMPTARGET_NODE+"_"+I.move.TYPE_NEXT).removeClass(d.node.TMPTARGET_NODE+"_"+I.move.TYPE_INNER));g.showIfameMask(e,!1);t.showHoverDom=!0;if(C.dragFlag!=0){C.dragFlag=0;var a,i,j;for(a=0,i=l.length;a<i;a++)j=l[a],j.isParent&&C.dragNodeShowBefore[j.tId]&&!j.open&&(f.expandCollapseNode(e,j,!j.open),
|
||||
delete C.dragNodeShowBefore[j.tId]);D&&D.remove();B&&B.remove();var p=(b.ctrlKey||b.metaKey)&&e.edit.drag.isMove&&e.edit.drag.isCopy||!e.edit.drag.isMove&&e.edit.drag.isCopy;!p&&s&&u&&l[0].parentTId&&u==l[0].parentTId&&v==d.move.TYPE_INNER&&(s=null);if(s){var q=u==null?null:m.getNodeCache(h,u);if(g.apply(e.callback.beforeDrop,[h.treeId,l,q,v,p],!0)==!1)f.selectNodes(x,l);else{var A=p?g.clone(l):l;a=function(){if(J){if(!p)for(var a=0,c=l.length;a<c;a++)f.removeNode(e,l[a]);if(v==d.move.TYPE_INNER)f.addNodes(h,
|
||||
q,A);else if(f.addNodes(h,q.getParentNode(),A),v==d.move.TYPE_PREV)for(a=0,c=A.length;a<c;a++)f.moveNode(h,q,A[a],v,!1);else for(a=-1,c=A.length-1;a<c;c--)f.moveNode(h,q,A[c],v,!1)}else if(p&&v==d.move.TYPE_INNER)f.addNodes(h,q,A);else if(p&&f.addNodes(h,q.getParentNode(),A),v!=d.move.TYPE_NEXT)for(a=0,c=A.length;a<c;a++)f.moveNode(h,q,A[a],v,!1);else for(a=-1,c=A.length-1;a<c;c--)f.moveNode(h,q,A[c],v,!1);f.selectNodes(h,A);o(A[0],e).focus().blur();e.treeObj.trigger(d.event.DROP,[b,h.treeId,A,q,
|
||||
v,p])};v==d.move.TYPE_INNER&&g.canAsync(h,q)?f.asyncNode(h,q,!1,a):a()}}else f.selectNodes(x,l),e.treeObj.trigger(d.event.DROP,[b,e.treeId,l,null,null,null])}}function k(){return!1}var i,j,e=m.getSetting(b.data.treeId),C=m.getRoot(e),t=m.getRoots();if(b.button==2||!e.edit.enable||!e.edit.drag.isCopy&&!e.edit.drag.isMove)return!0;var p=b.target,q=m.getRoot(e).curSelectedList,l=[];if(m.isSelectedNode(e,a))for(i=0,j=q.length;i<j;i++){if(q[i].editNameFlag&&g.eqs(p.tagName,"input")&&p.getAttribute("treeNode"+
|
||||
d.id.INPUT)!==null)return!0;l.push(q[i]);if(l[0].parentTId!==q[i].parentTId){l=[a];break}}else l=[a];f.editNodeBlur=!0;f.cancelCurEditNode(e);var F=w(e.treeObj.get(0).ownerDocument),M=w(e.treeObj.get(0).ownerDocument.body),D,B,s,J=!1,h=e,x=e,H,R,T=null,U=null,u=null,v=d.move.TYPE_INNER,N=b.clientX,O=b.clientY,L=(new Date).getTime();g.uCanDo(e)&&F.bind("mousemove",c);F.bind("mouseup",r);F.bind("selectstart",k);b.preventDefault&&b.preventDefault();return!0}};w.extend(!0,w.fn.zTree.consts,I);w.extend(!0,
|
||||
w.fn.zTree._z,{tools:{getAbs:function(b){b=b.getBoundingClientRect();return[b.left+(document.body.scrollLeft+document.documentElement.scrollLeft),b.top+(document.body.scrollTop+document.documentElement.scrollTop)]},inputFocus:function(b){b.get(0)&&(b.focus(),g.setCursorPosition(b.get(0),b.val().length))},inputSelect:function(b){b.get(0)&&(b.focus(),b.select())},setCursorPosition:function(b,a){if(b.setSelectionRange)b.focus(),b.setSelectionRange(a,a);else if(b.createTextRange){var c=b.createTextRange();
|
||||
c.collapse(!0);c.moveEnd("character",a);c.moveStart("character",a);c.select()}},showIfameMask:function(b,a){for(var c=m.getRoot(b);c.dragMaskList.length>0;)c.dragMaskList[0].remove(),c.dragMaskList.shift();if(a)for(var d=o("iframe",b),f=0,i=d.length;f<i;f++){var j=d.get(f),e=g.getAbs(j),j=o("<div id='zTreeMask_"+f+"' class='zTreeMask' style='top:"+e[1]+"px; left:"+e[0]+"px; width:"+j.offsetWidth+"px; height:"+j.offsetHeight+"px;'></div>",b);j.appendTo(o("body",b));c.dragMaskList.push(j)}}},view:{addEditBtn:function(b,
|
||||
a){if(!(a.editNameFlag||o(a,d.id.EDIT,b).length>0)&&g.apply(b.edit.showRenameBtn,[b.treeId,a],b.edit.showRenameBtn)){var c=o(a,d.id.A,b),r="<span class='"+d.className.BUTTON+" edit' id='"+a.tId+d.id.EDIT+"' title='"+g.apply(b.edit.renameTitle,[b.treeId,a],b.edit.renameTitle)+"' treeNode"+d.id.EDIT+" style='display:none;'></span>";c.append(r);o(a,d.id.EDIT,b).bind("click",function(){if(!g.uCanDo(b)||g.apply(b.callback.beforeEditName,[b.treeId,a],!0)==!1)return!1;f.editNode(b,a);return!1}).show()}},
|
||||
addRemoveBtn:function(b,a){if(!(a.editNameFlag||o(a,d.id.REMOVE,b).length>0)&&g.apply(b.edit.showRemoveBtn,[b.treeId,a],b.edit.showRemoveBtn)){var c=o(a,d.id.A,b),r="<span class='"+d.className.BUTTON+" remove' id='"+a.tId+d.id.REMOVE+"' title='"+g.apply(b.edit.removeTitle,[b.treeId,a],b.edit.removeTitle)+"' treeNode"+d.id.REMOVE+" style='display:none;'></span>";c.append(r);o(a,d.id.REMOVE,b).bind("click",function(){if(!g.uCanDo(b)||g.apply(b.callback.beforeRemove,[b.treeId,a],!0)==!1)return!1;f.removeNode(b,
|
||||
a);b.treeObj.trigger(d.event.REMOVE,[b.treeId,a]);return!1}).bind("mousedown",function(){return!0}).show()}},addHoverDom:function(b,a){if(m.getRoots().showHoverDom)a.isHover=!0,b.edit.enable&&(f.addEditBtn(b,a),f.addRemoveBtn(b,a)),g.apply(b.view.addHoverDom,[b.treeId,a])},cancelCurEditNode:function(b,a,c){var r=m.getRoot(b),k=b.data.key.name,i=r.curEditNode;if(i){var j=r.curEditInput,a=a?a:c?i[k]:j.val();if(g.apply(b.callback.beforeRename,[b.treeId,i,a,c],!0)===!1)return!1;else i[k]=a,b.treeObj.trigger(d.event.RENAME,
|
||||
[b.treeId,i,c]);o(i,d.id.A,b).removeClass(d.node.CURSELECTED_EDIT);j.unbind();f.setNodeName(b,i);i.editNameFlag=!1;r.curEditNode=null;r.curEditInput=null;f.selectNode(b,i,!1)}return r.noSelection=!0},editNode:function(b,a){var c=m.getRoot(b);f.editNodeBlur=!1;if(m.isSelectedNode(b,a)&&c.curEditNode==a&&a.editNameFlag)setTimeout(function(){g.inputFocus(c.curEditInput)},0);else{var r=b.data.key.name;a.editNameFlag=!0;f.removeTreeDom(b,a);f.cancelCurEditNode(b);f.selectNode(b,a,!1);o(a,d.id.SPAN,b).html("<input type=text class='rename' id='"+
|
||||
a.tId+d.id.INPUT+"' treeNode"+d.id.INPUT+" >");var k=o(a,d.id.INPUT,b);k.attr("value",a[r]);b.edit.editNameSelectAll?g.inputSelect(k):g.inputFocus(k);k.bind("blur",function(){f.editNodeBlur||f.cancelCurEditNode(b)}).bind("keydown",function(a){a.keyCode=="13"?(f.editNodeBlur=!0,f.cancelCurEditNode(b)):a.keyCode=="27"&&f.cancelCurEditNode(b,null,!0)}).bind("click",function(){return!1}).bind("dblclick",function(){return!1});o(a,d.id.A,b).addClass(d.node.CURSELECTED_EDIT);c.curEditInput=k;c.noSelection=
|
||||
!1;c.curEditNode=a}},moveNode:function(b,a,c,r,k,i){var j=m.getRoot(b),e=b.data.key.children;if(a!=c&&(!b.data.keep.leaf||!a||a.isParent||r!=d.move.TYPE_INNER)){var g=c.parentTId?c.getParentNode():j,t=a===null||a==j;t&&a===null&&(a=j);if(t)r=d.move.TYPE_INNER;j=a.parentTId?a.getParentNode():j;if(r!=d.move.TYPE_PREV&&r!=d.move.TYPE_NEXT)r=d.move.TYPE_INNER;if(r==d.move.TYPE_INNER)if(t)c.parentTId=null;else{if(!a.isParent)a.isParent=!0,a.open=!!a.open,f.setNodeLineIcos(b,a);c.parentTId=a.tId}var p;
|
||||
t?p=t=b.treeObj:(!i&&r==d.move.TYPE_INNER?f.expandCollapseNode(b,a,!0,!1):i||f.expandCollapseNode(b,a.getParentNode(),!0,!1),t=o(a,b),p=o(a,d.id.UL,b),t.get(0)&&!p.get(0)&&(p=[],f.makeUlHtml(b,a,p,""),t.append(p.join(""))),p=o(a,d.id.UL,b));var q=o(c,b);q.get(0)?t.get(0)||q.remove():q=f.appendNodes(b,c.level,[c],null,!1,!0).join("");p.get(0)&&r==d.move.TYPE_INNER?p.append(q):t.get(0)&&r==d.move.TYPE_PREV?t.before(q):t.get(0)&&r==d.move.TYPE_NEXT&&t.after(q);var l=-1,w=0,x=null,t=null,D=c.level;if(c.isFirstNode){if(l=
|
||||
0,g[e].length>1)x=g[e][1],x.isFirstNode=!0}else if(c.isLastNode)l=g[e].length-1,x=g[e][l-1],x.isLastNode=!0;else for(p=0,q=g[e].length;p<q;p++)if(g[e][p].tId==c.tId){l=p;break}l>=0&&g[e].splice(l,1);if(r!=d.move.TYPE_INNER)for(p=0,q=j[e].length;p<q;p++)j[e][p].tId==a.tId&&(w=p);if(r==d.move.TYPE_INNER){a[e]||(a[e]=[]);if(a[e].length>0)t=a[e][a[e].length-1],t.isLastNode=!1;a[e].splice(a[e].length,0,c);c.isLastNode=!0;c.isFirstNode=a[e].length==1}else a.isFirstNode&&r==d.move.TYPE_PREV?(j[e].splice(w,
|
||||
0,c),t=a,t.isFirstNode=!1,c.parentTId=a.parentTId,c.isFirstNode=!0,c.isLastNode=!1):a.isLastNode&&r==d.move.TYPE_NEXT?(j[e].splice(w+1,0,c),t=a,t.isLastNode=!1,c.parentTId=a.parentTId,c.isFirstNode=!1,c.isLastNode=!0):(r==d.move.TYPE_PREV?j[e].splice(w,0,c):j[e].splice(w+1,0,c),c.parentTId=a.parentTId,c.isFirstNode=!1,c.isLastNode=!1);m.fixPIdKeyValue(b,c);m.setSonNodeLevel(b,c.getParentNode(),c);f.setNodeLineIcos(b,c);f.repairNodeLevelClass(b,c,D);!b.data.keep.parent&&g[e].length<1?(g.isParent=!1,
|
||||
g.open=!1,a=o(g,d.id.UL,b),r=o(g,d.id.SWITCH,b),e=o(g,d.id.ICON,b),f.replaceSwitchClass(g,r,d.folder.DOCU),f.replaceIcoClass(g,e,d.folder.DOCU),a.css("display","none")):x&&f.setNodeLineIcos(b,x);t&&f.setNodeLineIcos(b,t);b.check&&b.check.enable&&f.repairChkClass&&(f.repairChkClass(b,g),f.repairParentChkClassWithSelf(b,g),g!=c.parent&&f.repairParentChkClassWithSelf(b,c));i||f.expandCollapseParentNode(b,c.getParentNode(),!0,k)}},removeEditBtn:function(b,a){o(a,d.id.EDIT,b).unbind().remove()},removeRemoveBtn:function(b,
|
||||
a){o(a,d.id.REMOVE,b).unbind().remove()},removeTreeDom:function(b,a){a.isHover=!1;f.removeEditBtn(b,a);f.removeRemoveBtn(b,a);g.apply(b.view.removeHoverDom,[b.treeId,a])},repairNodeLevelClass:function(b,a,c){if(c!==a.level){var f=o(a,b),g=o(a,d.id.A,b),b=o(a,d.id.UL,b),c=d.className.LEVEL+c,a=d.className.LEVEL+a.level;f.removeClass(c);f.addClass(a);g.removeClass(c);g.addClass(a);b.removeClass(c);b.addClass(a)}},selectNodes:function(b,a){for(var c=0,d=a.length;c<d;c++)f.selectNode(b,a[c],c>0)}},event:{},
|
||||
data:{setSonNodeLevel:function(b,a,c){if(c){var d=b.data.key.children;c.level=a?a.level+1:0;if(c[d])for(var a=0,f=c[d].length;a<f;a++)c[d][a]&&m.setSonNodeLevel(b,c,c[d][a])}}}});var H=w.fn.zTree,g=H._z.tools,d=H.consts,f=H._z.view,m=H._z.data,o=g.$;m.exSetting({edit:{enable:!1,editNameSelectAll:!1,showRemoveBtn:!0,showRenameBtn:!0,removeTitle:"remove",renameTitle:"rename",drag:{autoExpandTrigger:!1,isCopy:!0,isMove:!0,prev:!0,next:!0,inner:!0,minMoveSize:5,borderMax:10,borderMin:-5,maxShowNodeNum:5,
|
||||
autoOpenTime:500}},view:{addHoverDom:null,removeHoverDom:null},callback:{beforeDrag:null,beforeDragOpen:null,beforeDrop:null,beforeEditName:null,beforeRename:null,onDrag:null,onDragMove:null,onDrop:null,onRename:null}});m.addInitBind(function(b){var a=b.treeObj,c=d.event;a.bind(c.RENAME,function(a,c,d,f){g.apply(b.callback.onRename,[a,c,d,f])});a.bind(c.DRAG,function(a,c,d,f){g.apply(b.callback.onDrag,[c,d,f])});a.bind(c.DRAGMOVE,function(a,c,d,f){g.apply(b.callback.onDragMove,[c,d,f])});a.bind(c.DROP,
|
||||
function(a,c,d,f,e,m,o){g.apply(b.callback.onDrop,[c,d,f,e,m,o])})});m.addInitUnBind(function(b){var b=b.treeObj,a=d.event;b.unbind(a.RENAME);b.unbind(a.DRAG);b.unbind(a.DRAGMOVE);b.unbind(a.DROP)});m.addInitCache(function(){});m.addInitNode(function(b,a,c){if(c)c.isHover=!1,c.editNameFlag=!1});m.addInitProxy(function(b){var a=b.target,c=m.getSetting(b.data.treeId),f=b.relatedTarget,k="",i=null,j="",e=null,o=null;if(g.eqs(b.type,"mouseover")){if(o=g.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+d.id.A}]))k=
|
||||
g.getNodeMainDom(o).id,j="hoverOverNode"}else if(g.eqs(b.type,"mouseout"))o=g.getMDom(c,f,[{tagName:"a",attrName:"treeNode"+d.id.A}]),o||(k="remove",j="hoverOutNode");else if(g.eqs(b.type,"mousedown")&&(o=g.getMDom(c,a,[{tagName:"a",attrName:"treeNode"+d.id.A}])))k=g.getNodeMainDom(o).id,j="mousedownNode";if(k.length>0)switch(i=m.getNodeCache(c,k),j){case "mousedownNode":e=x.onMousedownNode;break;case "hoverOverNode":e=x.onHoverOverNode;break;case "hoverOutNode":e=x.onHoverOutNode}return{stop:!1,
|
||||
node:i,nodeEventType:j,nodeEventCallback:e,treeEventType:"",treeEventCallback:null}});m.addInitRoot(function(b){var b=m.getRoot(b),a=m.getRoots();b.curEditNode=null;b.curEditInput=null;b.curHoverNode=null;b.dragFlag=0;b.dragNodeShowBefore=[];b.dragMaskList=[];a.showHoverDom=!0});m.addZTreeTools(function(b,a){a.cancelEditName=function(a){m.getRoot(this.setting).curEditNode&&f.cancelCurEditNode(this.setting,a?a:null,!0)};a.copyNode=function(a,b,k,i){if(!b)return null;if(a&&!a.isParent&&this.setting.data.keep.leaf&&
|
||||
k===d.move.TYPE_INNER)return null;var j=this,e=g.clone(b);if(!a)a=null,k=d.move.TYPE_INNER;k==d.move.TYPE_INNER?(b=function(){f.addNodes(j.setting,a,[e],i)},g.canAsync(this.setting,a)?f.asyncNode(this.setting,a,i,b):b()):(f.addNodes(this.setting,a.parentNode,[e],i),f.moveNode(this.setting,a,e,k,!1,i));return e};a.editName=function(a){a&&a.tId&&a===m.getNodeCache(this.setting,a.tId)&&(a.parentTId&&f.expandCollapseParentNode(this.setting,a.getParentNode(),!0),f.editNode(this.setting,a))};a.moveNode=
|
||||
function(a,b,k,i){function j(){f.moveNode(e.setting,a,b,k,!1,i)}if(!b)return b;if(a&&!a.isParent&&this.setting.data.keep.leaf&&k===d.move.TYPE_INNER)return null;else if(a&&(b.parentTId==a.tId&&k==d.move.TYPE_INNER||o(b,this.setting).find("#"+a.tId).length>0))return null;else a||(a=null);var e=this;g.canAsync(this.setting,a)&&k===d.move.TYPE_INNER?f.asyncNode(this.setting,a,i,j):j();return b};a.setEditable=function(a){this.setting.edit.enable=a;return this.refresh()}});var N=f.cancelPreSelectedNode;
|
||||
f.cancelPreSelectedNode=function(b,a){for(var c=m.getRoot(b).curSelectedList,d=0,g=c.length;d<g;d++)if(!a||a===c[d])if(f.removeTreeDom(b,c[d]),a)break;N&&N.apply(f,arguments)};var O=f.createNodes;f.createNodes=function(b,a,c,d){O&&O.apply(f,arguments);c&&f.repairParentChkClassWithSelf&&f.repairParentChkClassWithSelf(b,d)};var V=f.makeNodeUrl;f.makeNodeUrl=function(b,a){return b.edit.enable?null:V.apply(f,arguments)};var L=f.removeNode;f.removeNode=function(b,a){var c=m.getRoot(b);if(c.curEditNode===
|
||||
a)c.curEditNode=null;L&&L.apply(f,arguments)};var P=f.selectNode;f.selectNode=function(b,a,c){var d=m.getRoot(b);if(m.isSelectedNode(b,a)&&d.curEditNode==a&&a.editNameFlag)return!1;P&&P.apply(f,arguments);f.addHoverDom(b,a);return!0};var Q=g.uCanDo;g.uCanDo=function(b,a){var c=m.getRoot(b);if(a&&(g.eqs(a.type,"mouseover")||g.eqs(a.type,"mouseout")||g.eqs(a.type,"mousedown")||g.eqs(a.type,"mouseup")))return!0;if(c.curEditNode)f.editNodeBlur=!1,c.curEditInput.focus();return!c.curEditNode&&(Q?Q.apply(f,
|
||||
arguments):!0)}})(jQuery);
|
||||
|
216
public/js/upload_paste/attachment_upload.js
Normal file
216
public/js/upload_paste/attachment_upload.js
Normal file
@ -0,0 +1,216 @@
|
||||
// upload attachment
|
||||
// 依赖note
|
||||
var urlPrefix = UrlPrefix;
|
||||
define('attachment_upload', ['jquery.ui.widget', 'fileupload'], function(){
|
||||
// Helper function that formats the file sizes
|
||||
function formatFileSize(bytes) {
|
||||
if (typeof bytes !== 'number') {
|
||||
return '';
|
||||
}
|
||||
if (bytes >= 1000000000) {
|
||||
return (bytes / 1000000000).toFixed(2) + ' GB';
|
||||
}
|
||||
if (bytes >= 1000000) {
|
||||
return (bytes / 1000000).toFixed(2) + ' MB';
|
||||
}
|
||||
return (bytes / 1000).toFixed(2) + ' KB';
|
||||
}
|
||||
|
||||
function setDropStyle(dropzoneId, formId) {
|
||||
// drag css
|
||||
var dropZone = $(dropzoneId);
|
||||
$(formId).bind('dragover', function (e) {
|
||||
e.preventDefault();
|
||||
var timeout = window.dropZoneTimeoutAttach;
|
||||
if(timeout) {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
|
||||
var found = false,
|
||||
node = e.target;
|
||||
do {
|
||||
if (node === dropZone[0]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
node = node.parentNode;
|
||||
} while (node != null);
|
||||
if (found) {
|
||||
dropZone.addClass('hover');
|
||||
} else {
|
||||
dropZone.removeClass('hover');
|
||||
}
|
||||
window.dropZoneTimeoutAttach = setTimeout(function () {
|
||||
window.dropZoneTimeoutAttach = null;
|
||||
dropZone.removeClass('in hover');
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
|
||||
setDropStyle("#dropAttach", "#uploadAttach");
|
||||
setDropStyle("#dropAvatar", "#uploadAvatar");
|
||||
|
||||
var initUploader = function() {
|
||||
$('.dropzone .btn-choose-file').click(function() {
|
||||
$(this).parent().find('input').click();
|
||||
});
|
||||
|
||||
var $msg = $('#attachUploadMsg');
|
||||
// Initialize the jQuery File Upload plugin
|
||||
$('#uploadAttach').fileupload({
|
||||
dataType: 'json',
|
||||
pasteZone: '', // 不能通过paste来上传图片
|
||||
// This element will accept file drag/drop uploading
|
||||
dropZone: $('#dropAttach'),
|
||||
formData: function(form) {
|
||||
return [{name: 'noteId', value: Note.curNoteId}] // 传递笔记本过去
|
||||
},
|
||||
// This function is called when a file is added to the queue;
|
||||
// either via the browse button, or via drag/drop:
|
||||
add: function(e, data) {
|
||||
var note = Note.getCurNote();
|
||||
if(!note || note.IsNew) {
|
||||
alert("This note hasn't saved, please save it firstly!")
|
||||
return;
|
||||
}
|
||||
|
||||
var tpl = $('<div class="alert alert-info"><img class="loader" src="/tinymce/plugins/leaui_image/public/images/ajax-loader.gif"> <a class="close" data-dismiss="alert">×</a></div>');
|
||||
|
||||
// Append the file name and file size
|
||||
tpl.append(data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small>');
|
||||
|
||||
// Add the HTML to the UL element
|
||||
$msg.html(tpl);
|
||||
data.context = $msg;
|
||||
|
||||
// 检查文件大小
|
||||
var size = data.files[0].size;
|
||||
var maxFileSize = +GlobalConfigs["uploadAttachSize"] || 100;
|
||||
if(typeof size == 'number' && size > 1024 * 1024 * maxFileSize) {
|
||||
tpl.find("img").remove();
|
||||
tpl.removeClass("alert-info").addClass("alert-danger");
|
||||
tpl.append(" Warning: File size is bigger than " + maxFileSize + "M");
|
||||
setTimeout((function(tpl) {
|
||||
return function() {
|
||||
tpl.remove();
|
||||
}
|
||||
})(tpl), 3000);
|
||||
return;
|
||||
}
|
||||
|
||||
// Automatically upload the file once it is added to the queue
|
||||
var jqXHR;
|
||||
setTimeout(function() {
|
||||
jqXHR = data.submit();
|
||||
}, 10);
|
||||
},
|
||||
/*
|
||||
progress: function (e, data) {
|
||||
},
|
||||
*/
|
||||
done: function(e, data) {
|
||||
if (data.result.Ok == true) {
|
||||
data.context.html("");
|
||||
Attach.addAttach(data.result.Item);
|
||||
} else {
|
||||
var re = data.result;
|
||||
data.context.html("");
|
||||
var tpl = $('<div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a></div>');
|
||||
tpl.append('<b>Error:</b> ' + data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small> ' + data.result.Msg);
|
||||
data.context.html(tpl);
|
||||
setTimeout((function(tpl) {
|
||||
return function() {
|
||||
tpl.remove();
|
||||
}
|
||||
})(tpl), 3000);
|
||||
}
|
||||
$("#uploadAttachMsg").scrollTop(1000);
|
||||
},
|
||||
fail: function(e, data) {
|
||||
data.context.html("");
|
||||
var tpl = $('<div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a></div>');
|
||||
tpl.append('<b>Error:</b> ' + data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small> ' + data.errorThrown);
|
||||
data.context.html(tpl);
|
||||
setTimeout((function(tpl) {
|
||||
return function() {
|
||||
tpl.remove();
|
||||
}
|
||||
})(tpl), 3000);
|
||||
|
||||
$("#uploadAttachMsg").scrollTop(1000);
|
||||
}
|
||||
});
|
||||
|
||||
//-------------------
|
||||
// 已经过时, 没有avatar了
|
||||
|
||||
var $msg2 = $('#avatarUploadMsg');
|
||||
$('#uploadAvatar').fileupload({
|
||||
dataType: 'json',
|
||||
dropZone: $('#dropAvatar'),
|
||||
pasteZone: '',
|
||||
add: function(e, data) {
|
||||
var tpl = $('<div class="alert alert-info"><img class="loader" src="/tinymce/plugins/leaui_image/public/images/ajax-loader.gif"> <a class="close" data-dismiss="alert">×</a></div>');
|
||||
|
||||
// Append the file name and file size
|
||||
tpl.append(data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small>');
|
||||
|
||||
// Add the HTML to the UL element
|
||||
$msg2.html(tpl);
|
||||
data.context = $msg2;
|
||||
|
||||
// 检查文件大小
|
||||
var size = data.files[0].size;
|
||||
var maxFileSize = +GlobalConfigs["uploadAvatarSize"] || 100;
|
||||
if(typeof size == 'number' && size > 1024 * 1024 * maxFileSize) {
|
||||
tpl.find("img").remove();
|
||||
tpl.removeClass("alert-info").addClass("alert-danger");
|
||||
tpl.append(" Warning: File size is bigger than " + maxFileSize + "M");
|
||||
setTimeout((function(tpl) {
|
||||
return function() {
|
||||
tpl.remove();
|
||||
}
|
||||
})(tpl), 3000);
|
||||
return;
|
||||
}
|
||||
|
||||
// Automatically upload the file once it is added to the queue
|
||||
var jqXHR;
|
||||
setTimeout(function() {
|
||||
jqXHR = data.submit();
|
||||
}, 10);
|
||||
},
|
||||
done: function(e, data) {
|
||||
if (data.result.Ok == true) {
|
||||
data.context.html("");
|
||||
var re = data.result;
|
||||
$("#avatar").attr("src", UrlPrefix + "/" + re.Id);
|
||||
} else {
|
||||
var re = data.result;
|
||||
data.context.html("");
|
||||
var tpl = $('<div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a></div>');
|
||||
tpl.append('<b>Error:</b> ' + data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small> ' + data.result.Msg);
|
||||
data.context.html(tpl);
|
||||
setTimeout((function(tpl) {
|
||||
return function() {
|
||||
tpl.remove();
|
||||
}
|
||||
})(tpl), 3000);
|
||||
}
|
||||
},
|
||||
fail: function(e, data) {
|
||||
data.context.html("");
|
||||
var tpl = $('<div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a></div>');
|
||||
tpl.append('<b>Error:</b> ' + data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small> ' + data.errorThrown);
|
||||
data.context.html(tpl);
|
||||
setTimeout((function(tpl) {
|
||||
return function() {
|
||||
tpl.remove();
|
||||
}
|
||||
})(tpl), 3000);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
initUploader();
|
||||
});
|
390
public/js/upload_paste/editor_drop_paste.js
Normal file
390
public/js/upload_paste/editor_drop_paste.js
Normal file
@ -0,0 +1,390 @@
|
||||
// for editor.
|
||||
// drag image to editor
|
||||
var urlPrefix = UrlPrefix; // window.location.protocol + "//" + window.location.host;
|
||||
define('editor_drop_paste', ['jquery.ui.widget', 'fileupload'], function(){
|
||||
function Process(editor) {
|
||||
var id = '__mcenew' + (new Date()).getTime();
|
||||
var str = '<div contenteditable="false" id="' + id + '" class="leanote-image-container">' +
|
||||
'<img class="loader" src="/images/ajax-loader.gif">' +
|
||||
'<div class="progress">' +
|
||||
'<div class="progress-bar progress-bar-success progress-bar-striped" role="progressbar" aria-valuenow="2" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">' +
|
||||
'0%' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
this.containerStr = str;
|
||||
editor.insertContent(str);
|
||||
var container = $('#' + id);
|
||||
this.container = container;
|
||||
this.id = id;
|
||||
this.processBar = container.find('.progress-bar');
|
||||
}
|
||||
Process.prototype.update = function(process) {
|
||||
var me = this;
|
||||
// 98%, 不要小数
|
||||
process = Math.ceil(process * 100);
|
||||
if(process >= 100) {
|
||||
process = 99;
|
||||
}
|
||||
process += "%";
|
||||
$('#' + me.id + ' .progress-bar').html(process).css('width', process);
|
||||
}
|
||||
Process.prototype.replace = function(src) {
|
||||
var me = this;
|
||||
getImageSize(src, function() {
|
||||
$('#' + me.id).replaceWith('<img src="' + src + '" />');
|
||||
});
|
||||
}
|
||||
Process.prototype.remove = function() {
|
||||
var me = this;
|
||||
$('#' + me.id).remove();
|
||||
}
|
||||
|
||||
// 当url改变时, 得到图片的大小
|
||||
function getImageSize(url, callback) {
|
||||
var img = document.createElement('img');
|
||||
|
||||
function done(width, height) {
|
||||
img.parentNode.removeChild(img);
|
||||
callback({width: width, height: height});
|
||||
}
|
||||
|
||||
img.onload = function() {
|
||||
done(img.clientWidth, img.clientHeight);
|
||||
};
|
||||
|
||||
img.onerror = function() {
|
||||
done();
|
||||
};
|
||||
|
||||
img.src = url;
|
||||
|
||||
var style = img.style;
|
||||
style.visibility = 'hidden';
|
||||
style.position = 'fixed';
|
||||
style.bottom = style.left = 0;
|
||||
style.width = style.height = 'auto';
|
||||
|
||||
document.body.appendChild(img);
|
||||
}
|
||||
|
||||
var i = 1;
|
||||
function insertImage(data) {
|
||||
var editor = tinymce.activeEditor;
|
||||
var dom = editor.dom;
|
||||
|
||||
var renderImage = function(data2) {
|
||||
// 这里, 如果图片宽度过大, 这里设置成500px
|
||||
var d = {};
|
||||
var imgElm;
|
||||
// 先显示loading...
|
||||
d.id = '__mcenew' + (i++);
|
||||
d.src = "http://leanote.com/images/loading-24.gif";
|
||||
imgElm = dom.createHTML('img', d);
|
||||
tinymce.activeEditor.insertContent(imgElm);
|
||||
imgElm = dom.get(d.id);
|
||||
|
||||
function callback (wh) {
|
||||
dom.setAttrib(imgElm, 'src', data2.src);
|
||||
// dom.setAttrib(imgElm, 'width', data2.width);
|
||||
if(data2.title) {
|
||||
dom.setAttrib(imgElm, 'title', data2.title);
|
||||
}
|
||||
|
||||
dom.setAttrib(imgElm, 'id', null);
|
||||
};
|
||||
getImageSize(data.src, callback);
|
||||
}
|
||||
|
||||
//-------------
|
||||
// outputImage?fileId=123232323
|
||||
var fileId = "";
|
||||
fileIds = data.src.split("fileId=")
|
||||
if(fileIds.length == 2 && fileIds[1].length == "53aecf8a8a039a43c8036282".length) {
|
||||
fileId = fileIds[1];
|
||||
}
|
||||
if(fileId) {
|
||||
// 得到fileId, 如果这个笔记不是我的, 那么肯定是协作的笔记, 那么需要将图片copy给原note owner
|
||||
var curNote = Note.getCurNote();
|
||||
if(curNote && curNote.UserId != UserInfo.UserId) {
|
||||
(function(data) {
|
||||
ajaxPost("/file/copyImage", {userId: UserInfo.UserId, fileId: fileId, toUserId: curNote.UserId}, function(re) {
|
||||
if(reIsOk(re) && re.Id) {
|
||||
var urlPrefix = window.location.protocol + "//" + window.location.host;
|
||||
data.src = urlPrefix + "/file/outputImage?fileId=" + re.Id;
|
||||
}
|
||||
renderImage(data);
|
||||
});
|
||||
})(data);
|
||||
} else {
|
||||
renderImage(data);
|
||||
}
|
||||
} else {
|
||||
renderImage(data);
|
||||
}
|
||||
}
|
||||
|
||||
var initUploader = function() {
|
||||
var ul = $('#upload ul');
|
||||
|
||||
$('#drop a').click(function() {
|
||||
// trigger to show file select
|
||||
$(this).parent().find('input').click();
|
||||
});
|
||||
|
||||
// Initialize the jQuery File Upload plugin
|
||||
$('#upload').fileupload({
|
||||
dataType: 'json',
|
||||
pasteZone: '', // 不允许paste
|
||||
acceptFileTypes: /(\.|\/)(gif|jpg|jpeg|png|jpe)$/i,
|
||||
maxFileSize: 210000,
|
||||
|
||||
// This element will accept file drag/drop uploading
|
||||
dropZone: $('#drop'),
|
||||
formData: function(form) {
|
||||
return [{name: 'albumId', value: ""}]
|
||||
},
|
||||
// This function is called when a file is added to the queue;
|
||||
// either via the browse button, or via drag/drop:
|
||||
add: function(e, data) {
|
||||
var tpl = $('<li><div class="alert alert-info"><img class="loader" src="/tinymce/plugins/leaui_image/public/images/ajax-loader.gif"> <a class="close" data-dismiss="alert">×</a></div></li>');
|
||||
|
||||
// Append the file name and file size
|
||||
tpl.find('div').append(data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small>');
|
||||
|
||||
// Add the HTML to the UL element
|
||||
data.context = tpl.appendTo(ul);
|
||||
|
||||
// data.form[0].action += "&album_id=" + $("#albumsForUpload").val();
|
||||
|
||||
// Automatically upload the file once it is added to the queue
|
||||
var jqXHR = data.submit();
|
||||
},
|
||||
|
||||
done: function(e, data) {
|
||||
if (data.result.Ok == true) {
|
||||
data.context.remove();
|
||||
// life
|
||||
var data2 = {src: urlPrefix + "/file/outputImage?fileId=" + data.result.Id}
|
||||
insertImage(data2);
|
||||
} else {
|
||||
data.context.empty();
|
||||
var tpl = $('<li><div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a></div></li>');
|
||||
tpl.find('div').append('<b>Error:</b> ' + data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small> ' + data.result.Msg);
|
||||
data.context.append(tpl);
|
||||
setTimeout((function(tpl) {
|
||||
return function() {
|
||||
tpl.remove();
|
||||
}
|
||||
})(tpl), 2000);
|
||||
}
|
||||
$("#uploadMsg").scrollTop(1000);
|
||||
},
|
||||
fail: function(e, data) {
|
||||
data.context.empty();
|
||||
var tpl = $('<li><div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a></div></li>');
|
||||
tpl.find('div').append('<b>Error:</b> ' + data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small> ' + data.errorThrown);
|
||||
data.context.append(tpl);
|
||||
setTimeout((function(tpl) {
|
||||
return function() {
|
||||
tpl.remove();
|
||||
}
|
||||
})(tpl), 2000);
|
||||
|
||||
$("#uploadMsg").scrollTop(1000);
|
||||
}
|
||||
});
|
||||
|
||||
// Prevent the default action when a file is dropped on the window
|
||||
$(document).on('drop dragover', function(e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// Helper function that formats the file sizes
|
||||
function formatFileSize(bytes) {
|
||||
if (typeof bytes !== 'number') {
|
||||
return '';
|
||||
}
|
||||
if (bytes >= 1000000000) {
|
||||
return (bytes / 1000000000).toFixed(2) + ' GB';
|
||||
}
|
||||
if (bytes >= 1000000) {
|
||||
return (bytes / 1000000).toFixed(2) + ' MB';
|
||||
}
|
||||
return (bytes / 1000).toFixed(2) + ' KB';
|
||||
}
|
||||
|
||||
function showUpload() {
|
||||
$("#upload").css("z-index", 12);
|
||||
var top = +$("#mceToolbar").css("height").slice(0, -2); // px
|
||||
$("#upload").css("top", top - 8);
|
||||
$("#upload").show();
|
||||
}
|
||||
|
||||
function hideUpload() {
|
||||
$("#upload").css("z-index", 0).css("top", "auto").hide();
|
||||
}
|
||||
|
||||
// drag css
|
||||
$(document).bind('dragover', function (e) {
|
||||
var dropZone = $('#drop'),
|
||||
timeout = window.dropZoneTimeout;
|
||||
if (!timeout) {
|
||||
dropZone.addClass('in');
|
||||
showUpload();
|
||||
} else {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
|
||||
var found = false,
|
||||
node = e.target;
|
||||
do {
|
||||
if (node === dropZone[0]) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
node = node.parentNode;
|
||||
} while (node != null);
|
||||
if (found) {
|
||||
dropZone.addClass('hover');
|
||||
} else {
|
||||
dropZone.removeClass('hover');
|
||||
}
|
||||
window.dropZoneTimeout = setTimeout(function () {
|
||||
window.dropZoneTimeout = null;
|
||||
dropZone.removeClass('in hover');
|
||||
hideUpload();
|
||||
}, 100);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// pasteImage
|
||||
var pasteImageInit = function() {
|
||||
var curNote;
|
||||
// Initialize the jQuery File Upload plugin
|
||||
var dom, editor;
|
||||
// 2015/4/17 添加wmd-input markdown paste image
|
||||
$('#editorContent, #wmd-input .editor-content').fileupload({
|
||||
dataType: 'json',
|
||||
pasteZone: $('#editorContent, #wmd-input .editor-content'),
|
||||
dropZone: '', // 只允许paste
|
||||
maxFileSize: 210000,
|
||||
url: "/file/pasteImage",
|
||||
paramName: 'file',
|
||||
formData: function(form) {
|
||||
return [{name: 'from', value: 'pasteImage'}, {name: 'noteId', value: Note.curNoteId}]
|
||||
},
|
||||
/*
|
||||
paste: function(e, data) {
|
||||
var jqXHR = data.submit();
|
||||
},
|
||||
*/
|
||||
progress: function(e, data) {
|
||||
if(curNote && !curNote.IsMarkdown) {
|
||||
data.process.update(data.loaded / data.total);
|
||||
}
|
||||
},
|
||||
add: function(e, data) {
|
||||
var note = Note.getCurNote();
|
||||
curNote = note;
|
||||
if(!note || note.IsNew) {
|
||||
alert("This note hasn't saved, please save it firstly!")
|
||||
return;
|
||||
}
|
||||
// 先显示loading...
|
||||
editor = tinymce.EditorManager.activeEditor;
|
||||
if(!note.IsMarkdown) {
|
||||
var process = new Process(editor);
|
||||
}
|
||||
data.process = process;
|
||||
var jqXHR = data.submit();
|
||||
|
||||
/*
|
||||
d.id = '__mcenew' + (new Date()).getTime();
|
||||
d.src = "http://leanote.com/images/loading-24.gif"; // 写死了
|
||||
var img = '<img src="' + d.src + '" id="' + d.id + '" />';
|
||||
editor.insertContent(img);
|
||||
var imgElm = $(d.id);
|
||||
data.imgId = d.id;
|
||||
data.context = imgElm;
|
||||
*/
|
||||
|
||||
/*
|
||||
// 上传之
|
||||
var c = new FormData;
|
||||
c.append("from", "pasteImage");
|
||||
// var d;
|
||||
// d = $.ajaxSettings.xhr();
|
||||
// d.withCredentials = i;var d = {};
|
||||
|
||||
// 先显示loading...
|
||||
var editor = tinymce.EditorManager.activeEditor;
|
||||
var dom = editor.dom;
|
||||
var d = {};
|
||||
d.id = '__mcenew';
|
||||
d.src = "http://leanote.com/images/loading-24.gif"; // 写死了
|
||||
editor.insertContent(dom.createHTML('img', d));
|
||||
var imgElm = dom.get('__mcenew');
|
||||
$.ajax({url: "/file/pasteImage", contentType:false, processData:false , data: c, type: "POST"}
|
||||
).done(function(re) {
|
||||
if(!re || typeof re != "object" || !re.Ok) {
|
||||
// 删除
|
||||
dom.remove(imgElm);
|
||||
return;
|
||||
}
|
||||
// 这里, 如果图片宽度过大, 这里设置成500px
|
||||
var urlPrefix = UrlPrefix; // window.location.protocol + "//" + window.location.host;
|
||||
var src = urlPrefix + "/file/outputImage?fileId=" + re.Id;
|
||||
getImageSize(src, function(wh) {
|
||||
// life 4/25
|
||||
if(wh && wh.width) {
|
||||
if(wh.width > 600) {
|
||||
wh.width = 600;
|
||||
}
|
||||
d.width = wh.width;
|
||||
dom.setAttrib(imgElm, 'width', d.width);
|
||||
}
|
||||
dom.setAttrib(imgElm, 'src', src);
|
||||
});
|
||||
dom.setAttrib(imgElm, 'id', null);
|
||||
});
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
*/
|
||||
},
|
||||
|
||||
done: function(e, data) {
|
||||
if (data.result.Ok == true) {
|
||||
// 这里, 如果图片宽度过大, 这里设置成500px
|
||||
var re = data.result;
|
||||
var urlPrefix = UrlPrefix; // window.location.protocol + "//" + window.location.host;
|
||||
var src = urlPrefix + "/file/outputImage?fileId=" + re.Id;
|
||||
|
||||
if(curNote && !curNote.IsMarkdown) {
|
||||
data.process.replace(src);
|
||||
} else {
|
||||
MD && MD.insertLink(src, 'title', true);
|
||||
}
|
||||
|
||||
/*
|
||||
getImageSize(src, function() {
|
||||
$img.attr('src', src);
|
||||
$img.removeAttr('id');
|
||||
});
|
||||
*/
|
||||
} else {
|
||||
data.process.remove();
|
||||
}
|
||||
},
|
||||
fail: function(e, data) {
|
||||
if(curNote && !curNote.IsMarkdown) {
|
||||
data.process.remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
initUploader();
|
||||
pasteImageInit();
|
||||
});
|
1212
public/js/upload_paste/libs/jquery.fileupload.js
vendored
Normal file
1212
public/js/upload_paste/libs/jquery.fileupload.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
188
public/js/upload_paste/libs/jquery.iframe-transport.js
Normal file
188
public/js/upload_paste/libs/jquery.iframe-transport.js
Normal file
@ -0,0 +1,188 @@
|
||||
/*
|
||||
* jQuery Iframe Transport Plugin 1.6.1
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint unparam: true, nomen: true */
|
||||
/*global define, window, document */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
/*
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['jquery'], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.jQuery);
|
||||
}
|
||||
*/
|
||||
factory(window.jQuery);
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
// Helper variable to create unique names for the transport iframes:
|
||||
var counter = 0;
|
||||
|
||||
// The iframe transport accepts three additional options:
|
||||
// options.fileInput: a jQuery collection of file input fields
|
||||
// options.paramName: the parameter name for the file form data,
|
||||
// overrides the name property of the file input field(s),
|
||||
// can be a string or an array of strings.
|
||||
// options.formData: an array of objects with name and value properties,
|
||||
// equivalent to the return data of .serializeArray(), e.g.:
|
||||
// [{name: 'a', value: 1}, {name: 'b', value: 2}]
|
||||
$.ajaxTransport('iframe', function (options) {
|
||||
if (options.async) {
|
||||
var form,
|
||||
iframe,
|
||||
addParamChar;
|
||||
return {
|
||||
send: function (_, completeCallback) {
|
||||
form = $('<form style="display:none;"></form>');
|
||||
form.attr('accept-charset', options.formAcceptCharset);
|
||||
addParamChar = /\?/.test(options.url) ? '&' : '?';
|
||||
// XDomainRequest only supports GET and POST:
|
||||
if (options.type === 'DELETE') {
|
||||
options.url = options.url + addParamChar + '_method=DELETE';
|
||||
options.type = 'POST';
|
||||
} else if (options.type === 'PUT') {
|
||||
options.url = options.url + addParamChar + '_method=PUT';
|
||||
options.type = 'POST';
|
||||
} else if (options.type === 'PATCH') {
|
||||
options.url = options.url + addParamChar + '_method=PATCH';
|
||||
options.type = 'POST';
|
||||
}
|
||||
// javascript:false as initial iframe src
|
||||
// prevents warning popups on HTTPS in IE6.
|
||||
// IE versions below IE8 cannot set the name property of
|
||||
// elements that have already been added to the DOM,
|
||||
// so we set the name along with the iframe HTML markup:
|
||||
iframe = $(
|
||||
'<iframe src="javascript:false;" name="iframe-transport-' +
|
||||
(counter += 1) + '"></iframe>'
|
||||
).bind('load', function () {
|
||||
var fileInputClones,
|
||||
paramNames = $.isArray(options.paramName) ?
|
||||
options.paramName : [options.paramName];
|
||||
iframe
|
||||
.unbind('load')
|
||||
.bind('load', function () {
|
||||
var response;
|
||||
// Wrap in a try/catch block to catch exceptions thrown
|
||||
// when trying to access cross-domain iframe contents:
|
||||
try {
|
||||
response = iframe.contents();
|
||||
// Google Chrome and Firefox do not throw an
|
||||
// exception when calling iframe.contents() on
|
||||
// cross-domain requests, so we unify the response:
|
||||
if (!response.length || !response[0].firstChild) {
|
||||
throw new Error();
|
||||
}
|
||||
} catch (e) {
|
||||
response = undefined;
|
||||
}
|
||||
// The complete callback returns the
|
||||
// iframe content document as response object:
|
||||
completeCallback(
|
||||
200,
|
||||
'success',
|
||||
{'iframe': response}
|
||||
);
|
||||
// Fix for IE endless progress bar activity bug
|
||||
// (happens on form submits to iframe targets):
|
||||
$('<iframe src="javascript:false;"></iframe>')
|
||||
.appendTo(form);
|
||||
form.remove();
|
||||
});
|
||||
form
|
||||
.prop('target', iframe.prop('name'))
|
||||
.prop('action', options.url)
|
||||
.prop('method', options.type);
|
||||
if (options.formData) {
|
||||
$.each(options.formData, function (index, field) {
|
||||
$('<input type="hidden"/>')
|
||||
.prop('name', field.name)
|
||||
.val(field.value)
|
||||
.appendTo(form);
|
||||
});
|
||||
}
|
||||
if (options.fileInput && options.fileInput.length &&
|
||||
options.type === 'POST') {
|
||||
fileInputClones = options.fileInput.clone();
|
||||
// Insert a clone for each file input field:
|
||||
options.fileInput.after(function (index) {
|
||||
return fileInputClones[index];
|
||||
});
|
||||
if (options.paramName) {
|
||||
options.fileInput.each(function (index) {
|
||||
$(this).prop(
|
||||
'name',
|
||||
paramNames[index] || options.paramName
|
||||
);
|
||||
});
|
||||
}
|
||||
// Appending the file input fields to the hidden form
|
||||
// removes them from their original location:
|
||||
form
|
||||
.append(options.fileInput)
|
||||
.prop('enctype', 'multipart/form-data')
|
||||
// enctype must be set as encoding for IE:
|
||||
.prop('encoding', 'multipart/form-data');
|
||||
}
|
||||
form.submit();
|
||||
// Insert the file input fields at their original location
|
||||
// by replacing the clones with the originals:
|
||||
if (fileInputClones && fileInputClones.length) {
|
||||
options.fileInput.each(function (index, input) {
|
||||
var clone = $(fileInputClones[index]);
|
||||
$(input).prop('name', clone.prop('name'));
|
||||
clone.replaceWith(input);
|
||||
});
|
||||
}
|
||||
});
|
||||
form.append(iframe).appendTo(document.body);
|
||||
},
|
||||
abort: function () {
|
||||
if (iframe) {
|
||||
// javascript:false as iframe src aborts the request
|
||||
// and prevents warning popups on HTTPS in IE6.
|
||||
// concat is used to avoid the "Script URL" JSLint error:
|
||||
iframe
|
||||
.unbind('load')
|
||||
.prop('src', 'javascript'.concat(':false;'));
|
||||
}
|
||||
if (form) {
|
||||
form.remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// The iframe transport returns the iframe content document as response.
|
||||
// The following adds converters from iframe to text, json, html, and script:
|
||||
$.ajaxSetup({
|
||||
converters: {
|
||||
'iframe text': function (iframe) {
|
||||
return iframe && $(iframe[0].body).text();
|
||||
},
|
||||
'iframe json': function (iframe) {
|
||||
return iframe && $.parseJSON($(iframe[0].body).text());
|
||||
},
|
||||
'iframe html': function (iframe) {
|
||||
return iframe && $(iframe[0].body).html();
|
||||
},
|
||||
'iframe script': function (iframe) {
|
||||
return iframe && $.globalEval($(iframe[0].body).text());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}));
|
534
public/js/upload_paste/libs/jquery.ui.widget.js
vendored
Normal file
534
public/js/upload_paste/libs/jquery.ui.widget.js
vendored
Normal file
@ -0,0 +1,534 @@
|
||||
/*
|
||||
* jQuery UI Widget 1.10.1+amd
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2013 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/jQuery.widget/
|
||||
*/
|
||||
|
||||
(function (factory) {
|
||||
/* 需要jquery, 会重新加载jquery, slimScroll会覆盖
|
||||
if (typeof define === "function" && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(["jquery"], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(jQuery);
|
||||
}
|
||||
*/
|
||||
|
||||
factory(jQuery);
|
||||
}(function( $, undefined ) {
|
||||
|
||||
var uuid = 0,
|
||||
slice = Array.prototype.slice,
|
||||
_cleanData = $.cleanData;
|
||||
$.cleanData = function( elems ) {
|
||||
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
||||
try {
|
||||
$( elem ).triggerHandler( "remove" );
|
||||
// http://bugs.jquery.com/ticket/8235
|
||||
} catch( e ) {}
|
||||
}
|
||||
_cleanData( elems );
|
||||
};
|
||||
|
||||
$.widget = function( name, base, prototype ) {
|
||||
var fullName, existingConstructor, constructor, basePrototype,
|
||||
// proxiedPrototype allows the provided prototype to remain unmodified
|
||||
// so that it can be used as a mixin for multiple widgets (#8876)
|
||||
proxiedPrototype = {},
|
||||
namespace = name.split( "." )[ 0 ];
|
||||
|
||||
name = name.split( "." )[ 1 ];
|
||||
fullName = namespace + "-" + name;
|
||||
|
||||
if ( !prototype ) {
|
||||
prototype = base;
|
||||
base = $.Widget;
|
||||
}
|
||||
|
||||
// create selector for plugin
|
||||
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
|
||||
return !!$.data( elem, fullName );
|
||||
};
|
||||
|
||||
$[ namespace ] = $[ namespace ] || {};
|
||||
existingConstructor = $[ namespace ][ name ];
|
||||
constructor = $[ namespace ][ name ] = function( options, element ) {
|
||||
// allow instantiation without "new" keyword
|
||||
if ( !this._createWidget ) {
|
||||
return new constructor( options, element );
|
||||
}
|
||||
|
||||
// allow instantiation without initializing for simple inheritance
|
||||
// must use "new" keyword (the code above always passes args)
|
||||
if ( arguments.length ) {
|
||||
this._createWidget( options, element );
|
||||
}
|
||||
};
|
||||
// extend with the existing constructor to carry over any static properties
|
||||
$.extend( constructor, existingConstructor, {
|
||||
version: prototype.version,
|
||||
// copy the object used to create the prototype in case we need to
|
||||
// redefine the widget later
|
||||
_proto: $.extend( {}, prototype ),
|
||||
// track widgets that inherit from this widget in case this widget is
|
||||
// redefined after a widget inherits from it
|
||||
_childConstructors: []
|
||||
});
|
||||
|
||||
basePrototype = new base();
|
||||
// we need to make the options hash a property directly on the new instance
|
||||
// otherwise we'll modify the options hash on the prototype that we're
|
||||
// inheriting from
|
||||
basePrototype.options = $.widget.extend( {}, basePrototype.options );
|
||||
$.each( prototype, function( prop, value ) {
|
||||
if ( !$.isFunction( value ) ) {
|
||||
proxiedPrototype[ prop ] = value;
|
||||
return;
|
||||
}
|
||||
proxiedPrototype[ prop ] = (function() {
|
||||
var _super = function() {
|
||||
return base.prototype[ prop ].apply( this, arguments );
|
||||
},
|
||||
_superApply = function( args ) {
|
||||
return base.prototype[ prop ].apply( this, args );
|
||||
};
|
||||
return function() {
|
||||
var __super = this._super,
|
||||
__superApply = this._superApply,
|
||||
returnValue;
|
||||
|
||||
this._super = _super;
|
||||
this._superApply = _superApply;
|
||||
|
||||
returnValue = value.apply( this, arguments );
|
||||
|
||||
this._super = __super;
|
||||
this._superApply = __superApply;
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
})();
|
||||
});
|
||||
constructor.prototype = $.widget.extend( basePrototype, {
|
||||
// TODO: remove support for widgetEventPrefix
|
||||
// always use the name + a colon as the prefix, e.g., draggable:start
|
||||
// don't prefix for widgets that aren't DOM-based
|
||||
widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
|
||||
}, proxiedPrototype, {
|
||||
constructor: constructor,
|
||||
namespace: namespace,
|
||||
widgetName: name,
|
||||
widgetFullName: fullName
|
||||
});
|
||||
|
||||
// If this widget is being redefined then we need to find all widgets that
|
||||
// are inheriting from it and redefine all of them so that they inherit from
|
||||
// the new version of this widget. We're essentially trying to replace one
|
||||
// level in the prototype chain.
|
||||
if ( existingConstructor ) {
|
||||
$.each( existingConstructor._childConstructors, function( i, child ) {
|
||||
var childPrototype = child.prototype;
|
||||
|
||||
// redefine the child widget using the same prototype that was
|
||||
// originally used, but inherit from the new version of the base
|
||||
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
|
||||
});
|
||||
// remove the list of existing child constructors from the old constructor
|
||||
// so the old child constructors can be garbage collected
|
||||
delete existingConstructor._childConstructors;
|
||||
} else {
|
||||
base._childConstructors.push( constructor );
|
||||
}
|
||||
|
||||
$.widget.bridge( name, constructor );
|
||||
};
|
||||
|
||||
$.widget.extend = function( target ) {
|
||||
var input = slice.call( arguments, 1 ),
|
||||
inputIndex = 0,
|
||||
inputLength = input.length,
|
||||
key,
|
||||
value;
|
||||
for ( ; inputIndex < inputLength; inputIndex++ ) {
|
||||
for ( key in input[ inputIndex ] ) {
|
||||
value = input[ inputIndex ][ key ];
|
||||
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
|
||||
// Clone objects
|
||||
if ( $.isPlainObject( value ) ) {
|
||||
target[ key ] = $.isPlainObject( target[ key ] ) ?
|
||||
$.widget.extend( {}, target[ key ], value ) :
|
||||
// Don't extend strings, arrays, etc. with objects
|
||||
$.widget.extend( {}, value );
|
||||
// Copy everything else by reference
|
||||
} else {
|
||||
target[ key ] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
|
||||
$.widget.bridge = function( name, object ) {
|
||||
var fullName = object.prototype.widgetFullName || name;
|
||||
$.fn[ name ] = function( options ) {
|
||||
var isMethodCall = typeof options === "string",
|
||||
args = slice.call( arguments, 1 ),
|
||||
returnValue = this;
|
||||
|
||||
// allow multiple hashes to be passed on init
|
||||
options = !isMethodCall && args.length ?
|
||||
$.widget.extend.apply( null, [ options ].concat(args) ) :
|
||||
options;
|
||||
|
||||
if ( isMethodCall ) {
|
||||
this.each(function() {
|
||||
var methodValue,
|
||||
instance = $.data( this, fullName );
|
||||
if ( !instance ) {
|
||||
return $.error( "cannot call methods on " + name + " prior to initialization; " +
|
||||
"attempted to call method '" + options + "'" );
|
||||
}
|
||||
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
|
||||
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
|
||||
}
|
||||
methodValue = instance[ options ].apply( instance, args );
|
||||
if ( methodValue !== instance && methodValue !== undefined ) {
|
||||
returnValue = methodValue && methodValue.jquery ?
|
||||
returnValue.pushStack( methodValue.get() ) :
|
||||
methodValue;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.each(function() {
|
||||
var instance = $.data( this, fullName );
|
||||
if ( instance ) {
|
||||
instance.option( options || {} )._init();
|
||||
} else {
|
||||
$.data( this, fullName, new object( options, this ) );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
};
|
||||
|
||||
$.Widget = function( /* options, element */ ) {};
|
||||
$.Widget._childConstructors = [];
|
||||
|
||||
$.Widget.prototype = {
|
||||
widgetName: "widget",
|
||||
widgetEventPrefix: "",
|
||||
defaultElement: "<div>",
|
||||
options: {
|
||||
disabled: false,
|
||||
|
||||
// callbacks
|
||||
create: null
|
||||
},
|
||||
_createWidget: function( options, element ) {
|
||||
element = $( element || this.defaultElement || this )[ 0 ];
|
||||
this.element = $( element );
|
||||
this.uuid = uuid++;
|
||||
this.eventNamespace = "." + this.widgetName + this.uuid;
|
||||
this.options = $.widget.extend( {},
|
||||
this.options,
|
||||
this._getCreateOptions(),
|
||||
options );
|
||||
|
||||
this.bindings = $();
|
||||
this.hoverable = $();
|
||||
this.focusable = $();
|
||||
|
||||
if ( element !== this ) {
|
||||
$.data( element, this.widgetFullName, this );
|
||||
this._on( true, this.element, {
|
||||
remove: function( event ) {
|
||||
if ( event.target === element ) {
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.document = $( element.style ?
|
||||
// element within the document
|
||||
element.ownerDocument :
|
||||
// element is window or document
|
||||
element.document || element );
|
||||
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
|
||||
}
|
||||
|
||||
this._create();
|
||||
this._trigger( "create", null, this._getCreateEventData() );
|
||||
this._init();
|
||||
},
|
||||
_getCreateOptions: $.noop,
|
||||
_getCreateEventData: $.noop,
|
||||
_create: $.noop,
|
||||
_init: $.noop,
|
||||
|
||||
destroy: function() {
|
||||
this._destroy();
|
||||
// we can probably remove the unbind calls in 2.0
|
||||
// all event bindings should go through this._on()
|
||||
this.element
|
||||
.unbind( this.eventNamespace )
|
||||
// 1.9 BC for #7810
|
||||
// TODO remove dual storage
|
||||
.removeData( this.widgetName )
|
||||
.removeData( this.widgetFullName )
|
||||
// support: jquery <1.6.3
|
||||
// http://bugs.jquery.com/ticket/9413
|
||||
.removeData( $.camelCase( this.widgetFullName ) );
|
||||
this.widget()
|
||||
.unbind( this.eventNamespace )
|
||||
.removeAttr( "aria-disabled" )
|
||||
.removeClass(
|
||||
this.widgetFullName + "-disabled " +
|
||||
"ui-state-disabled" );
|
||||
|
||||
// clean up events and states
|
||||
this.bindings.unbind( this.eventNamespace );
|
||||
this.hoverable.removeClass( "ui-state-hover" );
|
||||
this.focusable.removeClass( "ui-state-focus" );
|
||||
},
|
||||
_destroy: $.noop,
|
||||
|
||||
widget: function() {
|
||||
return this.element;
|
||||
},
|
||||
|
||||
option: function( key, value ) {
|
||||
var options = key,
|
||||
parts,
|
||||
curOption,
|
||||
i;
|
||||
|
||||
if ( arguments.length === 0 ) {
|
||||
// don't return a reference to the internal hash
|
||||
return $.widget.extend( {}, this.options );
|
||||
}
|
||||
|
||||
if ( typeof key === "string" ) {
|
||||
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
||||
options = {};
|
||||
parts = key.split( "." );
|
||||
key = parts.shift();
|
||||
if ( parts.length ) {
|
||||
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
|
||||
for ( i = 0; i < parts.length - 1; i++ ) {
|
||||
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
|
||||
curOption = curOption[ parts[ i ] ];
|
||||
}
|
||||
key = parts.pop();
|
||||
if ( value === undefined ) {
|
||||
return curOption[ key ] === undefined ? null : curOption[ key ];
|
||||
}
|
||||
curOption[ key ] = value;
|
||||
} else {
|
||||
if ( value === undefined ) {
|
||||
return this.options[ key ] === undefined ? null : this.options[ key ];
|
||||
}
|
||||
options[ key ] = value;
|
||||
}
|
||||
}
|
||||
|
||||
this._setOptions( options );
|
||||
|
||||
return this;
|
||||
},
|
||||
_setOptions: function( options ) {
|
||||
var key;
|
||||
|
||||
for ( key in options ) {
|
||||
this._setOption( key, options[ key ] );
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
_setOption: function( key, value ) {
|
||||
this.options[ key ] = value;
|
||||
|
||||
if ( key === "disabled" ) {
|
||||
this.widget()
|
||||
.toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
|
||||
.attr( "aria-disabled", value );
|
||||
this.hoverable.removeClass( "ui-state-hover" );
|
||||
this.focusable.removeClass( "ui-state-focus" );
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
enable: function() {
|
||||
return this._setOption( "disabled", false );
|
||||
},
|
||||
disable: function() {
|
||||
return this._setOption( "disabled", true );
|
||||
},
|
||||
|
||||
_on: function( suppressDisabledCheck, element, handlers ) {
|
||||
var delegateElement,
|
||||
instance = this;
|
||||
|
||||
// no suppressDisabledCheck flag, shuffle arguments
|
||||
if ( typeof suppressDisabledCheck !== "boolean" ) {
|
||||
handlers = element;
|
||||
element = suppressDisabledCheck;
|
||||
suppressDisabledCheck = false;
|
||||
}
|
||||
|
||||
// no element argument, shuffle and use this.element
|
||||
if ( !handlers ) {
|
||||
handlers = element;
|
||||
element = this.element;
|
||||
delegateElement = this.widget();
|
||||
} else {
|
||||
// accept selectors, DOM elements
|
||||
element = delegateElement = $( element );
|
||||
this.bindings = this.bindings.add( element );
|
||||
}
|
||||
|
||||
$.each( handlers, function( event, handler ) {
|
||||
function handlerProxy() {
|
||||
// allow widgets to customize the disabled handling
|
||||
// - disabled as an array instead of boolean
|
||||
// - disabled class as method for disabling individual parts
|
||||
if ( !suppressDisabledCheck &&
|
||||
( instance.options.disabled === true ||
|
||||
$( this ).hasClass( "ui-state-disabled" ) ) ) {
|
||||
return;
|
||||
}
|
||||
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
||||
.apply( instance, arguments );
|
||||
}
|
||||
|
||||
// copy the guid so direct unbinding works
|
||||
if ( typeof handler !== "string" ) {
|
||||
handlerProxy.guid = handler.guid =
|
||||
handler.guid || handlerProxy.guid || $.guid++;
|
||||
}
|
||||
|
||||
var match = event.match( /^(\w+)\s*(.*)$/ ),
|
||||
eventName = match[1] + instance.eventNamespace,
|
||||
selector = match[2];
|
||||
if ( selector ) {
|
||||
delegateElement.delegate( selector, eventName, handlerProxy );
|
||||
} else {
|
||||
element.bind( eventName, handlerProxy );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_off: function( element, eventName ) {
|
||||
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
|
||||
element.unbind( eventName ).undelegate( eventName );
|
||||
},
|
||||
|
||||
_delay: function( handler, delay ) {
|
||||
function handlerProxy() {
|
||||
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
||||
.apply( instance, arguments );
|
||||
}
|
||||
var instance = this;
|
||||
return setTimeout( handlerProxy, delay || 0 );
|
||||
},
|
||||
|
||||
_hoverable: function( element ) {
|
||||
this.hoverable = this.hoverable.add( element );
|
||||
this._on( element, {
|
||||
mouseenter: function( event ) {
|
||||
$( event.currentTarget ).addClass( "ui-state-hover" );
|
||||
},
|
||||
mouseleave: function( event ) {
|
||||
$( event.currentTarget ).removeClass( "ui-state-hover" );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_focusable: function( element ) {
|
||||
this.focusable = this.focusable.add( element );
|
||||
this._on( element, {
|
||||
focusin: function( event ) {
|
||||
$( event.currentTarget ).addClass( "ui-state-focus" );
|
||||
},
|
||||
focusout: function( event ) {
|
||||
$( event.currentTarget ).removeClass( "ui-state-focus" );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_trigger: function( type, event, data ) {
|
||||
var prop, orig,
|
||||
callback = this.options[ type ];
|
||||
|
||||
data = data || {};
|
||||
event = $.Event( event );
|
||||
event.type = ( type === this.widgetEventPrefix ?
|
||||
type :
|
||||
this.widgetEventPrefix + type ).toLowerCase();
|
||||
// the original event may come from any element
|
||||
// so we need to reset the target on the new event
|
||||
event.target = this.element[ 0 ];
|
||||
|
||||
// copy original event properties over to the new event
|
||||
orig = event.originalEvent;
|
||||
if ( orig ) {
|
||||
for ( prop in orig ) {
|
||||
if ( !( prop in event ) ) {
|
||||
event[ prop ] = orig[ prop ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.element.trigger( event, data );
|
||||
return !( $.isFunction( callback ) &&
|
||||
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
|
||||
event.isDefaultPrevented() );
|
||||
}
|
||||
};
|
||||
|
||||
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
||||
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
|
||||
if ( typeof options === "string" ) {
|
||||
options = { effect: options };
|
||||
}
|
||||
var hasOptions,
|
||||
effectName = !options ?
|
||||
method :
|
||||
options === true || typeof options === "number" ?
|
||||
defaultEffect :
|
||||
options.effect || defaultEffect;
|
||||
options = options || {};
|
||||
if ( typeof options === "number" ) {
|
||||
options = { duration: options };
|
||||
}
|
||||
hasOptions = !$.isEmptyObject( options );
|
||||
options.complete = callback;
|
||||
if ( options.delay ) {
|
||||
element.delay( options.delay );
|
||||
}
|
||||
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
|
||||
element[ method ]( options );
|
||||
} else if ( effectName !== method && element[ effectName ] ) {
|
||||
element[ effectName ]( options.duration, options.easing, callback );
|
||||
} else {
|
||||
element.queue(function( next ) {
|
||||
$( this )[ method ]();
|
||||
if ( callback ) {
|
||||
callback.call( element[ 0 ] );
|
||||
}
|
||||
next();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
}));
|
17
public/js/upload_paste/main.js
Normal file
17
public/js/upload_paste/main.js
Normal file
@ -0,0 +1,17 @@
|
||||
// 上传, 粘贴图片
|
||||
requirejs.config({
|
||||
paths: {
|
||||
// life
|
||||
'editor_drop_paste': 'js/upload_paste/editor_drop_paste',
|
||||
'attachment_upload': 'js/upload_paste/attachment_upload',
|
||||
'jquery.ui.widget': 'js/upload_paste/libs/jquery.ui.widget',
|
||||
'fileupload': 'js/upload_paste/libs/jquery.fileupload',
|
||||
'iframe-transport': 'js/upload_paste/libs/jquery.iframe-transport'
|
||||
},
|
||||
shim: {
|
||||
// life
|
||||
'fileupload': {deps: ['jquery.ui.widget', 'iframe-transport']},
|
||||
}
|
||||
});
|
||||
require(["editor_drop_paste", "attachment_upload"], function() {
|
||||
});
|
Reference in New Issue
Block a user