Repository: dwzteam/dwz_jui Branch: master Commit: 80c46ad111e9 Files: 173 Total size: 1.4 MB Directory structure: gitextract_ohlqek00/ ├── .gitignore ├── LICENSE.txt ├── README.md ├── bin/ │ ├── ESC.wsf │ ├── gzjs-esc.bat │ ├── gzjs.sh │ └── yuicompressor-2.4.8.jar ├── changepwd.html ├── chart/ │ └── test/ │ ├── barchart.html │ ├── hbarchart.html │ ├── linechart.html │ ├── linechart2.html │ └── piechart.html ├── demo/ │ ├── baidu_map.html │ ├── baidu_map_iframe.html │ ├── combox/ │ │ ├── city_all.html │ │ ├── city_bj.html │ │ └── city_sh.html │ ├── common/ │ │ ├── ajaxDone.json │ │ ├── ajaxDone_loadPage_error.json │ │ ├── ajaxDone_w_list.json │ │ ├── ajaxTimeout.json │ │ └── dwz-team.xls │ ├── database/ │ │ ├── db_attachmentBrightBack.html │ │ ├── db_attachmentLookup.html │ │ ├── db_lookupSuggest.html │ │ ├── db_select.html │ │ ├── db_widget.html │ │ ├── dwzOrgLookup.html │ │ ├── dwzOrgLookup2.html │ │ ├── treeBringBack.html │ │ └── treeLookup.html │ ├── pagination/ │ │ ├── ajaxDone1.html │ │ ├── ajaxDone2.html │ │ ├── ajaxDone3.html │ │ ├── dialog1.html │ │ ├── dialog2.html │ │ ├── layout1.html │ │ ├── layout2.html │ │ ├── list1.html │ │ ├── list2.html │ │ └── list3.html │ ├── row-col.html │ └── sortDrag/ │ ├── 1.html │ ├── 2.html │ └── form.html ├── demo_page1.html ├── demo_page2.html ├── demo_page4.html ├── demo_page5.html ├── demo_page6.html ├── demo_upload.html ├── doc/ │ ├── dwz-user-guide.docx │ └── git.txt ├── donation.html ├── dwz.frag.xml ├── index.html ├── index_menu.html ├── js/ │ ├── dwz.accordion.js │ ├── dwz.ajax.js │ ├── dwz.alertMsg.js │ ├── dwz.barDrag.js │ ├── dwz.checkbox.js │ ├── dwz.combox.js │ ├── dwz.contextmenu.js │ ├── dwz.core.js │ ├── dwz.cssTable.js │ ├── dwz.database.js │ ├── dwz.datepicker.js │ ├── dwz.dialog.js │ ├── dwz.dialogDrag.js │ ├── dwz.drag.js │ ├── dwz.effects.js │ ├── dwz.file.js │ ├── dwz.history.js │ ├── dwz.miscDrag.js │ ├── dwz.navTab.js │ ├── dwz.pagination.js │ ├── dwz.panel.js │ ├── dwz.print.js │ ├── dwz.regional.zh.js │ ├── dwz.resize.js │ ├── dwz.scrollCenter.js │ ├── dwz.selectedLoad.js │ ├── dwz.sortDrag.js │ ├── dwz.stable.js │ ├── dwz.switchEnv.js │ ├── dwz.tab.js │ ├── dwz.taskBar.js │ ├── dwz.theme.js │ ├── dwz.tree.js │ ├── dwz.ui.js │ ├── dwz.util.date.js │ ├── dwz.util.number.js │ ├── dwz.validate.method.js │ ├── jquery-1.12.4.js │ ├── jquery-3.4.1.js │ ├── jquery.bgiframe.js │ ├── jquery.cookie.js │ ├── jquery.easing.1.3.js │ ├── jquery.validate.js │ └── speedup.js ├── login.html ├── login_dialog.html ├── main.html ├── miscDrag.html ├── miscDrag2.html ├── miscDragScreen1.html ├── newPage1.html ├── newPage2.html ├── newPage3.html ├── sidebar_1.html ├── sidebar_2.html ├── tabsPage.html ├── test_print.html ├── themes/ │ ├── azure/ │ │ └── style.css │ ├── css/ │ │ ├── core.css │ │ ├── ieHack.css │ │ ├── login.css │ │ └── print.css │ ├── default/ │ │ └── style.css │ ├── green/ │ │ └── style.css │ ├── miscDrag/ │ │ └── screen.css │ ├── purple/ │ │ └── style.css │ └── silver/ │ └── style.css ├── uploadify/ │ ├── Change Log.txt │ ├── css/ │ │ └── uploadify.css │ └── scripts/ │ ├── jquery.uploadify.js │ └── uploadify.swf ├── validate_remote.html ├── w_accordion.html ├── w_alert.html ├── w_button.html ├── w_checkbox.html ├── w_combox.html ├── w_datepicker.html ├── w_dialog.html ├── w_editor.html ├── w_html5_upload.html ├── w_list.html ├── w_panel.html ├── w_removeSelected.html ├── w_tabs.html ├── w_textInput.html ├── w_tree.html ├── w_uploadify.html ├── w_validation.html ├── window_open.html └── xheditor/ ├── xheditor_emot/ │ ├── default/ │ │ └── config.txt │ ├── ipb/ │ │ └── config.txt │ └── pidgin/ │ └── config.txt ├── xheditor_lang/ │ ├── en.js │ ├── zh-cn.js │ └── zh-tw.js ├── xheditor_plugins/ │ ├── html2markdown.js │ ├── htmldomparser.js │ ├── multiupload/ │ │ ├── multiupload.css │ │ ├── multiupload.html │ │ ├── multiupload.js │ │ └── swfupload/ │ │ ├── swfupload.js │ │ └── swfupload.swf │ ├── showdown.js │ └── ubb.js └── xheditor_skin/ ├── default/ │ ├── iframe.css │ └── ui.css ├── nostyle/ │ ├── iframe.css │ └── ui.css ├── o2007blue/ │ ├── iframe.css │ └── ui.css ├── o2007silver/ │ ├── iframe.css │ └── ui.css └── vista/ ├── iframe.css └── ui.css ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ .idea ================================================ FILE: LICENSE.txt ================================================ jUI遵循Apache2开源协议发布,并提供免费使用。 版权所有Copyright © 2009-2020 by DWZ (http://j-ui.com) All rights reserved。 jUI® 商标和著作权所有者为DWZ团队。 Apache Licence是著名的非盈利开源组织Apache采用的协议。 该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,允许代码修改,再作为开源或商业软件发布。需要满足的条件: 1. 需要给代码的用户一份Apache Licence ; 2. 如果你修改了代码,需要在被修改的文件中说明; 3. 在延伸的代码中(修改和有源代码衍生的代码中)需要带有原来代码中的协议,商标,专利声明和其他原来作者规定需要包含的说明; 4. 如果再发布的产品中包含一个Notice文件,则在Notice文 件中需要带有本协议内容。你可以在Notice中增加自己的许可,但不可以表现为对Apache Licence构成更改。 具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================ FILE: README.md ================================================ > ## 介绍 github源码下载:https://github.com/dwzteam/dwz_jui DWZ富客户端框架(jQuery RIA framework), 是中国人自己开发的基于jQuery实现的Ajax RIA开源框架. DWZ富客户端框架设计目标是简单实用、扩展方便、快速开发、RIA思路、轻量级 DWZ支持用html扩展的方式来代替javascript代码, 基本可以保证程序员不懂javascript, 也能使用各种页面组件和ajax技术. 如果有特定需求也可以扩展DWZ做定制化开化. 国内很多程序员javascript不熟, 大大影响了开发速度. 使用DWZ框架自动邦定javascript效果. 不需要开发人员去关心javascript怎么写, 只要写标准html就可以了. DWZ简单扩展了html标准, 给HTML定义了一些特别的class 和attribute. DWZ框架会找到当前请求结果中的那些特别的class 和attribute, 并自动关联上相应的js处理事件和效果. DWZ基于jQuery可以非常方便的定制特定需求的UI组件, 并以jQuery插件的形式发布. 欢迎大家提出建议, 我们将在下一版本中进一步调整和完善功能。 DWZ富客户端框架完全开源,可以免费获取全部源码。团队中的每个人都是开源的拥护者,都希望为中国软件开源事业尽自己的一份力量。 DWZ官方微博 http://weibo.com/dwzui 在线演示地址 http://jui.org ### 学习DWZ的建议 - 通读DWZ文档,很多新手提的问题文档中都写了 - 看demo每个组件演示效果和代码(留意组件html结构) - 建议安装firebug,用firebug看html结构、CSS和调试JS都非常方便。见附录一 firebug介绍 - 对于初学者不建议看DWZ全部源码,但还是非常有必要看看dwz.ui.js和dwz.ajax.js - 可以从google code下载dwz_thinkphp版本,结合php后台去理解DWZ和服务器端的交互方式 ### DWZ区别于其它JS框架,最大的优点 - 完全开源,源码没有做任何混淆处理,方便扩展 - CSS和js代码彻底分离,修改样式方便 - 简单实用,扩展方便,轻量级框架,快速开发 - 仍然保留了html的页面布局方式 - 支持HTML扩展方式调用UI组件,开发人员不需写js - 只要懂html语法不需精通js,就可以使用ajax开发后台 - 基于jQuery,UI组件以jQuery插件的形式发布,扩展方便 ### 有偿服务 - 公司培训,技术支持,解决使用jUI过程中出现的全部疑难问题 - 定制化开发 ### 联系方式 合作电话:18600055221 技术支持:17767167745 邮箱:support@jui.org DWZ创始人: [北京]杜权(UI设计/制作) d@jui.org [杭州]吴平(Ajax开发) w@jui.org [杭州]张慧华(Ajax开发) z@jui.org 新加入成员: [北京]张涛 QQ:122794105 [北京]冀刚 QQ:63502308 jiweigang2008@tom.com [南京]郑应海 QQ:55691650 [成都]COCO QQ:80095667 官方微博(欢迎加入) http://weibo.com/dwzui jQuery.DWZ-jUI-1群 369203 jQuery.DWZ-jUI-2群 69611933 jQuery.DWZ-jUI-3群 20866231 jQuery.DWZ-jUI-5群 85031937 jQuery.DWZ-jUI-6群 172602882 jQuery.DWZ-jUI-7群 210322217 jQuery.DWZ-jUI-8群 139067378 jQuery.DWZ-jUI-9群 59680552 jQuery.DWZ-jUI-10群 329597326 ### 技术服务微信 ![](./themes/default/images/wx_zhh.jpg?width=200) > ## DWZ 移动端框架 - 在线演示版,使用chrome 开发模式设置手机版:`http://mobile.jui.org` - git源码:`https://gitee.com/dwzteam/dwz_mobile_app` - 在线文档:`http://dwzteam.gitee.io/dwz_mobile_doc_v1` - 安卓 Apk 安装测试版:`http://mobile.jui.org/apk/dwz_mobile_app.apk` ![](./doc/dwz_mobile_app.jpg) ## 捐助 如果您觉得我们的开源软件对你有所帮助,请扫下方二维码打赏我们一杯咖啡。 |支付宝|微信| |:---:|:---:| |![](./themes/default/images/zfb.png?width=200)|![](./themes/default/images/wx.png?width=200)| 版权声明: jUI遵循Apache2开源协议发布,并提供免费使用。 版权所有Copyright © 2009-2020 by DWZ (http://jui.org) All rights reserved。 Apache Licence是著名的非盈利开源组织Apache采用的协议。 该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,允许代码修改,再作为开源或商业软件发布。需要满足的条件: 需要给代码的用户一份Apache Licence 如果你修改了代码,需要在被修改的文件中说明 在延伸的代码中(修改和有源代码衍生的代码中)需要带有原来代码中的协议,商标,专利声明和其他原来作者规定需要包含的说明 如果再发布的产品中包含一个Notice文件,则在Notice文 件中需要带有本协议内容。你可以在Notice中增加自己的许可,但不可以表现为对Apache Licence构成更改 具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOTLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESSFOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THECOPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVERCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICTLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING INANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF SUCH DAMAGE. ================================================ FILE: bin/ESC.wsf ================================================ ----------------------------------------------------------------------------- ESC (ECMAScript Cruncher) * Version : 1.14 * Date : 2006-02-28 22:22:15 [+0100] * License : GNU GPL 2 (http://www.gnu.org/copyleft/gpl.txt) * Copyright (C) 2001-2006 Thomas Loo <tloo@saltstorm.net> --------------------------------------------------------------------------- ESC is an ECMAScript(*) pre-processor enabling an unlimited number of external scripts to be compressed/crunched into tight, bandwidth-optimized packages. ESC supports compressing of external sources only. Trying to process scripts inlined in HTML, ASP, PHP or equivalent pages are NOT recommended with this version of ESC. This feature might be added in a future version. Type "cscript ESC.wsf -help" for usage instructions. ESC is built using components from the Soya Scripting API 1.0.0-b10, a uni-host/cross-browser ECMAScript compliant class-library distributed freely under the terms of the BSD License. The Soya Scripting API, 'lib-soya' and the Soya SDK can be found at http://www.saltstorm.net/ --------------------------------------------------------------------------- * ECMAScript is the international standard for javascript. ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ----------------------------------------------------------------------------- ------------------------------------------------------------------------------ Usage: cscript ESC.wsf -l [0-4] -ow output.js foo.js bar.js C:\scripts\baz... ----------------------------------------------------------------------------- -a [-about] : Description page -c [-copyright] : Copyright/license notice -e [-example] : Examples of usage -h [-help] : This help-screen ----------------------------------------------------------------------------- -l [-level] [01(2)34] : [optional] Set crunch-level (4 sets -$ on) -s [-silent] : [optional] Run silent, nada stdout -v [-verbose] : [optional] Run in verbose mode -$ : [optional] Activate variable-substitution engine ----------------------------------------------------------------------------- -oa <filename> : Target filename for appending -ow <filename> : Target filename for writing -ow STDOUT : Write stream to STDOUT ----------------------------------------------------------------------------- <input-file(s)> : [required] file(s) and/or directories containing scripts to crunch... (paths containing spaces must be quoted) ----------------------------------------------------------------------------- Examples of usage. Crunch 'original1.js','original2.js' and 'original3.js' at level 2 (default) and save the output as 'crunched.js'. Any previous file named 'crunched.js' will be overwritten. X:\cscript ESC.wsf -ow crunched.js original1.js original2.js original3.js --------------------------------------------------------------------------- Grab all scriptfiles (.js) in directory 'C:\script-directory' and crunch them at level 1 (comment and empty line removal only) and append the result to 'crunched.js'. If 'crunched.js' doesn't exist, it will be created. X:\cscript ESC.wsf -l 1 -oa crunched.js C:\script-directory --------------------------------------------------------------------------- Subject 'original1.js' and 'original2.js' for variable substitution, but perform no comment or whitespace removal. Redirect output to STDOUT instead of writing to file. X:\cscript ESC.wsf -l 0 -$ -ow STDOUT original1.js original2.js --------------------------------------------------------------------------- Crunch 'original.js' using variable substitution and remove any occurance of whitespace (where permitted...) and save it as 'crunched.js' (equals -l 3 -$) X:\cscript ESC.wsf -l 4 -ow crunched.js original.js --------------------------------------------------------------------------- Try 'ESC.wsf -help' for information about available run-time directives. ----------------------------------------------------------------------------- ESC must be run from a DOS command prompt under cscript.exe. Do you want to switch host and have ESC bring up a helpscreen ? ESC needs JScript 5.5 or higher to score... You need to update your version of JScript to run ESC. Read the 'Requirements' section in the manual for information how to obtain and install the latest version of Microsofts 'Windows Script' package. Anchor ActiveXObject Call Closure Components Dictionary Document DOMParser Embed EvalError Event Form Global HttpCookie Image JavaArray JavaClass JavaMethod JavaObject JavaPackage Layer MimeType MimeTypeArray Option Url Packages Plugin PluginArray Popup RangeError ReferenceError TypeError StyleClass StyleSelector SyntaxError TypeError WScript URIError XMLHttpRequest XMLSerializer XPathEvaluator XSLTDocument XSLTProcessor Attr CDATASection CharacterData Comment CSS2Properties DOMException DOMImplementation DocumentType Element EntityReference EvalError NamedNodeMap Node NodeList Notation ProcessingInstruction Text HTMLElement HTMLDocument HTMLCollection HTMLHtmlElement HTMLHeadElement HTMLLinkElement HTMLTitleElement HTMLMetaElement HTMLBaseElement HTMLIsIndexElement HTMLStyleElement HTMLBodyElement HTMLFormElement HTMLSelectElement HTMLOptGroupElement HTMLOptionElement HTMLInputElement HTMLTextAreaElement HTMLButtonElement HTMLLabelElement HTMLFieldSetElement HTMLLegendElement HTMLUListElement HTMLOListElement HTMLDListElement HTMLDirectoryElement HTMLMenuElement HTMLLIElement HTMLBlockquoteElement HTMLDivElement HTMLParagraphElement HTMLHeadingElement HTMLQuoteElement HTMLPreElement HTMLBRElement HTMLBaseFontElement HTMLFontElement HTMLHRElement HTMLModElement HTMLAnchorElement HTMLImageElement HTMLObjectElement HTMLParamElement HTMLAppletElement HTMLMapElement HTMLAreaElement HTMLScriptElement HTMLTableElement HTMLTableCaptionElement HTMLTableColElement HTMLTableSectionElement HTMLTableRowElement HTMLTableCellElement HTMLFrameSetElement HTMLFrameElement HTMLIFrameElement _newEnum alert atob attachEvent back btoa captureEvents clearTimeout clearInterval close CollectGarbage confirm createEventObject createPopup decodeURI decodeURIComponent detachEvent dump encodeURI encodeURIComponent escape eval execScript find forward frameElement getAttention GetAttention getClass getComputedStyle getResource GetObject home isFinite isNaN moveBy moveTo open openDialog parseInt parseFloat print prompt releaseEvents resizeBy resizeTo ScriptEngine ScriptEngineMajorVersion ScriptEngineMinorVersion ScriptEngineBuildVersion scroll scrollBy scrollByLines scrollByPages scrollIntoView scrollTo setCursor setInterval setTimeout showHelp showModalDialog showModelessDialog sizeToContent stop taint toString updateCommands unescape untaint valueOf _content appCore arguments arity callee caller clientInformation clipboardData closed constructor controllers crypto debug defaultStatus directories document element event external history forward frames Infinity innerHeight innerWidth java length loading location locationbar name menubar navigator netscape offscreenBuffering opener opera outerHeight outerWidth pageXOffset pageYOffset parent personalbar pkcs11 prompter prototype returnValue screen screenLeft screenTop screenX screenY scrollX scrollY scrollbars self sidebar status statusbar style sun title toolbar top window onafterprint onbeforeprint onbeforeunload onblur onchange onclick onclose onerror onfocus onhelp onload onresize onreset onscroll onselect onunload onmousedown onmouseup onmouseover onmouseout onkeydown onkeyup onkeypress onmousemove onsubmit onreset onchange onselect onclose onabort onerror onpaint ondragdrop Soya BOOTSTRAP abstract break continue const class catch case debugger default double delete do enum extends else function finally float false for get instanceof implements import int in if long null new protected private package public return switch static super set typeof throw true this try undefined void var while with getter setter __defineGetter__ __defineSetter__ end elif cc_on _win32 _win16 _mac _alpha _x86 _mc680x0 _PowerPC _jscript _jscript_build _jscript_version Array Boolean Date Enumerator Error Function Math Number Object RegExp String VBArray ================================================ FILE: bin/gzjs-esc.bat ================================================ cd D:\workspace\UI\dev\dwz_jui\bin REM -------------- start package javascript -------------- type ..\js\dwz.core.js > dwzESC.js type ..\js\dwz.util.date.js >> dwzESC.js type ..\js\dwz.validate.method.js >> dwzESC.js type ..\js\dwz.barDrag.js >> dwzESC.js type ..\js\dwz.drag.js >> dwzESC.js type ..\js\dwz.tree.js >> dwzESC.js type ..\js\dwz.accordion.js >> dwzESC.js type ..\js\dwz.ui.js >> dwzESC.js type ..\js\dwz.theme.js >> dwzESC.js type ..\js\dwz.switchEnv.js >> dwzESC.js type ..\js\dwz.alertMsg.js >> dwzESC.js type ..\js\dwz.contextmenu.js >> dwzESC.js type ..\js\dwz.navTab.js >> dwzESC.js type ..\js\dwz.tab.js >> dwzESC.js type ..\js\dwz.resize.js >> dwzESC.js type ..\js\dwz.dialog.js >> dwzESC.js type ..\js\dwz.dialogDrag.js >> dwzESC.js type ..\js\dwz.sortDrag.js >> dwzESC.js type ..\js\dwz.cssTable.js >> dwzESC.js type ..\js\dwz.stable.js >> dwzESC.js type ..\js\dwz.taskBar.js >> dwzESC.js type ..\js\dwz.ajax.js >> dwzESC.js type ..\js\dwz.pagination.js >> dwzESC.js type ..\js\dwz.database.js >> dwzESC.js type ..\js\dwz.datepicker.js >> dwzESC.js type ..\js\dwz.effects.js >> dwzESC.js type ..\js\dwz.panel.js >> dwzESC.js type ..\js\dwz.checkbox.js >> dwzESC.js type ..\js\dwz.combox.js >> dwzESC.js type ..\js\dwz.history.js >> dwzESC.js type ..\js\dwz.print.js >> dwzESC.js cscript ESC.wsf -l 1 -ow dwzESC1.js dwzESC.js cscript ESC.wsf -l 2 -ow dwzESC2.js dwzESC1.js cscript ESC.wsf -l 3 -ow dwzESC3.js dwzESC2.js type dwzESC2.js > dwz.min.js #gzip -f dwz.min.js #copy dwz.min.js.gz dwz.min.gzjs /y del dwzESC*.js del dwz.min.js.gz ================================================ FILE: bin/gzjs.sh ================================================ # http://tool.chinaz.com/js.aspx # -------------- start package javascript -------------- cat ../js/dwz.core.js > dwz.all.js cat ../js/dwz.util.date.js >> dwz.all.js cat ../js/dwz.validate.method.js >> dwz.all.js cat ../js/dwz.barDrag.js >> dwz.all.js cat ../js/dwz.drag.js >> dwz.all.js cat ../js/dwz.tree.js >> dwz.all.js cat ../js/dwz.accordion.js >> dwz.all.js cat ../js/dwz.ui.js >> dwz.all.js cat ../js/dwz.theme.js >> dwz.all.js cat ../js/dwz.switchEnv.js >> dwz.all.js cat ../js/dwz.alertMsg.js >> dwz.all.js cat ../js/dwz.contextmenu.js >> dwz.all.js cat ../js/dwz.navTab.js >> dwz.all.js cat ../js/dwz.tab.js >> dwz.all.js cat ../js/dwz.resize.js >> dwz.all.js cat ../js/dwz.dialog.js >> dwz.all.js cat ../js/dwz.dialogDrag.js >> dwz.all.js cat ../js/dwz.sortDrag.js >> dwz.all.js cat ../js/dwz.cssTable.js >> dwz.all.js cat ../js/dwz.stable.js >> dwz.all.js cat ../js/dwz.taskBar.js >> dwz.all.js cat ../js/dwz.ajax.js >> dwz.all.js cat ../js/dwz.pagination.js >> dwz.all.js cat ../js/dwz.database.js >> dwz.all.js cat ../js/dwz.selectedLoad.js >> dwz.all.js cat ../js/dwz.datepicker.js >> dwz.all.js cat ../js/dwz.effects.js >> dwz.all.js cat ../js/dwz.panel.js >> dwz.all.js cat ../js/dwz.checkbox.js >> dwz.all.js cat ../js/dwz.combox.js >> dwz.all.js cat ../js/dwz.file.js >> dwz.all.js cat ../js/dwz.history.js >> dwz.all.js cat ../js/dwz.print.js >> dwz.all.js java -jar yuicompressor-2.4.8.jar dwz.all.js -o dwz.min.js --charset utf-8 --type js --nomunge rm -f dwz.all.js # gzip压缩 # gzip -f dwz.all.js # mv dwz.min.js.gz dwz.min.gzjs # -------------- start package css -------------- # cat ../../css/style.css > style.min.css # gzip -f style.min.css # mv style.min.css.gz style.min.gzcss ================================================ FILE: changepwd.html ================================================
查找带回 (suggest+lookup)
================================================ FILE: chart/test/barchart.html ================================================
================================================ FILE: chart/test/hbarchart.html ================================================
================================================ FILE: chart/test/linechart.html ================================================
================================================ FILE: chart/test/linechart2.html ================================================
================================================ FILE: chart/test/piechart.html ================================================
================================================ FILE: demo/baidu_map.html ================================================
================================================ FILE: demo/baidu_map_iframe.html ================================================ 显示/隐藏导航控件
================================================ FILE: demo/combox/city_all.html ================================================ [ ["all", "请选择省份"] ] ================================================ FILE: demo/combox/city_bj.html ================================================ [ ["bj", "北京市"] ] ================================================ FILE: demo/combox/city_sh.html ================================================ [ ["sh", "上海市"] ] ================================================ FILE: demo/common/ajaxDone.json ================================================ { "statusCode":"200", "message":"\u64cd\u4f5c\u6210\u529f", "navTabId":"", "rel":"", "callbackType":"", "forwardUrl":"", "confirmMsg":"" } ================================================ FILE: demo/common/ajaxDone_loadPage_error.json ================================================ { "statusCode":"300", "message":"加载页面验证失败,关闭页面", "navTabId":"", "rel":"", "callbackType":"closeCurrentNavTab", // closeCurrentNavTab, closeCurrentDialog "forwardUrl":"", "confirmMsg":"" } ================================================ FILE: demo/common/ajaxDone_w_list.json ================================================ { "statusCode":"200", "message":"\u64cd\u4f5c\u6210\u529f", "navTabId":"w_list", "rel":"", "callbackType":"closeCurrent", "forwardUrl":"", "confirmMsg":"" } ================================================ FILE: demo/common/ajaxTimeout.json ================================================ { "statusCode":"301", "message":"\u4f1a\u8bdd\u8d85\u65f6\uff0c\u8bf7\u91cd\u65b0\u767b\u5f55\u3002", "navTabId":"", "callbackType":"", "forwardUrl":"" } ================================================ FILE: demo/database/db_attachmentBrightBack.html ================================================ { "id":"1000", "fileName":"测试文件.txt", "attachmentPath":"/upload/测试文件.txt", "attachmentSize":"1024" } ================================================ FILE: demo/database/db_attachmentLookup.html ================================================

请选择需要上传的附件

附件:
================================================ FILE: demo/database/db_lookupSuggest.html ================================================ [ {"id":"1", "orgName":"技术部", "orgNum":"1001"}, {"id":"2", "orgName":"人事部", "orgNum":"1002"}, {"id":"3", "orgName":"销售部", "orgNum":"1003"}, {"id":"4", "orgName":"售后部", "orgNum":"1004"} ] ================================================ FILE: demo/database/db_select.html ================================================ ================================================ FILE: demo/database/db_widget.html ================================================

suggest+lookup

部门名称A1:
查找带回 (suggest+lookup)
部门编号A1:
部门名称A2:
查找带回 (suggest、lookup 联动效果)
部门名称B:
(suggest)
部门名称C:
查找带回 (lookup 通过复选框选择多个值查找回带)
部门编号C:
部门(结尾带下标):
查找带回 需要suffix="[]"属性,下标一般用于主从结构子表
部门(中间带下标):
查找带回 不需要suffix="[]"属性,lookupGroup属性中加上方括号[]
自定义lookupPk:
查找带回 自定义lookup主键,只需添加lookupPk="xxx"属性(lookupPk默认值为id)
附件:
附件 (lookup附件)

主从结构

从字符串 从整数 从浮点 从日期 从日期时间 部门名称 从枚举 从附件 操作
选择 选择 查找带回 查找带回 删除
从字符串 从整数 从浮点 从日期 从日期时间 部门名称 从枚举 从附件 操作
从字符串 从整数 从浮点 从日期 从日期时间 部门名称 从枚举 从附件 操作
================================================ FILE: demo/database/dwzOrgLookup.html ================================================
部门名称 部门编号 部门经理 创建人 查找带回
技术部 1001 administrator administrator 选择
人事部 1002 test administrator 选择
每页 条,共2条
================================================ FILE: demo/database/dwzOrgLookup2.html ================================================
部门名称 部门编号 部门经理 创建人
技术部 1001 leader administrator
人事部 1002 test administrator
人事部 1002 test administrator
每页 条,共2条
================================================ FILE: demo/database/treeBringBack.html ================================================

tree查找带回

城市:
区县:
查找带回
================================================ FILE: demo/database/treeLookup.html ================================================
================================================ FILE: demo/pagination/ajaxDone1.html ================================================ { "statusCode":"200", "message":"\u64cd\u4f5c\u6210\u529f", "navTabId":"pagination", "rel":"", "callbackType":"closeCurrent", "forwardUrl":"", "confirmMsg":"" } ================================================ FILE: demo/pagination/ajaxDone2.html ================================================ { "statusCode":"200", "message":"\u64cd\u4f5c\u6210\u529f", "navTabId":"", "rel":"jbsxBox2", "callbackType":"closeCurrent", "forwardUrl":"", "confirmMsg":"" } ================================================ FILE: demo/pagination/ajaxDone3.html ================================================ { "statusCode":"200", "message":"\u64cd\u4f5c\u6210\u529f", "navTabId":"", "rel":"jbsxBox2", "callbackType":"", "forwardUrl":"", "confirmMsg":"" } ================================================ FILE: demo/pagination/dialog1.html ================================================
================================================ FILE: demo/pagination/dialog2.html ================================================
================================================ FILE: demo/pagination/layout1.html ================================================

病人基本信息

病人编号:
  • 创建病例
病人处方
病人服药情况
基线调查
随访
================================================ FILE: demo/pagination/layout2.html ================================================
================================================ FILE: demo/pagination/list1.html ================================================
序号 诊所编号 诊所名称 病人编号 病人姓名 尿检日期 尿检结果 检验次数
1 bj0001 xxx诊所 xxx 张三 2011-9-6 xxx 1
1 bj0001 xxx诊所 xxx 李四 2011-9-6 xxx 1
1 bj0001 xxx诊所 xxx 张三 2011-9-6 xxx 1
1 bj0001 xxx诊所 xxx 李四 2011-9-6 xxx 1
1 bj0001 xxx诊所 xxx 张三 2011-9-6 xxx 1
1 bj0001 xxx诊所 xxx 李四 2011-9-6 xxx 1
1 bj0001 xxx诊所 xxx 张三 2011-9-6 xxx 1
1 bj0001 xxx诊所 xxx 李四 2011-9-6 xxx 1
1 bj0001 xxx诊所 xxx 张三 2011-9-6 xxx 1
1 bj0001 xxx诊所 xxx 李四 2011-9-6 xxx 1
1 bj0001 xxx诊所 xxx 张三 2011-9-6 xxx 1
1 bj0001 xxx诊所 xxx 李四 2011-9-6 xxx 1
显示 条,共50条
================================================ FILE: demo/pagination/list2.html ================================================
序号 姓名 性别 操作
1 张三 载入右边grid
2 李四 载入右边grid
显示 条,共2条
================================================ FILE: demo/pagination/list3.html ================================================
序号 姓名 性别
1 张三
2 李四
显示 条,共2条
================================================ FILE: demo/row-col.html ================================================

左边容器

拖动浏览器窗口大小,测试页面布局

右边容器

拖动浏览器窗口大小,测试页面布局

TEST Layout

test1

test2

test3
test4
test5
test6
================================================ FILE: demo/sortDrag/1.html ================================================

单个sortDrag示例

A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
A11
A12
A13
A14
A15
A16
A17
A18
A19
A20
================================================ FILE: demo/sortDrag/2.html ================================================

多个sortDrag示例

A1
A2
A3
A4
A5
A6
A7
A8
A9
A10
A11
A12
A13
A14
A15
A16
A17
A18
A19
A20
B1
B2
B3
B4
B5
================================================ FILE: demo/sortDrag/form.html ================================================

可拖动表单示例

客户名称:
性别:
年龄:
电话:
生日:
选择
部门名称:
查找带回
部门编号:
客户状态:
附件:
附件
介绍:
================================================ FILE: demo_page1.html ================================================
客户号 客户名称 客户类型 证件号码 信用等级 所属行业 建档日期
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
天津农信社 A120113196309052434 天津市华建装饰工程有限公司 联社营业部 29385739203816293 5级 政府机构 2009-05-21
显示 条,共${totalCount}条
================================================ FILE: demo_page2.html ================================================
================================================ FILE: demo_page4.html ================================================

查找带回

选择

选择

万元

================================================ FILE: demo_page5.html ================================================
资产总额:
数据来源:
最新修改时间:
最新修改人员:
================================================ FILE: demo_page6.html ================================================
divider
关键字或全称
汉字拼音首字母
完整的客户号
完整的营业执照号、身份证号
完整的号码
关键字或全名
可多选
可多选
可多选
关键字或全称
大于等于,小于等于
全辖查询时用
divider
================================================ FILE: demo_upload.html ================================================

uploadify上传示例

================================================ FILE: doc/git.txt ================================================ #git remote add github https://github.com/dwzteam/dwz_jui.git git remote add github git@github.com:dwzteam/dwz_jui.git git remote add oschina git@git.oschina.net:dwzteam/dwz_jui.git #提交到csdn code git push -u origin master #提交到github git push -u github master #提交到oschina git push -u oschina master git tag -a v1.5.1 -m '升级到jQuery1.11.3' git push origin v1.5.1 git push github v1.5.1 git push oschina v1.5.1 #删除tag git tag -d v1.5.1 git push origin :refs/tags/v1.5.1 github生成SSH公钥 ssh-keygen -t rsa -C "zhanghuihua@sohu.com" ~/.ssh/id_rsa.pub 中内容复制到github #清理git账号 git config --global user.name #检查git链接 ssh -T git@github.com ssh -T git@git.oschina.net ================================================ FILE: donation.html ================================================

每一个访问到这个页面的人,一定也是同样对技术有所追求的人。我们需要您的支持、鼓励,以及对我们所做成果的认可。如果您已经在使用jUI并为您创造了价值,请多多支持jUI吧,有了您的支持jUI才会走的更远更好,谢谢!

感谢大家一直以来的支持和关注推出: DWZ系列视频教程

使用支付钱包或微信扫描二维码。 捐赠时希望能留下姓名QQ号保持联系,谢谢支持!

支付宝扫一扫 微信扫一扫
================================================ FILE: dwz.frag.xml ================================================ <_AJAX_> <_PAGE_ id="dialogFrag">
]]> <_PAGE_ id="dialogProxy">
]]> <_PAGE_ id="taskbar">
]]> <_PAGE_ id="dwzFrag">
数据加载中,请稍等...
]]> <_PAGE_ id="pagination">
  • 首页 首页
  • 上一页
  • #pageNumFrag#
  • 下一页
  • 末页 末页
  • ]]> <_PAGE_ id="alertBoxFrag">

    #title#

    #message#
      #butFragment#
    ]]> <_PAGE_ id="alertButFrag">#butMsg# ]]> <_PAGE_ id="calendarFrag">
    ×
    日期列表选项
    : :
    ]]> <_PAGE_ id="navTabCM">
  • 刷新标签页
  • 关闭标签页
  • 关闭其它标签页
  • 关闭全部标签页
  • ]]> <_PAGE_ id="dialogCM">
  • 关闭弹出窗口
  • 关闭其它弹出窗口
  • 关闭全部弹出窗口
  • ]]> <_PAGE_ id="externalFrag"> ]]> <_MSG_ id="statusCode_503"> <_MSG_ id="validateFormError"> <_MSG_ id="sessionTimout"> <_MSG_ id="alertSelectMsg"> <_MSG_ id="forwardConfirmMsg"> <_MSG_ id="dwzTitle"> <_MSG_ id="mainTabTitle"> ================================================ FILE: index.html ================================================ 简单实用国产jQuery UI框架 - DWZ富客户端框架(J-UI.com)
    ================================================ FILE: index_menu.html ================================================ 简单实用国产jQuery UI框架 - DWZ富客户端框架(J-UI.com)
    ================================================ FILE: js/dwz.accordion.js ================================================ /** * @author Roger Wu */ (function($) { var jmenus = new Map(); // If the DWZ scope is not available, add it $.dwz = $.dwz || {}; $(window).resize(function(){ setTimeout(function(){ for (var i=0; i options.headers.index( clicked[0] ); options.active = clickedActive ? $([]) : clicked; toggle.call(this, toShow, toHide, data, clickedActive, down ); return false; }; function findActive(headers, selector) { return selector != undefined ? typeof selector == "number" ? headers.filter(":eq(" + selector + ")") : headers.not(headers.not(selector)) : selector === false ? $([]) : headers.filter(":eq(0)"); } $.extend($.dwz.accordion, { defaults: { selectedClass: "collapsable", alwaysOpen: true, animated: 'slide', event: "click", header: ".accordionHeader", autoheight: true, running: 0, navigationFilter: function() { return this.href.toLowerCase() == location.href.toLowerCase(); } }, animations: { slide: function(options, additions) { options = $.extend({ easing: "swing", duration: 300 }, options, additions); if ( !options.toHide.length ) { options.toShow.animate({height: "show"}, options); return; } var hideHeight = options.toHide.height(), showHeight = options.toShow.height(), difference = showHeight / hideHeight; options.toShow.css({ height: 0}).show(); options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({height:"hide"},{ step: function(now) { var current = (hideHeight - now) * difference; if (/msie|opera/.test(navigator.userAgent.toLowerCase())) { current = Math.ceil(current); } options.toShow.height( current ); }, duration: options.duration, easing: options.easing, complete: function() { if ( !options.autoheight ) { options.toShow.css({height:"auto"}); } options.toShow.css({overflow:"auto"}); options.complete(); } }); }, bounceslide: function(options) { this.slide(options, { easing: options.down ? "bounceout" : "swing", duration: options.down ? 1000 : 200 }); }, easeslide: function(options) { this.slide(options, { easing: "easeinout", duration: 700 }) } } }); })(jQuery); ================================================ FILE: js/dwz.ajax.js ================================================ /** * @author 张慧华 z@j-ui.com * */ /** * 普通ajax表单提交 * @param {Object} form * @param {Object} callback * @param {String} confirmMsg 提示确认信息 */ function validateCallback(form, callback, confirmMsg) { var $form = $(form); if (!$form.valid()) { return false; } var _submitFn = function(){ $form.find(':focus').blur(); var url = $form.attr("action"); $.ajax({ type: url.endsWith('.json')? 'GET' : form.method || 'POST', url: url, data: $form.serializeArray(), dataType: "json", cache: false, success: callback || DWZ.ajaxDone, error: DWZ.ajaxError }); } if (confirmMsg) { alertMsg.confirm(confirmMsg, {okCall: _submitFn}); } else { _submitFn(); } return false; } /** * 带文件上传的ajax表单提交 * @param {Object} form * @param {Object} callback */ function iframeCallback(form, callback){ var $form = $(form), $iframe = $("#callbackframe"); if(!$form.valid()) {return false;} if ($iframe.length == 0) { $iframe = $('').appendTo('body'); } if(!form.ajax) { $form.append(''); } form.target = 'callbackframe'; $form.find(':focus').blur(); _iframeResponse($iframe[0], callback || DWZ.ajaxDone); } function _iframeResponse(iframe, callback, dataType){ var $iframe = $(iframe), $document = $(document); $document.trigger("ajaxStart"); $iframe.bind("load", function(event){ $iframe.unbind("load"); $document.trigger("ajaxStop"); if (iframe.src == "javascript:'%3Chtml%3E%3C/html%3E';" || // For Safari iframe.src == "javascript:'';") { // For FF, IE return; } var doc = iframe.contentDocument || iframe.document; // fixing Opera 9.26,10.00 if (doc.readyState && doc.readyState != 'complete') return; // fixing Opera 9.64 if (doc.body && doc.body.innerHTML == "false") return; var response; if (doc.XMLDocument) { // response is a xml document Internet Explorer property response = doc.XMLDocument; } else if (doc.body){ try{ if (dataType == 'html') { response = $iframe.contents().find("body").html(); } else { response = $iframe.contents().find("body").text(); response = jQuery.parseJSON(response); } } catch (e){ // response is html document or plain text response = doc.body.innerHTML; } } else { // response is a xml document response = doc; } callback(response); }); } /** * navTabAjaxDone是DWZ框架中预定义的表单提交回调函数. * 服务器转回navTabId可以把那个navTab标记为reloadFlag=1, 下次切换到那个navTab时会重新载入内容. * callbackType如果是closeCurrent就会关闭当前tab * 只有callbackType="forward"时需要forwardUrl值 * navTabAjaxDone这个回调函数基本可以通用了,如果还有特殊需要也可以自定义回调函数. * 如果表单提交只提示操作是否成功, 就可以不指定回调函数. 框架会默认调用DWZ.ajaxDone() *
    * * form提交后返回json数据结构statusCode=DWZ.statusCode.ok表示操作成功, 做页面跳转等操作. statusCode=DWZ.statusCode.error表示操作失败, 提示错误原因. * statusCode=DWZ.statusCode.timeout表示session超时,下次点击时跳转到DWZ.loginUrl * {"statusCode":"200", "message":"操作成功", "navTabId":"navNewsLi", "forwardUrl":"", "callbackType":"closeCurrent", "rel"."xxxId"} * {"statusCode":"300", "message":"操作失败"} * {"statusCode":"301", "message":"会话超时"} * */ function navTabAjaxDone(json){ DWZ.ajaxDone(json); if (json[DWZ.keys.statusCode] == DWZ.statusCode.ok){ if (json.navTabId){ //把指定navTab页面标记为需要“重新载入”。注意navTabId不能是当前navTab页面的 navTab.reloadFlag(json.navTabId); } else { //重新载入当前navTab页面 var $pagerForm = $("#pagerForm", navTab.getCurrentPanel()); var args = $pagerForm.length>0 ? $pagerForm.serializeArray() : {} navTabPageBreak(args, json.rel); } if ("closeCurrent" == json.callbackType) { setTimeout(function(){navTab.closeCurrentTab(json.navTabId);}, 100); } else if ("forward" == json.callbackType) { navTab.reload(json.forwardUrl); } else if ("forwardConfirm" == json.callbackType) { alertMsg.confirm(json.confirmMsg || DWZ.msg("forwardConfirmMsg"), { okCall: function(){ navTab.reload(json.forwardUrl); }, cancelCall: function(){ navTab.closeCurrentTab(json.navTabId); } }); } else { navTab.getCurrentPanel().find(":input[initValue]").each(function(){ var initVal = $(this).attr("initValue"); $(this).val(initVal); }); } } } /** * dialog上的表单提交回调函数 * 当前navTab页面有pagerForm就重新加载 * 服务器转回navTabId,可以重新载入指定的navTab. statusCode=DWZ.statusCode.ok表示操作成功, 自动关闭当前dialog * * form提交后返回json数据结构,json格式和navTabAjaxDone一致 */ function dialogAjaxDone(json){ DWZ.ajaxDone(json); if (json[DWZ.keys.statusCode] == DWZ.statusCode.ok){ if (json.navTabId){ navTab.reload(json.forwardUrl, {navTabId: json.navTabId}); } else { var $pagerForm = $("#pagerForm", navTab.getCurrentPanel()); var args = $pagerForm.length>0 ? $pagerForm.serializeArray() : {} navTabPageBreak(args, json.rel); } if ("closeCurrent" == json.callbackType) { $.pdialog.closeCurrent(); } } } /** * 处理navTab上的查询, 会重新载入当前navTab * @param {Object} form */ function navTabSearch(form, navTabId){ var $form = $(form); if (form[DWZ.pageInfo.pageNum]) form[DWZ.pageInfo.pageNum].value = 1; navTab.reload($form.attr('action'), {data: $form.serializeArray(), navTabId:navTabId}); return false; } /** * 处理dialog弹出层上的查询, 会重新载入当前dialog * @param {Object} form */ function dialogSearch(form){ var $form = $(form); if (form[DWZ.pageInfo.pageNum]) form[DWZ.pageInfo.pageNum].value = 1; $.pdialog.reload($form.attr('action'), {data: $form.serializeArray()}); return false; } function dwzSearch(form, targetType){ if (targetType == "dialog") dialogSearch(form); else navTabSearch(form); return false; } /** * 处理div上的局部查询, 会重新载入指定div * @param {Object} form */ function divSearch(form, rel){ var $form = $(form); if (form[DWZ.pageInfo.pageNum]) form[DWZ.pageInfo.pageNum].value = 1; if (rel) { var $box = $("#" + rel); $box.ajaxUrl({ type:"POST", url:$form.attr("action"), data: $form.serializeArray(), callback:function(){ $box.find("[layoutH]").layoutH(); } }); } return false; } /** * * @param {Object} args {pageNum:"",numPerPage:"",orderField:"",orderDirection:""} * @param String formId 分页表单选择器,非必填项默认值是 "pagerForm" */ function _getPagerForm($parent, args) { var form = $("#pagerForm", $parent).get(0); if (form) { if (args["pageNum"]) form[DWZ.pageInfo.pageNum].value = args["pageNum"]; if (args["numPerPage"]) form[DWZ.pageInfo.numPerPage].value = args["numPerPage"]; if (args["orderField"]) form[DWZ.pageInfo.orderField].value = args["orderField"]; if (args["orderDirection"] && form[DWZ.pageInfo.orderDirection]) form[DWZ.pageInfo.orderDirection].value = args["orderDirection"]; } return form; } /** * 处理navTab中的分页和排序 * targetType: navTab 或 dialog * rel: 可选 用于局部刷新div id号 * data: pagerForm参数 {pageNum:"n", numPerPage:"n", orderField:"xxx", orderDirection:""} * callback: 加载完成回调函数 */ function dwzPageBreak(options){ var op = $.extend({ targetType:"navTab", rel:"", data:{pageNum:"", numPerPage:"", orderField:"", orderDirection:""}, callback:null}, options); var $parent = op.targetType == "dialog" ? $.pdialog.getCurrent() : navTab.getCurrentPanel(); if (op.rel) { var $box = $parent.find("#" + op.rel); var form = _getPagerForm($box, op.data); if (form) { $box.ajaxUrl({ type:"POST", url:$(form).attr("action"), data: $(form).serializeArray(), callback:function(){ $box.find("[layoutH]").layoutH(); } }); } } else { var form = _getPagerForm($parent, op.data); var params = $(form).serializeArray(); if (op.targetType == "dialog") { if (form) $.pdialog.reload($(form).attr("action"), {data: params, callback: op.callback}); } else { if (form) navTab.reload($(form).attr("action"), {data: params, callback: op.callback}); } } } /** * 处理navTab中的分页和排序 * @param args {pageNum:"n", numPerPage:"n", orderField:"xxx", orderDirection:""} * @param rel: 可选 用于局部刷新div id号 */ function navTabPageBreak(args, rel){ dwzPageBreak({targetType:"navTab", rel:rel, data:args}); } /** * 处理dialog中的分页和排序 * 参数同 navTabPageBreak */ function dialogPageBreak(args, rel){ dwzPageBreak({targetType:"dialog", rel:rel, data:args}); } function ajaxTodo(url, callback){ var $callback = callback || navTabAjaxDone; if (! $.isFunction($callback)) $callback = eval('(' + callback + ')'); $.ajax({ type:'POST', url:url, dataType:"json", cache: false, success: $callback, error: DWZ.ajaxError }); } /** * http://www.uploadify.com/documentation/uploadify/onqueuecomplete/ */ function uploadifyQueueComplete(queueData){ var msg = "The total number of files uploaded: "+queueData.uploadsSuccessful+"
    " + "The total number of errors while uploading: "+queueData.uploadsErrored+"
    " + "The total number of bytes uploaded: "+queueData.queueBytesUploaded+"
    " + "The average speed of all uploaded files: "+queueData.averageSpeed; if (queueData.uploadsErrored) { alertMsg.error(msg); } else { alertMsg.correct(msg); } } /** * http://www.uploadify.com/documentation/uploadify/onuploadsuccess/ */ function uploadifySuccess(file, data, response){ alert(data) } /** * http://www.uploadify.com/documentation/uploadify/onuploaderror/ */ function uploadifyError(file, errorCode, errorMsg) { alertMsg.error(errorCode+": "+errorMsg); } /** * http://www.uploadify.com/documentation/ * @param {Object} event * @param {Object} queueID * @param {Object} fileObj * @param {Object} errorObj */ function uploadifyError(event, queueId, fileObj, errorObj){ alert("event:" + event + "\nqueueId:" + queueId + "\nfileObj.name:" + fileObj.name + "\nerrorObj.type:" + errorObj.type + "\nerrorObj.info:" + errorObj.info); } DWZ.pargerFormExport = function (url, $form) { if ($form.length == 0) { window.location = url; return; } var $iframe = $("#callbackframe"); if ($iframe.length == 0) { $iframe = $("").appendTo("body"); } var pagerFormUrl = $form[0].action, pagerFormOnSubmit = $form.attr('onsubmit'); $form[0].action = url; $form[0].target = "callbackframe"; $form.removeAttr('onsubmit'); $form.submit(); $form[0].action = pagerFormUrl; $form.attr('onsubmit', pagerFormOnSubmit); }; $.fn.extend({ ajaxTodo:function(){ return this.each(function(){ var $this = $(this); $this.click(function(event){ if ($this.hasClass('disabled') || $this.hasClass('buttonDisabled')) { return false; } var url = unescape($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first")); DWZ.debug(url); if (!url.isFinishedTm()) { alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg")); return false; } var title = $this.attr("title"); if (title) { alertMsg.confirm(title, { okCall: function(){ ajaxTodo(url, $this.attr("callback")); } }); } else { ajaxTodo(url, $this.attr("callback")); } event.preventDefault(); }); }); }, dwzExport: function(){ function _doExport($this) { var $p = $this.attr("targetType") == "dialog" ? $.pdialog.getCurrent() : navTab.getCurrentPanel(); var $form = $("#pagerForm", $p); var url = $this.attr("href"); DWZ.pargerFormExport(url, $form); } return this.each(function(){ var $this = $(this); $this.click(function(event){ if ($this.hasClass('disabled') || $this.hasClass('buttonDisabled')) { return false; } var title = $this.attr("title"); if (title) { alertMsg.confirm(title, { okCall: function(){_doExport($this);} }); } else {_doExport($this);} event.preventDefault(); }); }); } }); /** * The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding. * iframe模拟ajax load, 解决GBK页面ajax load乱码问题 * * @param url * @param callback */ $.iframeLoad = function(url, callback) { var $form = $('
    ').appendTo('body'), $iframe = $("#callbackframe"); if ($iframe.length == 0) { $iframe = $('').appendTo('body'); } _iframeResponse($iframe[0], function(response) { $form.remove(); if (callback) callback.call($iframe, response); }, 'html'); $form.submit(); }; $.fn.iframeLoad = function(url, callback) { return this.each(function(){ var $box = $(this); $.iframeLoad(url, function(response){ $box.html(response).initUI(); if (callback) callback.call($box, response); }); }); }; ================================================ FILE: js/dwz.alertMsg.js ================================================ /** * @author 张慧华 z@j-ui.com */ $.setRegional("alertMsg", { title:{error:"Error", info:"Information", warn:"Warning", correct:"Successful", confirm:"Confirmation"}, butMsg:{ok:"OK", yes:"Yes", no:"No", cancel:"Cancel"} }); var alertMsg = { _boxId: "#alertMsgBox", _bgId: "#alertBackground", _closeTimer: null, types: {error:"error", info:"info", warn:"warn", correct:"correct", confirm:"confirm"}, _getTitle: function(key){ return $.regional.alertMsg.title[key]; }, _keydownOk: function(event){ if (event.keyCode == DWZ.keyCode.ENTER) event.data.target.trigger("click"); return false; }, _keydownEsc: function(event){ if (event.keyCode == DWZ.keyCode.ESC) event.data.target.trigger("click"); }, /** * * @param {Object} type * @param {Object} msg * @param {Object} buttons [button1, button2] */ open: function(type, msg, buttons){ $(this._boxId).remove(); var butsHtml = ""; if (buttons) { for (var i = 0; i < buttons.length; i++) { var sRel = buttons[i].call ? "callback" : ""; butsHtml += DWZ.frag["alertButFrag"].replace("#butMsg#", buttons[i].name).replace("#callback#", sRel); } } var boxHtml = DWZ.frag["alertBoxFrag"].replace("#type#", type).replace("#title#", this._getTitle(type)).replace("#message#", msg).replace("#butFragment#", butsHtml); $(boxHtml).appendTo("body").css({top:-$(this._boxId).height()+"px"}).animate({top:"0px"}, 500); if (this._closeTimer) { clearTimeout(this._closeTimer); this._closeTimer = null; } if (this.types.info == type || this.types.correct == type){ this._closeTimer = setTimeout(function(){alertMsg.close()}, 3500); } else { $(this._bgId).show(); } var jButs = $(this._boxId).find("a.button"); var jCallButs = jButs.filter("[rel=callback]"); var jDoc = $(document); for (var i = 0; i < buttons.length; i++) { if (buttons[i].call) jCallButs.eq(i).click(buttons[i].call); if (buttons[i].keyCode == DWZ.keyCode.ENTER) { jDoc.bind("keydown",{target:jButs.eq(i)}, this._keydownOk); } if (buttons[i].keyCode == DWZ.keyCode.ESC) { jDoc.bind("keydown",{target:jButs.eq(i)}, this._keydownEsc); } } }, close: function(){ $(document).unbind("keydown", this._keydownOk).unbind("keydown", this._keydownEsc); $(this._boxId).animate({top:-$(this._boxId).height()}, 500, function(){ $(this).remove(); }); $(this._bgId).hide(); }, error: function(msg, options) { this._alert(this.types.error, msg, options); }, info: function(msg, options) { this._alert(this.types.info, msg, options); }, warn: function(msg, options) { this._alert(this.types.warn, msg, options); }, correct: function(msg, options) { this._alert(this.types.correct, msg, options); }, _alert: function(type, msg, options) { var op = {okName:$.regional.alertMsg.butMsg.ok, okCall:null}; $.extend(op, options); var buttons = [ {name:op.okName, call: op.okCall, keyCode:DWZ.keyCode.ENTER} ]; this.open(type, msg, buttons); }, /** * * @param {Object} msg * @param {Object} options {okName, okCal, cancelName, cancelCall} */ confirm: function(msg, options) { var op = {okName:$.regional.alertMsg.butMsg.ok, okCall:null, cancelName:$.regional.alertMsg.butMsg.cancel, cancelCall:null}; $.extend(op, options); var buttons = [ {name:op.okName, call: op.okCall, keyCode:DWZ.keyCode.ENTER}, {name:op.cancelName, call: op.cancelCall, keyCode:DWZ.keyCode.ESC} ]; this.open(this.types.confirm, msg, buttons); } }; ================================================ FILE: js/dwz.barDrag.js ================================================ /** * @author Roger Wu * @version 1.0 */ (function($){ $.fn.cssv = function(pre){ var cssPre = $(this).css(pre); return cssPre.substring(0, cssPre.indexOf("px")) * 1; }; $.fn.jBar = function(options){ var op = $.extend({container:"#container", collapse:".collapse", toggleBut:".toggleCollapse div", sideBar:"#sidebar", sideBar2:"#sidebar_s", splitBar:"#splitBar", splitBar2:"#splitBarProxy"}, options); return this.each(function(){ var jbar = this; var sbar = $(op.sideBar2, jbar); var bar = $(op.sideBar, jbar); $(op.toggleBut, bar).click(function(){ DWZ.ui.sbar = false; $(op.splitBar).hide(); var sbarwidth = sbar.cssv("left") + sbar.outerWidth(); var barleft = sbarwidth - bar.outerWidth(); var cleft = $(op.container).cssv("left") - (bar.outerWidth() - sbar.outerWidth()); var cwidth = bar.outerWidth() - sbar.outerWidth() + $(op.container).outerWidth(); $(op.container).animate({left: cleft,width: cwidth},50,function(){ bar.animate({left: barleft}, 500, function(){ bar.hide(); sbar.show().css("left", -50).animate({left: 5}, 200); $(window).trigger(DWZ.eventType.resizeGrid); }); }); $(op.collapse,sbar).click(function(){ var sbarwidth = sbar.cssv("left") + sbar.outerWidth(); if(bar.is(":hidden")) { $(op.toggleBut, bar).hide(); bar.show().animate({left: sbarwidth}, 500); $(op.container).click(_hideBar); } else { bar.animate({left: barleft}, 500, function(){ bar.hide(); }); } function _hideBar() { $(op.container).unbind("click", _hideBar); if (!DWZ.ui.sbar) { bar.animate({left: barleft}, 500, function(){ bar.hide(); }); } } return false; }); return false; }); $(op.toggleBut, sbar).click(function(){ DWZ.ui.sbar = true; sbar.animate({left: -25}, 200, function(){ bar.show(); }); bar.animate({left: 5}, 800, function(){ $(op.splitBar).show(); $(op.toggleBut, bar).show(); var cleft = 5 + bar.outerWidth() + $(op.splitBar).outerWidth(); var cwidth = $(op.container).outerWidth() - (cleft - $(op.container).cssv("left")); $(op.container).css({left: cleft,width: cwidth}); $(op.collapse, sbar).unbind('click'); $(window).trigger(DWZ.eventType.resizeGrid); }); return false; }); $(op.splitBar).mousedown(function(event){ $(op.splitBar2).each(function(){ var spbar2 = $(this); setTimeout(function(){spbar2.show();}, 100); spbar2.css({visibility: "visible",left: $(op.splitBar).css("left")}); spbar2.jDrag($.extend(options, {obj:$("#sidebar"), move:"horizontal", event:event,stop: function(){ $(this).css("visibility", "hidden"); var move = $(this).cssv("left") - $(op.splitBar).cssv("left"); var sbarwidth = bar.outerWidth() + move; var cleft = $(op.container).cssv("left") + move; var cwidth = $(op.container).outerWidth() - move; bar.css("width", sbarwidth); $(op.splitBar).css("left", $(this).css("left")); $(op.container).css({left: cleft,width: cwidth}); }})); return false; }); }); }); } })(jQuery); ================================================ FILE: js/dwz.checkbox.js ================================================ /** * @author 张慧华 z@j-ui.com */ (function($){ $.fn.extend({ checkboxCtrl: function(parent){ return this.each(function(){ var $trigger = $(this); $trigger.click(function(){ var group = $trigger.attr("group"); if ($trigger.is(":checkbox")) { var type = $trigger.is(":checked") ? "all" : "none"; if (group) $.checkbox.select(group, type, parent); } else { if (group) $.checkbox.select(group, $trigger.attr("selectType") || "all", parent); } }); }); } }); $.checkbox = { selectAll: function(_name, _parent){ this.select(_name, "all", _parent); }, unSelectAll: function(_name, _parent){ this.select(_name, "none", _parent); }, selectInvert: function(_name, _parent){ this.select(_name, "invert", _parent); }, select: function(_name, _type, _parent){ var $parent = $(_parent || document), $checkboxLi = $parent.find(":checkbox[name='"+_name+"']"); switch(_type){ case "invert": $checkboxLi.each(function(){ this.checked = !this.checked; }); break; case "none": $checkboxLi.prop('checked', false); break; default: $checkboxLi.prop('checked', true); break; } $checkboxLi.trigger('change'); } }; })(jQuery); ================================================ FILE: js/dwz.combox.js ================================================ /** * @author Roger Wu */ (function($){ var allSelectBox = []; var killAllBox = function(bid){ $.each(allSelectBox, function(i){ if (allSelectBox[i] != bid) { if (!$("#" + allSelectBox[i])[0]) { $("#op_" + allSelectBox[i]).remove(); //allSelectBox.splice(i,1); } else { $("#op_" + allSelectBox[i]).css({ height: "", width: "" }).hide(); } $(document).unbind("click", killAllBox); } }); }; var _onchange = function(event){ var $ref = $("#"+event.data.ref); if ($ref.length == 0) return false; $.ajax({ type:'POST', dataType:"json", url:event.data.refUrl.replace("{value}", encodeURIComponent(event.data.$this.val())), cache: false, data:{}, success: function(json){ _comboxRefresh($ref, json); }, error: DWZ.ajaxError }); }; var _comboxRefresh = function($select, json){ if (!json) return; var html = ''; $.each(json, function(i){ if (json[i] && json[i].length > 1){ html += ''; } }); var $refCombox = $select.parents("div.combox:first"); $select.html(html).insertAfter($refCombox); $refCombox.remove(); $select.trigger("change").combox(); }; var _comboxReset = function($select){ var $box = $select.parents('div.select:first'), defaultValue = $box.find('>a').attr('default-value'); $('#op_'+$box.attr('id')).find('>li a[value="'+defaultValue+'"]').trigger('click'); }; $.extend($.fn, { comboxSelect: function(options){ var op = $.extend({ selector: ">a" }, options); return this.each(function(){ var box = $(this); var selector = $(op.selector, box); allSelectBox.push(box.attr("id")); $(op.selector, box).click(function(){ if (! box.hasClass('disabled')) { var options = $("#op_"+box.attr("id")); if (options.is(":hidden")) { if(options.height() > 300) { options.css({height:"300px",overflow:"scroll"}); } var top = box.offset().top+box[0].offsetHeight-50; if(top + options.height() > $(window).height() - 20) { top = $(window).height() - 20 - options.height(); } options.css({top:top,left:box.offset().left}).show(); killAllBox(box.attr("id")); $(document).click(killAllBox); } else { $(document).unbind("click", killAllBox); killAllBox(); } } return false; }); $("#op_"+box.attr("id")).find(">li").comboxOption(selector, box); }); }, comboxOption: function(selector, box){ return this.each(function(){ $(">a", this).click(function(){ var $this = $(this); $this.parent().parent().find(".selected").removeClass("selected"); $this.addClass("selected"); selector.text($this.text()); var $input = $("select", box); if ($input.val() != $this.attr("value")) { $("select", box).val($this.attr("value")).trigger("change"); } }); }); }, combox:function(){ /* 清理下拉层 */ var _selectBox = []; $.each(allSelectBox, function(i){ if ($("#" + allSelectBox[i])[0]) { _selectBox.push(allSelectBox[i]); } else { $("#op_" + allSelectBox[i]).remove(); } }); allSelectBox = _selectBox; return this.each(function(i){ var $this = $(this).hide(); var name = $this.attr("name"); var value= $this.val(); var label = $('option[value="' + value + '"]',$this).text(); var ref = $this.attr("ref"); var refUrl = $this.attr('refUrl') || ''; var resetValue = $this.attr('reset-value') !== undefined ? $this.attr('reset-value') : value var cid = $this.attr("id") || Math.round(Math.random()*10000000); var select = '
    '; select += '' + label +'
    '; var options = '"; $("body").append(options); $this.after(select); $("div.select", $this.next()).comboxSelect().append($this); if (ref && refUrl) { $this.unbind("change", _onchange).bind("change", {ref:ref, refUrl:refUrl, $this:$this}, _onchange); } }); }, // combox 刷新全部 option 项 comboxRefresh: function(json){ return this.each(function(){ var $select = $(this); _comboxRefresh($select, json); }); }, // combox reset还原初始值 comboxReset: function(){ return this.each(function(){ var $select = $(this); _comboxReset($select); }); }, comboxDisable: function(){ return this.each(function(){ $(this).parents('.combox .select:first').addClass('disabled'); }); }, comboxEnable: function(){ return this.each(function(){ $(this).parents('.combox .select:first').removeClass('disabled'); }); }, comboxVal: function(val){ return this.each(function(){ var $box = $(this).parents('.combox .select:first'); $('#op_'+$box.attr('id')).find('>li a[value="'+val+'"]').trigger('click'); }); } }); })(jQuery); ================================================ FILE: js/dwz.contextmenu.js ================================================ /** * @author 张慧华 z@j-ui.com */ (function($){ var menu, shadow, hash; $.fn.extend({ contextMenu: function(id, options){ var op = $.extend({ shadow : true, bindings:{}, ctrSub:null }, options ); if (!menu) { menu = $('
    ').appendTo('body').hide(); } if (!shadow) { shadow = $('
    ').appendTo('body').hide(); } hash = hash || []; hash.push({ id : id, shadow: op.shadow, bindings: op.bindings || {}, ctrSub: op.ctrSub }); var index = hash.length - 1; $(this).bind('contextmenu', function(e) { display(index, this, e, op); return false; }); return this; } }); function display(index, trigger, e, options) { var cur = hash[index]; var content = $(DWZ.frag[cur.id]); content.find('li').hoverClass(); // Send the content to the menu menu.html(content); $.each(cur.bindings, function(id, func) { $("[rel='"+id+"']", menu).bind('click', function(e) { hide(); func($(trigger), $("#"+cur.id)); }); }); var posX = e.pageX; var posY = e.pageY; if ($(window).width() < posX + menu.width()) posX -= menu.width(); if ($(window).height() < posY + menu.height()) posY -= menu.height(); menu.css({'left':posX,'top':posY}).show(); if (cur.shadow) shadow.css({width:menu.width(),height:menu.height(),left:posX+3,top:posY+3}).show(); $(document).one('click', hide); if ($.isFunction(cur.ctrSub)) {cur.ctrSub($(trigger), $("#"+cur.id));} } function hide() { menu.hide(); shadow.hide(); } })(jQuery); ================================================ FILE: js/dwz.core.js ================================================ /** * @author 张慧华 z@j-ui.com * */ var DWZ = { version: '1.6.2', regPlugins: [], // [function($parent){} ...] // sbar: show sidebar keyCode: { ENTER: 13, ESC: 27, END: 35, HOME: 36, SHIFT: 16, TAB: 9, LEFT: 37, RIGHT: 39, UP: 38, DOWN: 40, DELETE: 46, BACKSPACE:8 }, eventType: { pageClear:"pageClear", // 用于重新ajaxLoad、关闭nabTab, 关闭dialog时,去除xheditor等需要特殊处理的资源 resizeGrid:"resizeGrid", // 用于窗口或dialog大小调整 initEnvAfter: "initEnvAfter" // initEnv完成出发 }, isOverAxis: function(x, reference, size) { //Determines when x coordinate is over "b" element axis return (x > reference) && (x < (reference + size)); }, isOver: function(y, x, top, left, height, width) { //Determines when x, y coordinates is over "b" element return this.isOverAxis(y, top, height) && this.isOverAxis(x, left, width); }, pageInfo: {pageNum:"pageNum", numPerPage:"numPerPage", orderField:"orderField", orderDirection:"orderDirection"}, statusCode: {ok:200, error:300, timeout:301}, keys: {statusCode:"statusCode", message:"message"}, ui:{ sbar:true, hideMode:'display' //navTab组件切换的隐藏方式,支持的值有’display’,’offsets’负数偏移位置的值,默认值为’display’ }, frag:{}, //page fragment _msg:{}, //alert message _set:{ loginUrl:"", //session timeout loginTitle:"", //if loginTitle open a login dialog debug:false }, msg:function(key, args){ var _format = function(str,args) { args = args || []; var result = str || ""; for (var i = 0; i < args.length; i++){ result = result.replace(new RegExp("\\{" + i + "\\}", "g"), args[i]); } return result; } return _format(this._msg[key], args); }, debug:function(msg){ if (this._set.debug) { if (typeof(console) != "undefined") console.log(msg); else alert(msg); } }, loadLogin:function(){ if ($.pdialog && DWZ._set.loginTitle) { $.pdialog.open(DWZ._set.loginUrl, "login", DWZ._set.loginTitle, {mask:true,width:520,height:260}); } else { window.location = DWZ._set.loginUrl; } }, /* * json to string */ obj2str:function(o) { var r = []; if(typeof o =="string") return "\""+o.replace(/([\'\"\\])/g,"\\$1").replace(/(\n)/g,"\\n").replace(/(\r)/g,"\\r").replace(/(\t)/g,"\\t")+"\""; if(typeof o == "object"){ if(!o.sort){ for(var i in o) r.push(i+":"+DWZ.obj2str(o[i])); if(!!document.all && !/^\n?function\s*toString\(\)\s*\{\n?\s*\[native code\]\n?\s*\}\n?\s*$/.test(o.toString)){ r.push("toString:"+o.toString.toString()); } r="{"+r.join()+"}" }else{ for(var i =0;i]*>([\s\S]*)<\/body>/.exec(content); if(result && result.length === 2) return result[1]; return content; }, ajaxError:function(xhr, ajaxOptions, thrownError){ if (alertMsg) { alertMsg.error("
    Http status: " + xhr.status + " " + xhr.statusText + "
    " + "
    ajaxOptions: "+ajaxOptions + "
    " + "
    thrownError: "+thrownError + "
    " + "
    "+DWZ.getHtmlBody(xhr.responseText)+"
    "); } else { alert("Http status: " + xhr.status + " " + xhr.statusText + "\najaxOptions: " + ajaxOptions + "\nthrownError:"+thrownError + "\n" +xhr.responseText); } }, ajaxDone:function(json){ if(json[DWZ.keys.statusCode] == DWZ.statusCode.error) { if(json[DWZ.keys.message] && alertMsg) alertMsg.error(json[DWZ.keys.message]); } else if (json[DWZ.keys.statusCode] == DWZ.statusCode.timeout) { if(alertMsg) alertMsg.error(json[DWZ.keys.message] || DWZ.msg("sessionTimout"), {okCall:DWZ.loadLogin}); else DWZ.loadLogin(); } else if (json[DWZ.keys.statusCode] == DWZ.statusCode.ok){ if(json[DWZ.keys.message] && alertMsg) alertMsg.correct(json[DWZ.keys.message]); }; }, init:function(pageFrag, options){ var op = $.extend({ loginUrl:"login.html", loginTitle:null, callback:null, debug:false, statusCode:{}, keys:{} }, options); this._set.loginUrl = op.loginUrl; this._set.loginTitle = op.loginTitle; this._set.debug = op.debug; $.extend(DWZ.statusCode, op.statusCode); $.extend(DWZ.keys, op.keys); $.extend(DWZ.pageInfo, op.pageInfo); $.extend(DWZ.ui, op.ui); jQuery.ajax({ type:'GET', url:pageFrag, dataType:'xml', timeout: 50000, cache: false, error: function(xhr){ alert('Error loading XML document: ' + pageFrag + "\nHttp status: " + xhr.status + " " + xhr.statusText); }, success: function(xml){ $(xml).find("_PAGE_").each(function(){ var pageId = $(this).attr("id"); if (pageId) DWZ.frag[pageId] = $(this).text(); }); $(xml).find("_MSG_").each(function(){ var id = $(this).attr("id"); if (id) DWZ._msg[id] = $(this).text(); }); if (jQuery.isFunction(op.callback)) op.callback(); } }); var _doc = $(document); if (!_doc.isBind(DWZ.eventType.pageClear)) { _doc.bind(DWZ.eventType.pageClear, function(event){ var box = event.target; if ($.fn.xheditor) { $("textarea.editor", box).xheditor(false); } if (window.UE && UE.getEditor) { $('div.edui-editor', box).each(function(){ var editorId = $(this).parent().attr('id'); UE.getEditor(editorId).destroy(); }); } }); } } }; (function($){ // DWZ set regional $.setRegional = function(key, value){ if (!$.regional) $.regional = {}; $.regional[key] = value; }; $.fn.extend({ /** * @param {Object} op: {type:GET/POST, url:ajax请求地址, data:ajax请求参数列表, callback:回调函数 } */ ajaxUrl: function(op){ var $this = $(this); $this.trigger(DWZ.eventType.pageClear); $.ajax({ type: op.type || 'GET', url: op.url, data: op.data, cache: false, success: function(response){ var json = DWZ.jsonEval(response); if (json[DWZ.keys.statusCode]==DWZ.statusCode.error){ if ($.pdialog) $.pdialog.checkCloseCurrent(json); if (navTab) navTab.checkCloseCurrent(json); if (json[DWZ.keys.message]) alertMsg.error(json[DWZ.keys.message]); } else { $this.html(response).initUI(); if ($.isFunction(op.callback)) op.callback(response); } if (json[DWZ.keys.statusCode]==DWZ.statusCode.timeout){ if ($.pdialog) $.pdialog.checkCloseCurrent(json); if (navTab) navTab.checkCloseCurrent(json); alertMsg.error(json[DWZ.keys.message] || DWZ.msg("sessionTimout"), {okCall:function(){ DWZ.loadLogin(); }}); } }, error: DWZ.ajaxError, statusCode: { 503: function(xhr, ajaxOptions, thrownError) { alert(DWZ.msg("statusCode_503") || thrownError); } } }); }, loadUrl: function(url,data,callback){ $(this).ajaxUrl({url:url, data:data, callback:callback}); }, initUI: function() { return this.each(function(){ var $this = $(this); $.each(DWZ.regPlugins, function(index, fn){ fn($this); }); }); }, /** * adjust component inner reference box height * @param {Object} refBox: reference box jQuery Obj */ layoutH: function($refBox){ return this.each(function(){ var $this = $(this); if (! $refBox) $refBox = $this.getLayoutBox(); var iRefH = $refBox.height(); var iLayoutH = parseInt($this.attr("layoutH")); var iH = iRefH - iLayoutH > 50 ? iRefH - iLayoutH : 50; if ($this.isTag("table")) { $this.removeAttr("layoutH").wrap('
    '); } else { $this.height(iH).css("overflow","auto"); } }); }, getLayoutBox: function(){ return $(this).parents("div.layoutBox:first"); }, hoverClass: function(className, speed){ var _className = className || "hover"; return this.each(function(){ var $this = $(this), mouseOutTimer; $this.hover(function(){ if (mouseOutTimer) clearTimeout(mouseOutTimer); $this.addClass(_className); },function(){ mouseOutTimer = setTimeout(function(){$this.removeClass(_className);}, speed||10); }); }); }, focusClass: function(className){ var _className = className || "textInputFocus"; return this.each(function(){ $(this).focus(function(){ $(this).addClass(_className); }).blur(function(){ $(this).removeClass(_className); }); }); }, inputAlert: function(){ return this.each(function(){ var $this = $(this); function getAltBox(){ return $this.parent().find("label.alt"); } function altBoxCss(opacity){ var position = $this.position(); return { width:$this.width(), top:position.top+'px', left:position.left +'px', opacity:opacity || 1 }; } if (getAltBox().length < 1) { if (!$this.attr("id")) $this.attr("id", $this.attr("name") + "_" +Math.round(Math.random()*10000)); var $label = $('').appendTo($this.parent()); $label.css(altBoxCss(0.6)); if ($this.val()) $label.hide(); } $this.focus(function(){ getAltBox().css(altBoxCss(0.3)); }).blur(function(){ if (!$(this).val()) getAltBox().show().css("opacity",1); }).keydown(function(){ getAltBox().hide(); }); }); }, isTag:function(tn) { if(!tn) return false; return $(this)[0].tagName.toLowerCase() == tn?true:false; }, /** * 判断当前元素是否已经绑定某个事件 * @param {Object} type */ isBind:function(type) { var _events = $(this).data("events"); return _events && type && _events[type]; }, /** * 输出firebug日志 * @param {Object} msg */ log:function(msg){ return this.each(function(){ if (console) console.log("%s: %o", msg, this); }); } }); /** * 扩展String方法 */ $.extend(String.prototype, { isPositiveInteger:function(){ return (new RegExp(/^[1-9]\d*$/).test(this)); }, isInteger:function(){ return (new RegExp(/^\d+$/).test(this)); }, isNumber: function(value, element) { return (new RegExp(/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/).test(this)); }, trim:function(){ return this.replace(/(^\s*)|(\s*$)|\r|\n/g, ""); }, startsWith:function (pattern){ return this.indexOf(pattern) === 0; }, endsWith:function(pattern) { var d = this.length - pattern.length; return d >= 0 && this.lastIndexOf(pattern) === d; }, replaceSuffix:function(index){ return this.replace(/\[[0-9]+\]/,'['+index+']').replace('#index#',index); }, trans:function(){ return this.replace(/</g, '<').replace(/>/g,'>').replace(/"/g, '"'); }, encodeTXT: function(){ return (this).replaceAll('&', '&').replaceAll("<","<").replaceAll(">", ">").replaceAll(" ", " "); }, replaceAll:function(os, ns){ return this.replace(new RegExp(os,"gm"),ns); }, replaceTm:function(data){ if (!data) return this; return this.replace(RegExp("({[A-Za-z_]+[A-Za-z0-9_]*})","g"), function($1){ return data[$1.replace(/[{}]+/g, "")]; }); }, replaceTmById:function(_box){ var $parent = _box || $(document); return this.replace(RegExp("({[A-Za-z_]+[A-Za-z0-9_]*})","g"), function($1){ var $input = $parent.find("#"+$1.replace(/[{}]+/g, "")); return $input.val() ? $input.val() : $1; }); }, isFinishedTm:function(){ return !(new RegExp("{[A-Za-z_]+[A-Za-z0-9_]*}").test(this)); }, skipChar:function(ch) { if (!this || this.length===0) {return '';} if (this.charAt(0)===ch) {return this.substring(1).skipChar(ch);} return this; }, isValidPwd:function() { return (new RegExp(/^([_]|[a-zA-Z0-9]){6,32}$/).test(this)); }, isValidMail:function(){ return(new RegExp(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/).test(this.trim())); }, isSpaces:function() { for(var i=0; i= this.elements.length) { return null; } return this.elements[_index]; } this.containsKey = function(_key){ try { for (i = 0; i < this.elements.length; i++) { if (this.elements[i].key == _key) { return true; } } } catch (e) { return false; } return false; } this.values = function(){ var arr = new Array(); for (i = 0; i < this.elements.length; i++) { arr.push(this.elements[i].value); } return arr; } this.keys = function(){ var arr = new Array(); for (i = 0; i < this.elements.length; i++) { arr.push(this.elements[i].key); } return arr; } } ================================================ FILE: js/dwz.cssTable.js ================================================ /** * Theme Plugins * @author 张慧华 z@j-ui.com */ (function($){ $.fn.extend({ cssTable: function(options){ return this.each(function(){ var $this = $(this); var $trs = $this.find('tbody>tr'); var $grid = $this.parent(); // table var nowrap = $this.hasClass("nowrap"); $trs.hoverClass("hover").each(function(index){ var $tr = $(this); if (!nowrap && index % 2 == 1) $tr.addClass("trbg"); $tr.click(function(){ $trs.filter(".selected").removeClass("selected"); $tr.addClass("selected"); var sTarget = $tr.attr("target"); if (sTarget) { if ($("#"+sTarget, $grid).length == 0) { $grid.prepend(''); } $("#"+sTarget, $grid).val($tr.attr("rel")); } }); }); $this.find("thead [orderField]").orderBy({ targetType: $this.attr("targetType"), rel:$this.attr("rel"), asc: $this.attr("asc") || "asc", desc: $this.attr("desc") || "desc" }); }); } }); })(jQuery); ================================================ FILE: js/dwz.database.js ================================================ /** * @author ZhangHuihua@msn.com */ (function($){ var _lookup = {currentGroup:"", suffix:"", $target:null, pk:"id"}; var _util = { _lookupPrefix: function(key){ var strDot = _lookup.currentGroup ? "." : ""; return _lookup.currentGroup + strDot + key + _lookup.suffix; }, lookupPk: function(key){ return this._lookupPrefix(key); }, lookupField: function(key){ return this.lookupPk(key); } }; $.extend({ bringBackSuggest: function(args){ var $box = _lookup['$target'].parents(".unitBox:first"); // $box.trigger('bringBackSuggestDone', args); $box.find(":input").each(function(){ var $input = $(this), inputName = $input.attr("name"); for (var key in args) { var name = (_lookup.pk == key) ? _util.lookupPk(key) : _util.lookupField(key); if (name == inputName) { $input.val(args[key]); break; } } }); }, bringBack: function(args){ $.bringBackSuggest(args); $.pdialog.closeCurrent(); }, getSelectedIds: function(selectedIds, targetType){ var ids = ""; var $box = targetType == "dialog" ? $.pdialog.getCurrent() : navTab.getCurrentPanel(); $box.find("input:checked").filter("[name='"+selectedIds+"']").each(function(i){ var val = $(this).val(); ids += i==0 ? val : ","+val; }); return ids; } }); $.fn.extend({ lookup: function(){ return this.each(function(){ var $this = $(this), options = {mask:true, width:$this.attr('width')||820, height:$this.attr('height')||400, maxable:eval($this.attr("maxable") || "true"), resizable:eval($this.attr("resizable") || "true") }; $this.click(function(event){ _lookup = $.extend(_lookup, { currentGroup: $this.attr("lookupGroup") || "", suffix: $this.attr("suffix") || "", $target: $this, pk: $this.attr("lookupPk") || "id" }); var url = unescape($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first")); if (!url.isFinishedTm()) { alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg")); return false; } $.pdialog.open(url, "_blank", $this.attr("title") || $this.text(), options); return false; }); }); }, multLookup: function(){ return this.each(function(){ var $this = $(this), args={}; $this.click(function(event){ var $unitBox = $this.parents(".unitBox:first"); $unitBox.find("[name='"+$this.attr("multLookup")+"']").filter(":checked").each(function(){ var _args = DWZ.jsonEval($(this).val()); for (var key in _args) { var value = args[key] ? args[key]+"," : ""; args[key] = value + _args[key]; } }); if ($.isEmptyObject(args)) { alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg")); return false; } $.bringBack(args); }); }); }, suggest: function(){ var op = {suggest$:"#suggest", suggestShadow$: "#suggestShadow"}; var selectedIndex = -1; return this.each(function(){ var $input = $(this).attr('autocomplete', 'off').keydown(function(event){ if (event.keyCode == DWZ.keyCode.ENTER && $(op.suggest$).is(':visible')) return false; //屏蔽回车提交 }); var suggestFields=$input.attr('suggestFields').split(","); function _show(event){ var offset = $input.offset(); var iTop = offset.top+this.offsetHeight; var $suggest = $(op.suggest$); if ($suggest.length == 0) $suggest = $('
    ').appendTo($('body')); $suggest.css({ left:offset.left+'px', top:iTop+'px' }).show(); _lookup = $.extend(_lookup, { currentGroup: $input.attr("lookupGroup") || "", suffix: $input.attr("suffix") || "", $target: $input, pk: $input.attr("lookupPk") || "id" }); var url = unescape($input.attr("suggestUrl")).replaceTmById($(event.target).parents(".unitBox:first")); if (!url.isFinishedTm()) { alertMsg.error($input.attr("warn") || DWZ.msg("alertSelectMsg")); return false; } var postData = {}; postData[$input.attr("postField")||"inputValue"] = $input.val(); $.ajax({ global:false, type:'POST', dataType:"json", url:url, cache: false, data: postData, success: function(response){ if (!response) return; var html = ''; $.each(response, function(i){ var liAttr = '', liLabel = ''; for (var i=0; i' + liLabel + ''; }); var $lis = $suggest.html('
      '+html+'
    ').find("li"); $lis.hoverClass("selected").click(function(){ _select($(this)); }); if ($lis.length == 1 && event.keyCode != DWZ.keyCode.BACKSPACE) { _select($lis.eq(0)); } else if ($lis.length == 0){ var jsonStr = ""; for (var i=0; i= $items.length-1) selectedIndex = -1; else selectedIndex++; break; case DWZ.keyCode.UP: if (selectedIndex < 0) selectedIndex = $items.length-1; else selectedIndex--; break; default: _show(event); } $items.removeClass("selected"); if (selectedIndex>=0) { var $item = $items.eq(selectedIndex).addClass("selected"); _select($item); } }); }); }, itemDetail: function(){ return this.each(function(){ var $table = $(this).css("clear","both"), $tbody = $table.find("tbody"); var fields=[]; $table.find("tr:first th[type]").each(function(i){ var $th = $(this); var field = { type: $th.attr("type") || "text", patternDate: $th.attr("dateFmt") || "yyyy-MM-dd", name: $th.attr("name") || "", defaultVal: $th.attr("defaultVal") || "", size: $th.attr("size") || "12", enumUrl: $th.attr("enumUrl") || "", lookupGroup: $th.attr("lookupGroup") || "", lookupUrl: $th.attr("lookupUrl") || "", lookupPk: $th.attr("lookupPk") || "id", suggestUrl: $th.attr("suggestUrl"), suggestFields: $th.attr("suggestFields"), postField: $th.attr("postField") || "", fieldClass: $th.attr("fieldClass") || "", fieldAttrs: $th.attr("fieldAttrs") || "" }; fields.push(field); }); $tbody.find("a.btnDel").click(function(){ var $btnDel = $(this); if ($btnDel.is("[href^=javascript:]")){ $btnDel.parents("tr:first").remove(); initSuffix($tbody); return false; } function delDbData(){ $.ajax({ type:'POST', dataType:"json", url:$btnDel.attr('href'), cache: false, success: function(){ $btnDel.parents("tr:first").remove(); initSuffix($tbody); }, error: DWZ.ajaxError }); } if ($btnDel.attr("title")){ alertMsg.confirm($btnDel.attr("title"), {okCall: delDbData}); } else { delDbData(); } return false; }); var addButTxt = $table.attr('addButton') || "Add New"; if (addButTxt) { var $addBut = $('
    ').insertBefore($table).find("button"); var $rowNum = $('').insertBefore($table); var trTm = ""; $addBut.click(function(){ if (! trTm) trTm = trHtml(fields); var rowNum = 1; try{rowNum = parseInt($rowNum.val())} catch(e){} for (var i=0; itr').each(function(i){ $(':input, a.btnLook, a.btnAttach', this).each(function(){ var $this = $(this), name = $this.attr('name'), val = $this.val(); if (name) $this.attr('name', name.replaceSuffix(i)); var lookupGroup = $this.attr('lookupGroup'); if (lookupGroup) {$this.attr('lookupGroup', lookupGroup.replaceSuffix(i));} var suffix = $this.attr("suffix"); if (suffix) {$this.attr('suffix', suffix.replaceSuffix(i));} if (val && val.indexOf("#index#") >= 0) $this.val(val.replace('#index#',i+1)); }); }); } function tdHtml(field){ var html = '', suffix = ''; if (field.name.endsWith("[#index#]")) suffix = "[#index#]"; else if (field.name.endsWith("[]")) suffix = "[]"; var suffixFrag = suffix ? ' suffix="' + suffix + '" ' : ''; var attrFrag = ''; if (field.fieldAttrs){ var attrs = DWZ.jsonEval(field.fieldAttrs); for (var key in attrs) { attrFrag += key+'="'+attrs[key]+'"'; } } switch(field.type){ case 'del': html = '删除'; break; case 'lookup': var suggestFrag = ''; if (field.suggestFields) { suggestFrag = 'autocomplete="off" lookupGroup="'+field.lookupGroup+'"'+suffixFrag+' suggestUrl="'+field.suggestUrl+'" suggestFields="'+field.suggestFields+'"' + ' postField="'+field.postField+'"'; } html = '' + '' + '查找带回'; break; case 'attach': html = '' + '' + '查找带回'; break; case 'enum': $.ajax({ type:"POST", dataType:"html", async: false, url:field.enumUrl, data:{inputName:field.name}, success:function(response){ html = response; } }); break; case 'date': html = '' +'选择'; break; default: html = ''; break; } return ''+html+''; } function trHtml(fields){ var html = ''; $(fields).each(function(){ html += tdHtml(this); }); return ''+html+''; } }, selectedTodo: function(){ return this.each(function(){ var $this = $(this); var selectedIds = $this.attr("rel") || "ids"; var postType = $this.attr("postType") || "map"; $this.click(function(){ var targetType = $this.attr("targetType"); var ids = $.getSelectedIds(selectedIds, targetType); if (!ids) { alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg")); return false; } var _callback = $this.attr("callback") || (targetType == "dialog" ? dialogAjaxDone : navTabAjaxDone); if (! $.isFunction(_callback)) _callback = eval('(' + _callback + ')'); function _doPost(){ $.ajax({ type:'POST', url:$this.attr('href'), dataType:'json', cache: false, data: function(){ if (postType == 'map'){ return $.map(ids.split(','), function(val, i) { return {name: selectedIds, value: val}; }); } else { var _data = {}; _data[selectedIds] = ids; return _data; } }(), success: _callback, error: DWZ.ajaxError }); } var title = $this.attr("title"); if (title) { alertMsg.confirm(title, {okCall: _doPost}); } else { _doPost(); } return false; }); }); }, selectedBlank: function(){ return this.each(function(){ var $this = $(this); var selectedIds = $this.attr("rel") || "ids"; var postType = $this.attr("postType") || "map"; $this.click(function(){ var targetType = $this.attr("targetType"); var ids = $.getSelectedIds(selectedIds, targetType); if (!ids) { alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg")); return false; } var data = {}; if (postType == 'map'){ data = $.map(ids.split(','), function(val, i) { return {name: selectedIds, value: val}; }); } else { data[0] = {name: selectedIds, value: ids}; } var html = ''; $.each(data, function(index){ html += '' }); html = '
    '+html+'
    ' var $form = $(html).appendTo('body'); var title = $this.attr("title"); if (title) { alertMsg.confirm(title, {okCall: function() { $form.submit(); $form.remove(); }}); } else { $form.submit(); $form.remove(); } return false; }); }); } }); })(jQuery); ================================================ FILE: js/dwz.datepicker.js ================================================ /** * reference dwz.util.date.js * @author ZhangHuihua@msn.com * */ (function($){ $.setRegional("datepicker", { dayNames:['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], monthNames:['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }); $.fn.datepicker = function(opts){ var setting = { box$:"#calendar", year$:"#calendar [name=year]", month$:"#calendar [name=month]", tmInputs$:"#calendar .time :text", hour$:"#calendar .time .hh", minute$:"#calendar .time .mm", second$:"#calendar .time .ss", tmBox$:"#calendar .tm", tmUp$:"#calendar .time .up", tmDown$:"#calendar .time .down", close$:"#calendar .close", calIcon$:"a.inputDateButton", main$:"#calendar .main", days$:"#calendar .days", dayNames$:"#calendar .dayNames", clearBut$:"#calendar .clearBut", okBut$:"#calendar .okBut" }; function changeTmMenu(sltClass){ var $tm = $(setting.tmBox$); $tm.removeClass("hh").removeClass("mm").removeClass("ss"); if (sltClass) { $tm.addClass(sltClass); $(setting.tmInputs$).removeClass("slt").filter("." + sltClass).addClass("slt"); } } function clickTmMenu($input, type){ $(setting.tmBox$).find("."+type+" li").each(function(){ var $li = $(this); $li.click(function(){ $input.val($li.text()); }); }); } function keydownInt(e){ if (!((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode == DWZ.keyCode.DELETE || e.keyCode == DWZ.keyCode.BACKSPACE))) { return false; } } function changeTm($input, type){ var ivalue = parseInt($input.val()), istart = parseInt($input.attr("start")) || 0, iend = parseInt($input.attr("end")); var istep = parseInt($input.attr('step') || 1); if (type == 1) { if (ivalue <= iend-istep){$input.val(ivalue + istep);} } else if (type == -1){ if (ivalue >= istart+istep){$input.val(ivalue - istep);} } else if (ivalue > iend) { $input.val(iend); } else if (ivalue < istart) { $input.val(istart); } } return this.each(function(){ var $this = $(this); var dp = new Datepicker($this.val(), opts); function generateCalendar(dp){ var dw = dp.getDateWrap(); var minDate = dp.getMinDate(); var maxDate = dp.getMaxDate(); var monthStart = new Date(dw.year,dw.month-1,1); var startDay = monthStart.getDay(); var dayStr=""; if (startDay > 0){ //日历前面补齐 monthStart.setMonth(monthStart.getMonth() - 1); var prevDateWrap = dp.getDateWrap(monthStart); for(var t=prevDateWrap.days-startDay+1;t<=prevDateWrap.days;t++) { var _date = new Date(dw.year,dw.month-2,t); var _ctrClass = (_date >= minDate && _date <= maxDate) ? '' : 'disabled'; dayStr+='
    '+t+'
    '; } } for(var t=1;t<=dw.days;t++){ var _date = new Date(dw.year,dw.month-1,t); var _ctrClass = (_date >= minDate && _date <= maxDate) ? '' : 'disabled'; if(t==dw.day){ dayStr+='
    '+t+'
    '; }else{ dayStr+='
    '+t+'
    '; } } for(var t=1;t<=42-startDay-dw.days;t++){ // 日历后面补齐 var _date = new Date(dw.year,dw.month,t); var _ctrClass = (_date >= minDate && _date <= maxDate) ? '' : 'disabled'; dayStr+='
    '+t+'
    '; } var $days = $(setting.days$).html(dayStr).find("dd"); $days.not('.disabled').click(function(){ var $day = $(this); if (!dp.hasTime()) { $this.val(dp.formatDate(dp.changeDay($day.attr("day"), $day.attr("chMonth")))); closeCalendar(); } else { $days.removeClass("slt"); $day.addClass("slt"); } }); if (!dp.hasDate()) $(setting.main$).addClass('nodate'); // 仅时间,无日期 if (dp.hasTime()) { $("#calendar .time").show(); var iHour = dw.hour, iMinute = dw.minute, iSecond = dw.second; if (dp.opts.defaultTime && !$this.val()) { var timeStr = dp.opts.defaultTime.split(':'); iHour = parseInt(timeStr[0]); iMinute = parseInt(timeStr[1]); iSecond = parseInt(timeStr[2]); } iMinute = parseInt(iMinute / dp.opts.mmStep) * dp.opts.mmStep; iSecond = dp.hasSecond() ? iSecond : 0; var $hour = $(setting.hour$).val(iHour).focus(function(){ changeTmMenu("hh"); }); var $minute = $(setting.minute$).val(iMinute).attr('step',dp.opts.mmStep).focus(function(){ changeTmMenu("mm"); }); var $second = $(setting.second$).val(iSecond).attr('step',dp.opts.ssStep).focus(function(){ changeTmMenu("ss"); }); $hour.add($minute).add($second).click(function(){return false}); clickTmMenu($hour,"hh"); clickTmMenu($minute,"mm"); clickTmMenu($second,"ss"); $(setting.box$).click(function(){ changeTmMenu(); }); var $inputs = $(setting.tmInputs$); $inputs.keydown(keydownInt).each(function(){ var $input = $(this); $input.keyup(function(){ changeTm($input, 0); }); }); $(setting.tmUp$).click(function(){ $inputs.filter(".slt").each(function(){ changeTm($(this), 1); }); }); $(setting.tmDown$).click(function(){ $inputs.filter(".slt").each(function(){ changeTm($(this), -1); }); }); if (!dp.hasHour()) $hour.attr("disabled",true); if (!dp.hasMinute()) $minute.attr("disabled",true); if (!dp.hasSecond()) $second.attr("disabled",true); } } function closeCalendar() { $(setting.box$).remove(); $(document).unbind("click", closeCalendar); } $this.click(function(event){ closeCalendar(); var dp = new Datepicker($this.val(), opts); var offset = $this.offset(); var iTop = offset.top+this.offsetHeight; $(DWZ.frag['calendarFrag']).appendTo("body").css({ left:offset.left+'px', top:iTop+'px' }).show().click(function(event){ event.stopPropagation(); }); ($.fn.bgiframe && $(setting.box$).bgiframe()); var dayNames = ""; $.each($.regional.datepicker.dayNames, function(i,v){ dayNames += "
    " + v + "
    " }); $(setting.dayNames$).html(dayNames); var dw = dp.getDateWrap(); var $year = $(setting.year$); var yearstart = dp.getMinDate().getFullYear(); var yearend = dp.getMaxDate().getFullYear(); for(y=yearstart; y<=yearend; y++){ $year.append(''); } var $month = $(setting.month$); $.each($.regional.datepicker.monthNames, function(i,v){ var m = i+1; $month.append(''); }); // generate calendar generateCalendar(dp); $year.add($month).change(function(){ dp.changeDate($year.val(), $month.val()); generateCalendar(dp); }); // fix top var iBoxH = $(setting.box$).outerHeight(true); if (iTop > iBoxH && iTop > $(window).height()-iBoxH) { $(setting.box$).css("top", offset.top - iBoxH); } $(setting.close$).click(function(){ closeCalendar(); }); $(setting.clearBut$).click(function(){ $this.val(""); closeCalendar(); }); $(setting.okBut$).click(function(){ var $dd = $(setting.days$).find("dd.slt"); if ($dd.hasClass("disabled")) return false; var date = dp.changeDay($dd.attr("day"), $dd.attr("chMonth")); if (dp.hasTime()) { date.setHours(parseInt($(setting.hour$).val())); date.setMinutes(parseInt($(setting.minute$).val())); date.setSeconds(parseInt($(setting.second$).val())); } $this.val(dp.formatDate(date)); closeCalendar(); }); $(document).bind("click", closeCalendar); return false; }); $this.parent().find(setting.calIcon$).click(function(){ $this.trigger("click"); return false; }); }); } var Datepicker = function(sDate, opts) { this.opts = $.extend({ pattern:'yyyy-MM-dd', minDate:"1900-01-01", maxDate:"2099-12-31", mmStep:1, ssStep:1 }, opts); //动态minDate、maxDate var now = new Date(); this.opts.minDate = now.formatDateTm(this.opts.minDate); this.opts.maxDate = now.formatDateTm(this.opts.maxDate); this.sDate = sDate.trim(); } $.extend(Datepicker.prototype, { get: function(name) { return this.opts[name]; }, _getDays: function (y,m){//获取某年某月的天数 return m==2?(y%4||!(y%100)&&y%400?28:29):(/4|6|9|11/.test(m)?30:31); }, _minMaxDate: function(sDate){ var _count = sDate.split('-').length -1; var _format = 'y-M-d'; if (_count == 1) _format = 'y-M'; else if (_count == 0) _format = 'y'; return sDate.parseDate(_format); }, getMinDate: function(){ return this._minMaxDate(this.opts.minDate); }, getMaxDate: function(){ var _sDate = this.opts.maxDate; var _count = _sDate.split('-').length -1; var _date = this._minMaxDate(_sDate); if (_count < 2) { //format:y-M、y var _day = this._getDays(_date.getFullYear(), _date.getMonth()+1); _date.setDate(_day); if (_count == 0) {//format:y _date.setMonth(11); } } return _date; }, getDateWrap: function(date){ //得到年,月,日 if (!date) date = this.parseDate(this.sDate) || new Date(); var y = date.getFullYear(); var m = date.getMonth()+1; var days = this._getDays(y,m); return { year:y, month:m, day:date.getDate(), hour:date.getHours(),minute:date.getMinutes(),second:date.getSeconds(), days: days, date:date } }, /** * @param {year:2010, month:05, day:24} */ changeDate: function(y, m, d){ var date = new Date(y, m - 1, d || 1); this.sDate = this.formatDate(date); return date; }, changeDay: function(day, chMonth){ if (!chMonth) chMonth = 0; var dw = this.getDateWrap(); return this.changeDate(dw.year, dw.month+parseInt(chMonth), day); }, parseDate: function(sDate){ if (!sDate) return null; return sDate.parseDate(this.opts.pattern); }, formatDate: function(date){ return date.formatDate(this.opts.pattern); }, hasHour: function() { return this.opts.pattern.indexOf("H") != -1; }, hasMinute: function() { return this.opts.pattern.indexOf("m") != -1; }, hasSecond: function() { return this.opts.pattern.indexOf("s") != -1; }, hasTime: function() { return this.hasHour() || this.hasMinute() || this.hasSecond(); }, hasDate: function() { var _dateKeys = ['y','M','d','E']; for (var i=0; i<_dateKeys.length; i++){ if (this.opts.pattern.indexOf(_dateKeys[i]) != -1) return true; } return false; } }); })(jQuery); ================================================ FILE: js/dwz.dialog.js ================================================ /** * @author Roger Wu * reference:dwz.drag.js, dwz.dialogDrag.js, dwz.resize.js, dwz.taskBar.js */ (function($){ $.pdialog = { _op:{height:300, width:580, minH:40, minW:50, total:20, max:false, mask:false, resizable:true, drawable:true, maxable:true,minable:true,fresh:true}, _current:null, _zIndex:42, getCurrent:function(){ return this._current; }, reload:function(url, options){ var op = $.extend({data:{}, dialogId:"", callback:null}, options); var dialog = (op.dialogId && $("body").data(op.dialogId)) || this._current; if (dialog){ var jDContent = dialog.find(".dialogContent"); jDContent.ajaxUrl({ type:"POST", url:url, data:op.data, callback:function(response){ jDContent.find("[layoutH]").layoutH(jDContent); $(".pageContent", dialog).width($(dialog).width()-14); $(":button.close", dialog).click(function(){ $.pdialog.close(dialog); return false; }); if ($.isFunction(op.callback)) op.callback(response); } }); } }, //打开一个层 open:function(url, dlgid, title, options) { var op = $.extend({},$.pdialog._op, options); var dialog = $("body").data(dlgid); //重复打开一个层 if(dialog) { if(dialog.is(":hidden")) { dialog.show(); } if(op.fresh || url != $(dialog).data("url")){ dialog.data("url",url); dialog.find(".dialogHeader").find("h1").html(title); this.switchDialog(dialog); var jDContent = dialog.find(".dialogContent"); jDContent.ajaxUrl({ type:options.type||'GET', url:url, data:options.data || {}, callback:function(){ jDContent.find("[layoutH]").layoutH(jDContent); $(".pageContent", dialog).width($(dialog).width()-14); $("button.close", dialog).click(function(){ $.pdialog.close(dialog); return false; }); } }); } } else { //打开一个全新的层 $("body").append(DWZ.frag["dialogFrag"]); dialog = $(">.dialog:last-child", "body"); dialog.data("id",dlgid); dialog.data("url",url); if(options.close) dialog.data("close",options.close); if(options.param) dialog.data("param",options.param); ($.fn.bgiframe && dialog.bgiframe()); dialog.find(".dialogHeader").find("h1").html(title); $(dialog).css("zIndex", ($.pdialog._zIndex+=2)); $("div.shadow").css("zIndex", $.pdialog._zIndex - 3).show(); $.pdialog._init(dialog, options); $(dialog).click(function(){ $.pdialog.switchDialog(dialog); }); if(op.resizable) dialog.jresize(); if(op.drawable) dialog.dialogDrag(); $("a.close", dialog).click(function(event){ $.pdialog.close(dialog); return false; }); if (op.maxable) { $("a.maximize", dialog).show().click(function(event){ $.pdialog.switchDialog(dialog); $.pdialog.maxsize(dialog); dialog.jresize("destroy").dialogDrag("destroy"); return false; }); } else { $("a.maximize", dialog).hide(); } $("a.restore", dialog).click(function(event){ $.pdialog.restore(dialog); dialog.jresize().dialogDrag(); return false; }); if (op.minable) { $("a.minimize", dialog).show().click(function(event){ $.pdialog.minimize(dialog); return false; }); } else { $("a.minimize", dialog).hide(); } $("div.dialogHeader a", dialog).mousedown(function(){ return false; }); $("div.dialogHeader", dialog).dblclick(function(){ if($("a.restore",dialog).is(":hidden")) $("a.maximize",dialog).trigger("click"); else $("a.restore",dialog).trigger("click"); }); if(op.max) { // $.pdialog.switchDialog(dialog); $.pdialog.maxsize(dialog); dialog.jresize("destroy").dialogDrag("destroy"); } $("body").data(dlgid, dialog); $.pdialog._current = dialog; $.pdialog.attachShadow(dialog); //load data var jDContent = $(".dialogContent",dialog); jDContent.ajaxUrl({ type:options.type||'GET', url:url, data:options.data || {}, callback:function(){ jDContent.find("[layoutH]").layoutH(jDContent); $(".pageContent", dialog).width($(dialog).width()-14); $("button.close", dialog).click(function(){ $.pdialog.close(dialog); return false; }); } }); } if (op.mask) { $(dialog).css("zIndex", 1000); $("a.minimize",dialog).hide(); $(dialog).data("mask", true); $("#dialogBackground").show(); }else { //add a task to task bar if(op.minable) $.taskBar.addDialog(dlgid,title); } }, /** * 切换当前层 * @param {Object} dialog */ switchDialog:function(dialog) { var index = $(dialog).css("zIndex"); $.pdialog.attachShadow(dialog); if($.pdialog._current) { var cindex = $($.pdialog._current).css("zIndex"); $($.pdialog._current).css("zIndex", index); $(dialog).css("zIndex", cindex); $("div.shadow").css("zIndex", cindex - 1); $.pdialog._current = dialog; } $.taskBar.switchTask(dialog.data("id")); }, /** * 给当前层附上阴隐层 * @param {Object} dialog */ attachShadow:function(dialog) { var shadow = $("div.shadow"); if(shadow.is(":hidden")) shadow.show(); shadow.css({ top: parseInt($(dialog)[0].style.top) - 2, left: parseInt($(dialog)[0].style.left) - 4, height: parseInt($(dialog).height()) + 8, width: parseInt($(dialog).width()) + 8, zIndex:parseInt($(dialog).css("zIndex")) - 1 }); $(".shadow_c", shadow).children().addBack().each(function(){ $(this).css("height", $(dialog).outerHeight() - 4); }); }, _init:function(dialog, options) { var op = $.extend({}, this._op, options); var height = op.height>op.minH?op.height:op.minH; var width = op.width>op.minW?op.width:op.minW; if(isNaN(dialog.height()) || dialog.height() < height){ $(dialog).height(height+"px"); $(".dialogContent",dialog).height(height - $(".dialogHeader", dialog).outerHeight() - $(".dialogFooter", dialog).outerHeight() - 6); } if(isNaN(dialog.css("width")) || dialog.width() < width) { $(dialog).width(width+"px"); } var iTop = ($(window).height()-dialog.height())/2; dialog.css({ left: ($(window).width()-dialog.width())/2, top: iTop > 0 ? iTop : 0 }); }, /** * 初始化半透明层 * @param {Object} resizable * @param {Object} dialog * @param {Object} target */ initResize:function(resizable, dialog,target) { $("body").css("cursor", target + "-resize"); resizable.css({ top: $(dialog).css("top"), left: $(dialog).css("left"), height:$(dialog).css("height"), width:$(dialog).css("width") }); resizable.show(); }, /** * 改变阴隐层 * @param {Object} target * @param {Object} options */ repaint:function(target,options){ var shadow = $("div.shadow"); if(target != "w" && target != "e") { shadow.css("height", shadow.outerHeight() + options.tmove); $(".shadow_c", shadow).children().addBack().each(function(){ $(this).css("height", $(this).outerHeight() + options.tmove); }); } if(target == "n" || target =="nw" || target == "ne") { shadow.css("top", options.otop - 2); } if(options.owidth && (target != "n" || target != "s")) { shadow.css("width", options.owidth + 8); } if(target.indexOf("w") >= 0) { shadow.css("left", options.oleft - 4); } }, /** * 改变左右拖动层的高度 * @param {Object} target * @param {Object} tmove * @param {Object} dialog */ resizeTool:function(target, tmove, dialog) { $("div[class^='resizable']", dialog).filter(function(){ return $(this).attr("tar") == 'w' || $(this).attr("tar") == 'e'; }).each(function(){ $(this).css("height", $(this).outerHeight() + tmove); }); }, /** * 改变原始层的大小 * @param {Object} obj * @param {Object} dialog * @param {Object} target */ resizeDialog:function(obj, dialog, target) { var oleft = parseInt(obj.style.left); var otop = parseInt(obj.style.top); var height = parseInt(obj.style.height); var width = parseInt(obj.style.width); if(target == "n" || target == "nw") { tmove = parseInt($(dialog).css("top")) - otop; } else { tmove = height - parseInt($(dialog).css("height")); } $(dialog).css({left:oleft,width:width,top:otop,height:height}); $(".dialogContent", dialog).css("width", (width-12) + "px"); $(".pageContent", dialog).css("width", (width-14) + "px"); if (target != "w" && target != "e") { var content = $(".dialogContent", dialog); content.css({height:height - $(".dialogHeader", dialog).outerHeight() - $(".dialogFooter", dialog).outerHeight() - 6}); content.find("[layoutH]").layoutH(content); $.pdialog.resizeTool(target, tmove, dialog); } $.pdialog.repaint(target, {oleft:oleft,otop: otop,tmove: tmove,owidth:width}); $(window).trigger(DWZ.eventType.resizeGrid); }, close:function(dialog) { if(typeof dialog == 'string') dialog = $("body").data(dialog); if (!dialog) return; var close = dialog.data("close"); var go = true; if(close && $.isFunction(close)) { var param = dialog.data("param"); if(param && param != ""){ param = DWZ.jsonEval(param); go = close(param); } else { go = close(); } if(!go) return; } $(dialog).hide(); $("div.shadow").hide(); if($(dialog).data("mask")){ $("#dialogBackground").hide(); } else{ if ($(dialog).data("id")) $.taskBar.closeDialog($(dialog).data("id")); } $("body").removeData($(dialog).data("id")); $(dialog).trigger(DWZ.eventType.pageClear).remove(); }, closeCurrent:function(){ this.close($.pdialog._current); }, checkCloseCurrent:function(json){ if (!json) return; if (json[DWZ.keys.statusCode] == DWZ.statusCode.timeout || (json[DWZ.keys.statusCode] == DWZ.statusCode.error && "closeCurrentDialog" == json.callbackType) ) { this.closeCurrent(); } }, maxsize:function(dialog) { $(dialog).data("original",{ top:$(dialog).css("top"), left:$(dialog).css("left"), width:$(dialog).css("width"), height:$(dialog).css("height") }); $("a.maximize",dialog).hide(); $("a.restore",dialog).show(); var iContentW = $(window).width(); var iContentH = $(window).height() - 34; $(dialog).css({top:"0px",left:"0px",width:iContentW+"px",height:iContentH+"px"}); $.pdialog._resizeContent(dialog,iContentW,iContentH); }, restore:function(dialog) { var original = $(dialog).data("original"); var dwidth = parseInt(original.width); var dheight = parseInt(original.height); $(dialog).css({ top:original.top, left:original.left, width:dwidth, height:dheight }); $.pdialog._resizeContent(dialog,dwidth,dheight); $("a.maximize",dialog).show(); $("a.restore",dialog).hide(); $.pdialog.attachShadow(dialog); }, minimize:function(dialog){ $(dialog).hide(); $("div.shadow").hide(); var task = $.taskBar.getTask($(dialog).data("id")); $(".resizable").css({ top: $(dialog).css("top"), left: $(dialog).css("left"), height:$(dialog).css("height"), width:$(dialog).css("width") }).show().animate({top:$(window).height()-60,left:task.position().left,width:task.outerWidth(),height:task.outerHeight()},250,function(){ $(this).hide(); $.taskBar.inactive($(dialog).data("id")); }); }, _resizeContent:function(dialog,width,height) { var content = $(".dialogContent", dialog); content.css({width:(width-12) + "px",height:height - $(".dialogHeader", dialog).outerHeight() - $(".dialogFooter", dialog).outerHeight() - 6}); content.find("[layoutH]").layoutH(content); $(".pageContent", dialog).css("width", (width-14) + "px"); $(window).trigger(DWZ.eventType.resizeGrid); } }; })(jQuery); ================================================ FILE: js/dwz.dialogDrag.js ================================================ /** * @author Roger Wu */ (function($){ $.fn.dialogDrag = function(options){ if (typeof options == 'string') { if (options == 'destroy') return this.each(function() { var dialog = this; $("div.dialogHeader", dialog).unbind("mousedown"); }); } return this.each(function(){ var dialog = $(this); $("div.dialogHeader", dialog).mousedown(function(e){ $.pdialog.switchDialog(dialog); dialog.data("task",true); setTimeout(function(){ if(dialog.data("task"))$.dialogDrag.start(dialog,e); },100); return false; }).mouseup(function(e){ dialog.data("task",false); return false; }); }); }; $.dialogDrag = { currId:null, _init:function(dialog) { this.currId = new Date().getTime(); var shadow = $("#dialogProxy"); if (!shadow.length) { shadow = $(DWZ.frag["dialogProxy"]); $("body").append(shadow); } $("h1", shadow).html($(".dialogHeader h1", dialog).text()); }, start:function(dialog,event){ this._init(dialog); var sh = $("#dialogProxy"); sh.css({ left: dialog.css("left"), top: dialog.css("top"), height: dialog.css("height"), width: dialog.css("width"), zIndex:parseInt(dialog.css("zIndex")) + 1 }).show(); $("div.dialogContent",sh).css("height",$("div.dialogContent",dialog).css("height")); sh.data("dialog",dialog); dialog.css({left:"-10000px",top:"-10000px"}); $(".shadow").hide(); $(sh).jDrag({ selector:".dialogHeader", stop: this.stop, event:event }); return false; }, stop:function(){ var sh = $(arguments[0]); var dialog = sh.data("dialog"); $(dialog).css({left:$(sh).css("left"),top:$(sh).css("top")}); $.pdialog.attachShadow(dialog); $(sh).hide(); } } })(jQuery); ================================================ FILE: js/dwz.drag.js ================================================ /** * @author Roger Wu */ (function($){ $.scrollPosParents = function(el){ var $el = $(el); // var scrollPos = {top:$el.scrollTop(), left:$el.scrollLeft()}; var scrollPos = {top:0, left:0}; $el.parents().each(function(){ var $p = $(this); scrollPos.top += $p.scrollTop(); scrollPos.left += $p.scrollLeft(); }); return scrollPos; }; $.fn.jDrag = function(options){ if (typeof options == 'string') { if (options == 'destroy') return this.each(function(){ $(this).unbind('mousedown', $.rwdrag.start); $.data(this, 'pp-rwdrag', null); }); } return this.each(function(){ var el = $(this); $.data($.rwdrag, 'pp-rwdrag', { options: $.extend({ el: el, obj: el }, options) }); if (options.event) $.rwdrag.start(options.event); else { var select = options.selector; $(select, obj).bind('mousedown', $.rwdrag.start); } }); }; $.rwdrag = { start: function(e){ document.onselectstart=function(e){return false};//禁止选择 var data = $.data(this, 'pp-rwdrag'); var el = data.options.el[0]; $.data(el, 'pp-rwdrag', { options: data.options }); if (!$.rwdrag.current) { $.rwdrag.current = { el: el, oleft: parseInt(el.style.left) || 0, otop: parseInt(el.style.top) || 0, ox: e.pageX || e.screenX, oy: e.pageY || e.screenY }; $(document).bind("mouseup", $.rwdrag.stop).bind("mousemove", $.rwdrag.drag); } }, drag: function(e){ if (!e) var e = window.event; var current = $.rwdrag.current; var data = $.data(current.el, 'pp-rwdrag'); var left = (current.oleft + (e.pageX || e.clientX) - current.ox); var top = (current.otop + (e.pageY || e.clientY) - current.oy); if (top < 1) top = 0; if (data.options.move == 'horizontal') { if ((data.options.minW && left >= $(data.options.obj).cssv("left") + data.options.minW) && (data.options.maxW && left <= $(data.options.obj).cssv("left") + data.options.maxW)) current.el.style.left = left + 'px'; else if (data.options.scop) { if (data.options.relObj) { if ((left - parseInt(data.options.relObj.style.left)) > data.options.cellMinW) { current.el.style.left = left + 'px'; } } else current.el.style.left = left + 'px'; } } else if (data.options.move == 'vertical') { current.el.style.top = top + 'px'; } else { var selector = data.options.selector ? $(data.options.selector, data.options.obj) : $(data.options.obj); // if (left >= -selector.outerWidth() * 2 / 3 && top >= 0 && (left + selector.outerWidth() / 3 < $(window).width()) && (top + selector.outerHeight() < $(window).height())) { //浏览器缩放后有bug,先注释掉 current.el.style.left = left + 'px'; current.el.style.top = top + 'px'; // } } if (data.options.drag) { data.options.drag.apply(current.el, [current.el, e]); } return $.rwdrag.preventEvent(e); }, stop: function(e){ var current = $.rwdrag.current; var data = $.data(current.el, 'pp-rwdrag'); $(document).unbind('mousemove', $.rwdrag.drag).unbind('mouseup', $.rwdrag.stop); if (data.options.stop) { data.options.stop.apply(current.el, [current.el, e]); } $.rwdrag.current = null; document.onselectstart=function(e){return true};//启用选择 return $.rwdrag.preventEvent(e); }, preventEvent:function(e){ if (e.stopPropagation) e.stopPropagation(); if (e.preventDefault) e.preventDefault(); return false; } }; })(jQuery); ================================================ FILE: js/dwz.effects.js ================================================ /** * @author Roger Wu */ (function($){ $.extend($.fn, { jBlindUp: function(options){ var op = $.extend({duration: 500, easing: "swing", call: function(){}}, options); return this.each(function(){ var $this = $(this); $(this).animate({height: 0}, { step: function(){}, duration: op.duration, easing: op.easing, complete: function(){ $this.css({display: "none"}); op.call(); } }); }); }, jBlindDown: function(options){ var op = $.extend({to:0, duration: 500,easing: "swing",call: function(){}}, options); return this.each(function(){ var $this = $(this); var fixedPanelHeight = (op.to > 0)?op.to:$.effect.getDimensions($this[0]).height; $this.animate({height: fixedPanelHeight}, { step: function(){}, duration: op.duration, easing: op.easing, complete: function(){ $this.css({display: ""}); op.call(); } }); }); }, jSlideUp:function(options) { var op = $.extend({to:0, duration: 500,easing: "swing",call: function(){}}, options); return this.each(function(){ var $this = $(this); $this.wrapInner("
    "); var fixedHeight = (op.to > 0)?op.to:$.effect.getDimensions($(">div",$this)[0]).height; $this.css({overflow:"visible",position:"relative"}); $(">div",$this).css({position:"relative"}).animate({top: -fixedHeight}, { easing: op.easing, duration: op.duration, complete:function(){$this.html($(this).html());} }); }); }, jSlideDown:function(options) { var op = $.extend({to:0, duration: 500,easing: "swing",call: function(){}}, options); return this.each(function(){ var $this = $(this); var fixedHeight = (op.to > 0)?op.to:$.effect.getDimensions($this[0]).height; $this.wrapInner("
    "); $this.css({overflow:"visible",position:"relative", height:"0px"}) .animate({height: fixedHeight}, { duration: op.duration, easing: op.easing, complete: function(){ $this.css({display: "", overflow:""}); op.call(); } }); $(">div",$this).css({position:"relative"}).animate({top: 0}, { easing: op.easing, duration: op.duration, complete:function(){$this.html($(this).html());} }); }); } }); $.effect = { getDimensions: function(element, displayElement){ var dimensions = new $.effect.Rectangle; var displayOrig = $(element).css('display'); var visibilityOrig = $(element).css('visibility'); var isZero = $(element).height()==0?true:false; if ($(element).is(":hidden")) { $(element).css({visibility: 'hidden', display: 'block'}); if(isZero)$(element).css("height",""); // if ($.browser.opera) refElement.focus(); } dimensions.height = $(element).outerHeight(); dimensions.width = $(element).outerWidth(); if (displayOrig == 'none'){ $(element).css({visibility: visibilityOrig, display: 'none'}); if(isZero) if(isZero)$(element).css("height","0px"); } return dimensions; } } $.effect.Rectangle = function(){ this.width = 0; this.height = 0; this.unit = "px"; } $.extend(DWZ, { _randomColorFactor:function() { //return Math.round(Math.random() * 255); return Math.round(Math.random() * 223); }, randomColor:function(opacity) { return 'rgba(' + this._randomColorFactor() + ',' + this._randomColorFactor() + ',' + this._randomColorFactor() + ',' + (opacity || '.3') + ')'; } }); })(jQuery); ================================================ FILE: js/dwz.file.js ================================================ /** * Created by huihuazhang on 2016/4/27. * 基于HTML5 文件上传的核心脚本 * http://www.w3.org/TR/html-markup/input.file.html */ (function($){ function readAsDataURL(img, file, maxW, maxH){ // Using FileReader to display the image content var reader = new FileReader(); reader.onload = (function(aImg) { return function(e) { aImg.src = e.target.result; var width = aImg.naturalWidth, height = aImg.naturalHeight; aImg.setAttribute('data-width', width); aImg.setAttribute('data-height', height); if (maxW && maxH) { if (width/maxW > height/maxH) { aImg.setAttribute('height', maxH); } else { aImg.setAttribute('width', maxW); } } }; })(img); reader.readAsDataURL(file); } function previewUploadImg($uploadWrap, files, maxW, maxH) { var $previewElem = $('
    ').appendTo($uploadWrap); var file = files[0]; if (!file) {return false;} if (!file.type.match(/image.*/)) { throw "File Type must be an image"; } var img = document.createElement("img"); img.file = file; $previewElem.empty().append(img); // if ($previewElem.find('.edit-icon').length == 0) { // $previewElem.append(''); // } if ($previewElem.find('.del-icon').length == 0) { $('').appendTo($previewElem).click(function(event){ $previewElem.remove(); $uploadWrap.find('input[type=file]').val(''); }); } readAsDataURL(img, file, maxW, maxH); } // multiple function previewUploadImg2($uploadWrap, files, maxW, maxH) { var rel = $uploadWrap.attr('rel'); var $previewElem = $(rel); $previewElem.empty(); for (var index=0; index'); var img = document.createElement("img"); img.file = file; $thumb.append(img); $previewElem.append($thumb); readAsDataURL(img, file, maxW, maxH); } } $.fn.extend({ /** * 选择上传图片缩略图列表预览 * @param options */ previewUploadImg: function(options){ var op = $.extend({maxW:80, maxH:80}, options); return this.each(function(){ var $uploadWrap = $(this); var $inputFiles = $uploadWrap.find('input[type=file]'); $inputFiles.each(function(index){ var $inputFile = $(this).css({left:(op.maxW*index)+'px'}); $inputFile.on('change', function () { var files = this.files; if (this.multiple) { previewUploadImg2($uploadWrap, files, op.maxW, op.maxH); } else { previewUploadImg($uploadWrap, files, op.maxW, op.maxH); } }); }); var $delIcon = $uploadWrap.find('.del-icon'); if ($delIcon) { // 删除服务器上的图片 $delIcon.click(function(event){ $.ajax({ type: 'GET', url:$delIcon.attr('href'), dataType:"json", cache: false, success: function(json){ DWZ.ajaxDone(json); if (json[DWZ.keys.statusCode] == DWZ.statusCode.ok){ $uploadWrap.find('div.thumbnail').remove(); $uploadWrap.find('input[type=file]').val(''); } }, error: DWZ.ajaxError }); return false; }); } }); } }); DWZ.regPlugins.push(function($p){ $("div.upload-wrap", $p).previewUploadImg(); }); })(jQuery); ================================================ FILE: js/dwz.history.js ================================================ /** * jQuery ajax history plugins * @author 张慧华 z@j-ui.com */ (function($){ $.extend({ History: { _hash: new Array(), _cont: undefined, _currentHash: "", _callback: undefined, init: function(cont, callback){ $.History._cont = cont; $.History._callback = callback; var current_hash = location.hash.replace(/\?.*$/, ''); $.History._currentHash = current_hash; if (/msie/.test(navigator.userAgent.toLowerCase())) { if ($.History._currentHash == '') { $.History._currentHash = '#'; } $("body").append(''); var ihistory = $("#jQuery_history")[0]; var iframe = ihistory.contentDocument || ihistory.contentWindow.document; iframe.open(); iframe.close(); iframe.location.hash = current_hash; } if ($.isFunction(this._callback)) $.History._callback(current_hash.skipChar("#")); setInterval($.History._historyCheck, 100); }, _historyCheck: function(){ var current_hash = ""; if (/msie/.test(navigator.userAgent.toLowerCase())) { var ihistory = $("#jQuery_history")[0]; var iframe = ihistory.contentWindow; current_hash = iframe.location.hash.skipChar("#").replace(/\?.*$/, ''); } else { current_hash = location.hash.skipChar('#').replace(/\?.*$/, ''); } // if (!current_hash) { // if (current_hash != $.History._currentHash) { // $.History._currentHash = current_hash; // //TODO // } // } else { if (current_hash != $.History._currentHash) { $.History._currentHash = current_hash; $.History.loadHistory(current_hash); } // } }, addHistory: function(hash, fun, args){ $.History._currentHash = hash; var history = [hash, fun, args]; $.History._hash.push(history); if (/msie/.test(navigator.userAgent.toLowerCase())) { var ihistory = $("#jQuery_history")[0]; var iframe = ihistory.contentDocument || ihistory.contentWindow.document; iframe.open(); iframe.close(); iframe.location.hash = hash.replace(/\?.*$/, ''); location.hash = hash.replace(/\?.*$/, ''); } else { location.hash = hash.replace(/\?.*$/, ''); } }, loadHistory: function(hash){ if (/msie/.test(navigator.userAgent.toLowerCase())) { location.hash = hash; } for (var i = 0; i < $.History._hash.length; i += 1) { if ($.History._hash[i][0] == hash) { $.History._hash[i][1]($.History._hash[i][2]); return; } } } } }); })(jQuery); ================================================ FILE: js/dwz.miscDrag.js ================================================ /** * @author 张慧华 z@j-ui.com */ (function ($) { DWZ.miscDrag = { start: function ($sortBox, $item, event, op) { var $helper = $item.clone(); var position = $item.position(); $helper.addClass('sortDragHelper').css({ position: 'absolute', top: position.top + $sortBox.scrollTop(), left: position.left, zIndex: op.zIndex, minWidth: $item.width() + 'px', height: $item.height() + 'px' }).jDrag({ drag: this.drag, stop: this.stop, event: event }); $helper.data('$sortBox', $sortBox); $item.before($helper); return false; }, drag: function (el, event) { }, stop: function (el, event) { var $helper = $(arguments[0]), $sortBox = $helper.data('$sortBox'), $overBox = DWZ.miscDrag._getOverSortBox($sortBox.find($sortBox.attr('drag-rel')), $helper); if ($overBox.length > 0) { //移动到指定容器 var $dragBox = $helper.appendTo($overBox).mousedown(function (event) { $(this).jDrag({event: event}); }); var txt = $dragBox.html(), icon = $dragBox.attr('data-icon'), sn = $dragBox.attr('data-sn'), sequence = $overBox.find('> div').length; var overBoxPos = $overBox.position(), dragBoxPos = $dragBox.position(); var content = icon ? '' : txt; $dragBox.attr('data-sequence', sequence).html('

    ' + sequence + '

    ' + content).css({ height: 'auto', top: (dragBoxPos.top - overBoxPos.top) + 'px', left: (dragBoxPos.left - overBoxPos.left) + 'px' }); var rel = $sortBox.attr('rel'); if (rel) { $('

    ' + sequence + '

    ').appendTo(rel); } } else { $helper.remove(); } }, _getOverSortBox: function ($sortBox, $item) { var itemPos = $item.offset(); var y = itemPos.top + ($item.height() / 2), x = itemPos.left + ($item.width() / 2); return $sortBox.filter(':visible').filter(function () { var $sortBox = $(this), sortBoxPos = $sortBox.offset(), sortBoxH = $sortBox.height(), sortBoxW = $sortBox.width(); return DWZ.isOver(y, x, sortBoxPos.top, sortBoxPos.left, sortBoxH, sortBoxW); }); }, _createPlaceholder: function ($item) { return $('<' + $item[0].nodeName + ' class="sortDragPlaceholder"/>').css({ // width:$item.outerWidth()+'px', height: $item.outerHeight() + 'px', marginTop: $item.css('marginTop'), marginRight: $item.css('marginRight'), marginBottom: $item.css('marginBottom'), marginLeft: $item.css('marginLeft') }); }, startSortDrag: function ($sortBox, $item, event, op) { var $placeholder = this._createPlaceholder($item); var $helper = $item.clone(); var position = $item.position(); $helper.data('$sortBox', $sortBox).data('op', op).data('$item', $item).data('$placeholder', $placeholder); $helper.addClass('sortDragHelper').css({ position: 'absolute', top: position.top + $sortBox.scrollTop(), left: position.left, zIndex: op.zIndex, width: $item.width() + 'px', height: $item.height() + 'px' }).jDrag({ drag: this.dragSortDrag, stop: this.stopSortDrag, event: event }); $item.before($helper).before($placeholder); return false; }, dragSortDrag: function (el, event) { var $helper = $(arguments[0]), $sortBox = $helper.data('$sortBox'), $placeholder = $helper.data('$placeholder'); // 修复出现滚动条拖拽位置 var $unitBox = $helper.parents(".unitBox:first"), position = $helper.position(); $helper.css({ top: position.top + $unitBox.scrollTop() }); var $dragList = $($sortBox.attr('drag-rel')); for (var i = 0; i < $dragList.length; i++) { var $overBox = DWZ.miscDrag._getOverSortBox($dragList.eq(i), $helper); if ($overBox.length > 0 && $overBox[0] != $sortBox[0]) { //移动到其他容器 $placeholder.appendTo($overBox); } } }, stopSortDrag: function () { var $helper = $(arguments[0]), $sortBox = $helper.data('$sortBox'), $placeholder = $helper.data('$placeholder'), $item = $helper.data('$item'); if ($placeholder && $placeholder.is(':visible')) { //复制到目标容器 var $destBox = $placeholder.parents(".sortDrag:first"); //var html = $helper.html()+'×'; var html = $helper.html(); $destBox.append('
    ' + html + '
    '); $placeholder.remove(); $helper.remove(); if ($sortBox.attr('data-duplicate') != 1) { $item.remove(); } //从新绑定sortDrag if ($.fn.sortDrag) $destBox.sortDrag({refresh: true}); } else { $placeholder.remove(); $helper.remove(); } } }; $.fn.extend({ miscDrag: function (options) { var op = $.extend({ cursor: 'move', // selector 的鼠标手势 sortBoxs: 'div.miscDrag', //拖动排序项父容器 replace: false, //2个sortBox之间拖动替换 items: '> dt .dragBox', //拖动排序项选择器 zIndex: 1000 }, options); return this.each(function () { var $box = $(this); $box.find(op.items).each(function (i) { var $item = $(this); $item.mousedown(function (event) { DWZ.miscDrag.start($box, $item, event, op); event.preventDefault(); }); }); }); }, miscDragData: function () { var $miscDrag = $(this), $miscSortDrag = $($miscDrag.attr('rel')), $dragBoxList = $miscDrag.find('dd .dragBox'), $sortDragList = $miscSortDrag.find('.sortDrag'); var data = []; for (var i = 0; i < $dragBoxList.length; i++) { var $dragBox = $dragBoxList.eq(i), $sortDrag = $sortDragList.eq(i), $dragBoxPos = $dragBox.position(); var dataItem = { sn: $dragBox.attr('data-sn'), sequence: $dragBox.attr('data-sequence'), top: parseInt($dragBoxPos.top), left: parseInt($dragBoxPos.left), items: [] }; $sortDrag.find('.dragItem').each(function (index) { var $dragItem = $(this), $dragItemPos = $dragItem.position(); dataItem.items.push({ sn: $dragItem.attr('data-sn'), sequence: index + 1 }); }); data.push(dataItem) } return data; }, miscSortDragData: function () { var $miscSortDrag = $(this), $sortDragList = $miscSortDrag.find('.sortDrag'); var data = []; for (var i = 0; i < $sortDragList.length; i++) { var $sortDrag = $sortDragList.eq(i) var dataItem = { sn: $sortDrag.attr('data-sn'), name: $sortDrag.attr('data-name') || '', sequence: i + 1, items: [] }; $sortDrag.find('.dragItem').each(function (index) { var $dragItem = $(this); var itemData = { sn: $dragItem.attr('data-sn'), name: $dragItem.attr('data-name') || '', sequence: index + 1 }; $dragItem.find('.ctl-label :checkbox').each(function () { var $lable = $(this), lableName = $lable.attr('name'); if (lableName) { itemData[lableName] = $lable.is(":checked"); } }); dataItem.items.push(itemData); }); data.push(dataItem); } return data; }, miscSortDrag: function (options) { var op = $.extend({ cursor: 'move', // selector 的鼠标手势 sortBoxs: 'dl.miscSortDrag', //拖动排序项父容器 replace: false, //2个sortBox之间拖动替换 items: '> dt .dragItem', //拖动排序项选择器 zIndex: 1000 }, options); return this.each(function () { var $sortBox = $(this); $sortBox.find(op.items).each(function (i) { var $item = $(this); $item.mousedown(function (event) { DWZ.miscDrag.startSortDrag($sortBox, $item, event, op); event.preventDefault(); }); }); }); } }); })(jQuery); ================================================ FILE: js/dwz.navTab.js ================================================ /** * @author 张慧华 z@j-ui.com * */ var navTab = { componentBox: null, // tab component. contain tabBox, prevBut, nextBut, panelBox _tabBox: null, _prevBut: null, _nextBut: null, _panelBox: null, _moreBut:null, _moreBox:null, _currentIndex: 0, _op: {id:"navTab", stTabBox:".navTab-tab", stPanelBox:".navTab-panel", mainTabId:"main", close$:"a.close", prevClass:"tabsLeft", nextClass:"tabsRight", stMore:".tabsMore", stMoreLi:"ul.tabsMoreList"}, init: function(options){ if ($.History) $.History.init("#container"); var $this = this; $.extend(this._op, options); this.componentBox = $("#"+this._op.id); this._tabBox = this.componentBox.find(this._op.stTabBox); this._panelBox = this.componentBox.find(this._op.stPanelBox); this._prevBut = this.componentBox.find("."+this._op.prevClass); this._nextBut = this.componentBox.find("."+this._op.nextClass); this._moreBut = this.componentBox.find(this._op.stMore); this._moreBox = this.componentBox.find(this._op.stMoreLi); this._prevBut.click(function(event) {$this._scrollPrev()}); this._nextBut.click(function(event) {$this._scrollNext()}); this._moreBut.click(function(){ $this._moreBox.show(); return false; }); $(document).click(function(){$this._moreBox.hide()}); this._contextmenu(this._tabBox); this._contextmenu(this._getTabs()); this._init(); this._ctrlScrollBut(); }, _init: function(){ var $this = this; this._getTabs().each(function(iTabIndex){ $(this).unbind("click").click(function(event){ $this._switchTab(iTabIndex); }); $(this).find(navTab._op.close$).unbind("click").click(function(){ $this._closeTab(iTabIndex); }); }); this._getMoreLi().each(function(iTabIndex){ $(this).find(">a").unbind("click").click(function(event){ $this._switchTab(iTabIndex); }); }); this._switchTab(this._currentIndex); }, _contextmenu:function($obj){ // navTab右键菜单 var $this = this; $obj.contextMenu('navTabCM', { bindings:{ reload:function(t,m){ $this._reload(t, true); }, closeCurrent:function(t,m){ var tabId = t.attr("tabid"); if (tabId) $this.closeTab(tabId); else $this.closeCurrentTab(); }, closeOther:function(t,m){ var index = $this._indexTabId(t.attr("tabid")); $this._closeOtherTab(index > 0 ? index : $this._currentIndex); }, closeAll:function(t,m){ $this.closeAllTab(); } }, ctrSub:function(t,m){ var mReload = m.find("[rel='reload']"); var mCur = m.find("[rel='closeCurrent']"); var mOther = m.find("[rel='closeOther']"); var mAll = m.find("[rel='closeAll']"); var $tabLi = $this._getTabs(); if ($tabLi.length < 2) { mCur.addClass("disabled"); mOther.addClass("disabled"); mAll.addClass("disabled"); } if ($this._currentIndex == 0 || t.attr("tabid") == $this._op.mainTabId) { mCur.addClass("disabled"); mReload.addClass("disabled"); } else if ($tabLi.length == 2) { mOther.addClass("disabled"); } } }); }, _getTabs: function(){ return this._tabBox.find("> li"); }, _getPanels: function(){ return this._panelBox.find("> div"); }, _getMoreLi: function(){ return this._moreBox.find("> li"); }, _getTab: function(tabid){ var index = this._indexTabId(tabid); if (index >= 0) return this._getTabs().eq(index); }, getPanel: function(tabid){ var index = this._indexTabId(tabid); if (index >= 0) return this._getPanels().eq(index); }, _getTabsW: function(iStart, iEnd){ return this._tabsW(this._getTabs().slice(iStart, iEnd)); }, _tabsW:function($tabs){ var iW = 0; $tabs.each(function(){ iW += $(this).outerWidth(true); }); return iW; }, _indexTabId: function(tabid){ if (!tabid) return -1; var iOpenIndex = -1; this._getTabs().each(function(index){ if ($(this).attr("tabid") == tabid){iOpenIndex = index; return;} }); return iOpenIndex; }, _getLeft: function(){ return this._tabBox.position().left; }, _getScrollBarW: function(){ return this.componentBox.width()-55; }, _visibleStart: function(){ var iLeft = this._getLeft(), iW = 0; var $tabs = this._getTabs(); for (var i=0; i<$tabs.length; i++){ if (iW + iLeft >= 0) return i; iW += $tabs.eq(i).outerWidth(true); } return 0; }, _visibleEnd: function(){ var iLeft = this._getLeft(), iW = 0; var $tabs = this._getTabs(); for (var i=0; i<$tabs.length; i++){ iW += $tabs.eq(i).outerWidth(true); if (iW + iLeft > this._getScrollBarW()) return i; } return $tabs.length; }, _scrollPrev: function(){ var iStart = this._visibleStart(); if (iStart > 0){ this._scrollTab(-this._getTabsW(0, iStart-1)); } }, _scrollNext: function(){ var iEnd = this._visibleEnd(); if (iEnd < this._getTabs().length){ this._scrollTab(-this._getTabsW(0, iEnd+1) + this._getScrollBarW()); } }, _scrollTab: function(iLeft, isNext){ var $this = this; this._tabBox.animate({ left: iLeft+'px' }, 200, function(){$this._ctrlScrollBut();}); }, _scrollCurrent: function(){ // auto scroll current tab var iW = this._tabsW(this._getTabs()); if (iW <= this._getScrollBarW()){ this._scrollTab(0); } else if (this._getLeft() < this._getScrollBarW() - iW){ this._scrollTab(this._getScrollBarW()-iW); } else if (this._currentIndex < this._visibleStart()) { this._scrollTab(-this._getTabsW(0, this._currentIndex)); } else if (this._currentIndex >= this._visibleEnd()) { this._scrollTab(this._getScrollBarW() - this._getTabs().eq(this._currentIndex).outerWidth(true) - this._getTabsW(0, this._currentIndex)); } }, _ctrlScrollBut: function(){ var iW = this._tabsW(this._getTabs()); if (this._getScrollBarW() > iW){ this._prevBut.hide(); this._nextBut.hide(); this._tabBox.parent().removeClass("tabsPageHeaderMargin"); } else { this._prevBut.show().removeClass("tabsLeftDisabled"); this._nextBut.show().removeClass("tabsRightDisabled"); this._tabBox.parent().addClass("tabsPageHeaderMargin"); if (this._getLeft() >= 0){ this._prevBut.addClass("tabsLeftDisabled"); } else if (this._getLeft() <= this._getScrollBarW() - iW) { this._nextBut.addClass("tabsRightDisabled"); } } }, _switchTab: function(iTabIndex){ var $tab = this._getTabs().removeClass("selected").eq(iTabIndex).addClass("selected"); if (DWZ.ui.hideMode == 'offsets') { this._getPanels().css({position: 'absolute', top:'-100000px', left:'-100000px'}).eq(iTabIndex).css({position: '', top:'', left:''}); } else { this._getPanels().hide().eq(iTabIndex).show(); } this._getMoreLi().removeClass("selected").eq(iTabIndex).addClass("selected"); this._currentIndex = iTabIndex; this._scrollCurrent(); this._reload($tab); }, _closeTab: function(index, openTabid){ this._getTabs().eq(index).remove(); this._getPanels().eq(index).trigger(DWZ.eventType.pageClear).remove(); this._getMoreLi().eq(index).remove(); if (this._currentIndex >= index) this._currentIndex--; if (openTabid) { var openIndex = this._indexTabId(openTabid); if (openIndex > 0) this._currentIndex = openIndex; } this._init(); this._scrollCurrent(); this._reload(this._getTabs().eq(this._currentIndex)); }, closeTab: function(tabid){ var index = this._indexTabId(tabid); if (index > 0) { this._closeTab(index); } }, closeCurrentTab: function(openTabid){ //openTabid 可以为空,默认关闭当前tab后,打开最后一个tab if (this._currentIndex > 0) {this._closeTab(this._currentIndex, openTabid);} }, closeAllTab: function(){ this._getTabs().filter(":gt(0)").remove(); this._getPanels().filter(":gt(0)").trigger(DWZ.eventType.pageClear).remove(); this._getMoreLi().filter(":gt(0)").remove(); this._currentIndex = 0; this._init(); this._scrollCurrent(); }, _closeOtherTab: function(index){ index = index || this._currentIndex; if (index > 0) { var str$ = ":eq("+index+")"; this._getTabs().not(str$).filter(":gt(0)").remove(); this._getPanels().not(str$).filter(":gt(0)").trigger(DWZ.eventType.pageClear).remove(); this._getMoreLi().not(str$).filter(":gt(0)").remove(); this._currentIndex = 1; this._init(); this._scrollCurrent(); } else { this.closeAllTab(); } }, _loadUrlCallback: function($panel){ $panel.find("[layoutH]").layoutH(); $panel.find(":button.close").click(function(){ navTab.closeCurrentTab(); }); }, _reload: function($tab, flag){ flag = flag || $tab.data("reloadFlag"); var url = $tab.attr("url"); if (flag && url) { $tab.data("reloadFlag", null); var $panel = this.getPanel($tab.attr("tabid")); if ($tab.hasClass("external")){ navTab.openExternal(url, $panel); } else { //获取pagerForm参数 var $pagerForm = $("#pagerForm", $panel); var args = $pagerForm.length>0 ? $pagerForm.serializeArray() : {}; $panel.ajaxUrl({ type:"POST", url:url, data:args, callback:function(response){ navTab._loadUrlCallback($panel); } }); } } }, reloadFlag: function(tabid){ var $tab = this._getTab(tabid); if ($tab){ if (this._indexTabId(tabid) == this._currentIndex) this._reload($tab, true); else $tab.data("reloadFlag", 1); } }, reload: function(url, options){ var op = $.extend({data:{}, navTabId:"", callback:null}, options); var $tab = op.navTabId ? this._getTab(op.navTabId) : this._getTabs().eq(this._currentIndex); var $panel = op.navTabId ? this.getPanel(op.navTabId) : this._getPanels().eq(this._currentIndex); if ($panel){ if (!url) { url = $tab.attr("url"); } if (url) { if ($tab.hasClass("external")) { navTab.openExternal(url, $panel); } else { if ($.isEmptyObject(op.data)) { //获取pagerForm参数 var $pagerForm = $("#pagerForm", $panel); op.data = $pagerForm.length>0 ? $pagerForm.serializeArray() : {} } $panel.ajaxUrl({ type:"POST", url:url, data:op.data, callback:function(response){ navTab._loadUrlCallback($panel); if ($.isFunction(op.callback)) op.callback(response); } }); } } } }, getCurrentPanel: function() { return this._getPanels().eq(this._currentIndex); }, checkCloseCurrent:function(json){ if (!json) return; if (json[DWZ.keys.statusCode] == DWZ.statusCode.timeout || (json[DWZ.keys.statusCode] == DWZ.statusCode.error && "closeCurrentNavTab" == json.callbackType) ) { this.closeCurrentTab(); } }, openExternal:function(url, $panel){ var ih = navTab._panelBox.height(); $panel.html(DWZ.frag["externalFrag"].replaceAll("{url}", url).replaceAll("{height}", ih+"px")); }, /** * * @param {Object} tabid * @param {Object} url * @param {Object} params: title, data, fresh */ openTab: function(tabid, url, options){ //if found tabid replace tab, else create a new tab. var op = $.extend({title:"New Tab", type:"GET", data:{}, fresh:true, external:false}, options); var iOpenIndex = this._indexTabId(tabid); if (iOpenIndex >= 0){ var $tab = this._getTabs().eq(iOpenIndex); var span$ = $tab.attr("tabid") == this._op.mainTabId ? "> span > span" : "> span"; $tab.find(">a").attr("title", op.title).find(span$).html(op.title); var $panel = this._getPanels().eq(iOpenIndex); if(url && (op.fresh || $tab.attr("url") != url)) { $tab.attr("url", url); if (op.external || url.isExternalUrl()) { $tab.addClass("external"); navTab.openExternal(url, $panel); } else { $tab.removeClass("external"); $panel.ajaxUrl({ type:op.type, url:url, data:op.data, callback:function(){ navTab._loadUrlCallback($panel); } }); } } this._currentIndex = iOpenIndex; } else { var tabFrag = '
  • #title#close
  • '; this._tabBox.append(tabFrag.replaceAll("#tabid#", tabid).replaceAll("#title#", op.title)); this._panelBox.append('
    '); this._moreBox.append('
  • #title#
  • '.replaceAll("#title#", op.title)); var $tabs = this._getTabs(); var $tab = $tabs.filter(":last"); var $panel = this._getPanels().filter(":last"); if(url) { if (op.external || url.isExternalUrl()) { $tab.addClass("external"); navTab.openExternal(url, $panel); } else { $tab.removeClass("external"); $panel.ajaxUrl({ type: op.type, url: url, data: op.data, callback: function () { navTab._loadUrlCallback($panel); } }); } } if ($.History) { setTimeout(function(){ $.History.addHistory(tabid, function(tabid){ var i = navTab._indexTabId(tabid); if (i >= 0) navTab._switchTab(i); }, tabid); }, 10); } this._currentIndex = $tabs.length - 1; this._contextmenu($tabs.filter(":last").hoverClass("hover")); } this._init(); this._scrollCurrent(); this._getTabs().eq(this._currentIndex).attr("url", url); } }; ================================================ FILE: js/dwz.pagination.js ================================================ /** * * @author 张慧华 z@j-ui.com * @param {Object} opts Several options */ (function($){ $.fn.extend({ pagination: function(opts){ var setting = { first$:"li.j-first", prev$:"li.j-prev", next$:"li.j-next", last$:"li.j-last", nums$:"li.j-num>a", jumpto$:"li.jumpto", pageNumFrag:'
  • #pageNum#
  • ' }; return this.each(function(){ var $this = $(this); var pc = new Pagination(opts); var interval = pc.getInterval(); var pageNumFrag = ''; for (var i=interval.start; ispan").hide(); _bindEvent($prev, pc.getCurrentPage()-1, pc.targetType(), pc.rel()); _bindEvent($first, 1, pc.targetType(), pc.rel()); } else { $first.add($prev).addClass("disabled").find(">a").hide(); } if (pc.hasNext()) { $next.add($last).find(">span").hide(); _bindEvent($next, pc.getCurrentPage()+1, pc.targetType(), pc.rel()); _bindEvent($last, pc.numPages(), pc.targetType(), pc.rel()); } else { $next.add($last).addClass("disabled").find(">a").hide(); } $this.find(setting.nums$).each(function(i){ _bindEvent($(this), i+interval.start, pc.targetType(), pc.rel()); }); $this.find(setting.jumpto$).each(function(){ var $this = $(this); var $inputBox = $this.find(":text"); var $button = $this.find(":button"); $button.click(function(event){ var pageNum = $inputBox.val(); if (pageNum && pageNum.isPositiveInteger()) { dwzPageBreak({targetType:pc.targetType(), rel:pc.rel(), data: {pageNum:pageNum}}); } }); $inputBox.keyup(function(event){ if (event.keyCode == DWZ.keyCode.ENTER) $button.click(); }); }); }); function _bindEvent($target, pageNum, targetType, rel){ $target.bind("click", {pageNum:pageNum}, function(event){ dwzPageBreak({targetType:targetType, rel:rel, data:{pageNum:event.data.pageNum}}); event.preventDefault(); }); } }, orderBy: function(options){ var op = $.extend({ targetType:"navTab", rel:"", asc:"asc", desc:"desc"}, options); return this.each(function(){ var $this = $(this).css({cursor:"pointer"}).click(function(){ var orderField = $this.attr("orderField"); var orderDirection = $this.hasClass(op.asc) ? op.desc : op.asc; dwzPageBreak({targetType:op.targetType, rel:op.rel, data:{orderField: orderField, orderDirection: orderDirection}}); }); }); }, pagerForm: function(options){ var op = $.extend({pagerForm$:"#pagerForm", parentBox:document}, options); var frag = ''; return this.each(function(){ var $searchForm = $(this), $pagerForm = $(op.pagerForm$, op.parentBox); var actionUrl = $pagerForm.attr("action").replaceAll("#rel#", $searchForm.attr("action")); $pagerForm.attr("action", actionUrl); $searchForm.find(":input").each(function(){ var $input = $(this), name = $input.attr("name"); if (name && (!$input.is(":checkbox,:radio") || $input.is(":checked"))){ if ($pagerForm.find(":input[name='"+name+"']").length == 0) { var inputFrag = frag.replaceAll("#name#", name).replaceAll("#value#", $input.val()); $pagerForm.append(inputFrag); } } }); }); } }); var Pagination = function(opts) { this.opts = $.extend({ targetType:"navTab", // navTab, dialog rel:"", //用于局部刷新div id号 totalCount:0, numPerPage:10, pageNumShown:10, currentPage:1, callback:function(){return false;} }, opts); } $.extend(Pagination.prototype, { targetType:function(){return this.opts.targetType}, rel:function(){return this.opts.rel}, numPages:function() { return Math.ceil(this.opts.totalCount/this.opts.numPerPage); }, getInterval:function(){ var ne_half = Math.ceil(this.opts.pageNumShown/2); var np = this.numPages(); var upper_limit = np - this.opts.pageNumShown; var start = this.getCurrentPage() > ne_half ? Math.max( Math.min(this.getCurrentPage() - ne_half, upper_limit), 0 ) : 0; var end = this.getCurrentPage() > ne_half ? Math.min(this.getCurrentPage()+ne_half, np) : Math.min(this.opts.pageNumShown, np); return {start:start+1, end:end+1}; }, getCurrentPage:function(){ var currentPage = parseInt(this.opts.currentPage); if (isNaN(currentPage)) return 1; return currentPage; }, hasPrev:function(){ return this.getCurrentPage() > 1; }, hasNext:function(){ return this.getCurrentPage() < this.numPages(); } }); })(jQuery); ================================================ FILE: js/dwz.panel.js ================================================ /** * @author Roger Wu * @version 1.0 */ (function($){ $.extend($.fn, { jPanel:function(options){ var op = $.extend({header:"panelHeader", headerC:"panelHeaderContent", content:"panelContent", coll:"collapsable", exp:"expandable", footer:"panelFooter", footerC:"panelFooterContent"}, options); return this.each(function(){ var $panel = $(this); var close = $panel.hasClass("close"); var collapse = $panel.hasClass("collapse"); var $content = $(">div", $panel).addClass(op.content); var title = $(">h1",$panel).wrap('
    '); if(collapse)$("").addClass(close?op.exp:op.coll).insertAfter(title); var header = $(">div:first", $panel); var footer = $('
    ').appendTo($panel); var defaultH = $panel.attr("defH")?$panel.attr("defH"):0; var minH = $panel.attr("minH")?$panel.attr("minH"):0; if (close) $content.css({ height: "0px", display: "none" }); else { if (defaultH > 0) $content.height(defaultH + "px"); else if(minH > 0){ $content.css("minHeight", minH+"px"); } } if(!collapse) return; var $pucker = $("a", header); var inH = $content.innerHeight() - 6; if(minH > 0 && minH >= inH) defaultH = minH; else defaultH = inH; $pucker.click(function(){ if($pucker.hasClass(op.exp)){ $content.jBlindDown({to:defaultH,call:function(){ $pucker.removeClass(op.exp).addClass(op.coll); if(minH > 0) $content.css("minHeight",minH+"px"); }}); } else { if(minH > 0) $content.css("minHeight",""); if(minH >= inH) $content.css("height", minH+"px"); $content.jBlindUp({call:function(){ $pucker.removeClass(op.coll).addClass(op.exp); }}); } return false; }); }); } }); })(jQuery); ================================================ FILE: js/dwz.print.js ================================================ /** * @author 张慧华 z@j-ui.com * */ (function($){ $.printBox = function(rel){ var _printBoxId = 'printBox'; var $contentBox = rel ? $('#'+rel) : $("body"), $printBox = $('#'+_printBoxId); if ($printBox.length==0){ $printBox = $('
    ').appendTo("body"); } $printBox.html($contentBox.html()).find("[layoutH]").height("auto"); window.print(); } })(jQuery); ================================================ FILE: js/dwz.regional.zh.js ================================================ /** * @author 张慧华 z@j-ui.com */ (function($){ // jQuery validate if ($.validator) { $.extend($.validator.messages, { required: "必填字段", remote: "请修正该字段", email: "请输入正确格式的电子邮件", url: "请输入合法的网址", date: "请输入合法的日期", dateISO: "请输入合法的日期 (ISO).", number: "请输入合法的数字", digits: "只能输入整数", creditcard: "请输入合法的信用卡号", equalTo: "请再次输入相同的值", accept: "请输入拥有合法后缀名的字符串", maxlength: $.validator.format("长度最多是 {0} 的字符串"), minlength: $.validator.format("长度最少是 {0} 的字符串"), rangelength: $.validator.format("长度介于 {0} 和 {1} 之间的字符串"), range: $.validator.format("请输入一个介于 {0} 和 {1} 之间的值"), max: $.validator.format("请输入一个最大为 {0} 的值"), min: $.validator.format("请输入一个最小为 {0} 的值"), alphanumeric: "字母、数字、下划线", lettersonly: "必须是字母", phone: "数字、空格、括号" }); } // DWZ regional $.setRegional("datepicker", { dayNames: ['日', '一', '二', '三', '四', '五', '六'], monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'] }); $.setRegional("alertMsg", { title:{error:"错误", info:"提示", warn:"警告", correct:"成功", confirm:"确认提示"}, butMsg:{ok:"确定", yes:"是", no:"否", cancel:"取消"} }); })(jQuery); ================================================ FILE: js/dwz.resize.js ================================================ /** * @author Roger Wu * @version 1.0 */ (function($){ $.fn.extend({jresize:function(options) { if (typeof options == 'string') { if (options == 'destroy') return this.each(function() { var dialog = this; $("div[class^='resizable']",dialog).each(function() { $(this).hide(); }); }); } return this.each(function(){ var dialog = $(this); var resizable = $(".resizable"); $("div[class^='resizable']",dialog).each(function() { var bar = this; $(bar).mousedown(function(event) { $.pdialog.switchDialog(dialog); $.resizeTool.start(resizable, dialog, event, $(bar).attr("tar")); return false; }).show(); }); }); }}); $.resizeTool = { start:function(resizable, dialog, e, target) { $.pdialog.initResize(resizable, dialog, target); $.data(resizable[0], 'layer-drag', { options: $.extend($.pdialog._op, {target:target, dialog:dialog,stop:$.resizeTool.stop}) }); $.layerdrag.start(resizable[0], e, $.pdialog._op); }, stop:function(){ var data = $.data(arguments[0], 'layer-drag'); $.pdialog.resizeDialog(arguments[0], data.options.dialog, data.options.target); $("body").css("cursor", ""); $(arguments[0]).hide(); } }; $.layerdrag = { start:function(obj, e, options) { if (!$.layerdrag.current) { $.layerdrag.current = { el: obj, oleft: parseInt(obj.style.left) || 0, owidth: parseInt(obj.style.width) || 0, otop: parseInt(obj.style.top) || 0, oheight:parseInt(obj.style.height) || 0, ox: e.pageX || e.screenX, oy: e.pageY || e.clientY }; $(document).bind('mouseup', $.layerdrag.stop); $(document).bind('mousemove', $.layerdrag.drag); } return $.layerdrag.preventEvent(e); }, drag: function(e) { if (!e) var e = window.event; var current = $.layerdrag.current; var data = $.data(current.el, 'layer-drag'); var lmove = (e.pageX || e.screenX) - current.ox; var tmove = (e.pageY || e.clientY) - current.oy; if((e.pageY || e.clientY) <= 0 || (e.pageY || e.clientY) >= ($(window).height() - $(".dialogHeader", $(data.options.dialog)).outerHeight())) return false; var target = data.options.target; var width = current.owidth; var height = current.oheight; if (target != "n" && target != "s") { width += (target.indexOf("w") >= 0)?-lmove:lmove; } if (width >= $.pdialog._op.minW) { if (target.indexOf("w") >= 0) { current.el.style.left = (current.oleft + lmove) + 'px'; } if (target != "n" && target != "s") { current.el.style.width = width + 'px'; } } if (target != "w" && target != "e") { height += (target.indexOf("n") >= 0)?-tmove:tmove; } if (height >= $.pdialog._op.minH) { if (target.indexOf("n") >= 0) { current.el.style.top = (current.otop + tmove) + 'px'; } if (target != "w" && target != "e") { current.el.style.height = height + 'px'; } } return $.layerdrag.preventEvent(e); }, stop: function(e) { var current = $.layerdrag.current; var data = $.data(current.el, 'layer-drag'); $(document).unbind('mousemove', $.layerdrag.drag); $(document).unbind('mouseup', $.layerdrag.stop); if (data.options.stop) { data.options.stop.apply(current.el, [ current.el ]); } $.layerdrag.current = null; return $.layerdrag.preventEvent(e); }, preventEvent:function(e) { if (e.stopPropagation) e.stopPropagation(); if (e.preventDefault) e.preventDefault(); return false; } }; })(jQuery); ================================================ FILE: js/dwz.scrollCenter.js ================================================ /** * @desc 兼容不同的浏览器居中scrollCenter * @author 张慧华 z@j-ui.com */ (function($){ $.fn.extend({ getWindowSize: function(){ if ($.browser.opera) { return { width: window.innerWidth, height: window.innerHeight }; } return { width: $(window).width(), height: $(window).height() }; }, /** * @param options */ scrollCenter: function(options){ // 扩展参数 var op = $.extend({ z: 1000000, mode:"WH"}, options); // 追加到 document.body 并设置其样式 var windowSize = this.getWindowSize(); return this.each(function(){ var $this = $(this).css({ 'position': 'absolute', 'z-index': op.z }); // 当前位置参数 var bodyScrollTop = $(document).scrollTop(); var bodyScrollLeft = $(document).scrollLeft(); var movedivTop = (windowSize.height - $this.height()) / 2 + bodyScrollTop; var movedivLeft = (windowSize.width - $this.width()) / 2 + bodyScrollLeft; if (op.mode == "W") { $this.appendTo(document.body).css({ 'left': movedivLeft + 'px' }); } else if (op.model == "H"){ $this.appendTo(document.body).css({ 'top': movedivTop + 'px' }); } else { $this.appendTo(document.body).css({ 'top': (windowSize.height - $this.height()) / 2 + $(window).scrollTop() + 'px', 'left': movedivLeft + 'px' }); } // 滚动事件 $(window).scroll(function(e){ var windowSize = $this.getWindowSize(); var tmpBodyScrollTop = $(document).scrollTop(); var tmpBodyScrollLeft = $(document).scrollLeft(); movedivTop += tmpBodyScrollTop - bodyScrollTop; movedivLeft += tmpBodyScrollLeft - bodyScrollLeft; bodyScrollTop = tmpBodyScrollTop; bodyScrollLeft = tmpBodyScrollLeft; // 以动画方式进行移动 if (op.mode == "W") { $this.stop().animate({ 'left': movedivLeft + 'px' }); } else if (op.mode == "H") { $this.stop().animate({ 'top': movedivTop + 'px' }); } else { $this.stop().animate({ 'top': movedivTop + 'px', 'left': movedivLeft + 'px' }); } }); // 窗口大小重设事件 $(window).resize(function(){ var windowSize = $this.getWindowSize(); movedivTop = (windowSize.height - $this.height()) / 2 + $(document).scrollTop(); movedivLeft = (windowSize.width - $this.width()) / 2 + $(document).scrollLeft(); if (op.mode == "W") { $this.stop().animate({ 'left': movedivLeft + 'px' }); } else if (op.mode == "H") { $this.stop().animate({ 'top': movedivTop + 'px' }); } else { $this.stop().animate({ 'top': movedivTop + 'px', 'left': movedivLeft + 'px' }); } }); }); } }); })(jQuery); ================================================ FILE: js/dwz.selectedLoad.js ================================================ /** * Created by huihuazhang on 16/4/9. */ (function($){ $.fn.extend({ selectedLoad: function(){ function _getIds(selectedIds, targetType){ var ids = ""; var $box = targetType == "dialog" ? $.pdialog.getCurrent() : navTab.getCurrentPanel(); $box.find("input:checked").filter("[name='"+selectedIds+"']").each(function(i){ var val = $(this).val(); ids += i==0 ? val : ","+val; }); return ids; } return this.each(function(){ var $this = $(this); var selectedIds = $this.attr("rel") || "ids"; var postType = $this.attr("postType") || "map"; $this.click(function(){ var targetType = $this.attr("targetType"); var ids = _getIds(selectedIds, targetType); if (!ids) { alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg")); return false; } function _doPost(){ var data = function(){ if (postType == 'map'){ return $.map(ids.split(','), function(val, i) { return {name: selectedIds, value: val}; }); } else { var _data = {}; _data[selectedIds] = ids; return _data; } }(); if (targetType == "dialog") { var options = { type:'POST', mask:true, width:$this.attr('width')||820, height:$this.attr('height')||400, maxable:true, resizable:true, data: data }; $.pdialog.open($this.attr('href'), "_blank", $this.attr("title") || $this.text(), options); } else if (targetType == "navTab") { navTab.openTab("_blank", $this.attr('href'),{type:'POST', title:$this.attr("title") || $this.text(), data:data}); } //var $form = $('
    ' // + '' // +'
    ').appendTo('body'); //$form.submit().remove(); } var title = $this.attr("title"); if (title) { alertMsg.confirm(title, {okCall: _doPost}); } else { _doPost(); } return false; }); }); } }); DWZ.regPlugins.push(function($p){ $("a[target=selectedLoad]", $p).selectedLoad(); }); })(jQuery); ================================================ FILE: js/dwz.sortDrag.js ================================================ /** * @author 张慧华 z@j-ui.com */ (function ($) { var _op = { cursor: 'move', // selector 的鼠标手势 sortBoxs: 'div.sortDrag', //拖动排序项父容器 replace: false, //2个sortBox之间拖动替换 items: '> div, >dl, >p', //拖动排序项选择器 selector: '', //拖动排序项用于拖动的子元素的选择器,为空时等于item zIndex: 1000 }; DWZ.sortDrag = { _onDrag: false, //用于判断重复绑定拖动事件 start: function ($sortBox, $item, event, op) { var me = this; if (me._onDrag) { setTimeout(function () { me._onDrag = false; }, 500); return false; } me._onDrag = true; var $placeholder = this._createPlaceholder($item); var $helper = $item.clone(); var position = $item.position(); var scrollPosParents = $.scrollPosParents($sortBox); $helper.data('$sortBox', $sortBox).data('op', op).data('$item', $item).data('$placeholder', $placeholder); $helper.addClass('sortDragHelper').css({ position: 'absolute', top: position.top + scrollPosParents.top, left: position.left, zIndex: op.zIndex, width: $item.width() + 'px', height: $item.height() + 'px' }).jDrag({ selector: op.selector, drag: this.drag, stop: this.stop, event: event }); $item.before($placeholder).before($helper).hide(); return false; }, drag: function (el, event) { var $helper = $(arguments[0]), $sortBox = $helper.data('$sortBox'), $placeholder = $helper.data('$placeholder'); var $items = $sortBox.find($helper.data('op')['items']).filter(':visible').filter(':not(.sortDragPlaceholder, .sortDragHelper)'); var helperPos = $helper.position(), firstPos = $items.eq(0).position(); var $overBox = DWZ.sortDrag._getOverSortBox($helper, event); if ($sortBox.attr('data-over-sort') == 'true' && $overBox.length > 0 && $overBox[0] != $sortBox[0]) { //移动到其他容器 $placeholder.appendTo($overBox); $helper.data('$sortBox', $overBox); } else { for (var i = 0; i < $items.length; i++) { var $this = $items.eq(i), position = $this.position(); if (helperPos.top > position.top + 10 || helperPos.left > position.left + 10) { $this.after($placeholder); } else if (helperPos.top <= position.top || helperPos.left <= position.left) { $this.before($placeholder); break; } } } }, stop: function () { var $helper = $(arguments[0]), $sortBox = $helper.data('$sortBox'), $item = $helper.data('$item'), $placeholder = $helper.data('$placeholder'); var op = $.extend({}, _op, $helper.data('op')); var scrollPosParents = $.scrollPosParents($sortBox); var position = $placeholder.position(); $helper.animate({ top: (position.top + scrollPosParents.top) + "px", left: position.left + "px" }, { complete: function () { if ($helper.data('op')['replace']) { //2个sortBox之间替换处理 var $srcBox = $item.parents(op.sortBoxs + ":first"); var $destBox = $placeholder.parents(op.sortBoxs + ":first"); if ($srcBox[0] != $destBox[0]) { //判断是否移动到其他容器中 var $replaceItem = $placeholder.next(); if ($replaceItem.length > 0) { $replaceItem.insertAfter($item); } } } $item.insertAfter($placeholder).show(); $placeholder.remove(); $helper.remove(); }, duration: 300 }); DWZ.sortDrag._onDrag = false; }, _createPlaceholder: function ($item) { return $('<' + $item[0].nodeName + ' class="sortDragPlaceholder"/>').css({ width: $item.outerWidth() + 'px', height: $item.outerHeight() + 'px', marginTop: $item.css('marginTop'), marginRight: $item.css('marginRight'), marginBottom: $item.css('marginBottom'), marginLeft: $item.css('marginLeft') }); }, _getOverSortBox: function ($item, e) { var itemPos = $item.position(), y = itemPos.top + ($item.height() / 2), x = itemPos.left + ($item.width() / 2); var op = $.extend({}, _op, $item.data('op')); return $(op.sortBoxs).filter(':visible').filter(function () { var $sortBox = $(this), sortBoxPos = $sortBox.position(), sortBoxH = $sortBox.height(), sortBoxW = $sortBox.width(); return DWZ.isOver(y, x, sortBoxPos.top, sortBoxPos.left, sortBoxH, sortBoxW); }); } }; $.fn.sortDrag = function (options) { return this.each(function () { var op = $.extend({}, _op, options); var $sortBox = $(this); if ($sortBox.attr('selector')) op.selector = $sortBox.attr('selector'); $sortBox.find(op.items).each(function (i) { var $item = $(this), $selector = $item; if (op.selector) { $selector = $item.find(op.selector).css({cursor: op.cursor}); } if (op.refresh) { $selector.unbind('mousedown'); } $selector.mousedown(function (event) { if (!$sortBox.hasClass('disabled')) { DWZ.sortDrag.start($sortBox, $item, event, op); event.preventDefault(); } }); }); $sortBox.find('.close').mousedown(function (event) { $(this).parent().remove(); return false; }); $sortBox.find('.ctl-label').mousedown(function (event) { return false; }); }); } })(jQuery); ================================================ FILE: js/dwz.stable.js ================================================ /** * @author Roger Wu v1.0 * @author ZhangHuihua@msn.com 2011-4-1 */ (function($){ $.fn.jTable = function(options){ return this.each(function(){ var $table = $(this), nowrapTD = $table.attr("nowrapTD"); var tlength = $table.width(); var aStyles = []; var $tc = $table.parent().addClass("j-resizeGrid"); // table parent container var layoutH = $(this).attr("layoutH"); var oldThs = $table.find("thead>tr:last-child").find("th"); for(var i = 0, l = oldThs.length; i < l; i++) { var $th = $(oldThs[i]); var style = [], width = $th.innerWidth() - (100 * $th.innerWidth() / tlength)-2; style[0] = parseInt(width); style[1] = $th.attr("align"); aStyles[aStyles.length] = style; } $(this).wrap("
    "); var $grid = $table.parent().html($table.html()); var thead = $grid.find("thead"); thead.wrap("
    "); var lastH = $(">tr:last-child", thead); var ths = $(">th", lastH); $("th",thead).each(function(){ var $th = $(this); $th.html("
    "+ $th.html() +"
    "); }); ths.each(function(i){ var $th = $(this), style = aStyles[i]; $th.addClass(style[1]).hoverClass("hover").removeAttr("align").removeAttr("width").width(style[0]); }).filter("[orderField]").orderBy({ targetType: $table.attr("targetType"), rel:$table.attr("rel"), asc: $table.attr("asc") || "asc", desc: $table.attr("desc") || "desc" }); var tbody = $grid.find(">tbody"); var layoutStr = layoutH ? " layoutH='" + layoutH + "'" : ""; tbody.wrap("
    "); var ftr = $(">tr:first-child", tbody); var $trs = tbody.find('>tr'); $trs.hoverClass().each(function(){ var $tr = $(this); var $ftds = $(">td", this); for (var i=0; i < $ftds.length; i++) { var $ftd = $($ftds[i]); if (nowrapTD != "false") $ftd.html("
    " + $ftd.html() + "
    "); if (i < aStyles.length) $ftd.addClass(aStyles[i][1]); } $tr.click(function(){ $trs.filter(".selected").removeClass("selected"); $tr.addClass("selected"); var sTarget = $tr.attr("target"); if (sTarget) { if ($("#"+sTarget, $grid).length == 0) { $grid.prepend(''); } $("#"+sTarget, $grid).val($tr.attr("rel")); } }); }); $(">td",ftr).each(function(i){ if (i < aStyles.length) $(this).width(aStyles[i][0]); }); $grid.append(""); var scroller = $(".gridScroller", $grid); scroller.scroll(function(event){ var header = $(".gridThead", $grid); if(scroller.scrollLeft() > 0){ header.css("position", "relative"); var scroll = scroller.scrollLeft(); header.css("left", scroller.cssv("left") - scroll); } if(scroller.scrollLeft() == 0) { header.css("position", "relative"); header.css("left", "0px"); } return false; }); $(">tr", thead).each(function(){ $(">th", this).each(function(i){ var th = this, $th = $(this); $th.mouseover(function(event){ var offset = $.jTableTool.getOffset(th, event).offsetX; if($th.outerWidth() - offset < 5) { $th.css("cursor", "col-resize").mousedown(function(event){ $(".resizeProxy", $grid).show().css({ left: $.jTableTool.getRight(th)- $(".gridScroller", $grid).scrollLeft(), top:$.jTableTool.getTop(th), height:$.jTableTool.getHeight(th,$grid), cursor:"col-resize" }); $(".resizeMarker", $grid).show().css({ left: $.jTableTool.getLeft(th) + 1 - $(".gridScroller", $grid).scrollLeft(), top: $.jTableTool.getTop(th), height:$.jTableTool.getHeight(th,$grid) }); $(".resizeProxy", $grid).jDrag($.extend(options, {scop:true, cellMinW:20, relObj:$(".resizeMarker", $grid)[0], move: "horizontal", event:event, stop: function(){ var pleft = $(".resizeProxy", $grid).position().left; var mleft = $(".resizeMarker", $grid).position().left; var move = pleft - mleft - $th.outerWidth() -9; var cols = $.jTableTool.getColspan($th); var cellNum = $.jTableTool.getCellNum($th); var oldW = $th.width(), newW = $th.width() + move; var $dcell = $(">td", ftr).eq(cellNum - 1); $th.width(newW + "px"); $dcell.width(newW+"px"); var $table1 = $(thead).parent(); $table1.width(($table1.width() - oldW + newW)+"px"); var $table2 = $(tbody).parent(); $table2.width(($table2.width() - oldW + newW)+"px"); $(".resizeMarker,.resizeProxy", $grid).hide(); } }) ); }); } else { $th.css("cursor", $th.attr("orderField") ? "pointer" : "default"); $th.unbind("mousedown"); } return false; }); }); }); // function _resizeGrid(){ // $("div.j-resizeGrid").each(function(){ // var width = $(this).innerWidth(); // if (width){ // $("div.gridScroller", this).width(width+"px"); // } // }); // } // $(window).unbind(DWZ.eventType.resizeGrid).bind("resizeGrid", _resizeGrid); }); }; $.jTableTool = { getLeft:function(obj) { var width = 0; $(obj).prevAll().each(function(){ width += $(this).outerWidth(); }); return width - 1; }, getRight:function(obj) { var width = 0; $(obj).prevAll().addBack().each(function(){ width += $(this).outerWidth(); }); return width - 1; }, getTop:function(obj) { var height = 0; $(obj).parent().prevAll().each(function(){ height += $(this).outerHeight(); }); return height; }, getHeight:function(obj, parent) { var height = 0; var head = $(obj).parent(); head.nextAll().addBack().each(function(){ height += $(this).outerHeight(); }); $(".gridTbody", parent).children().each(function(){ height += $(this).outerHeight(); }); return height; }, getCellNum:function(obj) { return $(obj).prevAll().addBack().length; }, getColspan:function(obj) { return $(obj).attr("colspan") || 1; }, getStart:function(obj) { var start = 1; $(obj).prevAll().each(function(){ start += parseInt($(this).attr("colspan") || 1); }); return start; }, getPageCoord:function(element){ var coord = {x: 0, y: 0}; while (element){ coord.x += element.offsetLeft; coord.y += element.offsetTop; element = element.offsetParent; } return coord; }, getOffset:function(obj, evt){ if(/msie/.test(navigator.userAgent.toLowerCase())) { var objset = $(obj).offset(); var evtset = { offsetX:evt.pageX || evt.screenX, offsetY:evt.pageY || evt.screenY }; var offset ={ offsetX: evtset.offsetX - objset.left, offsetY: evtset.offsetY - objset.top }; return offset; } var target = evt.target; if (target.offsetLeft == undefined){ target = target.parentNode; } var pageCoord = $.jTableTool.getPageCoord(target); var eventCoord ={ x: window.pageXOffset + evt.clientX, y: window.pageYOffset + evt.clientY }; var offset ={ offsetX: eventCoord.x - pageCoord.x, offsetY: eventCoord.y - pageCoord.y }; return offset; } }; })(jQuery); ================================================ FILE: js/dwz.switchEnv.js ================================================ /** * @author zhanghuihua@msn.com */ (function($){ $.fn.navMenu = function(){ return this.each(function(){ var $box = $(this); $box.find("li>a").click(function(){ var $a = $(this); $.post($a.attr("href"), {}, function(html){ $("#sidebar").find(".accordion").remove().end().append(html).initUI(); $box.find("li").removeClass("selected"); $a.parent().addClass("selected"); navTab.closeAllTab(); }); return false; }); }); } $.fn.switchEnv = function(){ var op = {cities$:">ul>li", boxTitle$:">a>span"}; return this.each(function(){ var $this = $(this); $this.click(function(){ if ($this.hasClass("selected")){ _hide($this); } else { _show($this); } return false; }); $this.find(op.cities$).click(function(){ var $li = $(this); $.post($li.find(">a").attr("href"), {}, function(html){ _hide($this); $this.find(op.boxTitle$).html($li.find(">a").html()); navTab.closeAllTab(); $("#sidebar").find(".accordion").remove().end().append(html).initUI(); }); return false; }); }); } function _show($box){ $box.addClass("selected"); $(document).bind("click",{box:$box}, _handler); } function _hide($box){ $box.removeClass("selected"); $(document).unbind("click", _handler); } function _handler(event){ _hide(event.data.box); } })(jQuery); ================================================ FILE: js/dwz.tab.js ================================================ /** * @author 张慧华 z@j-ui.com * */ (function($){ $.fn.extend({ /** * options: reverse[true, false], eventType[click, hover], currentIndex[default index 0] * stTab[tabs selector], stTabPanel[tab panel selector] * ajaxClass[ajax load], closeClass[close tab] */ tabs: function (options){ var op = $.extend({reverse:false, eventType:"click", currentIndex:0, stTabHeader:"> .tabsHeader", stTab:">.tabsHeaderContent>ul", stTabPanel:"> .tabsContent", ajaxClass:"j-ajax", closeClass:"close", prevClass:"tabsLeft", nextClass:"tabsRight"}, options); return this.each(function(){ initTab($(this)); }); function initTab(jT){ var jSelector = jT.add($("> *", jT)); var jTabHeader = $(op.stTabHeader, jSelector); var jTabs = $(op.stTab + " li", jTabHeader); var jGroups = $(op.stTabPanel + " > *", jSelector); jTabs.unbind().find("a").unbind(); jTabHeader.find("."+op.prevClass).unbind(); jTabHeader.find("."+op.nextClass).unbind(); jTabs.each(function(iTabIndex){ if (op.currentIndex == iTabIndex) $(this).addClass("selected"); else $(this).removeClass("selected"); if (op.eventType == "hover") $(this).hover(function(event){switchTab(jT, iTabIndex)}); else $(this).click(function(event){switchTab(jT, iTabIndex)}); $("a", this).each(function(){ var $link = $(this); if ($link.hasClass(op.ajaxClass)) { $link.click(function(event){ var jGroup = jGroups.eq(iTabIndex); if (this.href && ($(this).attr('data-cache') == 'false' ||!jGroup.attr("loaded")) ) jGroup.loadUrl(this.href,{},function(){ jGroup.find("[layoutH]").layoutH(); jGroup.attr("loaded",true); }); event.preventDefault(); }); } else if ($link.hasClass(op.closeClass)) { $link.click(function(event){ jTabs.eq(iTabIndex).remove(); jGroups.eq(iTabIndex).remove(); if (iTabIndex == op.currentIndex) { op.currentIndex = (iTabIndex+1 < jTabs.length) ? iTabIndex : iTabIndex - 1; } else if (iTabIndex < op.currentIndex){ op.currentIndex = iTabIndex; } initTab(jT); return false; }); } }); }); switchTab(jT, op.currentIndex); // 折叠tab var collapse = jT.hasClass("collapse"), $tabsHeaderContent = jTabHeader.find('>.tabsHeaderContent'); var collapseFn = function(event){ if (jT.hasClass("close")) { jT.removeClass('close'); } else { jT.addClass('close'); } }; if(collapse){ var $icon = $('').addClass(close?op.exp:op.coll).insertAfter($tabsHeaderContent); $icon.click(collapseFn); } } function switchTab(jT, iTabIndex){ var jSelector = jT.add($("> *", jT)); var jTabHeader = $(op.stTabHeader, jSelector); var jTabs = $(op.stTab + " li", jTabHeader); var jGroups = $(op.stTabPanel + " > *", jSelector); var jTab = jTabs.eq(iTabIndex); var jGroup = jGroups.eq(iTabIndex); if (op.reverse && (jTab.hasClass("selected") )) { jTabs.removeClass("selected"); jGroups.hide(); } else { op.currentIndex = iTabIndex; jTabs.removeClass("selected"); jTab.addClass("selected"); jGroups.hide().eq(op.currentIndex).show(); } if (!jGroup.attr("inited")){ jGroup.attr("inited", 1000).find("input[type=text]").filter("[alt]").inputAlert(); } } } }); })(jQuery); ================================================ FILE: js/dwz.taskBar.js ================================================ /** * @author Roger Wu * @version 1.0 */ (function($){ $.fn.extend({ jTask:function(options){ return this.each(function(){ var $task = $(this); var id = $task.attr("id"); $task.click(function(e){ var dialog = $("body").data(id); if ($task.hasClass("selected")) { $("a.minimize", dialog).trigger("click"); } else { if (dialog.is(":hidden")) { $.taskBar.restoreDialog(dialog); } else $(dialog).trigger("click"); } $.taskBar.scrollCurrent($(this)); return false; }); $("div.close", $task).click(function(e){ $.pdialog.close(id) return false; }).hoverClass("closeHover"); $task.hoverClass("hover"); }); } }); $.taskBar = { _taskBar:null, _taskBox:null, _prevBut:null, _nextBut:null, _op:{id:"taskbar", taskBox:"div.taskbarContent",prevBut:".taskbarLeft",prevDis:"taskbarLeftDisabled", nextBut:".taskbarRight",nextDis:"taskbarRightDisabled", selected:"selected",boxMargin:"taskbarMargin"}, init:function(options) { var $this = this; $.extend(this._op, options); this._taskBar = $("#" + this._op.id); if (this._taskBar.length == 0) { this._taskBar = $(DWZ.frag["taskbar"]).appendTo($("#layout")); this._taskBar.find(".taskbarLeft").hoverClass("taskbarLeftHover"); this._taskBar.find(".taskbarRight").hoverClass("taskbarRightHover"); } this._taskBox = this._taskBar.find(this._op.taskBox); this._taskList = this._taskBox.find(">ul"); this._prevBut = this._taskBar.find(this._op.prevBut); this._nextBut = this._taskBar.find(this._op.nextBut); this._prevBut.click(function(e){$this.scrollLeft()}); this._nextBut.click(function(e){$this.scrollRight()}); this._contextmenu(this._taskBox); // taskBar右键菜单 }, _contextmenu:function(obj) { $(obj).contextMenu('dialogCM', { bindings:{ closeCurrent:function(t,m){ var obj = t.isTag("li")?t:$.taskBar._getCurrent(); $("div.close", obj).trigger("click"); }, closeOther:function(t,m){ var selector = t.isTag("li")?("#" +t.attr("id")):".selected"; var tasks = $.taskBar._taskList.find(">li:not(:"+selector+")"); tasks.each(function(i){ $("div.close",tasks[i]).trigger("click"); }); }, closeAll:function(t,m){ var tasks = $.taskBar._getTasks(); tasks.each(function(i){ $("div.close",tasks[i]).trigger("click"); }); } }, ctrSub:function(t,m){ var mCur = m.find("[rel='closeCurrent']"); var mOther = m.find("[rel='closeOther']"); if(!$.taskBar._getCurrent()[0]) { mCur.addClass("disabled"); mOther.addClass("disabled"); } else { if($.taskBar._getTasks().length == 1) mOther.addClass("disabled"); } } }); }, _scrollCurrent:function(){ var iW = this._tasksW(this._getTasks()); if (iW > this._getTaskBarW()) { var $this = this; var lTask = $(">li:last-child", this._taskList); var left = this._getTaskBarW() - lTask.position().left - lTask.outerWidth(true); this._taskList.animate({ left: left + 'px' }, 200, function(){ $this._ctrlScrollBut(); }); } else { this._ctrlScrollBut(); } }, _getTaskBarW:function(){ return this._taskBox.width()- (this._prevBut.is(":hidden")?this._prevBut.width()+2:0) - (this._nextBut.is(":hidden")?this._nextBut.width()+2:0); }, _scrollTask:function(task){ var $this = this; if(task.position().left + this._getLeft()+task.outerWidth() > this._getBarWidth()) { var left = this._getTaskBarW()- task.position().left - task.outerWidth(true) - 2; this._taskList.animate({left: left + 'px'}, 200, function(){ $this._ctrlScrollBut(); }); } else if(task.position().left + this._getLeft() < 0) { var left = this._getLeft()-(task.position().left + this._getLeft()); this._taskList.animate({left: left + 'px'}, 200, function(){ $this._ctrlScrollBut(); }); } }, /** * 控制左右移动按钮何时显示与隐藏 */ _ctrlScrollBut:function(){ var iW = this._tasksW(this._getTasks()); if (this._getTaskBarW() > iW) { this._taskBox.removeClass(this._op.boxMargin); this._nextBut.hide(); this._prevBut.hide(); if(this._getTasks().eq(0)[0])this._scrollTask(this._getTasks().eq(0)); } else { this._taskBox.addClass(this._op.boxMargin); this._nextBut.show().removeClass(this._op.nextDis); this._prevBut.show().removeClass(this._op.prevDis); if (this._getLeft() >= 0){ this._prevBut.addClass(this._op.prevDis); } if (this._getLeft() <= this._getTaskBarW() - iW) { this._nextBut.addClass(this._op.nextDis); } } }, _getLeft: function(){ return this._taskList.position().left; }, /** * 取得第一个完全显示在taskbar上的任务 */ _visibleStart: function(){ var iLeft = this._getLeft(); var jTasks = this._getTasks(); for (var i=0; i= 0) return jTasks.eq(i); } return jTasks.eq(0); }, /** * 取得最后一个完全显示在taskbar上的任务 */ _visibleEnd: function(){ var iLeft = this._getLeft(); var jTasks = this._getTasks(); for (var i=0; i this._getBarWidth()) return jTasks.eq(i); } return jTasks.eq(jTasks.length-1); }, /** * 取得所有的任务 */ _getTasks:function(){ return this._taskList.find(">li"); }, /** * 计算所传入的所有任务的宽度和 * @param {Object} jTasks */ _tasksW:function(jTasks){ var iW = 0; jTasks.each(function(){ iW += $(this).outerWidth(true); }); return iW; }, _getBarWidth: function() { return this._taskBar.innerWidth(); }, /** * 在任务栏上新加一个任务 * @param {Object} id * @param {Object} title */ addDialog: function(id, title){ this.show(); var task = $("#"+id,this._taskList); if (!task[0]) { var taskFrag = '
  • #title#
    Close
  • '; this._taskList.append(taskFrag.replace("#taskid#", id).replace("#title#", title)); task = $("#"+id,this._taskList); task.jTask(); } else { $(">div>span", task).text(title); } this._contextmenu(task); this.switchTask(id); this._scrollTask(task); }, /** * 关闭一个任务 * @param {Object} id */ closeDialog: function(obj){ var task = (typeof obj == 'string')? $("#"+obj, this._taskList):obj; if (task.length == 0) return; // fix bug for minable=false task.remove(); if(this._getTasks().length == 0){ this.hide(); } this._scrollCurrent(); }, /** * * @param {Object} id or dialog */ restoreDialog:function(obj){ var dialog = (typeof obj == 'string')?$("body").data(obj):obj; var id = (typeof obj == 'string')?obj:dialog.data("id"); var task = $.taskBar.getTask(id); $(".resizable").css({top: $(window).height()-60,left:$(task).position().left,height:$(task).outerHeight(),width:$(task).outerWidth() }).show().animate({top:$(dialog).css("top"),left: $(dialog).css("left"),width:$(dialog).css("width"),height:$(dialog).css("height")},250,function(){ $(this).hide(); $(dialog).show(); $.pdialog.attachShadow(dialog); }); $.taskBar.switchTask(id); }, /** * 把任务变成不是当前的 * @param {Object} id */ inactive:function(id){ $("#" + id, this._taskList).removeClass("selected"); }, /** * 向左移一个任务 */ scrollLeft: function(){ var task = this._visibleStart(); this._scrollTask(task); }, /** * 向右移一个任务 */ scrollRight: function(){ var task = this._visibleEnd(); this._scrollTask(task); }, /** * 移出当前点击的任务 * @param {Object} task */ scrollCurrent:function(task){ this._scrollTask(task); }, /** * 切换任务 * @param {Object} id */ switchTask:function(id) { this._getCurrent().removeClass("selected"); this.getTask(id).addClass("selected"); }, _getCurrent:function() { return this._taskList.find(">.selected"); }, getTask:function(id) { return $("#" + id, this._taskList); }, /** * 显示任务栏 */ show:function(){ if (this._taskBar.is(":hidden")) { this._taskBar.css("top", $(window).height() - 34 + this._taskBar.outerHeight()).show(); this._taskBar.animate({ top: $(window).height() - this._taskBar.outerHeight() }, 500); } }, /** * 隐藏任务栏 */ hide:function(){ this._taskBar.animate({ top: $(window).height() - 29 + this._taskBar.outerHeight(true) }, 500,function(){ $.taskBar._taskBar.hide(); }); } } })(jQuery); ================================================ FILE: js/dwz.theme.js ================================================ /** * Theme Plugins * @author 张慧华 z@j-ui.com */ (function($){ $.fn.extend({ theme: function(options){ var op = $.extend({themeBase:"themes"}, options); var _themeHref = op.themeBase + "/#theme#/style.css"; return this.each(function(){ var jThemeLi = $(this).find(">li[theme]"); var setTheme = function(themeName){ $("head").find("link[href$='style.css']").attr("href", _themeHref.replace("#theme#", themeName)); jThemeLi.find(">div").removeClass("selected"); jThemeLi.filter("[theme="+themeName+"]").find(">div").addClass("selected"); if ($.isFunction($.cookie)) $.cookie("dwz_theme", themeName); } jThemeLi.each(function(index){ var $this = $(this); var themeName = $this.attr("theme"); $this.addClass(themeName).click(function(){ setTheme(themeName); }); }); if ($.isFunction($.cookie)){ var themeName = $.cookie("dwz_theme"); if (themeName) { setTheme(themeName); } } }); } }); })(jQuery); ================================================ FILE: js/dwz.tree.js ================================================ /** * @author Roger Wu * @version 1.0 * added extend property oncheck */ (function($){ $.extend($.fn, { jTree:function(options) { var op = $.extend({checkFn:null, selected:"selected", exp:"expandable", coll:"collapsable", firstExp:"first_expandable", firstColl:"first_collapsable", lastExp:"last_expandable", lastColl:"last_collapsable", folderExp:"folder_expandable", folderColl:"folder_collapsable", endExp:"end_expandable", endColl:"end_collapsable",file:"file",ck:"checked", unck:"unchecked"}, options); return this.each(function(){ var $this = $(this); var cnum = $this.children().length; $(">li", $this).each(function(){ var $li = $(this); var first = $li.prev()[0]?false:true; var last = $li.next()[0]?false:true; $li.genTree({ icon:$this.hasClass("treeFolder"), ckbox:$this.hasClass("treeCheck"), options: op, level: 0, exp:(cnum>1?(first?op.firstExp:(last?op.lastExp:op.exp)):op.endExp), coll:(cnum>1?(first?op.firstColl:(last?op.lastColl:op.coll)):op.endColl), showSub:(!$this.hasClass("collapse") && ($this.hasClass("expand") || (cnum>1?(first?true:false):true))), isLast:(cnum>1?(last?true:false):true) }); }); setTimeout(function(){ if($this.hasClass("treeCheck")){ var checkFn = eval($this.attr("oncheck")); if(checkFn && $.isFunction(checkFn)) { $("div.ckbox", $this).each(function(){ var ckbox = $(this); ckbox.click(function(){ var checked = $(ckbox).hasClass("checked"); var tnode = ckbox.parent().parent(); var boxes = $("input", tnode); var items = []; if(boxes.length > 1) { $(boxes).each(function(){ items[items.length] = {name:$(this).attr("name"), value:$(this).val(), text:$(this).attr("text")}; }); } else { items = {name:boxes.attr("name"), value:boxes.val(), text:boxes.attr("text")}; } var parents = []; tnode.parents('li').each(function () { var $pNode = $(this), $pCkbox = $pNode.find('>div>div.ckbox'); $pCkbox.find('input').each(function(){ var pValue = { name:$(this).attr("name"), value:$(this).val(), text:$(this).attr("text"), checked:$pCkbox.hasClass('checked'), indeterminate:$pCkbox.hasClass('indeterminate') }; parents.push(pValue); }); }); checkFn({checked:checked, items:items, parents:parents}); }); }); } } $("a", $this).click(function(event){ $("div." + op.selected, $this).removeClass(op.selected); var parent = $(this).parent().addClass(op.selected); var $li = $(this).parents("li:first"), sTarget = $li.attr("target"); if (sTarget) { if ($("#"+sTarget, $this).length == 0) { $this.prepend(''); } $("#"+sTarget, $this).val($li.attr("rel")); } $(".ckbox",parent).trigger("click"); event.stopPropagation(); $(document).trigger("click"); if (!$(this).attr("target")) return false; }); },1); }); }, subTree:function(op, level) { return this.each(function(){ $(">li", this).each(function(){ var $this = $(this); var isLast = ($this.next()[0]?false:true); $this.genTree({ icon:op.icon, ckbox:op.ckbox, exp:isLast?op.options.lastExp:op.options.exp, coll:isLast?op.options.lastColl:op.options.coll, options:op.options, level:level, space:isLast?null:op.space, showSub:op.showSub, isLast:isLast }); }); }); }, genTree:function(options) { var op = $.extend({icon:options.icon,ckbox:options.ckbox,exp:"", coll:"", showSub:false, level:0, options:null, isLast:false}, options); return this.each(function(){ var node = $(this); var tree = $(">ul", node); var parent = node.parent().prev(); var checked = 'unchecked'; if(op.ckbox) { if($(">.checked",parent).length > 0) checked = 'checked'; } if (tree.length>0) { node.children(":first").wrap("
    "); $(">div", node).prepend("
    "+(op.ckbox ?"
    ":"")+(op.icon?"
    ":"")); op.showSub ? tree.show() : tree.hide(); $(">div>div:first,>div>a", node).click(function(){ var $fnode = $(">li:first",tree); if($fnode.children(":first").isTag('a')) tree.subTree(op, op.level + 1); var $this = $(this); var isA = $this.isTag('a'); var $this = isA?$(">div>div", node).eq(op.level):$this; if (!isA || tree.is(":hidden")) { $this.toggleClass(op.exp).toggleClass(op.coll); if (op.icon) { $(">div>div:last", node).toggleClass(op.options.folderExp).toggleClass(op.options.folderColl); } } (tree.is(":hidden"))?tree.slideDown("fast"):(isA?"":tree.slideUp("fast")); return false; }); addSpace(op.level, node); if(op.showSub) tree.subTree(op, op.level + 1); } else { node.children().wrap("
    "); $(">div", node).prepend('
    '+(op.ckbox?'
    ':'')+(op.icon?'
    ':'')); addSpace(op.level, node); if(op.isLast)$(node).addClass("last"); } if (op.ckbox) node._check(op); $(">div",node).mouseover(function(){ $(this).addClass("hover"); }).mouseout(function(){ $(this).removeClass("hover"); }); if(/msie/.test(navigator.userAgent.toLowerCase())) $(">div",node).click(function(){ $("a", this).trigger("click"); return false; }); }); function addSpace(level,node) { if (level > 0) { var parent = node.parent().parent(); var space = !parent.next()[0]?"indent":"line"; var plist = "
    "; if (level > 1) { var next = $(">div>div", parent).filter(":first"); var prev = ""; while(level > 1){ prev = prev + "
    "; next = next.next(); level--; } plist = prev + plist; } $(">div", node).prepend(plist); } } }, _check:function(op) { var node = $(this); var ckbox = $(">div>.ckbox", node); var $input = node.find("a"); var tname = $input.attr("tname"), tvalue = $input.attr("tvalue"); var attrs = "text='"+$input.text()+"' "; if (tname) attrs += "name='"+tname+"' "; if (tvalue) attrs += "value='"+tvalue+"' "; ckbox.append("").click(function(){ var cked = ckbox.hasClass("checked"); var aClass = cked?"unchecked":"checked"; var rClass = cked?"checked":"unchecked"; ckbox.removeClass(rClass).removeClass(!cked?"indeterminate":"").addClass(aClass); $("input", ckbox).attr("checked", !cked); $(">ul", node).find("li").each(function(){ var box = $("div.ckbox", this); box.removeClass(rClass).removeClass(!cked?"indeterminate":"").addClass(aClass) .find("input").attr("checked", !cked); }); $(node)._checkParent(); return false; }); var cAttr = $input.attr("checked") || false; if (cAttr) { ckbox.find("input").attr("checked", true); ckbox.removeClass("unchecked").addClass("checked"); $(node)._checkParent(); } }, _checkParent:function(){ if($(this).parent().hasClass("tree")) return; var parent = $(this).parent().parent(); var stree = $(">ul", parent); var ckbox = stree.find(">li>a").length+stree.find("div.ckbox").length; var ckboxed = stree.find("div.checked").length; var aClass = (ckboxed==ckbox?"checked":(ckboxed!=0?"indeterminate":"unchecked")); var rClass = (ckboxed==ckbox?"indeterminate":(ckboxed!=0?"checked":"indeterminate")); $(">div>.ckbox", parent).removeClass("unchecked").removeClass("checked").removeClass(rClass).addClass(aClass); var $checkbox = $(":checkbox", parent); if (aClass == "checked") $checkbox.attr("checked","checked"); else if (aClass == "unchecked") $checkbox.removeAttr("checked"); parent._checkParent(); } }); })(jQuery); ================================================ FILE: js/dwz.ui.js ================================================ function initEnv() { $("body").append(DWZ.frag["dwzFrag"]); $(window).resize(function(){ initLayout(); $(this).trigger(DWZ.eventType.resizeGrid); }); var ajaxbg = $("#background,#progressBar"); ajaxbg.hide(); $(document).ajaxStart(function(){ ajaxbg.show(); }).ajaxStop(function(){ ajaxbg.hide(); }); if ($.fn.jBar) $("#leftside").jBar({minW:150, maxW:700}); if ($.taskBar) $.taskBar.init(); if ($.fn.switchEnv) $("#switchEnvBox").switchEnv(); if ($.fn.navMenu) $("#navMenu").navMenu(); setTimeout(function(){ initLayout(); if (window.navTab) navTab.init(); // 注册DWZ插件。 DWZ.regPlugins.push(initUI); //第三方jQuery插件注册方法:DWZ.regPlugins.push(function($p){}); // 首次初始化插件 $(document).initUI(); // navTab styles var jTabsPH = $("div.tabsPageHeader"); jTabsPH.find(".tabsLeft").hoverClass("tabsLeftHover"); jTabsPH.find(".tabsRight").hoverClass("tabsRightHover"); jTabsPH.find(".tabsMore").hoverClass("tabsMoreHover"); $(document).trigger(DWZ.eventType.initEnvAfter); }, 10); } function initLayout(){ var iContentW = $(window).width() - (DWZ.ui.sbar ? $("#sidebar").width() + 10 : 34) - 5; var iContentH = $(window).height() - $("#header").height() - 34; $("#container").width(iContentW); $("#container .tabsPageContent").height(iContentH - 34).find("[layoutH]").layoutH(); $("#sidebar, #sidebar_s .collapse, #splitBar, #splitBarProxy").height(iContentH - 5); $("#taskbar").css({top: iContentH + $("#header").height() + 5, width:$(window).width()}); } function initUI($p){ //tables if ($.fn.jTable) $("table.table", $p).jTable(); // css tables if ($.fn.cssTable) $('table.list', $p).not('.nowrap').cssTable(); if ($.fn.jPanel) $("div.panel", $p).jPanel(); //auto bind tabs $("div.tabs", $p).each(function(){ var $this = $(this); var options = {}; options.currentIndex = $this.attr("currentIndex") || 0; options.eventType = $this.attr("eventType") || "click"; $this.tabs(options); }); if ($.fn.jTree) $("ul.tree", $p).jTree(); if ($.fn.accordion){ $('div.accordion', $p).each(function(){ var $this = $(this); $this.accordion({fillSpace:$this.attr("fillSpace"),alwaysOpen:true,active:0}); }); } if ($.fn.checkboxCtrl){ $(":button.checkboxCtrl, :checkbox.checkboxCtrl", $p).checkboxCtrl($p); } if ($.fn.combox) $("select.combox",$p).combox(); if ($.fn.xheditor) { $("textarea.editor", $p).each(function(){ var $this = $(this); var op = {html5Upload:false, skin: 'nostyle',tools: $this.attr("tools") || 'full'}; var upAttrs = [ ["upLinkUrl","upLinkExt","zip,rar,txt"], ["upImgUrl","upImgExt","jpg,jpeg,gif,png"], ["upFlashUrl","upFlashExt","swf"], ["upMediaUrl","upMediaExt","avi"] ]; $(upAttrs).each(function(i){ var urlAttr = upAttrs[i][0]; var extAttr = upAttrs[i][1]; if ($this.attr(urlAttr)) { op[urlAttr] = $this.attr(urlAttr); op[extAttr] = $this.attr(extAttr) || upAttrs[i][2]; } }); $this.xheditor(op); }); } if ($.fn.uploadify) { $(":file[uploaderOption]", $p).each(function(){ var $this = $(this); var options = { fileObjName: $this.attr("name") || "file", auto: true, multi: true, onUploadError: uploadifyError }; var uploaderOption = DWZ.jsonEval($this.attr("uploaderOption")); $.extend(options, uploaderOption); DWZ.debug("uploaderOption: "+DWZ.obj2str(uploaderOption)); $this.uploadify(options); }); } // init styles $("input[type=text], input[type=password], textarea", $p).addClass("textInput").focusClass("focus"); $("input[readonly], textarea[readonly]", $p).addClass("readonly"); $("input[disabled=true], textarea[disabled=true]", $p).addClass("disabled"); $("input[type=text]", $p).not("div.tabs input[type=text]", $p).filter("[alt]").inputAlert(); //Grid ToolBar $("div.panelBar li, div.panelBar", $p).hoverClass("hover"); //Button $("div.button", $p).hoverClass("buttonHover"); $("div.buttonActive", $p).hoverClass("buttonActiveHover"); //tabsPageHeader $("div.tabsHeader li, div.tabsPageHeader li, div.accordionHeader, div.accordion", $p).hoverClass("hover"); //validate form if ($.fn.validate) { $("form.required-validate", $p).each(function(){ var $form = $(this); $form.validate({ onsubmit: false, focusInvalid: false, focusCleanup: true, errorElement: "span", ignore:".ignore", invalidHandler: function(form, validator) { var errors = validator.numberOfInvalids(); if (errors) { var message = DWZ.msg("validateFormError",[errors]); alertMsg.error(message); } } }); $form.find('input[customvalid]').each(function(){ var $input = $(this); $input.rules("add", { customvalid: $input.attr("customvalid") }) }); }); } if ($.fn.datepicker){ $('input.date', $p).each(function(){ var $this = $(this); var opts = {}; if ($this.attr("dateFmt")) opts.pattern = $this.attr("dateFmt"); if ($this.attr("minDate")) opts.minDate = $this.attr("minDate"); if ($this.attr("maxDate")) opts.maxDate = $this.attr("maxDate"); if ($this.attr("mmStep")) opts.mmStep = $this.attr("mmStep"); if ($this.attr("ssStep")) opts.ssStep = $this.attr("ssStep"); if ($this.attr("defaultTime")) opts.defaultTime = $this.attr("defaultTime"); $this.datepicker(opts); }); } // navTab $("a[target=navTab]", $p).each(function(){ $(this).click(function(event){ var $this = $(this); if ($this.hasClass('disabled') || $this.hasClass('buttonDisabled')) {return false;} var title = $this.attr("title") || $this.text(); var tabid = $this.attr("rel") || "_blank"; var fresh = eval($this.attr("fresh") || "true"); var external = eval($this.attr("external") || "false"); var url = unescape($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first")); DWZ.debug(url); if (!url.isFinishedTm()) { alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg")); return false; } navTab.openTab(tabid, url,{title:title, fresh:fresh, external:external}); event.preventDefault(); }); }); //dialogs $("a[target=dialog]", $p).each(function(){ $(this).click(function(event){ var $this = $(this); if ($this.hasClass('disabled') || $this.hasClass('buttonDisabled')) {return false;} var title = $this.attr("title") || $this.text(); var rel = $this.attr("rel") || "_blank"; var options = {}; var w = $this.attr("width"); var h = $this.attr("height"); if (w) options.width = w; if (h) options.height = h; options.max = eval($this.attr("max") || "false"); options.mask = eval($this.attr("mask") || "false"); options.maxable = eval($this.attr("maxable") || "true"); options.minable = eval($this.attr("minable") || "true"); options.fresh = eval($this.attr("fresh") || "true"); options.resizable = eval($this.attr("resizable") || "true"); options.resizable = eval($this.attr("resizable") || "true"); options.drawable = eval($this.attr("drawable") || "true"); options.close = eval($this.attr("close") || ""); options.param = $this.attr("param") || ""; var url = unescape($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first")); DWZ.debug(url); if (!url.isFinishedTm()) { alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg")); return false; } $.pdialog.open(url, rel, title, options); return false; }); }); $("a[target=ajax], tr[target=ajax]", $p).each(function(){ $(this).click(function(event){ var $this = $(this); if ($this.hasClass('disabled') || $this.hasClass('buttonDisabled')) {return false;} var rel = $this.attr("rel"); if (rel) { var $rel = $("#"+rel); var url = unescape($this.attr("href")).replaceTmById($(event.target).parents(".unitBox:first")); DWZ.debug(url); if (!url.isFinishedTm()) { alertMsg.error($this.attr("warn") || DWZ.msg("alertSelectMsg")); return false; } $rel.loadUrl(url, {}, function(){ $rel.find("[layoutH]").layoutH(); }); } event.preventDefault(); }); }); $("div.pagination", $p).each(function(){ var $this = $(this); $this.pagination({ targetType:$this.attr("targetType"), rel:$this.attr("rel"), totalCount:$this.attr("totalCount"), numPerPage:$this.attr("numPerPage"), pageNumShown:$this.attr("pageNumShown") || 10, currentPage:$this.attr("currentPage") }); }); if ($.fn.sortDrag) $("div.sortDrag", $p).sortDrag(); // dwz.ajax.js if ($.fn.ajaxTodo) $("a[target=ajaxTodo]", $p).ajaxTodo(); if ($.fn.dwzExport) $("a[target=dwzExport]", $p).dwzExport(); if ($.fn.lookup) $("a[lookupGroup]", $p).lookup(); if ($.fn.multLookup) $("[multLookup]:button", $p).multLookup(); if ($.fn.suggest) $("input[suggestFields]", $p).suggest(); if ($.fn.itemDetail) $("table.itemDetail", $p).itemDetail(); if ($.fn.selectedTodo) $("a[target=selectedTodo]", $p).selectedTodo(); if ($.fn.selectedBlank) $("a[target=selectedBlank]", $p).selectedBlank(); if ($.fn.pagerForm) $("form[rel=pagerForm]", $p).pagerForm({parentBox:$p}); } ================================================ FILE: js/dwz.util.date.js ================================================ /** * @author 张慧华 z@j-ui.com * ---------------------------------------------------------- * These functions use the same 'format' strings as the * java.text.SimpleDateFormat class, with minor exceptions. * The format string consists of the following abbreviations: * * Field | Full Form | Short Form * -------------+--------------------+----------------------- * Year | yyyy (4 digits) | yy (2 digits), y (2 or 4 digits) * Month | MMM (name or abbr.)| MM (2 digits), M (1 or 2 digits) * | NNN (abbr.) | * Day of Month | dd (2 digits) | d (1 or 2 digits) * Day of Week | EE (name) | E (abbr) * Hour (1-12) | hh (2 digits) | h (1 or 2 digits) * Hour (0-23) | HH (2 digits) | H (1 or 2 digits) * Hour (0-11) | KK (2 digits) | K (1 or 2 digits) * Hour (1-24) | kk (2 digits) | k (1 or 2 digits) * Minute | mm (2 digits) | m (1 or 2 digits) * Second | ss (2 digits) | s (1 or 2 digits) * AM/PM | a | * * NOTE THE DIFFERENCE BETWEEN MM and mm! Month=MM, not mm! * Examples: * "MMM d, y" matches: January 01, 2000 * Dec 1, 1900 * Nov 20, 00 * "M/d/yy" matches: 01/20/00 * 9/2/00 * "MMM dd, yyyy hh:mm:ssa" matches: "January 01, 2000 12:30:45AM" * ---------------------------------------------------------- */ (function(){ var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat'); function LZ(x) {return(x<0||x>9?"":"0")+x} /** * formatDate (date_object, format) * Returns a date in the output format specified. * The format string uses the same abbreviations as in parseDate() * @param {Object} date * @param {Object} format */ function formatDate(date,format) { format=format+""; var result=""; var i_format=0; var c=""; var token=""; var y=date.getYear()+""; var M=date.getMonth()+1; var d=date.getDate(); var E=date.getDay(); var H=date.getHours(); var m=date.getMinutes(); var s=date.getSeconds(); var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k; // Convert real date parts into formatted versions var value={}; if (y.length < 4) {y=""+(y-0+1900);} value["y"]=""+y; value["yyyy"]=y; value["yy"]=y.substring(2,4); value["M"]=M; value["MM"]=LZ(M); value["MMM"]=MONTH_NAMES[M-1]; value["NNN"]=MONTH_NAMES[M+11]; value["d"]=d; value["dd"]=LZ(d); value["E"]=DAY_NAMES[E+7]; value["EE"]=DAY_NAMES[E]; value["H"]=H; value["HH"]=LZ(H); if (H==0){value["h"]=12;} else if (H>12){value["h"]=H-12;} else {value["h"]=H;} value["hh"]=LZ(value["h"]); if (H>11){value["K"]=H-12;} else {value["K"]=H;} value["k"]=H+1; value["KK"]=LZ(value["K"]); value["kk"]=LZ(value["k"]); if (H > 11) { value["a"]="PM"; } else { value["a"]="AM"; } value["m"]=m; value["mm"]=LZ(m); value["s"]=s; value["ss"]=LZ(s); while (i_format < format.length) { c=format.charAt(i_format); token=""; while ((format.charAt(i_format)==c) && (i_format < format.length)) { token += format.charAt(i_format++); } if (value[token] != null) { result += value[token]; } else { result += token; } } return result; } function _isInteger(val) { return (new RegExp(/^\d+$/).test(val)); } function _getInt(str,i,minlength,maxlength) { for (var x=maxlength; x>=minlength; x--) { var token=str.substring(i,i+x); if (token.length < minlength) { return null; } if (_isInteger(token)) { return token; } } return null; } /** * parseDate( date_string , format_string ) * * This function takes a date string and a format string. It matches * If the date string matches the format string, it returns the date. * If it does not match, it returns 0. * @param {Object} val * @param {Object} format */ function parseDate(val,format) { val=val+""; format=format+""; var i_val=0; var i_format=0; var c=""; var token=""; var token2=""; var x,y; var now=new Date(1900,0,1); var year=now.getYear(); var month=now.getMonth()+1; var date=1; var hh=now.getHours(); var mm=now.getMinutes(); var ss=now.getSeconds(); var ampm=""; while (i_format < format.length) { // Get next token from format string c=format.charAt(i_format); token=""; while ((format.charAt(i_format)==c) && (i_format < format.length)) { token += format.charAt(i_format++); } // Extract contents of value based on format token if (token=="yyyy" || token=="yy" || token=="y") { if (token=="yyyy") { x=4;y=4; } if (token=="yy") { x=2;y=2; } if (token=="y") { x=2;y=4; } year=_getInt(val,i_val,x,y); if (year==null) { return 0; } i_val += year.length; if (year.length==2) { if (year > 70) { year=1900+(year-0); } else { year=2000+(year-0); } } } else if (token=="MMM"||token=="NNN"){ month=0; for (var i=0; i11)) { month=i+1; if (month>12) { month -= 12; } i_val += month_name.length; break; } } } if ((month < 1)||(month>12)){return 0;} } else if (token=="EE"||token=="E"){ for (var i=0; i12)){return 0;} i_val+=month.length; } else if (token=="dd"||token=="d") { date=_getInt(val,i_val,token.length,2); if(date==null||(date<1)||(date>31)){return 0;} i_val+=date.length; } else if (token=="hh"||token=="h") { hh=_getInt(val,i_val,token.length,2); if(hh==null||(hh<1)||(hh>12)){return 0;} i_val+=hh.length; } else if (token=="HH"||token=="H") { hh=_getInt(val,i_val,token.length,2); if(hh==null||(hh<0)||(hh>23)){return 0;} i_val+=hh.length;} else if (token=="KK"||token=="K") { hh=_getInt(val,i_val,token.length,2); if(hh==null||(hh<0)||(hh>11)){return 0;} i_val+=hh.length; } else if (token=="kk"||token=="k") { hh=_getInt(val,i_val,token.length,2); if(hh==null||(hh<1)||(hh>24)){return 0;} i_val+=hh.length;hh--; } else if (token=="mm"||token=="m") { mm=_getInt(val,i_val,token.length,2); if(mm==null||(mm<0)||(mm>59)){return 0;} i_val+=mm.length; } else if (token=="ss"||token=="s") { ss=_getInt(val,i_val,token.length,2); if(ss==null||(ss<0)||(ss>59)){return 0;} i_val+=ss.length; } else if (token=="a") { if (val.substring(i_val,i_val+2).toLowerCase()=="am") {ampm="AM";} else if (val.substring(i_val,i_val+2).toLowerCase()=="pm") {ampm="PM";} else {return 0;} i_val+=2; } else { if (val.substring(i_val,i_val+token.length)!=token) {return 0;} else {i_val+=token.length;} } } // If there are any trailing characters left in the value, it doesn't match if (i_val != val.length) { return 0; } // Is date valid for month? if (month==2) { // Check for leap year if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year if (date > 29){ return 0; } } else { if (date > 28) { return 0; } } } if ((month==4)||(month==6)||(month==9)||(month==11)) { if (date > 30) { return 0; } } // Correct hours value if (hh<12 && ampm=="PM") { hh=hh-0+12; } else if (hh>11 && ampm=="AM") { hh-=12; } return new Date(year,month-1,date,hh,mm,ss); } Date.prototype.formatDate = function(dateFmt) { return formatDate(this, dateFmt); }; String.prototype.parseDate = function(dateFmt) { if (this.length < dateFmt.length) { dateFmt = dateFmt.slice(0,this.length); } return parseDate(this, dateFmt); }; /** * replaceTmEval("{1+2}-{2-1}") */ function replaceTmEval(data){ return data.replace(RegExp("({[A-Za-z0-9_+-]*})","g"), function($1){ return eval('(' + $1.replace(/[{}]+/g, "") + ')'); }); } /** * dateFmt:%y-%M-%d * %y-%M-{%d+1} * ex: new Date().formatDateTm('%y-%M-{%d-1}') * new Date().formatDateTm('2012-1') */ Date.prototype.formatDateTm = function(dateFmt) { var y = this.getFullYear(); var m = this.getMonth()+1; var d = this.getDate(); var sDate = dateFmt.replaceAll("%y",y).replaceAll("%M",m).replaceAll("%d",d); sDate = replaceTmEval(sDate); var _y=1900, _m=0, _d=1; var aDate = sDate.split('-'); if (aDate.length > 0) _y = aDate[0]; if (aDate.length > 1) _m = aDate[1]-1; if (aDate.length > 2) _d = aDate[2]; return new Date(_y,_m,_d).formatDate('yyyy-MM-dd'); }; })(); ================================================ FILE: js/dwz.util.number.js ================================================ /** * @author 张慧华 z@j-ui.com * */ (function(){ function formatCurrency(num) { num = num.toString().replace(/\$|\,/g,''); if(isNaN(num)) {num = "0";} var sign = (num == (num = Math.abs(num))); num = Math.floor(num*100+0.50000000001); var cents = num%100; num = Math.floor(num/100).toString(); if(cents<10) {cents = "0" + cents;} for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++){ num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3)); } return (((sign)?'':'-') + num + '.' + cents); } function parseCurrency(str) { if (!str) return 0; str = str.replace(',', ''); return $.isNumeric(str) ? parseFloat(str) : 0; } /** * 数字转中文大写 */ function amountInWords(dValue, maxDec){ // 验证输入金额数值或数值字符串: dValue = dValue.toString().replace(/,/g, ""); dValue = dValue.replace(/^0+/, ""); // 金额数值转字符、移除逗号、移除前导零 if (dValue == "") { return "零元整"; } // (错误:金额为空!) else if (isNaN(dValue)) { return "错误:金额不是合法的数值!"; } var minus = ""; // 负数的符号“-”的大写:“负”字。可自定义字符,如“(负)”。 var CN_SYMBOL = ""; // 币种名称(如“人民币”,默认空) if (dValue.length > 1) { if (dValue.indexOf('-') == 0) { dValue = dValue.replace("-", ""); minus = "负"; } // 处理负数符号“-” if (dValue.indexOf('+') == 0) { dValue = dValue.replace("+", ""); } // 处理前导正数符号“+”(无实际意义) } // 变量定义: var vInt = "", vDec = ""; // 字符串:金额的整数部分、小数部分 var resAIW; // 字符串:要输出的结果 var parts; // 数组(整数部分.小数部分),length=1时则仅为整数。 var digits, radices, bigRadices, decimals; // 数组:数字(0~9——零~玖);基(十进制记数系统中每个数字位的基是10——拾,佰,仟);大基(万,亿,兆,京,垓,杼,穰,沟,涧,正);辅币(元以下,角/分/厘/毫/丝)。 var zeroCount; // 零计数 var i, p, d; // 循环因子;前一位数字;当前位数字。 var quotient, modulus; // 整数部分计算用:商数、模数。 // 金额数值转换为字符,分割整数部分和小数部分:整数、小数分开来搞(小数部分有可能四舍五入后对整数部分有进位)。 var NoneDecLen = (typeof(maxDec) == "undefined" || maxDec == null || Number(maxDec) < 0 || Number(maxDec) > 5); // 是否未指定有效小数位(true/false) parts = dValue.split('.'); // 数组赋值:(整数部分.小数部分),Array的length=1则仅为整数。 if (parts.length > 1) { vInt = parts[0]; vDec = parts[1]; // 变量赋值:金额的整数部分、小数部分 if(NoneDecLen) { maxDec = vDec.length > 5 ? 5 : vDec.length; } // 未指定有效小数位参数值时,自动取实际小数位长但不超5。 var rDec = Number("0." + vDec); rDec *= Math.pow(10, maxDec); rDec = Math.round(Math.abs(rDec)); rDec /= Math.pow(10, maxDec); // 小数四舍五入 var aIntDec = rDec.toString().split('.'); if(Number(aIntDec[0]) == 1) { vInt = (Number(vInt) + 1).toString(); } // 小数部分四舍五入后有可能向整数部分的个位进位(值1) if(aIntDec.length > 1) { vDec = aIntDec[1]; } else { vDec = ""; } } else { vInt = dValue; vDec = ""; if(NoneDecLen) { maxDec = 0; } } if(vInt.length > 44) { return "错误:金额值太大了!整数位长【" + vInt.length.toString() + "】超过了上限——44位/千正/10^43(注:1正=1万涧=1亿亿亿亿亿,10^40)!"; } // 准备各字符数组 Prepare the characters corresponding to the digits: digits = new Array("零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"); radices = new Array("", "拾", "佰", "仟"); // 拾,佰,仟 bigRadices = new Array("", "万", "亿", "兆", "京", "垓", "杼", "穰" ,"沟", "涧", "正"); decimals = new Array("角", "分", "厘", "毫", "丝"); resAIW = ""; // 开始处理 // 处理整数部分(如果有) if (Number(vInt) > 0) { zeroCount = 0; for (i = 0; i < vInt.length; i++) { p = vInt.length - i - 1; d = vInt.substr(i, 1); quotient = p / 4; modulus = p % 4; if (d == "0") { zeroCount++; } else { if (zeroCount > 0) { resAIW += digits[0]; } zeroCount = 0; resAIW += digits[Number(d)] + radices[modulus]; } if (modulus == 0 && zeroCount < 4) { resAIW += bigRadices[quotient]; } } resAIW += "元"; } // 处理小数部分(如果有) for (i = 0; i < vDec.length; i++) { d = vDec.substr(i, 1); if (d != "0") { resAIW += digits[Number(d)] + decimals[i]; } } // 处理结果 if (resAIW == "") { resAIW = "零" + "元"; } // 零元 if (vDec == "") { resAIW += "整"; } // ...元整 resAIW = CN_SYMBOL + minus + resAIW; // 人民币/负......元角分/整 return resAIW; } Number.prototype.formatCurrency = function(format) { return formatCurrency(this); }; Number.prototype.amountInWords = function(maxDec) { return amountInWords(this, maxDec); } String.prototype.parseCurrency = function(format) { return parseCurrency(this); }; String.prototype.amountInWords = function(maxDec) { var dValue = parseCurrency(this); return amountInWords(dValue, maxDec); } })(); ================================================ FILE: js/dwz.validate.method.js ================================================ /** * @requires jquery.validate.js * @author 张慧华 z@j-ui.com */ (function($){ if ($.validator) { $.validator.addMethod("alphanumeric", function(value, element) { return this.optional(element) || /^\w+$/i.test(value); }, "Letters, numbers or underscores only please"); $.validator.addMethod("lettersonly", function(value, element) { return this.optional(element) || /^[a-z]+$/i.test(value); }, "Letters only please"); $.validator.addMethod("phone", function(value, element) { return this.optional(element) || /^[0-9 \(\)]{7,30}$/.test(value); }, "Please specify a valid phone number"); $.validator.addMethod("postcode", function(value, element) { return this.optional(element) || /^[0-9 A-Za-z]{5,20}$/.test(value); }, "Please specify a valid postcode"); $.validator.addMethod("date", function(value, element) { value = value.replace(/\s+/g, ""); if (String.prototype.parseDate){ var $input = $(element); var pattern = $input.attr('dateFmt') || 'yyyy-MM-dd'; return !$input.val() || $input.val().parseDate(pattern); } else { return this.optional(element) || value.match(/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/); } }, "Please enter a valid date."); /*自定义js函数验证 * */ $.validator.addMethod("customvalid", function(value, element, params) { try{ return eval('(' + params + ')'); }catch(e){ return false; } }, "Please fix this field."); $.validator.addClassRules({ date: {date: true}, alphanumeric: { alphanumeric: true }, lettersonly: { lettersonly: true }, phone: { phone: true }, postcode: {postcode: true} }); $.validator.setDefaults({errorElement:"span"}); $.validator.autoCreateRanges = true; } })(jQuery); ================================================ FILE: js/jquery-1.12.4.js ================================================ /*! * jQuery JavaScript Library v1.12.4 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2016-05-20T17:17Z */ (function( global, factory ) { if ( typeof module === "object" && typeof module.exports === "object" ) { // For CommonJS and CommonJS-like environments where a proper `window` // is present, execute the factory and get jQuery. // For environments that do not have a `window` with a `document` // (such as Node.js), expose a factory as module.exports. // This accentuates the need for the creation of a real `window`. // e.g. var jQuery = require("jquery")(window); // See ticket #14549 for more info. module.exports = global.document ? factory( global, true ) : function( w ) { if ( !w.document ) { throw new Error( "jQuery requires a window with a document" ); } return factory( w ); }; } else { factory( global ); } // Pass this if window is not defined yet }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { // Support: Firefox 18+ // Can't be in strict mode, several libs including ASP.NET trace // the stack via arguments.caller.callee and Firefox dies if // you try to trace through "use strict" call chains. (#13335) //"use strict"; var deletedIds = []; var document = window.document; var slice = deletedIds.slice; var concat = deletedIds.concat; var push = deletedIds.push; var indexOf = deletedIds.indexOf; var class2type = {}; var toString = class2type.toString; var hasOwn = class2type.hasOwnProperty; var support = {}; var version = "1.12.4", // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' // Need init if jQuery is called (just allow error to be thrown if not included) return new jQuery.fn.init( selector, context ); }, // Support: Android<4.1, IE<9 // Make sure we trim BOM and NBSP rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return letter.toUpperCase(); }; jQuery.fn = jQuery.prototype = { // The current version of jQuery being used jquery: version, constructor: jQuery, // Start with an empty selector selector: "", // The default length of a jQuery object is 0 length: 0, toArray: function() { return slice.call( this ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num != null ? // Return just the one element from the set ( num < 0 ? this[ num + this.length ] : this[ num ] ) : // Return all the elements in a clean array slice.call( this ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems ) { // Build a new jQuery matched element set var ret = jQuery.merge( this.constructor(), elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. each: function( callback ) { return jQuery.each( this, callback ); }, map: function( callback ) { return this.pushStack( jQuery.map( this, function( elem, i ) { return callback.call( elem, i, elem ); } ) ); }, slice: function() { return this.pushStack( slice.apply( this, arguments ) ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, eq: function( i ) { var len = this.length, j = +i + ( i < 0 ? len : 0 ); return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); }, end: function() { return this.prevObject || this.constructor(); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: push, sort: deletedIds.sort, splice: deletedIds.splice }; jQuery.extend = jQuery.fn.extend = function() { var src, copyIsArray, copy, name, options, clone, target = arguments[ 0 ] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; // skip the boolean and the target target = arguments[ i ] || {}; i++; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { target = {}; } // extend jQuery itself if only one argument is passed if ( i === length ) { target = this; i--; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( ( options = arguments[ i ] ) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject( copy ) || ( copyIsArray = jQuery.isArray( copy ) ) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray( src ) ? src : []; } else { clone = src && jQuery.isPlainObject( src ) ? src : {}; } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend( { // Unique for each copy of jQuery on the page expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), // Assume jQuery is ready without the ready module isReady: true, error: function( msg ) { throw new Error( msg ); }, noop: function() {}, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { return jQuery.type( obj ) === "function"; }, isArray: Array.isArray || function( obj ) { return jQuery.type( obj ) === "array"; }, isWindow: function( obj ) { /* jshint eqeqeq: false */ return obj != null && obj == obj.window; }, isNumeric: function( obj ) { // parseFloat NaNs numeric-cast false positives (null|true|false|"") // ...but misinterprets leading-number strings, particularly hex literals ("0x...") // subtraction forces infinities to NaN // adding 1 corrects loss of precision from parseFloat (#15100) var realStringObj = obj && obj.toString(); return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0; }, isEmptyObject: function( obj ) { var name; for ( name in obj ) { return false; } return true; }, isPlainObject: function( obj ) { var key; // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } try { // Not own constructor property must be Object if ( obj.constructor && !hasOwn.call( obj, "constructor" ) && !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { return false; } } catch ( e ) { // IE8,9 Will throw exceptions on certain host objects #9897 return false; } // Support: IE<9 // Handle iteration over inherited properties before own properties. if ( !support.ownFirst ) { for ( key in obj ) { return hasOwn.call( obj, key ); } } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. for ( key in obj ) {} return key === undefined || hasOwn.call( obj, key ); }, type: function( obj ) { if ( obj == null ) { return obj + ""; } return typeof obj === "object" || typeof obj === "function" ? class2type[ toString.call( obj ) ] || "object" : typeof obj; }, // Workarounds based on findings by Jim Driscoll // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globalEval: function( data ) { if ( data && jQuery.trim( data ) ) { // We use execScript on Internet Explorer // We use an anonymous function so that context is window // rather than jQuery in Firefox ( window.execScript || function( data ) { window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation } )( data ); } }, // Convert dashed to camelCase; used by the css and data modules // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, each: function( obj, callback ) { var length, i = 0; if ( isArrayLike( obj ) ) { length = obj.length; for ( ; i < length; i++ ) { if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { break; } } } else { for ( i in obj ) { if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { break; } } } return obj; }, // Support: Android<4.1, IE<9 trim: function( text ) { return text == null ? "" : ( text + "" ).replace( rtrim, "" ); }, // results is for internal usage only makeArray: function( arr, results ) { var ret = results || []; if ( arr != null ) { if ( isArrayLike( Object( arr ) ) ) { jQuery.merge( ret, typeof arr === "string" ? [ arr ] : arr ); } else { push.call( ret, arr ); } } return ret; }, inArray: function( elem, arr, i ) { var len; if ( arr ) { if ( indexOf ) { return indexOf.call( arr, elem, i ); } len = arr.length; i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; for ( ; i < len; i++ ) { // Skip accessing in sparse arrays if ( i in arr && arr[ i ] === elem ) { return i; } } } return -1; }, merge: function( first, second ) { var len = +second.length, j = 0, i = first.length; while ( j < len ) { first[ i++ ] = second[ j++ ]; } // Support: IE<9 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) if ( len !== len ) { while ( second[ j ] !== undefined ) { first[ i++ ] = second[ j++ ]; } } first.length = i; return first; }, grep: function( elems, callback, invert ) { var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert; // Go through the array, only saving the items // that pass the validator function for ( ; i < length; i++ ) { callbackInverse = !callback( elems[ i ], i ); if ( callbackInverse !== callbackExpect ) { matches.push( elems[ i ] ); } } return matches; }, // arg is for internal usage only map: function( elems, callback, arg ) { var length, value, i = 0, ret = []; // Go through the array, translating each of the items to their new values if ( isArrayLike( elems ) ) { length = elems.length; for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } // Go through every key on the object, } else { for ( i in elems ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret.push( value ); } } } // Flatten any nested arrays return concat.apply( [], ret ); }, // A global GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { var args, proxy, tmp; if ( typeof context === "string" ) { tmp = fn[ context ]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if ( !jQuery.isFunction( fn ) ) { return undefined; } // Simulated bind args = slice.call( arguments, 2 ); proxy = function() { return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, now: function() { return +( new Date() ); }, // jQuery.support is not used in Core but other projects attach their // properties to it so it needs to exist. support: support } ); // JSHint would error on this code due to the Symbol not being defined in ES5. // Defining this global in .jshintrc would create a danger of using the global // unguarded in another place, it seems safer to just disable JSHint for these // three lines. /* jshint ignore: start */ if ( typeof Symbol === "function" ) { jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ]; } /* jshint ignore: end */ // Populate the class2type map jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), function( i, name ) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); } ); function isArrayLike( obj ) { // Support: iOS 8.2 (not reproducible in simulator) // `in` check used to prevent JIT error (gh-2145) // hasOwn isn't used here due to false negatives // regarding Nodelist length in IE var length = !!obj && "length" in obj && obj.length, type = jQuery.type( obj ); if ( type === "function" || jQuery.isWindow( obj ) ) { return false; } return type === "array" || length === 0 || typeof length === "number" && length > 0 && ( length - 1 ) in obj; } var Sizzle = /*! * Sizzle CSS Selector Engine v2.2.1 * http://sizzlejs.com/ * * Copyright jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2015-10-17 */ (function( window ) { var i, support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, // Local document vars setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, // Instance-specific data expando = "sizzle" + 1 * new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function( a, b ) { if ( a === b ) { hasDuplicate = true; } return 0; }, // General-purpose constants MAX_NEGATIVE = 1 << 31, // Instance methods hasOwn = ({}).hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, // Use a stripped-down indexOf as it's faster than native // http://jsperf.com/thor-indexof-vs-for/5 indexOf = function( list, elem ) { var i = 0, len = list.length; for ( ; i < len; i++ ) { if ( list[i] === elem ) { return i; } } return -1; }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", // Regular expressions // http://www.w3.org/TR/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + // Operator (capture 2) "*([*^$|!~]?=)" + whitespace + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + identifier + ")(?:\\((" + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: // 1. quoted (capture 3; capture 4 or capture 5) "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + // 2. simple (capture 6) "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + // 3. anything else (capture 2) ".*" + ")\\)|)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rwhitespace = new RegExp( whitespace + "+", "g" ), rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), rpseudo = new RegExp( pseudos ), ridentifier = new RegExp( "^" + identifier + "$" ), matchExpr = { "ID": new RegExp( "^#(" + identifier + ")" ), "CLASS": new RegExp( "^\\.(" + identifier + ")" ), "TAG": new RegExp( "^(" + identifier + "|[*])" ), "ATTR": new RegExp( "^" + attributes ), "PSEUDO": new RegExp( "^" + pseudos ), "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), // For use in libraries implementing .is() // We use this for POS matching in `select` "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, rescape = /'|\\/g, // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), funescape = function( _, escaped, escapedWhitespace ) { var high = "0x" + escaped - 0x10000; // NaN means non-codepoint // Support: Firefox<24 // Workaround erroneous numeric interpretation of +"0x" return high !== high || escapedWhitespace ? escaped : high < 0 ? // BMP codepoint String.fromCharCode( high + 0x10000 ) : // Supplemental Plane codepoint (surrogate pair) String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); }, // Used for iframes // See setDocument() // Removing the function wrapper causes a "Permission Denied" // error in IE unloadHandler = function() { setDocument(); }; // Optimize for push.apply( _, NodeList ) try { push.apply( (arr = slice.call( preferredDoc.childNodes )), preferredDoc.childNodes ); // Support: Android<4.0 // Detect silently failing push.apply arr[ preferredDoc.childNodes.length ].nodeType; } catch ( e ) { push = { apply: arr.length ? // Leverage slice if possible function( target, els ) { push_native.apply( target, slice.call(els) ); } : // Support: IE<9 // Otherwise append directly function( target, els ) { var j = target.length, i = 0; // Can't trust NodeList.length while ( (target[j++] = els[i++]) ) {} target.length = j - 1; } }; } function Sizzle( selector, context, results, seed ) { var m, i, elem, nid, nidselect, match, groups, newSelector, newContext = context && context.ownerDocument, // nodeType defaults to 9, since context defaults to document nodeType = context ? context.nodeType : 9; results = results || []; // Return early from calls with invalid selector or context if ( typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { return results; } // Try to shortcut find operations (as opposed to filters) in HTML documents if ( !seed ) { if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { setDocument( context ); } context = context || document; if ( documentIsHTML ) { // If the selector is sufficiently simple, try using a "get*By*" DOM method // (excepting DocumentFragment context, where the methods don't exist) if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { // ID selector if ( (m = match[1]) ) { // Document context if ( nodeType === 9 ) { if ( (elem = context.getElementById( m )) ) { // Support: IE, Opera, Webkit // TODO: identify versions // getElementById can match elements by name instead of ID if ( elem.id === m ) { results.push( elem ); return results; } } else { return results; } // Element context } else { // Support: IE, Opera, Webkit // TODO: identify versions // getElementById can match elements by name instead of ID if ( newContext && (elem = newContext.getElementById( m )) && contains( context, elem ) && elem.id === m ) { results.push( elem ); return results; } } // Type selector } else if ( match[2] ) { push.apply( results, context.getElementsByTagName( selector ) ); return results; // Class selector } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { push.apply( results, context.getElementsByClassName( m ) ); return results; } } // Take advantage of querySelectorAll if ( support.qsa && !compilerCache[ selector + " " ] && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { if ( nodeType !== 1 ) { newContext = context; newSelector = selector; // qSA looks outside Element context, which is not what we want // Thanks to Andrew Dupont for this workaround technique // Support: IE <=8 // Exclude object elements } else if ( context.nodeName.toLowerCase() !== "object" ) { // Capture the context ID, setting it first if necessary if ( (nid = context.getAttribute( "id" )) ) { nid = nid.replace( rescape, "\\$&" ); } else { context.setAttribute( "id", (nid = expando) ); } // Prefix every selector in the list groups = tokenize( selector ); i = groups.length; nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']"; while ( i-- ) { groups[i] = nidselect + " " + toSelector( groups[i] ); } newSelector = groups.join( "," ); // Expand context for sibling selectors newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; } if ( newSelector ) { try { push.apply( results, newContext.querySelectorAll( newSelector ) ); return results; } catch ( qsaError ) { } finally { if ( nid === expando ) { context.removeAttribute( "id" ); } } } } } } // All others return select( selector.replace( rtrim, "$1" ), context, results, seed ); } /** * Create key-value caches of limited size * @returns {function(string, object)} Returns the Object data after storing it on itself with * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) * deleting the oldest entry */ function createCache() { var keys = []; function cache( key, value ) { // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) if ( keys.push( key + " " ) > Expr.cacheLength ) { // Only keep the most recent entries delete cache[ keys.shift() ]; } return (cache[ key + " " ] = value); } return cache; } /** * Mark a function for special use by Sizzle * @param {Function} fn The function to mark */ function markFunction( fn ) { fn[ expando ] = true; return fn; } /** * Support testing using an element * @param {Function} fn Passed the created div and expects a boolean result */ function assert( fn ) { var div = document.createElement("div"); try { return !!fn( div ); } catch (e) { return false; } finally { // Remove from its parent by default if ( div.parentNode ) { div.parentNode.removeChild( div ); } // release memory in IE div = null; } } /** * Adds the same handler for all of the specified attrs * @param {String} attrs Pipe-separated list of attributes * @param {Function} handler The method that will be applied */ function addHandle( attrs, handler ) { var arr = attrs.split("|"), i = arr.length; while ( i-- ) { Expr.attrHandle[ arr[i] ] = handler; } } /** * Checks document order of two siblings * @param {Element} a * @param {Element} b * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b */ function siblingCheck( a, b ) { var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); // Use IE sourceIndex if available on both nodes if ( diff ) { return diff; } // Check if b follows a if ( cur ) { while ( (cur = cur.nextSibling) ) { if ( cur === b ) { return -1; } } } return a ? 1 : -1; } /** * Returns a function to use in pseudos for input types * @param {String} type */ function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; } /** * Returns a function to use in pseudos for buttons * @param {String} type */ function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; } /** * Returns a function to use in pseudos for positionals * @param {Function} fn */ function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /** * Checks a node for validity as a Sizzle context * @param {Element|Object=} context * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value */ function testContext( context ) { return context && typeof context.getElementsByTagName !== "undefined" && context; } // Expose support vars for convenience support = Sizzle.support = {}; /** * Detects XML nodes * @param {Element|Object} elem An element or a document * @returns {Boolean} True iff elem is a non-HTML XML node */ isXML = Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; /** * Sets document-related variables once based on the current document * @param {Element|Object} [doc] An element or document object to use to set the document * @returns {Object} Returns the current document */ setDocument = Sizzle.setDocument = function( node ) { var hasCompare, parent, doc = node ? node.ownerDocument || node : preferredDoc; // Return early if doc is invalid or already selected if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { return document; } // Update global variables document = doc; docElem = document.documentElement; documentIsHTML = !isXML( document ); // Support: IE 9-11, Edge // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) if ( (parent = document.defaultView) && parent.top !== parent ) { // Support: IE 11 if ( parent.addEventListener ) { parent.addEventListener( "unload", unloadHandler, false ); // Support: IE 9 - 10 only } else if ( parent.attachEvent ) { parent.attachEvent( "onunload", unloadHandler ); } } /* Attributes ---------------------------------------------------------------------- */ // Support: IE<8 // Verify that getAttribute really returns attributes and not properties // (excepting IE8 booleans) support.attributes = assert(function( div ) { div.className = "i"; return !div.getAttribute("className"); }); /* getElement(s)By* ---------------------------------------------------------------------- */ // Check if getElementsByTagName("*") returns only elements support.getElementsByTagName = assert(function( div ) { div.appendChild( document.createComment("") ); return !div.getElementsByTagName("*").length; }); // Support: IE<9 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); // Support: IE<10 // Check if getElementById returns elements by name // The broken getElementById methods don't pick up programatically-set names, // so use a roundabout getElementsByName test support.getById = assert(function( div ) { docElem.appendChild( div ).id = expando; return !document.getElementsByName || !document.getElementsByName( expando ).length; }); // ID find and filter if ( support.getById ) { Expr.find["ID"] = function( id, context ) { if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { var m = context.getElementById( id ); return m ? [ m ] : []; } }; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { return elem.getAttribute("id") === attrId; }; }; } else { // Support: IE6/7 // getElementById is not reliable as a find shortcut delete Expr.find["ID"]; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); return node && node.value === attrId; }; }; } // Tag Expr.find["TAG"] = support.getElementsByTagName ? function( tag, context ) { if ( typeof context.getElementsByTagName !== "undefined" ) { return context.getElementsByTagName( tag ); // DocumentFragment nodes don't have gEBTN } else if ( support.qsa ) { return context.querySelectorAll( tag ); } } : function( tag, context ) { var elem, tmp = [], i = 0, // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too results = context.getElementsByTagName( tag ); // Filter out possible comments if ( tag === "*" ) { while ( (elem = results[i++]) ) { if ( elem.nodeType === 1 ) { tmp.push( elem ); } } return tmp; } return results; }; // Class Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { return context.getElementsByClassName( className ); } }; /* QSA/matchesSelector ---------------------------------------------------------------------- */ // QSA and matchesSelector support // matchesSelector(:active) reports false when true (IE9/Opera 11.5) rbuggyMatches = []; // qSa(:focus) reports false when true (Chrome 21) // We allow this because of a bug in IE8/9 that throws an error // whenever `document.activeElement` is accessed on an iframe // So, we allow :focus to pass through QSA all the time to avoid the IE error // See http://bugs.jquery.com/ticket/13378 rbuggyQSA = []; if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { // Build QSA regex // Regex strategy adopted from Diego Perini assert(function( div ) { // Select is set to empty string on purpose // This is to test IE's treatment of not explicitly // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 docElem.appendChild( div ).innerHTML = "" + ""; // Support: IE8, Opera 11-12.16 // Nothing should be selected when empty strings follow ^= or $= or *= // The test attribute must be unknown in Opera but "safe" for WinRT // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section if ( div.querySelectorAll("[msallowcapture^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); } // Support: IE8 // Boolean attributes and "value" are not treated correctly if ( !div.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); } // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { rbuggyQSA.push("~="); } // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } // Support: Safari 8+, iOS 8+ // https://bugs.webkit.org/show_bug.cgi?id=136851 // In-page `selector#id sibing-combinator selector` fails if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { rbuggyQSA.push(".#.+[+~]"); } }); assert(function( div ) { // Support: Windows 8 Native Apps // The type and name attributes are restricted during .innerHTML assignment var input = document.createElement("input"); input.setAttribute( "type", "hidden" ); div.appendChild( input ).setAttribute( "name", "D" ); // Support: IE8 // Enforce case-sensitivity of name attribute if ( div.querySelectorAll("[name=d]").length ) { rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":enabled").length ) { rbuggyQSA.push( ":enabled", ":disabled" ); } // Opera 10-11 does not throw on post-comma invalid pseudos div.querySelectorAll("*,:x"); rbuggyQSA.push(",.*:"); }); } if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { assert(function( div ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) support.disconnectedMatch = matches.call( div, "div" ); // This should fail with an exception // Gecko does not error, returns false instead matches.call( div, "[s!='']:x" ); rbuggyMatches.push( "!=", pseudos ); }); } rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); /* Contains ---------------------------------------------------------------------- */ hasCompare = rnative.test( docElem.compareDocumentPosition ); // Element contains another // Purposefully self-exclusive // As in, an element does not contain itself contains = hasCompare || rnative.test( docElem.contains ) ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && ( adown.contains ? adown.contains( bup ) : a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 )); } : function( a, b ) { if ( b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } } return false; }; /* Sorting ---------------------------------------------------------------------- */ // Document order sorting sortOrder = hasCompare ? function( a, b ) { // Flag for duplicate removal if ( a === b ) { hasDuplicate = true; return 0; } // Sort on method existence if only one input has compareDocumentPosition var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; if ( compare ) { return compare; } // Calculate position if both inputs belong to the same document compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? a.compareDocumentPosition( b ) : // Otherwise we know they are disconnected 1; // Disconnected nodes if ( compare & 1 || (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { // Choose the first element that is related to our preferred document if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { return -1; } if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { return 1; } // Maintain original order return sortInput ? ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 0; } return compare & 4 ? -1 : 1; } : function( a, b ) { // Exit early if the nodes are identical if ( a === b ) { hasDuplicate = true; return 0; } var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [ a ], bp = [ b ]; // Parentless nodes are either documents or disconnected if ( !aup || !bup ) { return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 0; // If the nodes are siblings, we can do a quick check } else if ( aup === bup ) { return siblingCheck( a, b ); } // Otherwise we need full lists of their ancestors for comparison cur = a; while ( (cur = cur.parentNode) ) { ap.unshift( cur ); } cur = b; while ( (cur = cur.parentNode) ) { bp.unshift( cur ); } // Walk down the tree looking for a discrepancy while ( ap[i] === bp[i] ) { i++; } return i ? // Do a sibling check if the nodes have a common ancestor siblingCheck( ap[i], bp[i] ) : // Otherwise nodes in our document sort first ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0; }; return document; }; Sizzle.matches = function( expr, elements ) { return Sizzle( expr, null, null, elements ); }; Sizzle.matchesSelector = function( elem, expr ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } // Make sure that attribute selectors are quoted expr = expr.replace( rattributeQuotes, "='$1']" ); if ( support.matchesSelector && documentIsHTML && !compilerCache[ expr + " " ] && ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { try { var ret = matches.call( elem, expr ); // IE 9's matchesSelector returns false on disconnected nodes if ( ret || support.disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9 elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch (e) {} } return Sizzle( expr, document, null, [ elem ] ).length > 0; }; Sizzle.contains = function( context, elem ) { // Set document vars if needed if ( ( context.ownerDocument || context ) !== document ) { setDocument( context ); } return contains( context, elem ); }; Sizzle.attr = function( elem, name ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } var fn = Expr.attrHandle[ name.toLowerCase() ], // Don't get fooled by Object.prototype properties (jQuery #13807) val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? fn( elem, name, !documentIsHTML ) : undefined; return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute( name ) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null; }; Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; /** * Document sorting and removing duplicates * @param {ArrayLike} results */ Sizzle.uniqueSort = function( results ) { var elem, duplicates = [], j = 0, i = 0; // Unless we *know* we can detect duplicates, assume their presence hasDuplicate = !support.detectDuplicates; sortInput = !support.sortStable && results.slice( 0 ); results.sort( sortOrder ); if ( hasDuplicate ) { while ( (elem = results[i++]) ) { if ( elem === results[ i ] ) { j = duplicates.push( i ); } } while ( j-- ) { results.splice( duplicates[ j ], 1 ); } } // Clear input after sorting to release objects // See https://github.com/jquery/sizzle/pull/225 sortInput = null; return results; }; /** * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ getText = Sizzle.getText = function( elem ) { var node, ret = "", i = 0, nodeType = elem.nodeType; if ( !nodeType ) { // If no nodeType, this is expected to be an array while ( (node = elem[i++]) ) { // Do not traverse comment nodes ret += getText( node ); } } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { // Use textContent for elements // innerText usage removed for consistency of new lines (jQuery #11153) if ( typeof elem.textContent === "string" ) { return elem.textContent; } else { // Traverse its children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } // Do not include comment or processing instruction nodes return ret; }; Expr = Sizzle.selectors = { // Can be adjusted by the user cacheLength: 50, createPseudo: markFunction, match: matchExpr, attrHandle: {}, find: {}, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { "ATTR": function( match ) { match[1] = match[1].replace( runescape, funescape ); // Move the given value to match[3] whether quoted or unquoted match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; } return match.slice( 0, 4 ); }, "CHILD": function( match ) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 what (child|of-type) 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 4 xn-component of xn+y argument ([+-]?\d*n|) 5 sign of xn-component 6 x of xn-component 7 sign of y-component 8 y of y-component */ match[1] = match[1].toLowerCase(); if ( match[1].slice( 0, 3 ) === "nth" ) { // nth-* requires argument if ( !match[3] ) { Sizzle.error( match[0] ); } // numeric x and y parameters for Expr.filter.CHILD // remember that false/true cast respectively to 0/1 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); // other types prohibit arguments } else if ( match[3] ) { Sizzle.error( match[0] ); } return match; }, "PSEUDO": function( match ) { var excess, unquoted = !match[6] && match[2]; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } // Accept quoted arguments as-is if ( match[3] ) { match[2] = match[4] || match[5] || ""; // Strip excess characters from unquoted arguments } else if ( unquoted && rpseudo.test( unquoted ) && // Get excess from tokenize (recursively) (excess = tokenize( unquoted, true )) && // advance to the next closing parenthesis (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { // excess is a negative index match[0] = match[0].slice( 0, excess ); match[2] = unquoted.slice( 0, excess ); } // Return only captures needed by the pseudo filter method (type and argument) return match.slice( 0, 3 ); } }, filter: { "TAG": function( nodeNameSelector ) { var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); return nodeNameSelector === "*" ? function() { return true; } : function( elem ) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function( className ) { var pattern = classCache[ className + " " ]; return pattern || (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && classCache( className, function( elem ) { return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); }); }, "ATTR": function( name, operator, check ) { return function( elem ) { var result = Sizzle.attr( elem, name ); if ( result == null ) { return operator === "!="; } if ( !operator ) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf( check ) === 0 : operator === "*=" ? check && result.indexOf( check ) > -1 : operator === "$=" ? check && result.slice( -check.length ) === check : operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : false; }; }, "CHILD": function( type, what, argument, first, last ) { var simple = type.slice( 0, 3 ) !== "nth", forward = type.slice( -4 ) !== "last", ofType = what === "of-type"; return first === 1 && last === 0 ? // Shortcut for :nth-*(n) function( elem ) { return !!elem.parentNode; } : function( elem, context, xml ) { var cache, uniqueCache, outerCache, node, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false; if ( parent ) { // :(first|last|only)-(child|of-type) if ( simple ) { while ( dir ) { node = elem; while ( (node = node[ dir ]) ) { if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { return false; } } // Reverse direction for :only-* (if we haven't yet done so) start = dir = type === "only" && !start && "nextSibling"; } return true; } start = [ forward ? parent.firstChild : parent.lastChild ]; // non-xml :nth-child(...) stores cache data on `parent` if ( forward && useCache ) { // Seek `elem` from a previously-cached index // ...in a gzip-friendly way node = parent; outerCache = node[ expando ] || (node[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ node.uniqueID ] || (outerCache[ node.uniqueID ] = {}); cache = uniqueCache[ type ] || []; nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; diff = nodeIndex && cache[ 2 ]; node = nodeIndex && parent.childNodes[ nodeIndex ]; while ( (node = ++nodeIndex && node && node[ dir ] || // Fallback to seeking `elem` from the start (diff = nodeIndex = 0) || start.pop()) ) { // When found, cache indexes on `parent` and break if ( node.nodeType === 1 && ++diff && node === elem ) { uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; break; } } } else { // Use previously-cached element index if available if ( useCache ) { // ...in a gzip-friendly way node = elem; outerCache = node[ expando ] || (node[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ node.uniqueID ] || (outerCache[ node.uniqueID ] = {}); cache = uniqueCache[ type ] || []; nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; diff = nodeIndex; } // xml :nth-child(...) // or :nth-last-child(...) or :nth(-last)?-of-type(...) if ( diff === false ) { // Use the same loop as above to seek `elem` from the start while ( (node = ++nodeIndex && node && node[ dir ] || (diff = nodeIndex = 0) || start.pop()) ) { if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { // Cache the index of each encountered element if ( useCache ) { outerCache = node[ expando ] || (node[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ node.uniqueID ] || (outerCache[ node.uniqueID ] = {}); uniqueCache[ type ] = [ dirruns, diff ]; } if ( node === elem ) { break; } } } } } // Incorporate the offset, then check against cycle size diff -= last; return diff === first || ( diff % first === 0 && diff / first >= 0 ); } }; }, "PSEUDO": function( pseudo, argument ) { // pseudo-class names are case-insensitive // http://www.w3.org/TR/selectors/#pseudo-classes // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Remember that setFilters inherits from pseudos var args, fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || Sizzle.error( "unsupported pseudo: " + pseudo ); // The user may use createPseudo to indicate that // arguments are needed to create the filter function // just as Sizzle does if ( fn[ expando ] ) { return fn( argument ); } // But maintain support for old signatures if ( fn.length > 1 ) { args = [ pseudo, pseudo, "", argument ]; return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? markFunction(function( seed, matches ) { var idx, matched = fn( seed, argument ), i = matched.length; while ( i-- ) { idx = indexOf( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : function( elem ) { return fn( elem, 0, args ); }; } return fn; } }, pseudos: { // Potentially complex pseudos "not": markFunction(function( selector ) { // Trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], matcher = compile( selector.replace( rtrim, "$1" ) ); return matcher[ expando ] ? markFunction(function( seed, matches, context, xml ) { var elem, unmatched = matcher( seed, null, xml, [] ), i = seed.length; // Match elements unmatched by `matcher` while ( i-- ) { if ( (elem = unmatched[i]) ) { seed[i] = !(matches[i] = elem); } } }) : function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); // Don't keep the element (issue #299) input[0] = null; return !results.pop(); }; }), "has": markFunction(function( selector ) { return function( elem ) { return Sizzle( selector, elem ).length > 0; }; }), "contains": markFunction(function( text ) { text = text.replace( runescape, funescape ); return function( elem ) { return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; }; }), // "Whether an element is represented by a :lang() selector // is based solely on the element's language value // being equal to the identifier C, // or beginning with the identifier C immediately followed by "-". // The matching of C against the element's language value is performed case-insensitively. // The identifier C does not have to be a valid language name." // http://www.w3.org/TR/selectors/#lang-pseudo "lang": markFunction( function( lang ) { // lang value must be a valid identifier if ( !ridentifier.test(lang || "") ) { Sizzle.error( "unsupported lang: " + lang ); } lang = lang.replace( runescape, funescape ).toLowerCase(); return function( elem ) { var elemLang; do { if ( (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { elemLang = elemLang.toLowerCase(); return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; } } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); return false; }; }), // Miscellaneous "target": function( elem ) { var hash = window.location && window.location.hash; return hash && hash.slice( 1 ) === elem.id; }, "root": function( elem ) { return elem === docElem; }, "focus": function( elem ) { return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); }, // Boolean properties "enabled": function( elem ) { return elem.disabled === false; }, "disabled": function( elem ) { return elem.disabled === true; }, "checked": function( elem ) { // In CSS3, :checked should return both checked and selected elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked var nodeName = elem.nodeName.toLowerCase(); return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); }, "selected": function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly if ( elem.parentNode ) { elem.parentNode.selectedIndex; } return elem.selected === true; }, // Contents "empty": function( elem ) { // http://www.w3.org/TR/selectors/#empty-pseudo // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), // but not by others (comment: 8; processing instruction: 7; etc.) // nodeType < 6 works because attributes (2) do not appear as children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { if ( elem.nodeType < 6 ) { return false; } } return true; }, "parent": function( elem ) { return !Expr.pseudos["empty"]( elem ); }, // Element/input types "header": function( elem ) { return rheader.test( elem.nodeName ); }, "input": function( elem ) { return rinputs.test( elem.nodeName ); }, "button": function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "text": function( elem ) { var attr; return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && // Support: IE<8 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); }, // Position-in-collection "first": createPositionalPseudo(function() { return [ 0 ]; }), "last": createPositionalPseudo(function( matchIndexes, length ) { return [ length - 1 ]; }), "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; }), "even": createPositionalPseudo(function( matchIndexes, length ) { var i = 0; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "odd": createPositionalPseudo(function( matchIndexes, length ) { var i = 1; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; }), "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; ++i < length; ) { matchIndexes.push( i ); } return matchIndexes; }) } }; Expr.pseudos["nth"] = Expr.pseudos["eq"]; // Add button/input type pseudos for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { Expr.pseudos[ i ] = createInputPseudo( i ); } for ( i in { submit: true, reset: true } ) { Expr.pseudos[ i ] = createButtonPseudo( i ); } // Easy API for creating new setFilters function setFilters() {} setFilters.prototype = Expr.filters = Expr.pseudos; Expr.setFilters = new setFilters(); tokenize = Sizzle.tokenize = function( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; if ( cached ) { return parseOnly ? 0 : cached.slice( 0 ); } soFar = selector; groups = []; preFilters = Expr.preFilter; while ( soFar ) { // Comma and first run if ( !matched || (match = rcomma.exec( soFar )) ) { if ( match ) { // Don't consume trailing commas as valid soFar = soFar.slice( match[0].length ) || soFar; } groups.push( (tokens = []) ); } matched = false; // Combinators if ( (match = rcombinators.exec( soFar )) ) { matched = match.shift(); tokens.push({ value: matched, // Cast descendant combinators to space type: match[0].replace( rtrim, " " ) }); soFar = soFar.slice( matched.length ); } // Filters for ( type in Expr.filter ) { if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || (match = preFilters[ type ]( match ))) ) { matched = match.shift(); tokens.push({ value: matched, type: type, matches: match }); soFar = soFar.slice( matched.length ); } } if ( !matched ) { break; } } // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens return parseOnly ? soFar.length : soFar ? Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); }; function toSelector( tokens ) { var i = 0, len = tokens.length, selector = ""; for ( ; i < len; i++ ) { selector += tokens[i].value; } return selector; } function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, checkNonElements = base && dir === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { return matcher( elem, context, xml ); } } } : // Check against all ancestor/preceding elements function( elem, context, xml ) { var oldCache, uniqueCache, outerCache, newCache = [ dirruns, doneName ]; // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching if ( xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { if ( matcher( elem, context, xml ) ) { return true; } } } } else { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { outerCache = elem[ expando ] || (elem[ expando ] = {}); // Support: IE <9 only // Defend against cloned attroperties (jQuery gh-1709) uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); if ( (oldCache = uniqueCache[ dir ]) && oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { // Assign to newCache so results back-propagate to previous elements return (newCache[ 2 ] = oldCache[ 2 ]); } else { // Reuse newcache so results back-propagate to previous elements uniqueCache[ dir ] = newCache; // A match means we're done; a fail means we have to keep checking if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { return true; } } } } } }; } function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; } function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { Sizzle( selector, contexts[i], results ); } return results; } function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newUnmatched.push( elem ); if ( mapped ) { map.push( i ); } } } } return newUnmatched; } function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { if ( postFilter && !postFilter[ expando ] ) { postFilter = setMatcher( postFilter ); } if ( postFinder && !postFinder[ expando ] ) { postFinder = setMatcher( postFinder, postSelector ); } return markFunction(function( seed, results, context, xml ) { var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : elems, matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, postFinder || ( seed ? preFilter : preexisting || postFilter ) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherIn; // Find primary matches if ( matcher ) { matcher( matcherIn, matcherOut, context, xml ); } // Apply postFilter if ( postFilter ) { temp = condense( matcherOut, postMap ); postFilter( temp, [], context, xml ); // Un-match failing elements by moving them back to matcherIn i = temp.length; while ( i-- ) { if ( (elem = temp[i]) ) { matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); } } } if ( seed ) { if ( postFinder || preFilter ) { if ( postFinder ) { // Get the final matcherOut by condensing this intermediate into postFinder contexts temp = []; i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) ) { // Restore matcherIn since elem is not yet a final match temp.push( (matcherIn[i] = elem) ); } } postFinder( null, (matcherOut = []), temp, xml ); } // Move matched elements from seed to results to keep them synchronized i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) && (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } } } // Add elements to results, through postFinder if defined } else { matcherOut = condense( matcherOut === results ? matcherOut.splice( preexisting, matcherOut.length ) : matcherOut ); if ( postFinder ) { postFinder( null, results, matcherOut, xml ); } else { push.apply( results, matcherOut ); } } }); } function matcherFromTokens( tokens ) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[ tokens[0].type ], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, // The foundational matcher ensures that elements are reachable from top-level context(s) matchContext = addCombinator( function( elem ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { return indexOf( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); // Avoid hanging onto element (issue #299) checkContext = null; return ret; } ]; for ( ; i < len; i++ ) { if ( (matcher = Expr.relative[ tokens[i].type ]) ) { matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; } else { matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); // Return special upon seeing a positional matcher if ( matcher[ expando ] ) { // Find the next relative operator (if any) for proper handling j = ++i; for ( ; j < len; j++ ) { if ( Expr.relative[ tokens[j].type ] ) { break; } } return setMatcher( i > 1 && elementMatcher( matchers ), i > 1 && toSelector( // If the preceding token was a descendant combinator, insert an implicit any-element `*` tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) ).replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), j < len && toSelector( tokens ) ); } matchers.push( matcher ); } } return elementMatcher( matchers ); } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, outermost ) { var elem, j, matcher, matchedCount = 0, i = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, // We must always have either seed elements or outermost context elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), // Use integer dirruns iff this is the outermost matcher dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), len = elems.length; if ( outermost ) { outermostContext = context === document || context || outermost; } // Add elements passing elementMatchers directly to results // Support: IE<9, Safari // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id for ( ; i !== len && (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { j = 0; if ( !context && elem.ownerDocument !== document ) { setDocument( elem ); xml = !documentIsHTML; } while ( (matcher = elementMatchers[j++]) ) { if ( matcher( elem, context || document, xml) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // `i` is now the count of elements visited above, and adding it to `matchedCount` // makes the latter nonnegative. matchedCount += i; // Apply set filters to unmatched elements // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` // equals `i`), unless we didn't visit _any_ elements in the above loop because we have // no element matchers and no seed. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that // case, which will result in a "00" `matchedCount` that differs from `i` but is also // numerically zero. if ( bySet && i !== matchedCount ) { j = 0; while ( (matcher = setMatchers[j++]) ) { matcher( unmatched, setMatched, context, xml ); } if ( seed ) { // Reintegrate element matches to eliminate the need for sorting if ( matchedCount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setMatched[i]) ) { setMatched[i] = pop.call( results ); } } } // Discard index placeholder values to get only actual matches setMatched = condense( setMatched ); } // Add matches to results push.apply( results, setMatched ); // Seedless set matches succeeding multiple successful matchers stipulate sorting if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { Sizzle.uniqueSort( results ); } } // Override manipulation of globals by nested matchers if ( outermost ) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; return bySet ? markFunction( superMatcher ) : superMatcher; } compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], cached = compilerCache[ selector + " " ]; if ( !cached ) { // Generate a function of recursive functions that can be used to check each element if ( !match ) { match = tokenize( selector ); } i = match.length; while ( i-- ) { cached = matcherFromTokens( match[i] ); if ( cached[ expando ] ) { setMatchers.push( cached ); } else { elementMatchers.push( cached ); } } // Cache the compiled function cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); // Save selector and tokenization cached.selector = selector; } return cached; }; /** * A low-level selection function that works with Sizzle's compiled * selector functions * @param {String|Function} selector A selector or a pre-compiled * selector function built with Sizzle.compile * @param {Element} context * @param {Array} [results] * @param {Array} [seed] A set of elements to match against */ select = Sizzle.select = function( selector, context, results, seed ) { var i, tokens, token, type, find, compiled = typeof selector === "function" && selector, match = !seed && tokenize( (selector = compiled.selector || selector) ); results = results || []; // Try to minimize operations if there is only one selector in the list and no seed // (the latter of which guarantees us context) if ( match.length === 1 ) { // Reduce context if the leading compound selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; if ( !context ) { return results; // Precompiled matchers will still verify ancestry, so step up a level } else if ( compiled ) { context = context.parentNode; } selector = selector.slice( tokens.shift().value.length ); } // Fetch a seed set for right-to-left matching i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; while ( i-- ) { token = tokens[i]; // Abort if we hit a combinator if ( Expr.relative[ (type = token.type) ] ) { break; } if ( (find = Expr.find[ type ]) ) { // Search, expanding context for leading sibling combinators if ( (seed = find( token.matches[0].replace( runescape, funescape ), rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context )) ) { // If seed is empty or no tokens remain, we can return early tokens.splice( i, 1 ); selector = seed.length && toSelector( tokens ); if ( !selector ) { push.apply( results, seed ); return results; } break; } } } } // Compile and execute a filtering function if one is not provided // Provide `match` to avoid retokenization if we modified the selector above ( compiled || compile( selector, match ) )( seed, context, !documentIsHTML, results, !context || rsibling.test( selector ) && testContext( context.parentNode ) || context ); return results; }; // One-time assignments // Sort stability support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; // Support: Chrome 14-35+ // Always assume duplicates if they aren't passed to the comparison function support.detectDuplicates = !!hasDuplicate; // Initialize against the default document setDocument(); // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) // Detached nodes confoundingly follow *each other* support.sortDetached = assert(function( div1 ) { // Should return 1, but returns 4 (following) return div1.compareDocumentPosition( document.createElement("div") ) & 1; }); // Support: IE<8 // Prevent attribute/property "interpolation" // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx if ( !assert(function( div ) { div.innerHTML = ""; return div.firstChild.getAttribute("href") === "#" ; }) ) { addHandle( "type|href|height|width", function( elem, name, isXML ) { if ( !isXML ) { return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); } }); } // Support: IE<9 // Use defaultValue in place of getAttribute("value") if ( !support.attributes || !assert(function( div ) { div.innerHTML = ""; div.firstChild.setAttribute( "value", "" ); return div.firstChild.getAttribute( "value" ) === ""; }) ) { addHandle( "value", function( elem, name, isXML ) { if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { return elem.defaultValue; } }); } // Support: IE<9 // Use getAttributeNode to fetch booleans when getAttribute lies if ( !assert(function( div ) { return div.getAttribute("disabled") == null; }) ) { addHandle( booleans, function( elem, name, isXML ) { var val; if ( !isXML ) { return elem[ name ] === true ? name.toLowerCase() : (val = elem.getAttributeNode( name )) && val.specified ? val.value : null; } }); } return Sizzle; })( window ); jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[ ":" ] = jQuery.expr.pseudos; jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; var dir = function( elem, dir, until ) { var matched = [], truncate = until !== undefined; while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { if ( elem.nodeType === 1 ) { if ( truncate && jQuery( elem ).is( until ) ) { break; } matched.push( elem ); } } return matched; }; var siblings = function( n, elem ) { var matched = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { matched.push( n ); } } return matched; }; var rneedsContext = jQuery.expr.match.needsContext; var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ ); var risSimple = /^.[^:#\[\.,]*$/; // Implement the identical functionality for filter and not function winnow( elements, qualifier, not ) { if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep( elements, function( elem, i ) { /* jshint -W018 */ return !!qualifier.call( elem, i, elem ) !== not; } ); } if ( qualifier.nodeType ) { return jQuery.grep( elements, function( elem ) { return ( elem === qualifier ) !== not; } ); } if ( typeof qualifier === "string" ) { if ( risSimple.test( qualifier ) ) { return jQuery.filter( qualifier, elements, not ); } qualifier = jQuery.filter( qualifier, elements ); } return jQuery.grep( elements, function( elem ) { return ( jQuery.inArray( elem, qualifier ) > -1 ) !== not; } ); } jQuery.filter = function( expr, elems, not ) { var elem = elems[ 0 ]; if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 && elem.nodeType === 1 ? jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { return elem.nodeType === 1; } ) ); }; jQuery.fn.extend( { find: function( selector ) { var i, ret = [], self = this, len = self.length; if ( typeof selector !== "string" ) { return this.pushStack( jQuery( selector ).filter( function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } } } ) ); } for ( i = 0; i < len; i++ ) { jQuery.find( selector, self[ i ], ret ); } // Needed because $( selector, context ) becomes $( context ).find( selector ) ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); ret.selector = this.selector ? this.selector + " " + selector : selector; return ret; }, filter: function( selector ) { return this.pushStack( winnow( this, selector || [], false ) ); }, not: function( selector ) { return this.pushStack( winnow( this, selector || [], true ) ); }, is: function( selector ) { return !!winnow( this, // If this is a positional/relative selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". typeof selector === "string" && rneedsContext.test( selector ) ? jQuery( selector ) : selector || [], false ).length; } } ); // Initialize a jQuery object // A central reference to the root jQuery(document) var rootjQuery, // A simple way to check for HTML strings // Prioritize #id over to avoid XSS via location.hash (#9521) // Strict HTML recognition (#11290: must start with <) rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, init = jQuery.fn.init = function( selector, context, root ) { var match, elem; // HANDLE: $(""), $(null), $(undefined), $(false) if ( !selector ) { return this; } // init accepts an alternate rootjQuery // so migrate can support jQuery.sub (gh-2101) root = root || rootjQuery; // Handle HTML strings if ( typeof selector === "string" ) { if ( selector.charAt( 0 ) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { // Assume that strings that start and end with <> are HTML and skip the regex check match = [ null, selector, null ]; } else { match = rquickExpr.exec( selector ); } // Match html or make sure no context is specified for #id if ( match && ( match[ 1 ] || !context ) ) { // HANDLE: $(html) -> $(array) if ( match[ 1 ] ) { context = context instanceof jQuery ? context[ 0 ] : context; // scripts is true for back-compat // Intentionally let the error be thrown if parseHTML is not present jQuery.merge( this, jQuery.parseHTML( match[ 1 ], context && context.nodeType ? context.ownerDocument || context : document, true ) ); // HANDLE: $(html, props) if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { for ( match in context ) { // Properties of context are called as methods if possible if ( jQuery.isFunction( this[ match ] ) ) { this[ match ]( context[ match ] ); // ...and otherwise set as attributes } else { this.attr( match, context[ match ] ); } } } return this; // HANDLE: $(#id) } else { elem = document.getElementById( match[ 2 ] ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id !== match[ 2 ] ) { return rootjQuery.find( selector ); } // Otherwise, we inject the element directly into the jQuery object this.length = 1; this[ 0 ] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return ( context || root ).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // HANDLE: $(DOMElement) } else if ( selector.nodeType ) { this.context = this[ 0 ] = selector; this.length = 1; return this; // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return typeof root.ready !== "undefined" ? root.ready( selector ) : // Execute immediately if ready is not present selector( jQuery ); } if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray( selector, this ); }; // Give the init function the jQuery prototype for later instantiation init.prototype = jQuery.fn; // Initialize central reference rootjQuery = jQuery( document ); var rparentsprev = /^(?:parents|prev(?:Until|All))/, // methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.fn.extend( { has: function( target ) { var i, targets = jQuery( target, this ), len = targets.length; return this.filter( function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( this, targets[ i ] ) ) { return true; } } } ); }, closest: function( selectors, context ) { var cur, i = 0, l = this.length, matched = [], pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? jQuery( selectors, context || this.context ) : 0; for ( ; i < l; i++ ) { for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { // Always skip document fragments if ( cur.nodeType < 11 && ( pos ? pos.index( cur ) > -1 : // Don't pass non-elements to Sizzle cur.nodeType === 1 && jQuery.find.matchesSelector( cur, selectors ) ) ) { matched.push( cur ); break; } } } return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { // No argument, return index in parent if ( !elem ) { return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; } // index in selector if ( typeof elem === "string" ) { return jQuery.inArray( this[ 0 ], jQuery( elem ) ); } // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used elem.jquery ? elem[ 0 ] : elem, this ); }, add: function( selector, context ) { return this.pushStack( jQuery.uniqueSort( jQuery.merge( this.get(), jQuery( selector, context ) ) ) ); }, addBack: function( selector ) { return this.add( selector == null ? this.prevObject : this.prevObject.filter( selector ) ); } } ); function sibling( cur, dir ) { do { cur = cur[ dir ]; } while ( cur && cur.nodeType !== 1 ); return cur; } jQuery.each( { parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return dir( elem, "parentNode", until ); }, next: function( elem ) { return sibling( elem, "nextSibling" ); }, prev: function( elem ) { return sibling( elem, "previousSibling" ); }, nextAll: function( elem ) { return dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return siblings( ( elem.parentNode || {} ).firstChild, elem ); }, children: function( elem ) { return siblings( elem.firstChild ); }, contents: function( elem ) { return jQuery.nodeName( elem, "iframe" ) ? elem.contentDocument || elem.contentWindow.document : jQuery.merge( [], elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var ret = jQuery.map( this, fn, until ); if ( name.slice( -5 ) !== "Until" ) { selector = until; } if ( selector && typeof selector === "string" ) { ret = jQuery.filter( selector, ret ); } if ( this.length > 1 ) { // Remove duplicates if ( !guaranteedUnique[ name ] ) { ret = jQuery.uniqueSort( ret ); } // Reverse order for parents* and prev-derivatives if ( rparentsprev.test( name ) ) { ret = ret.reverse(); } } return this.pushStack( ret ); }; } ); var rnotwhite = ( /\S+/g ); // Convert String-formatted options into Object-formatted ones function createOptions( options ) { var object = {}; jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { object[ flag ] = true; } ); return object; } /* * Create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how * the callback list behaves or a more traditional option object * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible options: * * once: will ensure the callback list can only be fired once (like a Deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a Deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( options ) { // Convert options from String-formatted to Object-formatted if needed // (we check in cache first) options = typeof options === "string" ? createOptions( options ) : jQuery.extend( {}, options ); var // Flag to know if list is currently firing firing, // Last fire value for non-forgettable lists memory, // Flag to know if list was already fired fired, // Flag to prevent firing locked, // Actual callback list list = [], // Queue of execution data for repeatable lists queue = [], // Index of currently firing callback (modified by add/remove as needed) firingIndex = -1, // Fire callbacks fire = function() { // Enforce single-firing locked = options.once; // Execute callbacks for all pending executions, // respecting firingIndex overrides and runtime changes fired = firing = true; for ( ; queue.length; firingIndex = -1 ) { memory = queue.shift(); while ( ++firingIndex < list.length ) { // Run callback and check for early termination if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && options.stopOnFalse ) { // Jump to end and forget the data so .add doesn't re-fire firingIndex = list.length; memory = false; } } } // Forget the data if we're done with it if ( !options.memory ) { memory = false; } firing = false; // Clean up if we're done firing for good if ( locked ) { // Keep an empty list if we have data for future add calls if ( memory ) { list = []; // Otherwise, this object is spent } else { list = ""; } } }, // Actual Callbacks object self = { // Add a callback or a collection of callbacks to the list add: function() { if ( list ) { // If we have memory from a past run, we should fire after adding if ( memory && !firing ) { firingIndex = list.length - 1; queue.push( memory ); } ( function add( args ) { jQuery.each( args, function( _, arg ) { if ( jQuery.isFunction( arg ) ) { if ( !options.unique || !self.has( arg ) ) { list.push( arg ); } } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { // Inspect recursively add( arg ); } } ); } )( arguments ); if ( memory && !firing ) { fire(); } } return this; }, // Remove a callback from the list remove: function() { jQuery.each( arguments, function( _, arg ) { var index; while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); // Handle firing indexes if ( index <= firingIndex ) { firingIndex--; } } } ); return this; }, // Check if a given callback is in the list. // If no argument is given, return whether or not list has callbacks attached. has: function( fn ) { return fn ? jQuery.inArray( fn, list ) > -1 : list.length > 0; }, // Remove all callbacks from the list empty: function() { if ( list ) { list = []; } return this; }, // Disable .fire and .add // Abort any current/pending executions // Clear all callbacks and values disable: function() { locked = queue = []; list = memory = ""; return this; }, disabled: function() { return !list; }, // Disable .fire // Also disable .add unless we have memory (since it would have no effect) // Abort any pending executions lock: function() { locked = true; if ( !memory ) { self.disable(); } return this; }, locked: function() { return !!locked; }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { if ( !locked ) { args = args || []; args = [ context, args.slice ? args.slice() : args ]; queue.push( args ); if ( !firing ) { fire(); } } return this; }, // Call all the callbacks with the given arguments fire: function() { self.fireWith( this, arguments ); return this; }, // To know if the callbacks have already been called at least once fired: function() { return !!fired; } }; return self; }; jQuery.extend( { Deferred: function( func ) { var tuples = [ // action, add listener, listener list, final state [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ], [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ], [ "notify", "progress", jQuery.Callbacks( "memory" ) ] ], state = "pending", promise = { state: function() { return state; }, always: function() { deferred.done( arguments ).fail( arguments ); return this; }, then: function( /* fnDone, fnFail, fnProgress */ ) { var fns = arguments; return jQuery.Deferred( function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; // deferred[ done | fail | progress ] for forwarding actions to newDefer deferred[ tuple[ 1 ] ]( function() { var returned = fn && fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise() .progress( newDefer.notify ) .done( newDefer.resolve ) .fail( newDefer.reject ); } else { newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); } } ); } ); fns = null; } ).promise(); }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function( obj ) { return obj != null ? jQuery.extend( obj, promise ) : promise; } }, deferred = {}; // Keep pipe for back-compat promise.pipe = promise.then; // Add list-specific methods jQuery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], stateString = tuple[ 3 ]; // promise[ done | fail | progress ] = list.add promise[ tuple[ 1 ] ] = list.add; // Handle state if ( stateString ) { list.add( function() { // state = [ resolved | rejected ] state = stateString; // [ reject_list | resolve_list ].disable; progress_list.lock }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); } // deferred[ resolve | reject | notify ] deferred[ tuple[ 0 ] ] = function() { deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments ); return this; }; deferred[ tuple[ 0 ] + "With" ] = list.fireWith; } ); // Make the deferred a promise promise.promise( deferred ); // Call given func if any if ( func ) { func.call( deferred, deferred ); } // All done! return deferred; }, // Deferred helper when: function( subordinate /* , ..., subordinateN */ ) { var i = 0, resolveValues = slice.call( arguments ), length = resolveValues.length, // the count of uncompleted subordinates remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, // the master Deferred. // If resolveValues consist of only a single Deferred, just use that. deferred = remaining === 1 ? subordinate : jQuery.Deferred(), // Update function for both resolve and progress values updateFunc = function( i, contexts, values ) { return function( value ) { contexts[ i ] = this; values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; if ( values === progressValues ) { deferred.notifyWith( contexts, values ); } else if ( !( --remaining ) ) { deferred.resolveWith( contexts, values ); } }; }, progressValues, progressContexts, resolveContexts; // add listeners to Deferred subordinates; treat others as resolved if ( length > 1 ) { progressValues = new Array( length ); progressContexts = new Array( length ); resolveContexts = new Array( length ); for ( ; i < length; i++ ) { if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { resolveValues[ i ].promise() .progress( updateFunc( i, progressContexts, progressValues ) ) .done( updateFunc( i, resolveContexts, resolveValues ) ) .fail( deferred.reject ); } else { --remaining; } } } // if we're not waiting on anything, resolve the master if ( !remaining ) { deferred.resolveWith( resolveContexts, resolveValues ); } return deferred.promise(); } } ); // The deferred used on DOM ready var readyList; jQuery.fn.ready = function( fn ) { // Add the callback jQuery.ready.promise().done( fn ); return this; }; jQuery.extend( { // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, // Hold (or release) the ready event holdReady: function( hold ) { if ( hold ) { jQuery.readyWait++; } else { jQuery.ready( true ); } }, // Handle when the DOM is ready ready: function( wait ) { // Abort if there are pending holds or we're already ready if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { return; } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if ( wait !== true && --jQuery.readyWait > 0 ) { return; } // If there are functions bound, to execute readyList.resolveWith( document, [ jQuery ] ); // Trigger any bound ready events if ( jQuery.fn.triggerHandler ) { jQuery( document ).triggerHandler( "ready" ); jQuery( document ).off( "ready" ); } } } ); /** * Clean-up method for dom ready events */ function detach() { if ( document.addEventListener ) { document.removeEventListener( "DOMContentLoaded", completed ); window.removeEventListener( "load", completed ); } else { document.detachEvent( "onreadystatechange", completed ); window.detachEvent( "onload", completed ); } } /** * The ready event handler and self cleanup method */ function completed() { // readyState === "complete" is good enough for us to call the dom ready in oldIE if ( document.addEventListener || window.event.type === "load" || document.readyState === "complete" ) { detach(); jQuery.ready(); } } jQuery.ready.promise = function( obj ) { if ( !readyList ) { readyList = jQuery.Deferred(); // Catch cases where $(document).ready() is called // after the browser event has already occurred. // Support: IE6-10 // Older IE sometimes signals "interactive" too soon if ( document.readyState === "complete" || ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { // Handle it asynchronously to allow scripts the opportunity to delay ready window.setTimeout( jQuery.ready ); // Standards-based browsers support DOMContentLoaded } else if ( document.addEventListener ) { // Use the handy event callback document.addEventListener( "DOMContentLoaded", completed ); // A fallback to window.onload, that will always work window.addEventListener( "load", completed ); // If IE event model is used } else { // Ensure firing before onload, maybe late but safe also for iframes document.attachEvent( "onreadystatechange", completed ); // A fallback to window.onload, that will always work window.attachEvent( "onload", completed ); // If IE and not a frame // continually check to see if the document is ready var top = false; try { top = window.frameElement == null && document.documentElement; } catch ( e ) {} if ( top && top.doScroll ) { ( function doScrollCheck() { if ( !jQuery.isReady ) { try { // Use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ top.doScroll( "left" ); } catch ( e ) { return window.setTimeout( doScrollCheck, 50 ); } // detach all dom ready events detach(); // and execute any waiting functions jQuery.ready(); } } )(); } } } return readyList.promise( obj ); }; // Kick off the DOM ready check even if the user does not jQuery.ready.promise(); // Support: IE<9 // Iteration over object's inherited properties before its own var i; for ( i in jQuery( support ) ) { break; } support.ownFirst = i === "0"; // Note: most support tests are defined in their respective modules. // false until the test is run support.inlineBlockNeedsLayout = false; // Execute ASAP in case we need to set body.style.zoom jQuery( function() { // Minified: var a,b,c,d var val, div, body, container; body = document.getElementsByTagName( "body" )[ 0 ]; if ( !body || !body.style ) { // Return for frameset docs that don't have a body return; } // Setup div = document.createElement( "div" ); container = document.createElement( "div" ); container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; body.appendChild( container ).appendChild( div ); if ( typeof div.style.zoom !== "undefined" ) { // Support: IE<8 // Check if natively block-level elements act like inline-block // elements when setting their display to 'inline' and giving // them layout div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1"; support.inlineBlockNeedsLayout = val = div.offsetWidth === 3; if ( val ) { // Prevent IE 6 from affecting layout for positioned elements #11048 // Prevent IE from shrinking the body in IE 7 mode #12869 // Support: IE<8 body.style.zoom = 1; } } body.removeChild( container ); } ); ( function() { var div = document.createElement( "div" ); // Support: IE<9 support.deleteExpando = true; try { delete div.test; } catch ( e ) { support.deleteExpando = false; } // Null elements to avoid leaks in IE. div = null; } )(); var acceptData = function( elem ) { var noData = jQuery.noData[ ( elem.nodeName + " " ).toLowerCase() ], nodeType = +elem.nodeType || 1; // Do not set data on non-element DOM nodes because it will not be cleared (#8335). return nodeType !== 1 && nodeType !== 9 ? false : // Nodes accept data unless otherwise specified; rejection can be conditional !noData || noData !== true && elem.getAttribute( "classid" ) === noData; }; var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /([A-Z])/g; function dataAttr( elem, key, data ) { // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if ( data === undefined && elem.nodeType === 1 ) { var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : // Only convert to a number if it doesn't change the string +data + "" === data ? +data : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch ( e ) {} // Make sure we set the data so it isn't changed later jQuery.data( elem, key, data ); } else { data = undefined; } } return data; } // checks a cache object for emptiness function isEmptyDataObject( obj ) { var name; for ( name in obj ) { // if the public data object is empty, the private is still empty if ( name === "data" && jQuery.isEmptyObject( obj[ name ] ) ) { continue; } if ( name !== "toJSON" ) { return false; } } return true; } function internalData( elem, name, data, pvt /* Internal Use Only */ ) { if ( !acceptData( elem ) ) { return; } var ret, thisCache, internalKey = jQuery.expando, // We have to handle DOM nodes and JS objects differently because IE6-7 // can't GC object references properly across the DOM-JS boundary isNode = elem.nodeType, // Only DOM nodes need the global jQuery cache; JS object data is // attached directly to the object so GC can occur automatically cache = isNode ? jQuery.cache : elem, // Only defining an ID for JS objects if its cache already exists allows // the code to shortcut on the same path as a DOM node with no cache id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; // Avoid doing any more work than we need to when trying to get data on an // object that has no data at all if ( ( !id || !cache[ id ] || ( !pvt && !cache[ id ].data ) ) && data === undefined && typeof name === "string" ) { return; } if ( !id ) { // Only DOM nodes need a new unique ID for each element since their data // ends up in the global cache if ( isNode ) { id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++; } else { id = internalKey; } } if ( !cache[ id ] ) { // Avoid exposing jQuery metadata on plain JS objects when the object // is serialized using JSON.stringify cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; } // An object can be passed to jQuery.data instead of a key/value pair; this gets // shallow copied over onto the existing cache if ( typeof name === "object" || typeof name === "function" ) { if ( pvt ) { cache[ id ] = jQuery.extend( cache[ id ], name ); } else { cache[ id ].data = jQuery.extend( cache[ id ].data, name ); } } thisCache = cache[ id ]; // jQuery data() is stored in a separate object inside the object's internal data // cache in order to avoid key collisions between internal data and user-defined // data. if ( !pvt ) { if ( !thisCache.data ) { thisCache.data = {}; } thisCache = thisCache.data; } if ( data !== undefined ) { thisCache[ jQuery.camelCase( name ) ] = data; } // Check for both converted-to-camel and non-converted data property names // If a data property was specified if ( typeof name === "string" ) { // First Try to find as-is property data ret = thisCache[ name ]; // Test for null|undefined property data if ( ret == null ) { // Try to find the camelCased property ret = thisCache[ jQuery.camelCase( name ) ]; } } else { ret = thisCache; } return ret; } function internalRemoveData( elem, name, pvt ) { if ( !acceptData( elem ) ) { return; } var thisCache, i, isNode = elem.nodeType, // See jQuery.data for more information cache = isNode ? jQuery.cache : elem, id = isNode ? elem[ jQuery.expando ] : jQuery.expando; // If there is already no cache entry for this object, there is no // purpose in continuing if ( !cache[ id ] ) { return; } if ( name ) { thisCache = pvt ? cache[ id ] : cache[ id ].data; if ( thisCache ) { // Support array or space separated string names for data keys if ( !jQuery.isArray( name ) ) { // try the string as a key before any manipulation if ( name in thisCache ) { name = [ name ]; } else { // split the camel cased version by spaces unless a key with the spaces exists name = jQuery.camelCase( name ); if ( name in thisCache ) { name = [ name ]; } else { name = name.split( " " ); } } } else { // If "name" is an array of keys... // When data is initially created, via ("key", "val") signature, // keys will be converted to camelCase. // Since there is no way to tell _how_ a key was added, remove // both plain key and camelCase key. #12786 // This will only penalize the array argument path. name = name.concat( jQuery.map( name, jQuery.camelCase ) ); } i = name.length; while ( i-- ) { delete thisCache[ name[ i ] ]; } // If there is no data left in the cache, we want to continue // and let the cache object itself get destroyed if ( pvt ? !isEmptyDataObject( thisCache ) : !jQuery.isEmptyObject( thisCache ) ) { return; } } } // See jQuery.data for more information if ( !pvt ) { delete cache[ id ].data; // Don't destroy the parent cache unless the internal data object // had been the only thing left in it if ( !isEmptyDataObject( cache[ id ] ) ) { return; } } // Destroy the cache if ( isNode ) { jQuery.cleanData( [ elem ], true ); // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) /* jshint eqeqeq: false */ } else if ( support.deleteExpando || cache != cache.window ) { /* jshint eqeqeq: true */ delete cache[ id ]; // When all else fails, undefined } else { cache[ id ] = undefined; } } jQuery.extend( { cache: {}, // The following elements (space-suffixed to avoid Object.prototype collisions) // throw uncatchable exceptions if you attempt to set expando properties noData: { "applet ": true, "embed ": true, // ...but Flash objects (which have this classid) *can* handle expandos "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" }, hasData: function( elem ) { elem = elem.nodeType ? jQuery.cache[ elem[ jQuery.expando ] ] : elem[ jQuery.expando ]; return !!elem && !isEmptyDataObject( elem ); }, data: function( elem, name, data ) { return internalData( elem, name, data ); }, removeData: function( elem, name ) { return internalRemoveData( elem, name ); }, // For internal use only. _data: function( elem, name, data ) { return internalData( elem, name, data, true ); }, _removeData: function( elem, name ) { return internalRemoveData( elem, name, true ); } } ); jQuery.fn.extend( { data: function( key, value ) { var i, name, data, elem = this[ 0 ], attrs = elem && elem.attributes; // Special expections of .data basically thwart jQuery.access, // so implement the relevant behavior ourselves // Gets all values if ( key === undefined ) { if ( this.length ) { data = jQuery.data( elem ); if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { i = attrs.length; while ( i-- ) { // Support: IE11+ // The attrs elements can be null (#14894) if ( attrs[ i ] ) { name = attrs[ i ].name; if ( name.indexOf( "data-" ) === 0 ) { name = jQuery.camelCase( name.slice( 5 ) ); dataAttr( elem, name, data[ name ] ); } } } jQuery._data( elem, "parsedAttrs", true ); } } return data; } // Sets multiple values if ( typeof key === "object" ) { return this.each( function() { jQuery.data( this, key ); } ); } return arguments.length > 1 ? // Sets one value this.each( function() { jQuery.data( this, key, value ); } ) : // Gets one value // Try to fetch any internally stored data first elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; }, removeData: function( key ) { return this.each( function() { jQuery.removeData( this, key ); } ); } } ); jQuery.extend( { queue: function( elem, type, data ) { var queue; if ( elem ) { type = ( type || "fx" ) + "queue"; queue = jQuery._data( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !queue || jQuery.isArray( data ) ) { queue = jQuery._data( elem, type, jQuery.makeArray( data ) ); } else { queue.push( data ); } } return queue || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks( elem, type ), next = function() { jQuery.dequeue( elem, type ); }; // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); startLength--; } if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } // clear up the last queue stop function delete hooks.stop; fn.call( elem, next, hooks ); } if ( !startLength && hooks ) { hooks.empty.fire(); } }, // not intended for public consumption - generates a queueHooks object, // or returns the current one _queueHooks: function( elem, type ) { var key = type + "queueHooks"; return jQuery._data( elem, key ) || jQuery._data( elem, key, { empty: jQuery.Callbacks( "once memory" ).add( function() { jQuery._removeData( elem, type + "queue" ); jQuery._removeData( elem, key ); } ) } ); } } ); jQuery.fn.extend( { queue: function( type, data ) { var setter = 2; if ( typeof type !== "string" ) { data = type; type = "fx"; setter--; } if ( arguments.length < setter ) { return jQuery.queue( this[ 0 ], type ); } return data === undefined ? this : this.each( function() { var queue = jQuery.queue( this, type, data ); // ensure a hooks for this queue jQuery._queueHooks( this, type ); if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { jQuery.dequeue( this, type ); } } ); }, dequeue: function( type ) { return this.each( function() { jQuery.dequeue( this, type ); } ); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, obj ) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } }; if ( typeof type !== "string" ) { obj = type; type = undefined; } type = type || "fx"; while ( i-- ) { tmp = jQuery._data( elements[ i ], type + "queueHooks" ); if ( tmp && tmp.empty ) { count++; tmp.empty.add( resolve ); } } resolve(); return defer.promise( obj ); } } ); ( function() { var shrinkWrapBlocksVal; support.shrinkWrapBlocks = function() { if ( shrinkWrapBlocksVal != null ) { return shrinkWrapBlocksVal; } // Will be changed later if needed. shrinkWrapBlocksVal = false; // Minified: var b,c,d var div, body, container; body = document.getElementsByTagName( "body" )[ 0 ]; if ( !body || !body.style ) { // Test fired too early or in an unsupported environment, exit. return; } // Setup div = document.createElement( "div" ); container = document.createElement( "div" ); container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; body.appendChild( container ).appendChild( div ); // Support: IE6 // Check if elements with layout shrink-wrap their children if ( typeof div.style.zoom !== "undefined" ) { // Reset CSS: box-sizing; display; margin; border div.style.cssText = // Support: Firefox<29, Android 2.3 // Vendor-prefix box-sizing "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + "box-sizing:content-box;display:block;margin:0;border:0;" + "padding:1px;width:1px;zoom:1"; div.appendChild( document.createElement( "div" ) ).style.width = "5px"; shrinkWrapBlocksVal = div.offsetWidth !== 3; } body.removeChild( container ); return shrinkWrapBlocksVal; }; } )(); var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; var isHidden = function( elem, el ) { // isHidden might be called from jQuery#filter function; // in that case, element will be second argument elem = el || elem; return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); }; function adjustCSS( elem, prop, valueParts, tween ) { var adjusted, scale = 1, maxIterations = 20, currentValue = tween ? function() { return tween.cur(); } : function() { return jQuery.css( elem, prop, "" ); }, initial = currentValue(), unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), // Starting value computation is required for potential unit mismatches initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && rcssNum.exec( jQuery.css( elem, prop ) ); if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { // Trust units reported by jQuery.css unit = unit || initialInUnit[ 3 ]; // Make sure we update the tween properties later on valueParts = valueParts || []; // Iteratively approximate from a nonzero starting point initialInUnit = +initial || 1; do { // If previous iteration zeroed out, double until we get *something*. // Use string for doubling so we don't accidentally see scale as unchanged below scale = scale || ".5"; // Adjust and apply initialInUnit = initialInUnit / scale; jQuery.style( elem, prop, initialInUnit + unit ); // Update scale, tolerating zero or NaN from tween.cur() // Break the loop if scale is unchanged or perfect, or if we've just had enough. } while ( scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations ); } if ( valueParts ) { initialInUnit = +initialInUnit || +initial || 0; // Apply relative offset (+=/-=) if specified adjusted = valueParts[ 1 ] ? initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : +valueParts[ 2 ]; if ( tween ) { tween.unit = unit; tween.start = initialInUnit; tween.end = adjusted; } } return adjusted; } // Multifunctional method to get and set values of a collection // The value/s can optionally be executed if it's a function var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { var i = 0, length = elems.length, bulk = key == null; // Sets many values if ( jQuery.type( key ) === "object" ) { chainable = true; for ( i in key ) { access( elems, fn, i, key[ i ], true, emptyGet, raw ); } // Sets one value } else if ( value !== undefined ) { chainable = true; if ( !jQuery.isFunction( value ) ) { raw = true; } if ( bulk ) { // Bulk operations run against the entire set if ( raw ) { fn.call( elems, value ); fn = null; // ...except when executing function values } else { bulk = fn; fn = function( elem, key, value ) { return bulk.call( jQuery( elem ), value ); }; } } if ( fn ) { for ( ; i < length; i++ ) { fn( elems[ i ], key, raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) ) ); } } } return chainable ? elems : // Gets bulk ? fn.call( elems ) : length ? fn( elems[ 0 ], key ) : emptyGet; }; var rcheckableType = ( /^(?:checkbox|radio)$/i ); var rtagName = ( /<([\w:-]+)/ ); var rscriptType = ( /^$|\/(?:java|ecma)script/i ); var rleadingWhitespace = ( /^\s+/ ); var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" + "details|dialog|figcaption|figure|footer|header|hgroup|main|" + "mark|meter|nav|output|picture|progress|section|summary|template|time|video"; function createSafeFragment( document ) { var list = nodeNames.split( "|" ), safeFrag = document.createDocumentFragment(); if ( safeFrag.createElement ) { while ( list.length ) { safeFrag.createElement( list.pop() ); } } return safeFrag; } ( function() { var div = document.createElement( "div" ), fragment = document.createDocumentFragment(), input = document.createElement( "input" ); // Setup div.innerHTML = "
    a"; // IE strips leading whitespace when .innerHTML is used support.leadingWhitespace = div.firstChild.nodeType === 3; // Make sure that tbody elements aren't automatically inserted // IE will insert them into empty tables support.tbody = !div.getElementsByTagName( "tbody" ).length; // Make sure that link elements get serialized correctly by innerHTML // This requires a wrapper element in IE support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; // Makes sure cloning an html5 element does not cause problems // Where outerHTML is undefined, this still works support.html5Clone = document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav>"; // Check if a disconnected checkbox will retain its checked // value of true after appended to the DOM (IE6/7) input.type = "checkbox"; input.checked = true; fragment.appendChild( input ); support.appendChecked = input.checked; // Make sure textarea (and checkbox) defaultValue is properly cloned // Support: IE6-IE11+ div.innerHTML = ""; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; // #11217 - WebKit loses check when the name is after the checked attribute fragment.appendChild( div ); // Support: Windows Web Apps (WWA) // `name` and `type` must use .setAttribute for WWA (#14901) input = document.createElement( "input" ); input.setAttribute( "type", "radio" ); input.setAttribute( "checked", "checked" ); input.setAttribute( "name", "t" ); div.appendChild( input ); // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 // old WebKit doesn't clone checked state correctly in fragments support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; // Support: IE<9 // Cloned elements keep attachEvent handlers, we use addEventListener on IE9+ support.noCloneEvent = !!div.addEventListener; // Support: IE<9 // Since attributes and properties are the same in IE, // cleanData must set properties to undefined rather than use removeAttribute div[ jQuery.expando ] = 1; support.attributes = !div.getAttribute( jQuery.expando ); } )(); // We have to close these tags to support XHTML (#13200) var wrapMap = { option: [ 1, "" ], legend: [ 1, "
    ", "
    " ], area: [ 1, "", "" ], // Support: IE8 param: [ 1, "", "" ], thead: [ 1, "", "
    " ], tr: [ 2, "", "
    " ], col: [ 2, "", "
    " ], td: [ 3, "", "
    " ], // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, // unless wrapped in a div with non-breaking characters in front of it. _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
    ", "
    " ] }; // Support: IE8-IE9 wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; function getAll( context, tag ) { var elems, elem, i = 0, found = typeof context.getElementsByTagName !== "undefined" ? context.getElementsByTagName( tag || "*" ) : typeof context.querySelectorAll !== "undefined" ? context.querySelectorAll( tag || "*" ) : undefined; if ( !found ) { for ( found = [], elems = context.childNodes || context; ( elem = elems[ i ] ) != null; i++ ) { if ( !tag || jQuery.nodeName( elem, tag ) ) { found.push( elem ); } else { jQuery.merge( found, getAll( elem, tag ) ); } } } return tag === undefined || tag && jQuery.nodeName( context, tag ) ? jQuery.merge( [ context ], found ) : found; } // Mark scripts as having already been evaluated function setGlobalEval( elems, refElements ) { var elem, i = 0; for ( ; ( elem = elems[ i ] ) != null; i++ ) { jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[ i ], "globalEval" ) ); } } var rhtml = /<|&#?\w+;/, rtbody = / from table fragments if ( !support.tbody ) { // String was a , *may* have spurious elem = tag === "table" && !rtbody.test( elem ) ? tmp.firstChild : // String was a bare or wrap[ 1 ] === "
    " && !rtbody.test( elem ) ? tmp : 0; j = elem && elem.childNodes.length; while ( j-- ) { if ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), "tbody" ) && !tbody.childNodes.length ) { elem.removeChild( tbody ); } } } jQuery.merge( nodes, tmp.childNodes ); // Fix #12392 for WebKit and IE > 9 tmp.textContent = ""; // Fix #12392 for oldIE while ( tmp.firstChild ) { tmp.removeChild( tmp.firstChild ); } // Remember the top-level container for proper cleanup tmp = safe.lastChild; } } } // Fix #11356: Clear elements from fragment if ( tmp ) { safe.removeChild( tmp ); } // Reset defaultChecked for any radios and checkboxes // about to be appended to the DOM in IE 6/7 (#8060) if ( !support.appendChecked ) { jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); } i = 0; while ( ( elem = nodes[ i++ ] ) ) { // Skip elements already in the context collection (trac-4087) if ( selection && jQuery.inArray( elem, selection ) > -1 ) { if ( ignored ) { ignored.push( elem ); } continue; } contains = jQuery.contains( elem.ownerDocument, elem ); // Append to fragment tmp = getAll( safe.appendChild( elem ), "script" ); // Preserve script evaluation history if ( contains ) { setGlobalEval( tmp ); } // Capture executables if ( scripts ) { j = 0; while ( ( elem = tmp[ j++ ] ) ) { if ( rscriptType.test( elem.type || "" ) ) { scripts.push( elem ); } } } } tmp = null; return safe; } ( function() { var i, eventName, div = document.createElement( "div" ); // Support: IE<9 (lack submit/change bubble), Firefox (lack focus(in | out) events) for ( i in { submit: true, change: true, focusin: true } ) { eventName = "on" + i; if ( !( support[ i ] = eventName in window ) ) { // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) div.setAttribute( eventName, "t" ); support[ i ] = div.attributes[ eventName ].expando === false; } } // Null elements to avoid leaks in IE. div = null; } )(); var rformElems = /^(?:input|select|textarea)$/i, rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, rtypenamespace = /^([^.]*)(?:\.(.+)|)/; function returnTrue() { return true; } function returnFalse() { return false; } // Support: IE9 // See #13393 for more info function safeActiveElement() { try { return document.activeElement; } catch ( err ) { } } function on( elem, types, selector, data, fn, one ) { var origFn, type; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) if ( typeof selector !== "string" ) { // ( types-Object, data ) data = data || selector; selector = undefined; } for ( type in types ) { on( elem, type, selector, data, types[ type ], one ); } return elem; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { return elem; } if ( one === 1 ) { origFn = fn; fn = function( event ) { // Can use an empty set, since event contains the info jQuery().off( event ); return origFn.apply( this, arguments ); }; // Use same guid so caller can remove using origFn fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); } return elem.each( function() { jQuery.event.add( this, types, fn, data, selector ); } ); } /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { global: {}, add: function( elem, types, handler, data, selector ) { var tmp, events, t, handleObjIn, special, eventHandle, handleObj, handlers, type, namespaces, origType, elemData = jQuery._data( elem ); // Don't attach events to noData or text/comment nodes (but allow plain objects) if ( !elemData ) { return; } // Caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; selector = handleObjIn.selector; } // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } // Init the element's event structure and main handler, if this is the first if ( !( events = elemData.events ) ) { events = elemData.events = {}; } if ( !( eventHandle = elemData.handle ) ) { eventHandle = elemData.handle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded return typeof jQuery !== "undefined" && ( !e || jQuery.event.triggered !== e.type ) ? jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : undefined; }; // Add elem as a property of the handle fn to prevent a memory leak // with IE non-native events eventHandle.elem = elem; } // Handle multiple events separated by a space types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[ t ] ) || []; type = origType = tmp[ 1 ]; namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); // There *must* be a type, no attaching namespace-only handlers if ( !type ) { continue; } // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[ type ] || {}; // If selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegateType : special.bindType ) || type; // Update special based on newly reset type special = jQuery.event.special[ type ] || {}; // handleObj is passed to all event handlers handleObj = jQuery.extend( { type: type, origType: origType, data: data, handler: handler, guid: handler.guid, selector: selector, needsContext: selector && jQuery.expr.match.needsContext.test( selector ), namespace: namespaces.join( "." ) }, handleObjIn ); // Init the event handler queue if we're the first if ( !( handlers = events[ type ] ) ) { handlers = events[ type ] = []; handlers.delegateCount = 0; // Only use addEventListener/attachEvent if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); } else if ( elem.attachEvent ) { elem.attachEvent( "on" + type, eventHandle ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } // Add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegateCount++, 0, handleObj ); } else { handlers.push( handleObj ); } // Keep track of which events have ever been used, for event optimization jQuery.event.global[ type ] = true; } // Nullify elem to prevent memory leaks in IE elem = null; }, // Detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedTypes ) { var j, handleObj, tmp, origCount, t, events, special, handlers, type, namespaces, origType, elemData = jQuery.hasData( elem ) && jQuery._data( elem ); if ( !elemData || !( events = elemData.events ) ) { return; } // Once for each type.namespace in types; type may be omitted types = ( types || "" ).match( rnotwhite ) || [ "" ]; t = types.length; while ( t-- ) { tmp = rtypenamespace.exec( types[ t ] ) || []; type = origType = tmp[ 1 ]; namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); // Unbind all events (on this namespace, if provided) for the element if ( !type ) { for ( type in events ) { jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jQuery.event.special[ type ] || {}; type = ( selector ? special.delegateType : special.bindType ) || type; handlers = events[ type ] || []; tmp = tmp[ 2 ] && new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); // Remove matching events origCount = j = handlers.length; while ( j-- ) { handleObj = handlers[ j ]; if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !tmp || tmp.test( handleObj.namespace ) ) && ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { handlers.splice( j, 1 ); if ( handleObj.selector ) { handlers.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); } } } // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( origCount && !handlers.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } delete events[ type ]; } } // Remove the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { delete elemData.handle; // removeData also checks for emptiness and clears the expando if empty // so use it instead of delete jQuery._removeData( elem, "events" ); } }, trigger: function( event, data, elem, onlyHandlers ) { var handle, ontype, cur, bubbleType, special, tmp, i, eventPath = [ elem || document ], type = hasOwn.call( event, "type" ) ? event.type : event, namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; cur = tmp = elem = elem || document; // Don't do events on text and comment nodes if ( elem.nodeType === 3 || elem.nodeType === 8 ) { return; } // focus/blur morphs to focusin/out; ensure we're not firing them right now if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { return; } if ( type.indexOf( "." ) > -1 ) { // Namespaced trigger; create a regexp to match event type in handle() namespaces = type.split( "." ); type = namespaces.shift(); namespaces.sort(); } ontype = type.indexOf( ":" ) < 0 && "on" + type; // Caller can pass in a jQuery.Event object, Object, or just an event type string event = event[ jQuery.expando ] ? event : new jQuery.Event( type, typeof event === "object" && event ); // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) event.isTrigger = onlyHandlers ? 2 : 3; event.namespace = namespaces.join( "." ); event.rnamespace = event.namespace ? new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : null; // Clean up the event in case it is being reused event.result = undefined; if ( !event.target ) { event.target = elem; } // Clone any incoming data and prepend the event, creating the handler arg list data = data == null ? [ event ] : jQuery.makeArray( data, [ event ] ); // Allow special events to draw outside the lines special = jQuery.event.special[ type ] || {}; if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { bubbleType = special.delegateType || type; if ( !rfocusMorph.test( bubbleType + type ) ) { cur = cur.parentNode; } for ( ; cur; cur = cur.parentNode ) { eventPath.push( cur ); tmp = cur; } // Only add window if we got to document (e.g., not plain obj or detached DOM) if ( tmp === ( elem.ownerDocument || document ) ) { eventPath.push( tmp.defaultView || tmp.parentWindow || window ); } } // Fire handlers on the event path i = 0; while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { event.type = i > 1 ? bubbleType : special.bindType || type; // jQuery handler handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } // Native handler handle = ontype && cur[ ontype ]; if ( handle && handle.apply && acceptData( cur ) ) { event.result = handle.apply( cur, data ); if ( event.result === false ) { event.preventDefault(); } } } event.type = type; // If nobody prevented the default action, do it now if ( !onlyHandlers && !event.isDefaultPrevented() ) { if ( ( !special._default || special._default.apply( eventPath.pop(), data ) === false ) && acceptData( elem ) ) { // Call a native DOM method on the target with the same name name as the event. // Can't use an .isFunction() check here because IE6/7 fails that test. // Don't do default actions on window, that's where global variables be (#6170) if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method tmp = elem[ ontype ]; if ( tmp ) { elem[ ontype ] = null; } // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; try { elem[ type ](); } catch ( e ) { // IE<9 dies on focus/blur to hidden element (#1486,#12518) // only reproducible on winXP IE8 native, not IE9 in IE8 mode } jQuery.event.triggered = undefined; if ( tmp ) { elem[ ontype ] = tmp; } } } } return event.result; }, dispatch: function( event ) { // Make a writable jQuery.Event from the native event object event = jQuery.event.fix( event ); var i, j, ret, matched, handleObj, handlerQueue = [], args = slice.call( arguments ), handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], special = jQuery.event.special[ event.type ] || {}; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[ 0 ] = event; event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { return; } // Determine handlers handlerQueue = jQuery.event.handlers.call( this, event, handlers ); // Run delegates first; they may want to stop propagation beneath us i = 0; while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { event.currentTarget = matched.elem; j = 0; while ( ( handleObj = matched.handlers[ j++ ] ) && !event.isImmediatePropagationStopped() ) { // Triggered event must either 1) have no namespace, or 2) have namespace(s) // a subset or equal to those in the bound event (both can have no namespace). if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { event.handleObj = handleObj; event.data = handleObj.data; ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || handleObj.handler ).apply( matched.elem, args ); if ( ret !== undefined ) { if ( ( event.result = ret ) === false ) { event.preventDefault(); event.stopPropagation(); } } } } } // Call the postDispatch hook for the mapped type if ( special.postDispatch ) { special.postDispatch.call( this, event ); } return event.result; }, handlers: function( event, handlers ) { var i, matches, sel, handleObj, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target; // Support (at least): Chrome, IE9 // Find delegate handlers // Black-hole SVG instance trees (#13180) // // Support: Firefox<=42+ // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343) if ( delegateCount && cur.nodeType && ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) { /* jshint eqeqeq: false */ for ( ; cur != this; cur = cur.parentNode || this ) { /* jshint eqeqeq: true */ // Don't check non-elements (#13208) // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) { matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; // Don't conflict with Object.prototype properties (#13203) sel = handleObj.selector + " "; if ( matches[ sel ] === undefined ) { matches[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) > -1 : jQuery.find( sel, this, null, [ cur ] ).length; } if ( matches[ sel ] ) { matches.push( handleObj ); } } if ( matches.length ) { handlerQueue.push( { elem: cur, handlers: matches } ); } } } } // Add the remaining (directly-bound) handlers if ( delegateCount < handlers.length ) { handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } ); } return handlerQueue; }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } // Create a writable copy of the event object and normalize some properties var i, prop, copy, type = event.type, originalEvent = event, fixHook = this.fixHooks[ type ]; if ( !fixHook ) { this.fixHooks[ type ] = fixHook = rmouseEvent.test( type ) ? this.mouseHooks : rkeyEvent.test( type ) ? this.keyHooks : {}; } copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = new jQuery.Event( originalEvent ); i = copy.length; while ( i-- ) { prop = copy[ i ]; event[ prop ] = originalEvent[ prop ]; } // Support: IE<9 // Fix target property (#1925) if ( !event.target ) { event.target = originalEvent.srcElement || document; } // Support: Safari 6-8+ // Target should not be a text node (#504, #13143) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } // Support: IE<9 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) event.metaKey = !!event.metaKey; return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; }, // Includes some event props shared by KeyEvent and MouseEvent props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " + "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split( " " ), filter: function( event, original ) { // Add which for key events if ( event.which == null ) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: ( "button buttons clientX clientY fromElement offsetX offsetY " + "pageX pageY screenX screenY toElement" ).split( " " ), filter: function( event, original ) { var body, eventDoc, doc, button = original.button, fromElement = original.fromElement; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && original.clientX != null ) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); } // Add relatedTarget, if necessary if ( !event.relatedTarget && fromElement ) { event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, special: { load: { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, focus: { // Fire native event if possible so blur/focus sequence is correct trigger: function() { if ( this !== safeActiveElement() && this.focus ) { try { this.focus(); return false; } catch ( e ) { // Support: IE<9 // If we error on focus to hidden element (#1486, #12518), // let .trigger() run the handlers } } }, delegateType: "focusin" }, blur: { trigger: function() { if ( this === safeActiveElement() && this.blur ) { this.blur(); return false; } }, delegateType: "focusout" }, click: { // For checkbox, fire native event so checked state will be right trigger: function() { if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { this.click(); return false; } }, // For cross-browser consistency, don't fire native .click() on links _default: function( event ) { return jQuery.nodeName( event.target, "a" ); } }, beforeunload: { postDispatch: function( event ) { // Support: Firefox 20+ // Firefox doesn't alert if the returnValue field is not set. if ( event.result !== undefined && event.originalEvent ) { event.originalEvent.returnValue = event.result; } } } }, // Piggyback on a donor event to simulate a different one simulate: function( type, elem, event ) { var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true // Previously, `originalEvent: {}` was set here, so stopPropagation call // would not be triggered on donor event, since in our own // jQuery.event.stopPropagation function we had a check for existence of // originalEvent.stopPropagation method, so, consequently it would be a noop. // // Guard for simulated events was moved to jQuery.event.stopPropagation function // since `originalEvent` should point to the original event for the // constancy with other events and for more focused logic } ); jQuery.event.trigger( e, null, elem ); if ( e.isDefaultPrevented() ) { event.preventDefault(); } } }; jQuery.removeEvent = document.removeEventListener ? function( elem, type, handle ) { // This "if" is needed for plain objects if ( elem.removeEventListener ) { elem.removeEventListener( type, handle ); } } : function( elem, type, handle ) { var name = "on" + type; if ( elem.detachEvent ) { // #8545, #7054, preventing memory leaks for custom events in IE6-8 // detachEvent needed property on element, by name of that event, // to properly expose it to GC if ( typeof elem[ name ] === "undefined" ) { elem[ name ] = null; } elem.detachEvent( name, handle ); } }; jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword if ( !( this instanceof jQuery.Event ) ) { return new jQuery.Event( src, props ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && // Support: IE < 9, Android < 4.0 src.returnValue === false ? returnTrue : returnFalse; // Event type } else { this.type = src; } // Put explicitly provided properties onto the event object if ( props ) { jQuery.extend( this, props ); } // Create a timestamp if incoming event doesn't have one this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { constructor: jQuery.Event, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse, preventDefault: function() { var e = this.originalEvent; this.isDefaultPrevented = returnTrue; if ( !e ) { return; } // If preventDefault exists, run it on the original event if ( e.preventDefault ) { e.preventDefault(); // Support: IE // Otherwise set the returnValue property of the original event to false } else { e.returnValue = false; } }, stopPropagation: function() { var e = this.originalEvent; this.isPropagationStopped = returnTrue; if ( !e || this.isSimulated ) { return; } // If stopPropagation exists, run it on the original event if ( e.stopPropagation ) { e.stopPropagation(); } // Support: IE // Set the cancelBubble property of the original event to true e.cancelBubble = true; }, stopImmediatePropagation: function() { var e = this.originalEvent; this.isImmediatePropagationStopped = returnTrue; if ( e && e.stopImmediatePropagation ) { e.stopImmediatePropagation(); } this.stopPropagation(); } }; // Create mouseenter/leave events using mouseover/out and event-time checks // so that event delegation works in jQuery. // Do the same for pointerenter/pointerleave and pointerover/pointerout // // Support: Safari 7 only // Safari sends mouseenter too often; see: // https://code.google.com/p/chromium/issues/detail?id=470258 // for the description of the bug (it existed in older Chrome versions as well). jQuery.each( { mouseenter: "mouseover", mouseleave: "mouseout", pointerenter: "pointerover", pointerleave: "pointerout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, bindType: fix, handle: function( event ) { var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj; // For mouseenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; } ); // IE submit delegation if ( !support.submit ) { jQuery.event.special.submit = { setup: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Lazy-add a submit handler when a descendant form may potentially be submitted jQuery.event.add( this, "click._submit keypress._submit", function( e ) { // Node name check avoids a VML-related crash in IE (#9807) var elem = e.target, form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? // Support: IE <=8 // We use jQuery.prop instead of elem.form // to allow fixing the IE8 delegated submit issue (gh-2332) // by 3rd party polyfills/workarounds. jQuery.prop( elem, "form" ) : undefined; if ( form && !jQuery._data( form, "submit" ) ) { jQuery.event.add( form, "submit._submit", function( event ) { event._submitBubble = true; } ); jQuery._data( form, "submit", true ); } } ); // return undefined since we don't need an event listener }, postDispatch: function( event ) { // If form was submitted by the user, bubble the event up the tree if ( event._submitBubble ) { delete event._submitBubble; if ( this.parentNode && !event.isTrigger ) { jQuery.event.simulate( "submit", this.parentNode, event ); } } }, teardown: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Remove delegated handlers; cleanData eventually reaps submit handlers attached above jQuery.event.remove( this, "._submit" ); } }; } // IE change delegation and checkbox/radio fix if ( !support.change ) { jQuery.event.special.change = { setup: function() { if ( rformElems.test( this.nodeName ) ) { // IE doesn't fire change on a check/radio until blur; trigger it on click // after a propertychange. Eat the blur-change in special.change.handle. // This still fires onchange a second time for check/radio after blur. if ( this.type === "checkbox" || this.type === "radio" ) { jQuery.event.add( this, "propertychange._change", function( event ) { if ( event.originalEvent.propertyName === "checked" ) { this._justChanged = true; } } ); jQuery.event.add( this, "click._change", function( event ) { if ( this._justChanged && !event.isTrigger ) { this._justChanged = false; } // Allow triggered, simulated change events (#11500) jQuery.event.simulate( "change", this, event ); } ); } return false; } // Delegated event; lazy-add a change handler on descendant inputs jQuery.event.add( this, "beforeactivate._change", function( e ) { var elem = e.target; if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "change" ) ) { jQuery.event.add( elem, "change._change", function( event ) { if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { jQuery.event.simulate( "change", this.parentNode, event ); } } ); jQuery._data( elem, "change", true ); } } ); }, handle: function( event ) { var elem = event.target; // Swallow native change events from checkbox/radio, we already triggered them above if ( this !== elem || event.isSimulated || event.isTrigger || ( elem.type !== "radio" && elem.type !== "checkbox" ) ) { return event.handleObj.handler.apply( this, arguments ); } }, teardown: function() { jQuery.event.remove( this, "._change" ); return !rformElems.test( this.nodeName ); } }; } // Support: Firefox // Firefox doesn't have focus(in | out) events // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 // // Support: Chrome, Safari // focus(in | out) events fire after focus & blur events, // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order // Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857 if ( !support.focusin ) { jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { // Attach a single capturing handler on the document while someone wants focusin/focusout var handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); }; jQuery.event.special[ fix ] = { setup: function() { var doc = this.ownerDocument || this, attaches = jQuery._data( doc, fix ); if ( !attaches ) { doc.addEventListener( orig, handler, true ); } jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); }, teardown: function() { var doc = this.ownerDocument || this, attaches = jQuery._data( doc, fix ) - 1; if ( !attaches ) { doc.removeEventListener( orig, handler, true ); jQuery._removeData( doc, fix ); } else { jQuery._data( doc, fix, attaches ); } } }; } ); } jQuery.fn.extend( { on: function( types, selector, data, fn ) { return on( this, types, selector, data, fn ); }, one: function( types, selector, data, fn ) { return on( this, types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { var handleObj, type; if ( types && types.preventDefault && types.handleObj ) { // ( event ) dispatched jQuery.Event handleObj = types.handleObj; jQuery( types.delegateTarget ).off( handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler ); return this; } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnFalse; } return this.each( function() { jQuery.event.remove( this, types, fn, selector ); } ); }, trigger: function( type, data ) { return this.each( function() { jQuery.event.trigger( type, data, this ); } ); }, triggerHandler: function( type, data ) { var elem = this[ 0 ]; if ( elem ) { return jQuery.event.trigger( type, data, elem, true ); } } } ); var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, rnoshimcache = new RegExp( "<(?:" + nodeNames + ")[\\s/>]", "i" ), rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, // Support: IE 10-11, Edge 10240+ // In IE/Edge using regex groups here causes severe slowdowns. // See https://connect.microsoft.com/IE/feedback/details/1736512/ rnoInnerhtml = /\s*$/g, safeFragment = createSafeFragment( document ), fragmentDiv = safeFragment.appendChild( document.createElement( "div" ) ); // Support: IE<8 // Manipulating tables requires a tbody function manipulationTarget( elem, content ) { return jQuery.nodeName( elem, "table" ) && jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? elem.getElementsByTagName( "tbody" )[ 0 ] || elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) : elem; } // Replace/restore the type attribute of script elements for safe DOM manipulation function disableScript( elem ) { elem.type = ( jQuery.find.attr( elem, "type" ) !== null ) + "/" + elem.type; return elem; } function restoreScript( elem ) { var match = rscriptTypeMasked.exec( elem.type ); if ( match ) { elem.type = match[ 1 ]; } else { elem.removeAttribute( "type" ); } return elem; } function cloneCopyEvent( src, dest ) { if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { return; } var type, i, l, oldData = jQuery._data( src ), curData = jQuery._data( dest, oldData ), events = oldData.events; if ( events ) { delete curData.handle; curData.events = {}; for ( type in events ) { for ( i = 0, l = events[ type ].length; i < l; i++ ) { jQuery.event.add( dest, type, events[ type ][ i ] ); } } } // make the cloned public data object a copy from the original if ( curData.data ) { curData.data = jQuery.extend( {}, curData.data ); } } function fixCloneNodeIssues( src, dest ) { var nodeName, e, data; // We do not need to do anything for non-Elements if ( dest.nodeType !== 1 ) { return; } nodeName = dest.nodeName.toLowerCase(); // IE6-8 copies events bound via attachEvent when using cloneNode. if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { data = jQuery._data( dest ); for ( e in data.events ) { jQuery.removeEvent( dest, e, data.handle ); } // Event data gets referenced instead of copied if the expando gets copied too dest.removeAttribute( jQuery.expando ); } // IE blanks contents when cloning scripts, and tries to evaluate newly-set text if ( nodeName === "script" && dest.text !== src.text ) { disableScript( dest ).text = src.text; restoreScript( dest ); // IE6-10 improperly clones children of object elements using classid. // IE10 throws NoModificationAllowedError if parent is null, #12132. } else if ( nodeName === "object" ) { if ( dest.parentNode ) { dest.outerHTML = src.outerHTML; } // This path appears unavoidable for IE9. When cloning an object // element in IE9, the outerHTML strategy above is not sufficient. // If the src has innerHTML and the destination does not, // copy the src.innerHTML into the dest.innerHTML. #10324 if ( support.html5Clone && ( src.innerHTML && !jQuery.trim( dest.innerHTML ) ) ) { dest.innerHTML = src.innerHTML; } } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { // IE6-8 fails to persist the checked state of a cloned checkbox // or radio button. Worse, IE6-7 fail to give the cloned element // a checked appearance if the defaultChecked value isn't also set dest.defaultChecked = dest.checked = src.checked; // IE6-7 get confused and end up setting the value of a cloned // checkbox/radio button to an empty string instead of "on" if ( dest.value !== src.value ) { dest.value = src.value; } // IE6-8 fails to return the selected option to the default selected // state when cloning options } else if ( nodeName === "option" ) { dest.defaultSelected = dest.selected = src.defaultSelected; // IE6-8 fails to set the defaultValue to the correct value when // cloning other types of input fields } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; } } function domManip( collection, args, callback, ignored ) { // Flatten any nested arrays args = concat.apply( [], args ); var first, node, hasScripts, scripts, doc, fragment, i = 0, l = collection.length, iNoClone = l - 1, value = args[ 0 ], isFunction = jQuery.isFunction( value ); // We can't cloneNode fragments that contain checked, in WebKit if ( isFunction || ( l > 1 && typeof value === "string" && !support.checkClone && rchecked.test( value ) ) ) { return collection.each( function( index ) { var self = collection.eq( index ); if ( isFunction ) { args[ 0 ] = value.call( this, index, self.html() ); } domManip( self, args, callback, ignored ); } ); } if ( l ) { fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); first = fragment.firstChild; if ( fragment.childNodes.length === 1 ) { fragment = first; } // Require either new content or an interest in ignored elements to invoke the callback if ( first || ignored ) { scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); hasScripts = scripts.length; // Use the original fragment for the last item // instead of the first because it can end up // being emptied incorrectly in certain situations (#8070). for ( ; i < l; i++ ) { node = fragment; if ( i !== iNoClone ) { node = jQuery.clone( node, true, true ); // Keep references to cloned scripts for later restoration if ( hasScripts ) { // Support: Android<4.1, PhantomJS<2 // push.apply(_, arraylike) throws on ancient WebKit jQuery.merge( scripts, getAll( node, "script" ) ); } } callback.call( collection[ i ], node, i ); } if ( hasScripts ) { doc = scripts[ scripts.length - 1 ].ownerDocument; // Reenable scripts jQuery.map( scripts, restoreScript ); // Evaluate executable scripts on first document insertion for ( i = 0; i < hasScripts; i++ ) { node = scripts[ i ]; if ( rscriptType.test( node.type || "" ) && !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { if ( node.src ) { // Optional AJAX dependency, but won't run scripts if not present if ( jQuery._evalUrl ) { jQuery._evalUrl( node.src ); } } else { jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ) .replace( rcleanScript, "" ) ); } } } } // Fix #11809: Avoid leaking memory fragment = first = null; } } return collection; } function remove( elem, selector, keepData ) { var node, elems = selector ? jQuery.filter( selector, elem ) : elem, i = 0; for ( ; ( node = elems[ i ] ) != null; i++ ) { if ( !keepData && node.nodeType === 1 ) { jQuery.cleanData( getAll( node ) ); } if ( node.parentNode ) { if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { setGlobalEval( getAll( node, "script" ) ); } node.parentNode.removeChild( node ); } } return elem; } jQuery.extend( { htmlPrefilter: function( html ) { return html.replace( rxhtmlTag, "<$1>" ); }, clone: function( elem, dataAndEvents, deepDataAndEvents ) { var destElements, node, clone, i, srcElements, inPage = jQuery.contains( elem.ownerDocument, elem ); if ( support.html5Clone || jQuery.isXMLDoc( elem ) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { clone = elem.cloneNode( true ); // IE<=8 does not properly clone detached, unknown element nodes } else { fragmentDiv.innerHTML = elem.outerHTML; fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); } if ( ( !support.noCloneEvent || !support.noCloneChecked ) && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) { // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 destElements = getAll( clone ); srcElements = getAll( elem ); // Fix all IE cloning issues for ( i = 0; ( node = srcElements[ i ] ) != null; ++i ) { // Ensure that the destination node is not null; Fixes #9587 if ( destElements[ i ] ) { fixCloneNodeIssues( node, destElements[ i ] ); } } } // Copy the events from the original to the clone if ( dataAndEvents ) { if ( deepDataAndEvents ) { srcElements = srcElements || getAll( elem ); destElements = destElements || getAll( clone ); for ( i = 0; ( node = srcElements[ i ] ) != null; i++ ) { cloneCopyEvent( node, destElements[ i ] ); } } else { cloneCopyEvent( elem, clone ); } } // Preserve script evaluation history destElements = getAll( clone, "script" ); if ( destElements.length > 0 ) { setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); } destElements = srcElements = node = null; // Return the cloned set return clone; }, cleanData: function( elems, /* internal */ forceAcceptData ) { var elem, type, id, data, i = 0, internalKey = jQuery.expando, cache = jQuery.cache, attributes = support.attributes, special = jQuery.event.special; for ( ; ( elem = elems[ i ] ) != null; i++ ) { if ( forceAcceptData || acceptData( elem ) ) { id = elem[ internalKey ]; data = id && cache[ id ]; if ( data ) { if ( data.events ) { for ( type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); // This is a shortcut to avoid jQuery.event.remove's overhead } else { jQuery.removeEvent( elem, type, data.handle ); } } } // Remove cache only if it was not already removed by jQuery.event.remove if ( cache[ id ] ) { delete cache[ id ]; // Support: IE<9 // IE does not allow us to delete expando properties from nodes // IE creates expando attributes along with the property // IE does not have a removeAttribute function on Document nodes if ( !attributes && typeof elem.removeAttribute !== "undefined" ) { elem.removeAttribute( internalKey ); // Webkit & Blink performance suffers when deleting properties // from DOM nodes, so set to undefined instead // https://code.google.com/p/chromium/issues/detail?id=378607 } else { elem[ internalKey ] = undefined; } deletedIds.push( id ); } } } } } } ); jQuery.fn.extend( { // Keep domManip exposed until 3.0 (gh-2225) domManip: domManip, detach: function( selector ) { return remove( this, selector, true ); }, remove: function( selector ) { return remove( this, selector ); }, text: function( value ) { return access( this, function( value ) { return value === undefined ? jQuery.text( this ) : this.empty().append( ( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value ) ); }, null, value, arguments.length ); }, append: function() { return domManip( this, arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.appendChild( elem ); } } ); }, prepend: function() { return domManip( this, arguments, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { var target = manipulationTarget( this, elem ); target.insertBefore( elem, target.firstChild ); } } ); }, before: function() { return domManip( this, arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this ); } } ); }, after: function() { return domManip( this, arguments, function( elem ) { if ( this.parentNode ) { this.parentNode.insertBefore( elem, this.nextSibling ); } } ); }, empty: function() { var elem, i = 0; for ( ; ( elem = this[ i ] ) != null; i++ ) { // Remove element nodes and prevent memory leaks if ( elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem, false ) ); } // Remove any remaining nodes while ( elem.firstChild ) { elem.removeChild( elem.firstChild ); } // If this is a select, ensure that it displays empty (#12336) // Support: IE<9 if ( elem.options && jQuery.nodeName( elem, "select" ) ) { elem.options.length = 0; } } return this; }, clone: function( dataAndEvents, deepDataAndEvents ) { dataAndEvents = dataAndEvents == null ? false : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map( function() { return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); } ); }, html: function( value ) { return access( this, function( value ) { var elem = this[ 0 ] || {}, i = 0, l = this.length; if ( value === undefined ) { return elem.nodeType === 1 ? elem.innerHTML.replace( rinlinejQuery, "" ) : undefined; } // See if we can take a shortcut and just use innerHTML if ( typeof value === "string" && !rnoInnerhtml.test( value ) && ( support.htmlSerialize || !rnoshimcache.test( value ) ) && ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { value = jQuery.htmlPrefilter( value ); try { for ( ; i < l; i++ ) { // Remove element nodes and prevent memory leaks elem = this[ i ] || {}; if ( elem.nodeType === 1 ) { jQuery.cleanData( getAll( elem, false ) ); elem.innerHTML = value; } } elem = 0; // If using innerHTML throws an exception, use the fallback method } catch ( e ) {} } if ( elem ) { this.empty().append( value ); } }, null, value, arguments.length ); }, replaceWith: function() { var ignored = []; // Make the changes, replacing each non-ignored context element with the new content return domManip( this, arguments, function( elem ) { var parent = this.parentNode; if ( jQuery.inArray( this, ignored ) < 0 ) { jQuery.cleanData( getAll( this ) ); if ( parent ) { parent.replaceChild( elem, this ); } } // Force callback invocation }, ignored ); } } ); jQuery.each( { appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var elems, i = 0, ret = [], insert = jQuery( selector ), last = insert.length - 1; for ( ; i <= last; i++ ) { elems = i === last ? this : this.clone( true ); jQuery( insert[ i ] )[ original ]( elems ); // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() push.apply( ret, elems.get() ); } return this.pushStack( ret ); }; } ); var iframe, elemdisplay = { // Support: Firefox // We have to pre-define these values for FF (#10227) HTML: "block", BODY: "block" }; /** * Retrieve the actual display of a element * @param {String} name nodeName of the element * @param {Object} doc Document object */ // Called only from within defaultDisplay function actualDisplay( name, doc ) { var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), display = jQuery.css( elem[ 0 ], "display" ); // We don't have any data stored on the element, // so use "detach" method as fast way to get rid of the element elem.detach(); return display; } /** * Try to determine the default display value of an element * @param {String} nodeName */ function defaultDisplay( nodeName ) { var doc = document, display = elemdisplay[ nodeName ]; if ( !display ) { display = actualDisplay( nodeName, doc ); // If the simple way fails, read from inside an iframe if ( display === "none" || !display ) { // Use the already-created iframe if possible iframe = ( iframe || jQuery( "