diff --git a/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch b/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch new file mode 100644 index 0000000..627021f --- /dev/null +++ b/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.settings/org.eclipse.wst.xsl.core.prefs b/.settings/org.eclipse.wst.xsl.core.prefs new file mode 100644 index 0000000..5a50ac6 --- /dev/null +++ b/.settings/org.eclipse.wst.xsl.core.prefs @@ -0,0 +1,12 @@ +#Fri Apr 26 12:50:35 CST 2013 +CHECK_CALL_TEMPLATES=2 +CHECK_XPATHS=2 +CIRCULAR_REF=2 +DUPLICATE_PARAMETER=2 +EMPTY_PARAM=1 +MISSING_INCLUDE=2 +MISSING_PARAM=1 +NAME_ATTRIBUTE_EMPTY=2 +NAME_ATTRIBUTE_MISSING=2 +TEMPLATE_CONFLICT=2 +eclipse.preferences.version=1 diff --git a/WebRoot/WEB-INF/views/job/index.html b/WebRoot/WEB-INF/views/job/index.html index 8cb154c..18746b9 100644 --- a/WebRoot/WEB-INF/views/job/index.html +++ b/WebRoot/WEB-INF/views/job/index.html @@ -1,4 +1,6 @@ -<#include "/layout/_layout.html" /> <@head title="首页|四眼井|互联网人的乐园 "> +<#include "/layout/_layout.html" /> +<@head title="首页|四眼井|互联网人的乐园 "> + <@body> (${hot.count!}) - - - - - - - \ No newline at end of file diff --git a/WebRoot/js/jquery-powerFloat/201012/jquery-power-float-demo.html b/WebRoot/js/jquery-powerFloat/201012/jquery-power-float-demo.html new file mode 100644 index 0000000..7a5ed6f --- /dev/null +++ b/WebRoot/js/jquery-powerFloat/201012/jquery-power-float-demo.html @@ -0,0 +1,540 @@ + + + + + + + + +jQuery万能浮动框插件测试 » 张鑫旭-鑫空间-鑫生活 + + + + + +
+
+
+ + + + by zhangxinxu 2010-12-08 15:22 +
+

jQuery万能浮动框插件测试

+
+
+

一、加载页面上元素

+

默认rel加载

+
HTML代码:<a id="trigger1" href="javascript:;" rel="targetBox">默认rel加载</a>
+
JS代码:$("#trigger1").powerFloat();
+
+
+

target参数加载

+
HTML代码:<a id="trigger2" href="###">target参数加载</a>
+
JS代码:$("#trigger2").powerFloat({ + target: $("#targetBox") +});
+
+
+

target参数为选择器

+
HTML代码:<a id="trigger3" href="###">target参数为选择器</a>
+
JS代码:$("#trigger3").powerFloat({ + target: ".target_box" +});
+
+
+

二、Ajax加载外部元素

+

rel属性显示图片

+
HTML代码:<a id="trigger4" href="javascript:;" rel="http://image.zhangxinxu.com/image/study/s/s256/mm1.jpg">rel属性显示图片</a>
+
JS代码:$("#trigger4").powerFloat({ + targetMode: "ajax" +});
+
+
+

target参数为图片地址

+
HTML代码:<a id="trigger5" href="javascript:;">target参数为图片地址</a>
+
JS代码:$("#trigger5").powerFloat({ + target: "http://image.zhangxinxu.com/image/study/s/s512/mm2.jpg", + targetMode: "ajax" +});
+
+
+

加载外部HTML片段:

+
HTML代码:<button id="trigger6">点击切换显示</button>
+
JS代码:$("#trigger6").powerFloat({ + eventType: "click", + target: "/study/201009/html-load.html", + targetMode: "ajax" +});
+
+
+

加载外部页面数据失败:

+
HTML代码:<button id="trigger7">点击测试</button>
+
JS代码:$("#trigger7").powerFloat({ + eventType: "click", + target: "http://www.baidu.com/", + targetMode: "ajax" +});
+
+
+

三、下拉列表的显示

+

纯文字列表下拉:

+
HTML代码:<button id="trigger8">点击显示姓名列表▼</button>
+
JS代码:$("#trigger8").powerFloat({ + width: "inherit", + eventType: "click", + target: ["唐丽霞", "徐栋梁", "成霞", "王庆花", "王腊梅", "朱小丽", "束方娟", "吉回秀", "陈阳", "<a href='##'>更多 >></a>"], + targetMode: "list" +});
+
+
+

带链接的文字下拉:更多文章▼

+
HTML代码:<a id="trigger9" href="/wordpress/">更多文章▼</a>
+
JS代码:$("#trigger9").powerFloat({ + width: 250, + target: [ + { + href: "##", + text: "这是文章1的说" + }, + { + href: "##", + text: "啊,看,文章2" + }, + { + href: "##", + text: "啊啦,不好,我把文章3忘家里了!" + }, + { + href: "##", + text: "马萨噶,这就是传说中的...文章4..." + }, + { + href: "##", + text: "什么嘛,就是文章5,害我白期待一场" + } + ], + targetMode: "list" +});
+
+
+

无列表数据显示

+
HTML代码:<a id="trigger10" href="#">无列表数据显示</a>
+
JS代码:$("#trigger10").powerFloat({ + targetMode: "list" +});
+
+
+

四、简单提示的显示

+

输入密码:

+

再次输入:

+
HTML代码:输入密码:<input class="pwdTrigger" type="password" placeholder="6~20个字符" /> +再次输入:<input class="pwdTrigger" type="password" placeholder="输入与上面一样的密码" />
+
JS代码:$(".pwdTrigger").powerFloat({ + eventType: "focus", + targetMode: "remind", + targetAttr: "placeholder", + position: "1-4" +});
+
+
+

点击确定按钮或失去焦点后显示提示(文本框数据留空/输入奇怪字符等):

+
HTML代码:<input id="posTrigger1" type="text" /> <button id="trigger11">确定</button>
+
JS代码:var fnPosTri = function() { + var oPosTri = $("#posTrigger1"), vPosTri = $.trim(oPosTri.val()); + if (vPosTri === "") { + oPosTri.powerFloat({ + eventType: null, + targetMode: "remind", + target: "输入内容不能为空!", + position: "1-4" + }).focus(); + } else if (/\W/g.test(vPosTri)) { + oPosTri.powerFloat({ + eventType: null, + targetMode: "remind", + target: "只能输入英文字符、数字和下划线", + position: "1-4" + }).focus(); + } else { + $.powerFloat.hide(); + } +}; +$("#trigger11").bind("click", fnPosTri); +$("#posTrigger1").bind("blur", fnPosTri);
+
+
+

四、自定义浮动提示

+

+ 模拟title的tip提示显示: + 摸我 + 我也要 + 还有我 +

+
HTML代码:<a class="tipTrigger" href="###" tip="摸我">摸我</a> +<a class="tipTrigger" href="###" tip="我也要">我也要</a> +<a class="tipTrigger" href="###" tip="还有我">还有我</a>
+
JS代码:$(".tipTrigger").powerFloat({ + offsets: { + x: -10, + y: 22 + }, + showDelay: 200, + + hoverHold: false, + + targetMode: "tip", + targetAttr: "tip", + position: "3-4" +});
+
+
+

右上角固定位置的操作提示层(ajax请求中提示,页面跳转中提示等):

+

+ + + + +

+
HTML代码:<span id="targetFixed" class="target_fixed"></span> +<button class="operateTrigger">登录</button> +<button class="operateTrigger">提交</button> +<button class="operateTrigger">刷新</button>
+
CSS代码:.target_fixed { height:25px; padding:1px; position:fixed; _position:absolute; top:0; right:0; }
+
JS代码:
$(".operateTrigger").click(function() {
+    var txt = $(this).text();
+    //IE6位置
+    if (!window.XMLHttpRequest) {
+        $("#targetFixed").css("top", $(document).scrollTop() + 2);	
+    }
+    //创建半透明遮罩层
+    if (!$("#overLay").size()) {
+        $('<div id="overLay"></div>').prependTo($("body"));
+        $("#overLay").css({
+            width: "100%",
+            backgroundColor: "#000",
+            opacity: 0.2,
+            position: "absolute",
+            left: 0,
+            top: 0,
+            zIndex: 99
+        }).height($(document).height());
+    }
+    //显示操作提示,最关键核心代码
+    $("#targetFixed").powerFloat({
+        eventType: null,
+        targetMode: "doing",	
+        target: "正在" + txt + "中...",
+        position: "1-2"
+    });
+    //定时关闭,测试用
+    setTimeout(function() {
+        $("#overLay").remove();
+        $.powerFloat.hide();
+    }, 2000);
+});
+
+
+

五、自定义装载容器

+
+

自定义容器装载外部图片(无柔化投影):

+
CSS代码:
.custom_container{position:absolute; background-color:rgba(0, 0, 0, .5); background-color:#999\9;}
+.custom_container img{padding:0; position:relative; top:-5px; left:-5px;}
+
HTML代码:<div id="customContainer" class="custom_container"></div> +<input id="trigger12" type="button" src="http://image.zhangxinxu.com/image/study/s/s256/mm10.jpg" value="点击我" />
+
JS代码:$("#trigger12").powerFloat({ + eventType: "click", + targetMode: "ajax", + targetAttr: "src", + + container: $("#customContainer"), + reverseSharp: true +});
+
+
+

自定义容器装载页面元素:

+
HTML代码:<input id="trigger13" type="button" src="targetBox" value="点击我" />
+
JS代码:$("#trigger13").powerFloat({ + eventType: "click", + targetMode: null, + targetAttr: "src", + + container: $("#customContainer") +});
+
+
+

六、鼠标跟随效果

+

缩略图显示大图,同时鼠标跟随(垂直方向):

+ + + +
CSS代码:.dib { display: inline-block; }
+
HTML代码:<a class="dib" id="trigger14" href="http://image.zhangxinxu.com/image/study/s/s256/mm1.jpg"> + <img src="http://image.zhangxinxu.com/image/study/s/s128/mm1.jpg" /> +</a>
+
JS代码:$("#trigger14").powerFloat({ + targetMode: "ajax", + targetAttr: "href", + hoverFollow: "y", + position: "6-8" +});
+
+
+

缩略图显示大图,同时鼠标跟随(水平方向):

+ + + +
CSS代码:.dib { display: inline-block; }
+
HTML代码:<a class="dib" id="trigger15" href="http://image.zhangxinxu.com/image/study/s/s256/mm1.jpg"> + <img src="http://image.zhangxinxu.com/image/study/s/s128/mm1.jpg" /> +</a>
+
JS代码:$("#trigger15").powerFloat({ + targetMode: "ajax", + targetAttr: "href", + hoverFollow: "x", + hoverHold: false, + position: "5-7" +});
+
+
+ +
+
+ +
+
+ 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 +
+
+ 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 +
+
+ 17 + 18 + 19 + 20 +
+ 显示更多 » +
+ + + + + + + + diff --git a/WebRoot/js/jquery-powerFloat/css/common.css b/WebRoot/js/jquery-powerFloat/css/common.css new file mode 100644 index 0000000..e221841 --- /dev/null +++ b/WebRoot/js/jquery-powerFloat/css/common.css @@ -0,0 +1,35 @@ +@charset "utf-8"; +/* CSS Document */ +body{margin:0; font-size:84%; background:#eee; color:#333; font-family:Verdana, Geneva, sans-serif;} +ul,ol,form,h1,h2,h3,h4,h5,h6,p{padding:0; margin:0; list-style-type:none;} +i,cite{font-style:normal;} +a{color:#34538b; text-decoration:underline;}a:hover{color:#F30; text-decoration:underline;} +.l{float:left;}.r{float:right;}.cl{clear:both;}img{border:0;} +.tc{text-align:center;}.tr{text-align:right;} +.g0{color:#000;}.g3{color:#333;}.g6{color:#666666;}.g9{color:#999999;}.r3{color:#f30;} +.vm{vertical-align:middle;}.vtb{vertical-align:text-bottom;}.vt{vertical-align:top;}.vn{vertical-align:-2px;} +.ml2{margin-left:2px;}.ml5{margin-left:5px;}.ml10{margin-left:10px;}.ml20{margin-left:20px;}.mr2{margin-right:2px;}.mr5{margin-right:5px;}.mr10{margin-right:10px;}.mr20{margin-right:20px;}.mt2{margin-top:2px;}.mt5{margin-top:5px;}.mt10{margin-top:10px;}.mt20{margin-top:20px;}.mb2{margin-bottom:2px;}.mb5{margin-bottom:5px;}.mb10{margin-bottom:10px;}.mb20{margin-bottom:20px;} +.f9{font-size:0.9em;}.f10{font-size:1em;}.f11{font-size:1.1em;}.f12{font-size:1.2em;}.f13{font-size:1.3em;}.f14{font-size:1.4em;}.f15{font-size:1.5em;}.f16{font-size:1.6em;} +.fix{zoom:1;}.fix:after,.fix:before{display:block; content:"clear"; height:0; clear:both; overflow:hidden; visibility:hidden;} +.rel{position:relative;}.abs{position:absolute;}.fixed{position:fixed;} +.dn{display:none;}.db{display:block;}.dib{display:inline-block;}.di{display:inline;} +.dot{background:url(http://www.zhangxinxu.com/wordpress/wp-content/themes/default/images/zxx_dotted.gif) repeat-x 0 bottom;} +.zxx_out_box{width:70%; min-width:700px; border-left:1px solid white; border-right:1px solid white; margin:0 auto;} +.zxx_in_box{min-height:550px; _height:550px; border-left:1px solid #ccc; border-right:1px solid #ccc; background:white; padding:1em 2.5em 0;} +.zxx_header{padding:10px 20px 5px; border-bottom:1px solid #ccc; overflow:hidden; zoom:1;} +.zxx_author_time{float:right; margin-top:34px; color:#787878; font-family:"Courier New", Courier, monospace;} +.zxx_title{font-size:1.6em; text-align:center; margin:20px 0;} +.zxx_main_con{min-height:580px; _height:580px; padding:0 20px 20px;} +.zxx_footer{padding-bottom:25px; text-align:center;} +.zxx_test_list{padding:1em; font-size:1.1em; border-bottom:1px dashed #ccc; line-height:1.3; overflow:hidden; zoom:1;} +.zxx_code{display:block; padding:10px; margin:5px 0; background:#eee; border:1px dashed #ccc; clear:both; zoom:1;} +.zxx_code xmp,.zxx_code pre{margin:0; color:#00F; font-size:12px; white-space:pre-wrap; word-wrap:break-word;} +.zxx_btn{display:inline-block; background:url(../image/down_btn.png) no-repeat; padding-left:25px;} +.zxx_btn span,.zxx_btn a{display:inline-block; height:45px; line-height:45px; background:url(../image/down_btn.png) no-repeat right top; padding:0 45px 0 20px; cursor:pointer;} +.zxx_btn:hover,.zxx_btn a:hover{text-decoration:none; color:#34538b;} +.shadow{-moz-box-shadow:0 0 5px rgba(52, 83, 139, .6); -webkit-box-shadow:0 0 5px rgba(52, 83, 139, .6); box-shadow:0 0 5px rgba(52, 83, 139, .6);} +.zxx_ad_left{position:absolute; left:10px; top:120px; padding:10px 6px; background:white;} +.zxx_ad_right{position:absolute; right:10px; top:120px; padding:10px 6px; background:white;} +.zxx_ad_left.fixed,.zxx_ad_right.fixed{position:fixed!important; position:absolute;} +.zxx_ad_fixed{top:5px; position:fixed!important; position:absolute;} +.zxx_ad_close{font-size:12px; color:#0033ff; position:absolute; right:2px; top:0px; z-index:1000;} \ No newline at end of file diff --git a/WebRoot/js/jquery-powerFloat/css/powerFloat.css b/WebRoot/js/jquery-powerFloat/css/powerFloat.css new file mode 100644 index 0000000..490c306 --- /dev/null +++ b/WebRoot/js/jquery-powerFloat/css/powerFloat.css @@ -0,0 +1,140 @@ +@charset "utf-8"; +/* powerFloat */ +.float_ajax_box { + border: 1px solid #ccc; + background-color: #fff; +} + +.float_loading { + width: 100px; + height: 100px; + background: url(http://www.zhangxinxu.com/study/image/loading.gif) no-repeat center; +} + +.float_ajax_image { + padding: 5px; +} + +.float_ajax_error { + width: 200px; + padding: 40px 0; + text-align: center; +} + +.float_list_ul { + margin: 0; + padding: 1px; + border: 1px solid #beceeb; + background-color: #fff; + font-size: 12px; + list-style-type: none; +} + +.float_list_a { + display:block; + text-decoration: none; +} +.float_list_a:hover { + background-color:#f0f3f9; + color: #333; + text-decoration: none; +} + +.float_list_ul li { + line-height: 20px; + border-top: 1px solid #f0f3f9; + text-indent: 5px; +} + +.float_list_ul li:first-child { + border-top: 0; +} + +.float_list_null { + padding: 40px 20px; + text-align: center; +} + +.float_remind_box { + border: 1px solid #F7CE39; + background: #ffffe0; + padding: 5px 10px; +} + +.float_tip_box { + line-height: 18px; + padding: 0 3px; + background-color: #ffffe0; + -moz-box-shadow: 1px 1px 2px rgba(0, 0, 0, .4); + -webkit-box-shadow: 1px 1px 2px rgba(0, 0, 0, .4); + box-shadow: 1px 1px 2px rgba(0, 0, 0, .4); + border: 1px solid #333; + position:absolute; +} + +.float_doing_box { + border: 1px solid #F7CE39; + background: #ffffe0 url(http://www.zhangxinxu.com/study/image/loading_s.gif) no-repeat 5px center; + padding: 5px 10px 5px 25px; + font-size: 12px; + position: absolute; +} + +.float_corner { + font-size: 18px; + font-family: '宋体'; + position: absolute; + left: -6000px; + overflow: hidden; +} +.float_corner .corner { + position: absolute; +} +.float_corner .corner_1 { + /*可去除*/ + color: #ccc; +} +.float_corner .corner_2 { + /*可去除*/ + color: #fff; +} +.float_corner_top, .float_corner_bottom { + width: 16px; + height: 8px; +} +.float_corner_top { + line-height: 14px; +} +.float_corner_bottom { + line-height: 17px; +} +.float_corner_left, .float_corner_right { + width: 8px; + height: 16px; +} +.float_corner_top .corner, .float_corner_bottom .corner { + left: 0; +} +.float_corner_right .corner, .float_corner_left .corner{ + top: -2px; +} +.float_corner_bottom .corner_1 { +} +.float_corner_bottom .corner_2 { + top: 1px; +} +.float_corner_left .corner_1 { + right: 0; +} +.float_corner_left .corner_2 { + right: 1px; +} +.float_corner_top .corner_1 { + bottom: 0; +} +.float_corner_top .corner_2 { + bottom: 1px; +} +.float_corner_right .corner_2 { + left: 1px; +} diff --git a/WebRoot/js/jquery-powerFloat/js/jquery-powerFloat.js b/WebRoot/js/jquery-powerFloat/js/jquery-powerFloat.js new file mode 100644 index 0000000..4fda23d --- /dev/null +++ b/WebRoot/js/jquery-powerFloat/js/jquery-powerFloat.js @@ -0,0 +1,882 @@ +/*! + * jquery-powerFloat.js + * jQuery 万能浮动层插件 + * http://www.zhangxinxu.com/wordpress/?p=1328 + * © by zhangxinxu + * 2010-12-06 v1.0.0 插件编写,初步调试 + * 2010-12-30 v1.0.1 限定尖角字符字体,避免受浏览器自定义字体干扰 + * 2011-01-03 v1.1.0 修复连续获得焦点显示后又隐藏的bug + 修复图片加载正则判断不准确的问题 + * 2011-02-15 v1.1.1 关于居中对齐位置判断的特殊处理 + * 2011-04-15 v1.2.0 修复浮动层含有过高select框在IE下点击会隐藏浮动层的问题,同时优化事件绑定 + * 2011-09-13 v1.3.0 修复两个菜单hover时间间隔过短隐藏回调不执行的问题 + * 2012-01-13 v1.4.0 去除ajax加载的存储 + 修复之前按照ajax地址后缀判断是否图片的问题 + 修复一些脚本运行出错 + 修复hover延时显示时,元素没有显示但鼠标移出依然触发隐藏回调的问题 + * 2012-02-27 v1.5.0 为无id容器创建id逻辑使用错误的问题 + 修复无事件浮动出现时同页面点击空白区域浮动层不隐藏的问题 + 修复点击与hover并存时特定时候o.trigger报为null错误的问题 + * 2012-03-29 v1.5.1 修复连续hover时候后面一个不触发显示的问题 + * 2012-05-02 v1.5.2 点击事件 浮动框再次点击隐藏的问题修复 + * 2012-11-02 v1.6.0 兼容jQuery 1.8.2 + * 2012-01-28 v1.6.1 target参数支持funtion类型,以实现类似动态Ajax地址功能 + */ + +(function($) { + $.fn.powerFloat = function(options) { + return $(this).each(function() { + var s = $.extend({}, defaults, options || {}); + var init = function(pms, trigger) { + if (o.target && o.target.css("display") !== "none") { + o.targetHide(); + } + o.s = pms; + o.trigger = trigger; + }, hoverTimer; + + switch (s.eventType) { + case "hover": { + $(this).hover(function() { + if (o.timerHold) { + o.flagDisplay = true; + } + + var numShowDelay = parseInt(s.showDelay, 10); + + init(s, $(this)); + //鼠标hover延时 + if (numShowDelay) { + if (hoverTimer) { + clearTimeout(hoverTimer); + } + hoverTimer = setTimeout(function() { + o.targetGet.call(o); + }, numShowDelay); + } else { + o.targetGet(); + } + }, function() { + if (hoverTimer) { + clearTimeout(hoverTimer); + } + if (o.timerHold) { + clearTimeout(o.timerHold); + } + + o.flagDisplay = false; + + o.targetHold(); + }); + if (s.hoverFollow) { + //鼠标跟随 + $(this).mousemove(function(e) { + o.cacheData.left = e.pageX; + o.cacheData.top = e.pageY; + o.targetGet.call(o); + return false; + }); + } + break; + } + case "click": { + $(this).click(function(e) { + if (o.display && o.trigger && e.target === o.trigger.get(0)) { + o.flagDisplay = false; + o.displayDetect(); + } else { + init(s, $(this)); + o.targetGet(); + + if (!$(document).data("mouseupBind")) { + $(document).bind("mouseup", function(e) { + var flag = false; + if (o.trigger) { + var idTarget = o.target.attr("id"); + if (!idTarget) { + idTarget = "R_" + Math.random(); + o.target.attr("id", idTarget); + } + $(e.target).parents().each(function() { + if ($(this).attr("id") === idTarget) { + flag = true; + } + }); + if (s.eventType === "click" && o.display && e.target != o.trigger.get(0) && !flag) { + o.flagDisplay = false; + o.displayDetect(); + } + } + return false; + }).data("mouseupBind", true); + } + } + }); + + break; + } + case "focus": { + $(this).focus(function() { + var self = $(this); + setTimeout(function() { + init(s, self); + o.targetGet(); + }, 200); + }).blur(function() { + o.flagDisplay = false; + setTimeout(function() { + o.displayDetect(); + }, 190); + }); + break; + } + default: { + init(s, $(this)); + o.targetGet(); + // 放置页面点击后显示的浮动内容隐掉 + $(document).unbind("mouseup").data("mouseupBind", false); + } + } + }); + }; + + var o = { + targetGet: function() { + //一切显示的触发来源 + if (!this.trigger) { return this; } + var attr = this.trigger.attr(this.s.targetAttr), target = typeof this.s.target == "function"? this.s.target.call(this.trigger): this.s.target; + + switch (this.s.targetMode) { + case "common": { + if (target) { + var type = typeof(target); + if (type === "object") { + if (target.size()) { + o.target = target.eq(0); + } + } else if (type === "string") { + if ($(target).size()) { + o.target = $(target).eq(0); + } + } + } else { + if (attr && $("#" + attr).size()) { + o.target = $("#" + attr); + } + } + if (o.target) { + o.targetShow(); + } else { + return this; + } + + break; + } + case "ajax": { + //ajax元素,如图片,页面地址 + var url = target || attr; + this.targetProtect = false; + + if (!url) { return; } + + if (!o.cacheData[url]) { + o.loading(); + } + + //优先认定为图片加载 + var tempImage = new Image(); + + tempImage.onload = function() { + var w = tempImage.width, h = tempImage.height; + var winw = $(window).width(), winh = $(window).height(); + var imgScale = w / h, winScale = winw / winh; + if (imgScale > winScale) { + //图片的宽高比大于显示屏幕 + if (w > winw / 2) { + w = winw / 2; + h = w / imgScale; + } + } else { + //图片高度较高 + if (h > winh / 2) { + h = winh / 2; + w = h * imgScale; + } + } + var imgHtml = ''; + o.cacheData[url] = true; + o.target = $(imgHtml); + o.targetShow(); + }; + tempImage.onerror = function() { + //如果图片加载失败,两种可能,一是100%图片,则提示;否则作为页面加载 + if (/(\.jpg|\.png|\.gif|\.bmp|\.jpeg)$/i.test(url)) { + o.target = $('
图片加载失败。
'); + o.targetShow(); + } else { + $.ajax({ + url: url, + success: function(data) { + if (typeof(data) === "string") { + o.cacheData[url] = true; + o.target = $('
' + data + '
'); + o.targetShow(); + } + }, + error: function() { + o.target = $('
数据没有加载成功。
'); + o.targetShow(); + } + }); + } + }; + tempImage.src = url; + + break; + } + case "list": { + //下拉列表 + var targetHtml = ''; + o.target = $(targetHtml); + this.targetProtect = false; + o.targetShow(); + break; + } + case "remind": { + //内容均是字符串 + var strRemind = target || attr; + this.targetProtect = false; + if (typeof(strRemind) === "string") { + o.target = $('' + strRemind + ''); + o.targetShow(); + } + break; + } + default: { + var objOther = target || attr, type = typeof(objOther); + if (objOther) { + if (type === "string") { + //选择器 + if (/^.[^:#\[\.,]*$/.test(objOther)) { + if ($(objOther).size()) { + o.target = $(objOther).eq(0); + this.targetProtect = true; + } else if ($("#" + objOther).size()) { + o.target = $("#" + objOther).eq(0); + this.targetProtect = true; + } else { + o.target = $('
' + objOther + '
'); + this.targetProtect = false; + } + } else { + o.target = $('
' + objOther + '
'); + this.targetProtect = false; + } + + o.targetShow(); + } else if (type === "object") { + if (!$.isArray(objOther) && objOther.size()) { + o.target = objOther.eq(0); + this.targetProtect = true; + o.targetShow(); + } + } + } + } + } + return this; + }, + container: function() { + //容器(如果有)重装target + var cont = this.s.container, mode = this.s.targetMode || "mode"; + if (mode === "ajax" || mode === "remind") { + //显示三角 + this.s.sharpAngle = true; + } else { + this.s.sharpAngle = false; + } + //是否反向 + if (this.s.reverseSharp) { + this.s.sharpAngle = !this.s.sharpAngle; + } + + if (mode !== "common") { + //common模式无新容器装载 + if (cont === null) { + cont = "plugin"; + } + if ( cont === "plugin" ) { + if (!$("#floatBox_" + mode).size()) { + $('
').appendTo($("body")).hide(); + } + cont = $("#floatBox_" + mode); + } + + if (cont && typeof(cont) !== "string" && cont.size()) { + if (this.targetProtect) { + o.target.show().css("position", "static"); + } + o.target = cont.empty().append(o.target); + } + } + return this; + }, + setWidth: function() { + var w = this.s.width; + if (w === "auto") { + if (this.target.get(0).style.width) { + this.target.css("width", "auto"); + } + } else if (w === "inherit") { + this.target.width(this.trigger.width()); + } else { + this.target.css("width", w); + } + return this; + }, + position: function() { + if (!this.trigger || !this.target) { + return this; + } + var pos, tri_h = 0, tri_w = 0, cor_w = 0, cor_h = 0, tri_l, tri_t, tar_l, tar_t, cor_l, cor_t, + tar_h = this.target.data("height"), tar_w = this.target.data("width"), + st = $(window).scrollTop(), + + off_x = parseInt(this.s.offsets.x, 10) || 0, off_y = parseInt(this.s.offsets.y, 10) || 0, + mousePos = this.cacheData; + + //缓存目标对象高度,宽度,提高鼠标跟随时显示性能,元素隐藏时缓存清除 + if (!tar_h) { + tar_h = this.target.outerHeight(); + if (this.s.hoverFollow) { + this.target.data("height", tar_h); + } + } + if (!tar_w) { + tar_w = this.target.outerWidth(); + if (this.s.hoverFollow) { + this.target.data("width", tar_w); + } + } + + pos = this.trigger.offset(); + tri_h = this.trigger.outerHeight(); + tri_w = this.trigger.outerWidth(); + tri_l = pos.left; + tri_t = pos.top; + + var funMouseL = function() { + if (tri_l < 0) { + tri_l = 0; + } else if (tri_l + tri_h > $(window).width()) { + tri_l = $(window).width() - tri_w; + } + }, funMouseT = function() { + if (tri_t < 0) { + tri_t = 0; + } else if (tri_t + tri_h > $(document).height()) { + tri_t = $(document).height() - tri_h; + } + }; + //如果是鼠标跟随 + if (this.s.hoverFollow && mousePos.left && mousePos.top) { + if (this.s.hoverFollow === "x") { + //水平方向移动,说明纵坐标固定 + tri_l = mousePos.left + funMouseL(); + } else if (this.s.hoverFollow === "y") { + //垂直方向移动,说明横坐标固定,纵坐标跟随鼠标移动 + tri_t = mousePos.top; + funMouseT(); + } else { + tri_l = mousePos.left; + tri_t = mousePos.top; + funMouseL(); + funMouseT(); + } + } + + + var arrLegalPos = ["4-1", "1-4", "5-7", "2-3", "2-1", "6-8", "3-4", "4-3", "8-6", "1-2", "7-5", "3-2"], + align = this.s.position, alignMatch = false, strDirect; + $.each(arrLegalPos, function(i, n) { + if (n === align) { + alignMatch = true; + return; + } + }); + if (!alignMatch) { + align = "4-1"; + } + + var funDirect = function(a) { + var dir = "bottom"; + //确定方向 + switch (a) { + case "1-4": case "5-7": case "2-3": { + dir = "top"; + break; + } + case "2-1": case "6-8": case "3-4": { + dir = "right"; + break; + } + case "1-2": case "8-6": case "4-3": { + dir = "left"; + break; + } + case "4-1": case "7-5": case "3-2": { + dir = "bottom"; + break; + } + } + return dir; + }; + + //居中判断 + var funCenterJudge = function(a) { + if (a === "5-7" || a === "6-8" || a === "8-6" || a === "7-5") { + return true; + } + return false; + }; + + var funJudge = function(dir) { + var totalHeight = 0, totalWidth = 0, flagCorner = (o.s.sharpAngle && o.corner) ? true: false; + if (dir === "right") { + totalWidth = tri_l + tri_w + tar_w + off_x; + if (flagCorner) { + totalWidth += o.corner.width(); + } + if (totalWidth > $(window).width()) { + return false; + } + } else if (dir === "bottom") { + totalHeight = tri_t + tri_h + tar_h + off_y; + if (flagCorner) { + totalHeight += o.corner.height(); + } + if (totalHeight > st + $(window).height()) { + return false; + } + } else if (dir === "top") { + totalHeight = tar_h + off_y; + if (flagCorner) { + totalHeight += o.corner.height(); + } + if (totalHeight > tri_t - st) { + return false; + } + } else if (dir === "left") { + totalWidth = tar_w + off_x; + if (flagCorner) { + totalWidth += o.corner.width(); + } + if (totalWidth > tri_l) { + return false; + } + } + return true; + }; + //此时的方向 + strDirect = funDirect(align); + + if (this.s.sharpAngle) { + //创建尖角 + this.createSharp(strDirect); + } + + //边缘过界判断 + if (this.s.edgeAdjust) { + //根据位置是否溢出显示界面重新判定定位 + if (funJudge(strDirect)) { + //该方向不溢出 + (function() { + if (funCenterJudge(align)) { return; } + var obj = { + top: { + right: "2-3", + left: "1-4" + }, + right: { + top: "2-1", + bottom: "3-4" + }, + bottom: { + right: "3-2", + left: "4-1" + }, + left: { + top: "1-2", + bottom: "4-3" + } + }; + var o = obj[strDirect], name; + if (o) { + for (name in o) { + if (!funJudge(name)) { + align = o[name]; + } + } + } + })(); + } else { + //该方向溢出 + (function() { + if (funCenterJudge(align)) { + var center = { + "5-7": "7-5", + "7-5": "5-7", + "6-8": "8-6", + "8-6": "6-8" + }; + align = center[align]; + } else { + var obj = { + top: { + left: "3-2", + right: "4-1" + }, + right: { + bottom: "1-2", + top: "4-3" + }, + bottom: { + left: "2-3", + right: "1-4" + }, + left: { + bottom: "2-1", + top: "3-4" + } + }; + var o = obj[strDirect], arr = []; + for (name in o) { + arr.push(name); + } + if (funJudge(arr[0]) || !funJudge(arr[1])) { + align = o[arr[0]]; + } else { + align = o[arr[1]]; + } + } + })(); + } + } + + //已确定的尖角 + var strNewDirect = funDirect(align), strFirst = align.split("-")[0]; + if (this.s.sharpAngle) { + //创建尖角 + this.createSharp(strNewDirect); + cor_w = this.corner.width(), cor_h = this.corner.height(); + } + + //确定left, top值 + if (this.s.hoverFollow) { + //如果鼠标跟随 + if (this.s.hoverFollow === "x") { + //仅水平方向跟随 + tar_l = tri_l + off_x; + if (strFirst === "1" || strFirst === "8" || strFirst === "4" ) { + //最左 + tar_l = tri_l - (tar_w - tri_w) / 2 + off_x; + } else { + //右侧 + tar_l = tri_l - (tar_w - tri_w) + off_x; + } + + //这是垂直位置,固定不动 + if (strFirst === "1" || strFirst === "5" || strFirst === "2" ) { + tar_t = tri_t - off_y - tar_h - cor_h; + //尖角 + cor_t = tri_t - cor_h - off_y - 1; + + } else { + //下方 + tar_t = tri_t + tri_h + off_y + cor_h; + cor_t = tri_t + tri_h + off_y + 1; + } + cor_l = pos.left - (cor_w - tri_w) / 2; + } else if (this.s.hoverFollow === "y") { + //仅垂直方向跟随 + if (strFirst === "1" || strFirst === "5" || strFirst === "2" ) { + //顶部 + tar_t = tri_t - (tar_h - tri_h) / 2 + off_y; + } else { + //底部 + tar_t = tri_t - (tar_h - tri_h) + off_y; + } + + if (strFirst === "1" || strFirst === "8" || strFirst === "4" ) { + //左侧 + tar_l = tri_l - tar_w - off_x - cor_w; + cor_l = tri_l - cor_w - off_x - 1; + } else { + //右侧 + tar_l = tri_l + tri_w - off_x + cor_w; + cor_l = tri_l + tri_w + off_x + 1; + } + cor_t = pos.top - (cor_h - tri_h) / 2; + } else { + tar_l = tri_l + off_x; + tar_t = tri_t + off_y; + } + + } else { + switch (strNewDirect) { + case "top": { + tar_t = tri_t - off_y - tar_h - cor_h; + if (strFirst == "1") { + tar_l = tri_l - off_x; + } else if (strFirst === "5") { + tar_l = tri_l - (tar_w - tri_w) / 2 - off_x; + } else { + tar_l = tri_l - (tar_w - tri_w) - off_x; + } + cor_t = tri_t - cor_h - off_y - 1; + cor_l = tri_l - (cor_w - tri_w) / 2; + break; + } + case "right": { + tar_l = tri_l + tri_w + off_x + cor_w; + if (strFirst == "2") { + tar_t = tri_t + off_y; + } else if (strFirst === "6") { + tar_t = tri_t - (tar_h - tri_h) / 2 + off_y; + } else { + tar_t = tri_t - (tar_h - tri_h) + off_y; + } + cor_l = tri_l + tri_w + off_x + 1; + cor_t = tri_t - (cor_h - tri_h) / 2; + break; + } + case "bottom": { + tar_t = tri_t + tri_h + off_y + cor_h; + if (strFirst == "4") { + tar_l = tri_l + off_x; + } else if (strFirst === "7") { + tar_l = tri_l - (tar_w - tri_w) / 2 + off_x; + } else { + tar_l = tri_l - (tar_w - tri_w) + off_x; + } + cor_t = tri_t + tri_h + off_y + 1; + cor_l = tri_l - (cor_w - tri_w) / 2; + break; + } + case "left": { + tar_l = tri_l - tar_w - off_x - cor_w; + if (strFirst == "2") { + tar_t = tri_t - off_y; + } else if (strFirst === "6") { + tar_t = tri_t - (tar_w - tri_w) / 2 - off_y; + } else { + tar_t = tri_t - (tar_h - tri_h) - off_y; + } + cor_l = tar_l + cor_w; + cor_t = tri_t - (tar_w - cor_w) / 2; + break; + } + } + } + //尖角的显示 + if (cor_h && cor_w && this.corner) { + this.corner.css({ + left: cor_l, + top: cor_t, + zIndex: this.s.zIndex + 1 + }); + } + //浮动框显示 + this.target.css({ + position: "absolute", + left: tar_l, + top: tar_t, + zIndex: this.s.zIndex + }); + return this; + }, + createSharp: function(dir) { + var bgColor, bdColor, color1 = "", color2 = ""; + var objReverse = { + left: "right", + right: "left", + bottom: "top", + top: "bottom" + }, dirReverse = objReverse[dir] || "top"; + + if (this.target) { + bgColor = this.target.css("background-color"); + if (parseInt(this.target.css("border-" + dirReverse + "-width")) > 0) { + bdColor = this.target.css("border-" + dirReverse + "-color"); + } + + if (bdColor && bdColor !== "transparent") { + color1 = 'style="color:' + bdColor + ';"'; + } else { + color1 = 'style="display:none;"'; + } + if (bgColor && bgColor !== "transparent") { + color2 = 'style="color:' + bgColor + ';"'; + }else { + color2 = 'style="display:none;"'; + } + } + + var html = '
' + + '' + + '' + + '
'; + if (!$("#floatCorner_" + dir).size()) { + $("body").append($(html)); + } + this.corner = $("#floatCorner_" + dir); + return this; + }, + targetHold: function() { + if (this.s.hoverHold) { + var delay = parseInt(this.s.hideDelay, 10) || 200; + if (this.target) { + this.target.hover(function() { + o.flagDisplay = true; + }, function() { + if (o.timerHold) { + clearTimeout(o.timerHold); + } + o.flagDisplay = false; + o.targetHold(); + }); + } + + o.timerHold = setTimeout(function() { + o.displayDetect.call(o); + }, delay); + } else { + this.displayDetect(); + } + return this; + }, + loading: function() { + this.target = $('
'); + this.targetShow(); + this.target.removeData("width").removeData("height"); + return this; + }, + displayDetect: function() { + //显示与否检测与触发 + if (!this.flagDisplay && this.display) { + this.targetHide(); + this.timerHold = null; + } + return this; + }, + targetShow: function() { + o.cornerClear(); + this.display = true; + this.container().setWidth().position(); + this.target.show(); + if ($.isFunction(this.s.showCall)) { + this.s.showCall.call(this.trigger, this.target); + } + return this; + }, + targetHide: function() { + this.display = false; + this.targetClear(); + this.cornerClear(); + if ($.isFunction(this.s.hideCall)) { + this.s.hideCall.call(this.trigger); + } + this.target = null; + this.trigger = null; + this.s = {}; + this.targetProtect = false; + return this; + }, + targetClear: function() { + if (this.target) { + if (this.target.data("width")) { + this.target.removeData("width").removeData("height"); + } + if (this.targetProtect) { + //保护孩子 + this.target.children().hide().appendTo($("body")); + } + this.target.unbind().hide(); + } + }, + cornerClear: function() { + if (this.corner) { + //使用remove避免潜在的尖角颜色冲突问题 + this.corner.remove(); + } + }, + target: null, + trigger: null, + s: {}, + cacheData: {}, + targetProtect: false + }; + + $.powerFloat = {}; + $.powerFloat.hide = function() { + o.targetHide(); + }; + + var defaults = { + width: "auto", //可选参数:inherit,数值(px) + offsets: { + x: 0, + y: 0 + }, + zIndex: 999, + + eventType: "hover", //事件类型,其他可选参数有:click, focus + + showDelay: 0, //鼠标hover显示延迟 + hideDelay: 0, //鼠标移出隐藏延时 + + hoverHold: true, + hoverFollow: false, //true或是关键字x, y + + targetMode: "common", //浮动层的类型,其他可选参数有:ajax, list, remind + target: null, //target对象获取来源,优先获取,如果为null,则从targetAttr中获取。 + targetAttr: "rel", //target对象获取来源,当targetMode为list时无效 + + container: null, //转载target的容器,可以使用"plugin"关键字,则表示使用插件自带容器类型 + reverseSharp: false, //是否反向小三角的显示,默认ajax, remind是显示三角的,其他如list和自定义形式是不显示的 + + position: "4-1", //trigger-target + edgeAdjust: true, //边缘位置自动调整 + + showCall: $.noop, + hideCall: $.noop + + }; +})(jQuery); \ No newline at end of file diff --git a/WebRoot/js/jquery-powerFloat/js/mini/jquery-powerFloat-min.js b/WebRoot/js/jquery-powerFloat/js/mini/jquery-powerFloat-min.js new file mode 100644 index 0000000..8f81156 --- /dev/null +++ b/WebRoot/js/jquery-powerFloat/js/mini/jquery-powerFloat-min.js @@ -0,0 +1,25 @@ +/*! + * jquery-powerFloat.js + * jQuery 万能浮动层插件 + * http://www.zhangxinxu.com/wordpress/?p=1328 + * © by zhangxinxu + * 2010-12-06 v1.0.0 插件编写,初步调试 + * 2010-12-30 v1.0.1 限定尖角字符字体,避免受浏览器自定义字体干扰 + * 2011-01-03 v1.1.0 修复连续获得焦点显示后又隐藏的bug + 修复图片加载正则判断不准确的问题 + * 2011-02-15 v1.1.1 关于居中对齐位置判断的特殊处理 + * 2011-04-15 v1.2.0 修复浮动层含有过高select框在IE下点击会隐藏浮动层的问题,同时优化事件绑定 + * 2011-09-13 v1.3.0 修复两个菜单hover时间间隔过短隐藏回调不执行的问题 + * 2012-01-13 v1.4.0 去除ajax加载的存储 + 修复之前按照ajax地址后缀判断是否图片的问题 + 修复一些脚本运行出错 + 修复hover延时显示时,元素没有显示但鼠标移出依然触发隐藏回调的问题 + * 2012-02-27 v1.5.0 为无id容器创建id逻辑使用错误的问题 + 修复无事件浮动出现时同页面点击空白区域浮动层不隐藏的问题 + 修复点击与hover并存时特定时候o.trigger报为null错误的问题 + * 2012-03-29 v1.5.1 修复连续hover时候后面一个不触发显示的问题 + * 2012-05-02 v1.5.2 点击事件 浮动框再次点击隐藏的问题修复 + * 2012-11-02 v1.6.0 兼容jQuery 1.8.2 + * 2012-01-28 v1.6.1 target参数支持funtion类型,以实现类似动态Ajax地址功能 + */ +(function(a){a.fn.powerFloat=function(d){return a(this).each(function(){var f=a.extend({},b,d||{});var g=function(i,h){if(c.target&&c.target.css("display")!=="none"){c.targetHide()}c.s=i;c.trigger=h},e;switch(f.eventType){case"hover":a(this).hover(function(){if(c.timerHold){c.flagDisplay=true}var h=parseInt(f.showDelay,10);g(f,a(this));if(h){if(e){clearTimeout(e)}e=setTimeout(function(){c.targetGet.call(c)},h)}else{c.targetGet()}},function(){if(e){clearTimeout(e)}if(c.timerHold){clearTimeout(c.timerHold)}c.flagDisplay=false;c.targetHold()});if(f.hoverFollow){a(this).mousemove(function(h){c.cacheData.left=h.pageX;c.cacheData.top=h.pageY;c.targetGet.call(c);return false})}break;case"click":a(this).click(function(h){if(c.display&&c.trigger&&h.target===c.trigger.get(0)){c.flagDisplay=false;c.displayDetect()}else{g(f,a(this));c.targetGet();if(!a(document).data("mouseupBind")){a(document).bind("mouseup",function(k){var i=false;if(c.trigger){var j=c.target.attr("id");if(!j){j="R_"+Math.random();c.target.attr("id",j)}a(k.target).parents().each(function(){if(a(this).attr("id")===j){i=true}});if(f.eventType==="click"&&c.display&&k.target!=c.trigger.get(0)&&!i){c.flagDisplay=false;c.displayDetect()}}return false}).data("mouseupBind",true)}}});break;case"focus":a(this).focus(function(){var h=a(this);setTimeout(function(){g(f,h);c.targetGet()},200)}).blur(function(){c.flagDisplay=false;setTimeout(function(){c.displayDetect()},190)});break;default:g(f,a(this));c.targetGet();a(document).unbind("mouseup").data("mouseupBind",false)}})};var c={targetGet:function(){if(!this.trigger){return this}var h=this.trigger.attr(this.s.targetAttr),g=typeof this.s.target=="function"?this.s.target.call(this.trigger):this.s.target;switch(this.s.targetMode){case"common":if(g){var i=typeof(g);if(i==="object"){if(g.size()){c.target=g.eq(0)}}else{if(i==="string"){if(a(g).size()){c.target=a(g).eq(0)}}}}else{if(h&&a("#"+h).size()){c.target=a("#"+h)}}if(c.target){c.targetShow()}else{return this}break;case"ajax":var d=g||h;this.targetProtect=false;if(!d){return}if(!c.cacheData[d]){c.loading()}var f=new Image();f.onload=function(){var m=f.width,q=f.height;var p=a(window).width(),s=a(window).height();var r=m/q,o=p/s;if(r>o){if(m>p/2){m=p/2;q=m/r}}else{if(q>s/2){q=s/2;m=q*r}}var n='';c.cacheData[d]=true;c.target=a(n);c.targetShow()};f.onerror=function(){if(/(\.jpg|\.png|\.gif|\.bmp|\.jpeg)$/i.test(d)){c.target=a('
图片加载失败。
');c.targetShow()}else{a.ajax({url:d,success:function(m){if(typeof(m)==="string"){c.cacheData[d]=true;c.target=a('
'+m+"
");c.targetShow()}},error:function(){c.target=a('
数据没有加载成功。
');c.targetShow()}})}};f.src=d;break;case"list":var k='";c.target=a(k);this.targetProtect=false;c.targetShow();break;case"remind":var l=g||h;this.targetProtect=false;if(typeof(l)==="string"){c.target=a(""+l+"");c.targetShow()}break;default:var e=g||h,i=typeof(e);if(e){if(i==="string"){if(/^.[^:#\[\.,]*$/.test(e)){if(a(e).size()){c.target=a(e).eq(0);this.targetProtect=true}else{if(a("#"+e).size()){c.target=a("#"+e).eq(0);this.targetProtect=true}else{c.target=a("
"+e+"
");this.targetProtect=false}}}else{c.target=a("
"+e+"
");this.targetProtect=false}c.targetShow()}else{if(i==="object"){if(!a.isArray(e)&&e.size()){c.target=e.eq(0);this.targetProtect=true;c.targetShow()}}}}}return this},container:function(){var d=this.s.container,e=this.s.targetMode||"mode";if(e==="ajax"||e==="remind"){this.s.sharpAngle=true}else{this.s.sharpAngle=false}if(this.s.reverseSharp){this.s.sharpAngle=!this.s.sharpAngle}if(e!=="common"){if(d===null){d="plugin"}if(d==="plugin"){if(!a("#floatBox_"+e).size()){a('
').appendTo(a("body")).hide()}d=a("#floatBox_"+e)}if(d&&typeof(d)!=="string"&&d.size()){if(this.targetProtect){c.target.show().css("position","static")}c.target=d.empty().append(c.target)}}return this},setWidth:function(){var d=this.s.width;if(d==="auto"){if(this.target.get(0).style.width){this.target.css("width","auto")}}else{if(d==="inherit"){this.target.width(this.trigger.width())}else{this.target.css("width",d)}}return this},position:function(){if(!this.trigger||!this.target){return this}var h,x=0,k=0,m=0,y=0,s,o,e,E,u,q,f=this.target.data("height"),C=this.target.data("width"),r=a(window).scrollTop(),B=parseInt(this.s.offsets.x,10)||0,A=parseInt(this.s.offsets.y,10)||0,w=this.cacheData;if(!f){f=this.target.outerHeight();if(this.s.hoverFollow){this.target.data("height",f)}}if(!C){C=this.target.outerWidth();if(this.s.hoverFollow){this.target.data("width",C)}}h=this.trigger.offset();x=this.trigger.outerHeight();k=this.trigger.outerWidth();s=h.left;o=h.top;var l=function(){if(s<0){s=0}else{if(s+x>a(window).width()){s=a(window).width()-k}}},i=function(){if(o<0){o=0}else{if(o+x>a(document).height()){o=a(document).height()-x}}};if(this.s.hoverFollow&&w.left&&w.top){if(this.s.hoverFollow==="x"){s=w.left;l()}else{if(this.s.hoverFollow==="y"){o=w.top;i()}else{s=w.left;o=w.top;l();i()}}}var g=["4-1","1-4","5-7","2-3","2-1","6-8","3-4","4-3","8-6","1-2","7-5","3-2"],v=this.s.position,d=false,j;a.each(g,function(F,G){if(G===v){d=true;return}});if(!d){v="4-1"}var D=function(F){var G="bottom";switch(F){case"1-4":case"5-7":case"2-3":G="top";break;case"2-1":case"6-8":case"3-4":G="right";break;case"1-2":case"8-6":case"4-3":G="left";break;case"4-1":case"7-5":case"3-2":G="bottom";break}return G};var n=function(F){if(F==="5-7"||F==="6-8"||F==="8-6"||F==="7-5"){return true}return false};var t=function(H){var I=0,F=0,G=(c.s.sharpAngle&&c.corner)?true:false;if(H==="right"){F=s+k+C+B;if(G){F+=c.corner.width()}if(F>a(window).width()){return false}}else{if(H==="bottom"){I=o+x+f+A;if(G){I+=c.corner.height()}if(I>r+a(window).height()){return false}}else{if(H==="top"){I=f+A;if(G){I+=c.corner.height()}if(I>o-r){return false}}else{if(H==="left"){F=C+B;if(G){F+=c.corner.width()}if(F>s){return false}}}}}return true};j=D(v);if(this.s.sharpAngle){this.createSharp(j)}if(this.s.edgeAdjust){if(t(j)){(function(){if(n(v)){return}var G={top:{right:"2-3",left:"1-4"},right:{top:"2-1",bottom:"3-4"},bottom:{right:"3-2",left:"4-1"},left:{top:"1-2",bottom:"4-3"}};var H=G[j],F;if(H){for(F in H){if(!t(F)){v=H[F]}}}})()}else{(function(){if(n(v)){var G={"5-7":"7-5","7-5":"5-7","6-8":"8-6","8-6":"6-8"};v=G[v]}else{var H={top:{left:"3-2",right:"4-1"},right:{bottom:"1-2",top:"4-3"},bottom:{left:"2-3",right:"1-4"},left:{bottom:"2-1",top:"3-4"}};var I=H[j],F=[];for(name in I){F.push(name)}if(t(F[0])||!t(F[1])){v=I[F[0]]}else{v=I[F[1]]}}})()}}var z=D(v),p=v.split("-")[0];if(this.s.sharpAngle){this.createSharp(z);m=this.corner.width(),y=this.corner.height()}if(this.s.hoverFollow){if(this.s.hoverFollow==="x"){e=s+B;if(p==="1"||p==="8"||p==="4"){e=s-(C-k)/2+B}else{e=s-(C-k)+B}if(p==="1"||p==="5"||p==="2"){E=o-A-f-y;q=o-y-A-1}else{E=o+x+A+y;q=o+x+A+1}u=h.left-(m-k)/2}else{if(this.s.hoverFollow==="y"){if(p==="1"||p==="5"||p==="2"){E=o-(f-x)/2+A}else{E=o-(f-x)+A}if(p==="1"||p==="8"||p==="4"){e=s-C-B-m;u=s-m-B-1}else{e=s+k-B+m;u=s+k+B+1}q=h.top-(y-x)/2}else{e=s+B;E=o+A}}}else{switch(z){case"top":E=o-A-f-y;if(p=="1"){e=s-B}else{if(p==="5"){e=s-(C-k)/2-B}else{e=s-(C-k)-B}}q=o-y-A-1;u=s-(m-k)/2;break;case"right":e=s+k+B+m;if(p=="2"){E=o+A}else{if(p==="6"){E=o-(f-x)/2+A}else{E=o-(f-x)+A}}u=s+k+B+1;q=o-(y-x)/2;break;case"bottom":E=o+x+A+y;if(p=="4"){e=s+B}else{if(p==="7"){e=s-(C-k)/2+B}else{e=s-(C-k)+B}}q=o+x+A+1;u=s-(m-k)/2;break;case"left":e=s-C-B-m;if(p=="2"){E=o-A}else{if(p==="6"){E=o-(C-k)/2-A}else{E=o-(f-x)-A}}u=e+m;q=o-(C-m)/2;break}}if(y&&m&&this.corner){this.corner.css({left:u,top:q,zIndex:this.s.zIndex+1})}this.target.css({position:"absolute",left:e,top:E,zIndex:this.s.zIndex});return this},createSharp:function(g){var j,k,f="",d="";var i={left:"right",right:"left",bottom:"top",top:"bottom"},e=i[g]||"top";if(this.target){j=this.target.css("background-color");if(parseInt(this.target.css("border-"+e+"-width"))>0){k=this.target.css("border-"+e+"-color")}if(k&&k!=="transparent"){f='style="color:'+k+';"'}else{f='style="display:none;"'}if(j&&j!=="transparent"){d='style="color:'+j+';"'}else{d='style="display:none;"'}}var h='
";if(!a("#floatCorner_"+g).size()){a("body").append(a(h))}this.corner=a("#floatCorner_"+g);return this},targetHold:function(){if(this.s.hoverHold){var d=parseInt(this.s.hideDelay,10)||200;if(this.target){this.target.hover(function(){c.flagDisplay=true},function(){if(c.timerHold){clearTimeout(c.timerHold)}c.flagDisplay=false;c.targetHold()})}c.timerHold=setTimeout(function(){c.displayDetect.call(c)},d)}else{this.displayDetect()}return this},loading:function(){this.target=a('
');this.targetShow();this.target.removeData("width").removeData("height");return this},displayDetect:function(){if(!this.flagDisplay&&this.display){this.targetHide();this.timerHold=null}return this},targetShow:function(){c.cornerClear();this.display=true;this.container().setWidth().position();this.target.show();if(a.isFunction(this.s.showCall)){this.s.showCall.call(this.trigger,this.target)}return this},targetHide:function(){this.display=false;this.targetClear();this.cornerClear();if(a.isFunction(this.s.hideCall)){this.s.hideCall.call(this.trigger)}this.target=null;this.trigger=null;this.s={};this.targetProtect=false;return this},targetClear:function(){if(this.target){if(this.target.data("width")){this.target.removeData("width").removeData("height")}if(this.targetProtect){this.target.children().hide().appendTo(a("body"))}this.target.unbind().hide()}},cornerClear:function(){if(this.corner){this.corner.remove()}},target:null,trigger:null,s:{},cacheData:{},targetProtect:false};a.powerFloat={};a.powerFloat.hide=function(){c.targetHide()};var b={width:"auto",offsets:{x:0,y:0},zIndex:999,eventType:"hover",showDelay:0,hideDelay:0,hoverHold:true,hoverFollow:false,targetMode:"common",target:null,targetAttr:"rel",container:null,reverseSharp:false,position:"4-1",edgeAdjust:true,showCall:a.noop,hideCall:a.noop}})(jQuery); \ No newline at end of file diff --git a/WebRoot/js/jquery-validation/jquery.validate.css b/WebRoot/js/jquery-validation/jquery.validate.css new file mode 100644 index 0000000..9500c4a --- /dev/null +++ b/WebRoot/js/jquery-validation/jquery.validate.css @@ -0,0 +1,13 @@ +label.error { + width: 10em; + float: none; + color: red; + padding-left: .5em; + vertical-align: top; + height:29px; + line-height:29px; +} + +p { + clear: both; +} diff --git a/WebRoot/js/jquery-validation/jquery.validate.min.js b/WebRoot/js/jquery-validation/jquery.validate.min.js new file mode 100644 index 0000000..edd6452 --- /dev/null +++ b/WebRoot/js/jquery-validation/jquery.validate.min.js @@ -0,0 +1,51 @@ +/** + * jQuery Validation Plugin 1.9.0 + * + * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ + * http://docs.jquery.com/Plugins/Validation + * + * Copyright (c) 2006 - 2011 Jörn Zaefferer + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ +(function(c){c.extend(c.fn,{validate:function(a){if(this.length){var b=c.data(this[0],"validator");if(b)return b;this.attr("novalidate","novalidate");b=new c.validator(a,this[0]);c.data(this[0],"validator",b);if(b.settings.onsubmit){a=this.find("input, button");a.filter(".cancel").click(function(){b.cancelSubmit=true});b.settings.submitHandler&&a.filter(":submit").click(function(){b.submitButton=this});this.submit(function(d){function e(){if(b.settings.submitHandler){if(b.submitButton)var f=c("").attr("name", +b.submitButton.name).val(b.submitButton.value).appendTo(b.currentForm);b.settings.submitHandler.call(b,b.currentForm);b.submitButton&&f.remove();return false}return true}b.settings.debug&&d.preventDefault();if(b.cancelSubmit){b.cancelSubmit=false;return e()}if(b.form()){if(b.pendingRequest){b.formSubmitted=true;return false}return e()}else{b.focusInvalid();return false}})}return b}else a&&a.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing")},valid:function(){if(c(this[0]).is("form"))return this.validate().form(); +else{var a=true,b=c(this[0].form).validate();this.each(function(){a&=b.element(this)});return a}},removeAttrs:function(a){var b={},d=this;c.each(a.split(/\s/),function(e,f){b[f]=d.attr(f);d.removeAttr(f)});return b},rules:function(a,b){var d=this[0];if(a){var e=c.data(d.form,"validator").settings,f=e.rules,g=c.validator.staticRules(d);switch(a){case "add":c.extend(g,c.validator.normalizeRule(b));f[d.name]=g;if(b.messages)e.messages[d.name]=c.extend(e.messages[d.name],b.messages);break;case "remove":if(!b){delete f[d.name]; +return g}var h={};c.each(b.split(/\s/),function(j,i){h[i]=g[i];delete g[i]});return h}}d=c.validator.normalizeRules(c.extend({},c.validator.metadataRules(d),c.validator.classRules(d),c.validator.attributeRules(d),c.validator.staticRules(d)),d);if(d.required){e=d.required;delete d.required;d=c.extend({required:e},d)}return d}});c.extend(c.expr[":"],{blank:function(a){return!c.trim(""+a.value)},filled:function(a){return!!c.trim(""+a.value)},unchecked:function(a){return!a.checked}});c.validator=function(a, +b){this.settings=c.extend(true,{},c.validator.defaults,a);this.currentForm=b;this.init()};c.validator.format=function(a,b){if(arguments.length==1)return function(){var d=c.makeArray(arguments);d.unshift(a);return c.validator.format.apply(this,d)};if(arguments.length>2&&b.constructor!=Array)b=c.makeArray(arguments).slice(1);if(b.constructor!=Array)b=[b];c.each(b,function(d,e){a=a.replace(RegExp("\\{"+d+"\\}","g"),e)});return a};c.extend(c.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error", +validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:c([]),errorLabelContainer:c([]),onsubmit:true,ignore:":hidden",ignoreTitle:false,onfocusin:function(a){this.lastActive=a;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass);this.addWrapper(this.errorsFor(a)).hide()}},onfocusout:function(a){if(!this.checkable(a)&&(a.name in this.submitted||!this.optional(a)))this.element(a)}, +onkeyup:function(a){if(a.name in this.submitted||a==this.lastElement)this.element(a)},onclick:function(a){if(a.name in this.submitted)this.element(a);else a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).addClass(b).removeClass(d):c(a).addClass(b).removeClass(d)},unhighlight:function(a,b,d){a.type==="radio"?this.findByName(a.name).removeClass(b).addClass(d):c(a).removeClass(b).addClass(d)}},setDefaults:function(a){c.extend(c.validator.defaults, +a)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:c.validator.format("Please enter no more than {0} characters."), +minlength:c.validator.format("Please enter at least {0} characters."),rangelength:c.validator.format("Please enter a value between {0} and {1} characters long."),range:c.validator.format("Please enter a value between {0} and {1}."),max:c.validator.format("Please enter a value less than or equal to {0}."),min:c.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){function a(e){var f=c.data(this[0].form,"validator"),g="on"+e.type.replace(/^validate/, +"");f.settings[g]&&f.settings[g].call(f,this[0],e)}this.labelContainer=c(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||c(this.currentForm);this.containers=c(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var b=this.groups={};c.each(this.settings.groups,function(e,f){c.each(f.split(/\s/),function(g,h){b[h]=e})});var d= +this.settings.rules;c.each(d,function(e,f){d[e]=c.validator.normalizeRule(f)});c(this.currentForm).validateDelegate("[type='text'], [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",a).validateDelegate("[type='radio'], [type='checkbox'], select, option","click", +a);this.settings.invalidHandler&&c(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){this.checkForm();c.extend(this.submitted,this.errorMap);this.invalid=c.extend({},this.errorMap);this.valid()||c(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(a){this.lastElement= +a=this.validationTargetFor(this.clean(a));this.prepareElement(a);this.currentElements=c(a);var b=this.check(a);if(b)delete this.invalid[a.name];else this.invalid[a.name]=true;if(!this.numberOfInvalids())this.toHide=this.toHide.add(this.containers);this.showErrors();return b},showErrors:function(a){if(a){c.extend(this.errorMap,a);this.errorList=[];for(var b in a)this.errorList.push({message:a[b],element:this.findByName(b)[0]});this.successList=c.grep(this.successList,function(d){return!(d.name in a)})}this.settings.showErrors? +this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){c.fn.resetForm&&c(this.currentForm).resetForm();this.submitted={};this.lastElement=null;this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b=0,d;for(d in a)b++;return b},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()== +0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{c(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(a){}},findLastActive:function(){var a=this.lastActive;return a&&c.grep(this.errorList,function(b){return b.element.name==a.name}).length==1&&a},elements:function(){var a=this,b={};return c(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&& +a.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in b||!a.objectLength(c(this).rules()))return false;return b[this.name]=true})},clean:function(a){return c(a)[0]},errors:function(){return c(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=c([]);this.toHide=c([]);this.currentElements=c([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)}, +prepareElement:function(a){this.reset();this.toHide=this.errorsFor(a)},check:function(a){a=this.validationTargetFor(this.clean(a));var b=c(a).rules(),d=false,e;for(e in b){var f={method:e,parameters:b[e]};try{var g=c.validator.methods[e].call(this,a.value.replace(/\r/g,""),a,f.parameters);if(g=="dependency-mismatch")d=true;else{d=false;if(g=="pending"){this.toHide=this.toHide.not(this.errorsFor(a));return}if(!g){this.formatAndAdd(a,f);return false}}}catch(h){this.settings.debug&&window.console&&console.log("exception occured when checking element "+ +a.id+", check the '"+f.method+"' method",h);throw h;}}if(!d){this.objectLength(b)&&this.successList.push(a);return true}},customMetaMessage:function(a,b){if(c.metadata){var d=this.settings.meta?c(a).metadata()[this.settings.meta]:c(a).metadata();return d&&d.messages&&d.messages[b]}},customMessage:function(a,b){var d=this.settings.messages[a];return d&&(d.constructor==String?d:d[b])},findDefined:function(){for(var a=0;aWarning: No message defined for "+a.name+"")},formatAndAdd:function(a,b){var d=this.defaultMessage(a,b.method),e=/\$?\{(\d+)\}/g;if(typeof d=="function")d=d.call(this,b.parameters,a);else if(e.test(d))d=jQuery.format(d.replace(e,"{$1}"),b.parameters);this.errorList.push({message:d,element:a});this.errorMap[a.name]=d;this.submitted[a.name]= +d},addWrapper:function(a){if(this.settings.wrapper)a=a.add(a.parent(this.settings.wrapper));return a},defaultShowErrors:function(){for(var a=0;this.errorList[a];a++){var b=this.errorList[a];this.settings.highlight&&this.settings.highlight.call(this,b.element,this.settings.errorClass,this.settings.validClass);this.showLabel(b.element,b.message)}if(this.errorList.length)this.toShow=this.toShow.add(this.containers);if(this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]); +if(this.settings.unhighlight){a=0;for(b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass)}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return c(this.errorList).map(function(){return this.element})},showLabel:function(a,b){var d=this.errorsFor(a);if(d.length){d.removeClass(this.settings.validClass).addClass(this.settings.errorClass); +d.attr("generated")&&d.html(b)}else{d=c("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(a),generated:true}).addClass(this.settings.errorClass).html(b||"");if(this.settings.wrapper)d=d.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();this.labelContainer.append(d).length||(this.settings.errorPlacement?this.settings.errorPlacement(d,c(a)):d.insertAfter(a))}if(!b&&this.settings.success){d.text("");typeof this.settings.success=="string"?d.addClass(this.settings.success):this.settings.success(d)}this.toShow= +this.toShow.add(d)},errorsFor:function(a){var b=this.idOrName(a);return this.errors().filter(function(){return c(this).attr("for")==b})},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(a){if(this.checkable(a))a=this.findByName(a.name).not(this.settings.ignore)[0];return a},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(a){var b=this.currentForm;return c(document.getElementsByName(a)).map(function(d, +e){return e.form==b&&e.name==a&&e||null})},getLength:function(a,b){switch(b.nodeName.toLowerCase()){case "select":return c("option:selected",b).length;case "input":if(this.checkable(b))return this.findByName(b.name).filter(":checked").length}return a.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):true},dependTypes:{"boolean":function(a){return a},string:function(a,b){return!!c(a,b.form).length},"function":function(a,b){return a(b)}},optional:function(a){return!c.validator.methods.required.call(this, +c.trim(a.value),a)&&"dependency-mismatch"},startRequest:function(a){if(!this.pending[a.name]){this.pendingRequest++;this.pending[a.name]=true}},stopRequest:function(a,b){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[a.name];if(b&&this.pendingRequest==0&&this.formSubmitted&&this.form()){c(this.currentForm).submit();this.formSubmitted=false}else if(!b&&this.pendingRequest==0&&this.formSubmitted){c(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted= +false}},previousValue:function(a){return c.data(a,"previousValue")||c.data(a,"previousValue",{old:null,valid:true,message:this.defaultMessage(a,"remote")})}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(a,b){a.constructor==String?this.classRuleSettings[a]=b:c.extend(this.classRuleSettings, +a)},classRules:function(a){var b={};(a=c(a).attr("class"))&&c.each(a.split(" "),function(){this in c.validator.classRuleSettings&&c.extend(b,c.validator.classRuleSettings[this])});return b},attributeRules:function(a){var b={};a=c(a);for(var d in c.validator.methods){var e;if(e=d==="required"&&typeof c.fn.prop==="function"?a.prop(d):a.attr(d))b[d]=e;else if(a[0].getAttribute("type")===d)b[d]=true}b.maxlength&&/-1|2147483647|524288/.test(b.maxlength)&&delete b.maxlength;return b},metadataRules:function(a){if(!c.metadata)return{}; +var b=c.data(a.form,"validator").settings.meta;return b?c(a).metadata()[b]:c(a).metadata()},staticRules:function(a){var b={},d=c.data(a.form,"validator");if(d.settings.rules)b=c.validator.normalizeRule(d.settings.rules[a.name])||{};return b},normalizeRules:function(a,b){c.each(a,function(d,e){if(e===false)delete a[d];else if(e.param||e.depends){var f=true;switch(typeof e.depends){case "string":f=!!c(e.depends,b.form).length;break;case "function":f=e.depends.call(b,b)}if(f)a[d]=e.param!==undefined? +e.param:true;else delete a[d]}});c.each(a,function(d,e){a[d]=c.isFunction(e)?e(b):e});c.each(["minlength","maxlength","min","max"],function(){if(a[this])a[this]=Number(a[this])});c.each(["rangelength","range"],function(){if(a[this])a[this]=[Number(a[this][0]),Number(a[this][1])]});if(c.validator.autoCreateRanges){if(a.min&&a.max){a.range=[a.min,a.max];delete a.min;delete a.max}if(a.minlength&&a.maxlength){a.rangelength=[a.minlength,a.maxlength];delete a.minlength;delete a.maxlength}}a.messages&&delete a.messages; +return a},normalizeRule:function(a){if(typeof a=="string"){var b={};c.each(a.split(/\s/),function(){b[this]=true});a=b}return a},addMethod:function(a,b,d){c.validator.methods[a]=b;c.validator.messages[a]=d!=undefined?d:c.validator.messages[a];b.length<3&&c.validator.addClassRules(a,c.validator.normalizeRule(a))},methods:{required:function(a,b,d){if(!this.depend(d,b))return"dependency-mismatch";switch(b.nodeName.toLowerCase()){case "select":return(a=c(b).val())&&a.length>0;case "input":if(this.checkable(b))return this.getLength(a, +b)>0;default:return c.trim(a).length>0}},remote:function(a,b,d){if(this.optional(b))return"dependency-mismatch";var e=this.previousValue(b);this.settings.messages[b.name]||(this.settings.messages[b.name]={});e.originalMessage=this.settings.messages[b.name].remote;this.settings.messages[b.name].remote=e.message;d=typeof d=="string"&&{url:d}||d;if(this.pending[b.name])return"pending";if(e.old===a)return e.valid;e.old=a;var f=this;this.startRequest(b);var g={};g[b.name]=a;c.ajax(c.extend(true,{url:d, +mode:"abort",port:"validate"+b.name,dataType:"json",data:g,success:function(h){f.settings.messages[b.name].remote=e.originalMessage;var j=h===true;if(j){var i=f.formSubmitted;f.prepareElement(b);f.formSubmitted=i;f.successList.push(b);f.showErrors()}else{i={};h=h||f.defaultMessage(b,"remote");i[b.name]=e.message=c.isFunction(h)?h(a):h;f.showErrors(i)}e.valid=j;f.stopRequest(b,j)}},d));return"pending"},minlength:function(a,b,d){return this.optional(b)||this.getLength(c.trim(a),b)>=d},maxlength:function(a, +b,d){return this.optional(b)||this.getLength(c.trim(a),b)<=d},rangelength:function(a,b,d){a=this.getLength(c.trim(a),b);return this.optional(b)||a>=d[0]&&a<=d[1]},min:function(a,b,d){return this.optional(b)||a>=d},max:function(a,b,d){return this.optional(b)||a<=d},range:function(a,b,d){return this.optional(b)||a>=d[0]&&a<=d[1]},email:function(a,b){return this.optional(b)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(a)}, +url:function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)}, +date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a))},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 -]+/.test(a))return false;var d=0,e=0,f=false;a=a.replace(/\D/g,"");for(var g=a.length-1;g>= +0;g--){e=a.charAt(g);e=parseInt(e,10);if(f)if((e*=2)>9)e-=9;d+=e;f=!f}return d%10==0},accept:function(a,b,d){d=typeof d=="string"?d.replace(/,/g,"|"):"png|jpe?g|gif";return this.optional(b)||a.match(RegExp(".("+d+")$","i"))},equalTo:function(a,b,d){d=c(d).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){c(b).valid()});return a==d.val()}}});c.format=c.validator.format})(jQuery); +(function(c){var a={};if(c.ajaxPrefilter)c.ajaxPrefilter(function(d,e,f){e=d.port;if(d.mode=="abort"){a[e]&&a[e].abort();a[e]=f}});else{var b=c.ajax;c.ajax=function(d){var e=("port"in d?d:c.ajaxSettings).port;if(("mode"in d?d:c.ajaxSettings).mode=="abort"){a[e]&&a[e].abort();return a[e]=b.apply(this,arguments)}return b.apply(this,arguments)}}})(jQuery); +(function(c){!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.handle.call(this,e)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)},handler:function(e){arguments[0]=c.event.fix(e);arguments[0].type=b;return c.event.handle.apply(this,arguments)}}});c.extend(c.fn,{validateDelegate:function(a, +b,d){return this.bind(b,function(e){var f=c(e.target);if(f.is(a))return d.apply(f,arguments)})}})})(jQuery); diff --git a/WebRoot/js/jquery-validation/messages_cn.js b/WebRoot/js/jquery-validation/messages_cn.js new file mode 100644 index 0000000..814cc38 --- /dev/null +++ b/WebRoot/js/jquery-validation/messages_cn.js @@ -0,0 +1,23 @@ +/* + * Translated default messages for the jQuery validation plugin. + * Locale: CN + */ +jQuery.extend(jQuery.validator.messages, { + required: "必选字段", + remote: "请修正该字段", + email: "请输入正确格式的电子邮件", + url: "请输入合法的网址", + date: "请输入合法的日期", + dateISO: "请输入合法的日期 (ISO).", + number: "请输入合法的数字", + digits: "只能输入整数", + creditcard: "请输入合法的信用卡号", + equalTo: "请再次输入相同的值", + accept: "请输入拥有合法后缀名的字符串", + maxlength: jQuery.validator.format("请输入一个长度最多是 {1} 的字符串"), + minlength: jQuery.validator.format("请输入一个长度最少是 {0} 的字符串"), + rangelength: jQuery.validator.format("请输入一个长度介于 {0} 和 {1} 之间的字符串"), + range: jQuery.validator.format("请输入一个介于 {0} 和 {1} 之间的值"), + max: jQuery.validator.format("请输入一个最大为 {0} 的值"), + min: jQuery.validator.format("请输入一个最小为 {0} 的值") +}); \ No newline at end of file diff --git a/WebRoot/js/jquery.validationEngine-zh_CN.js b/WebRoot/js/jquery.validationEngine-zh_CN.js deleted file mode 100644 index f3f0c34..0000000 --- a/WebRoot/js/jquery.validationEngine-zh_CN.js +++ /dev/null @@ -1,177 +0,0 @@ -(function($){ - $.fn.validationEngineLanguage = function(){ - }; - $.validationEngineLanguage = { - newLang: function(){ - $.validationEngineLanguage.allRules = { - "required": { // Add your regex rules here, you can take telephone as an example - "regex": "none", - "alertText": "* 此处不可空白", - "alertTextCheckboxMultiple": "* 请选择一个项目", - "alertTextCheckboxe": "* 您必须钩选此栏", - "alertTextDateRange": "* 日期范围不可空白" - }, - "requiredInFunction": { - "func": function(field, rules, i, options){ - return (field.val() == "test") ? true : false; - }, - "alertText": "* Field must equal test" - }, - "dateRange": { - "regex": "none", - "alertText": "* 无效的 ", - "alertText2": " 日期范围" - }, - "dateTimeRange": { - "regex": "none", - "alertText": "* 无效的 ", - "alertText2": " 时间范围" - }, - "minSize": { - "regex": "none", - "alertText": "* 最少 ", - "alertText2": " 个字符" - }, - "maxSize": { - "regex": "none", - "alertText": "* 最多 ", - "alertText2": " 个字符" - }, - "groupRequired": { - "regex": "none", - "alertText": "* 你必需选填其中一个栏位" - }, - "min": { - "regex": "none", - "alertText": "* 最小值為 " - }, - "max": { - "regex": "none", - "alertText": "* 最大值为 " - }, - "past": { - "regex": "none", - "alertText": "* 日期必需早于 " - }, - "future": { - "regex": "none", - "alertText": "* 日期必需晚于 " - }, - "maxCheckbox": { - "regex": "none", - "alertText": "* 最多选取 ", - "alertText2": " 个项目" - }, - "minCheckbox": { - "regex": "none", - "alertText": "* 请选择 ", - "alertText2": " 个项目" - }, - "equals": { - "regex": "none", - "alertText": "* 请输入与上面相同的密码" - }, - "creditCard": { - "regex": "none", - "alertText": "* 无效的信用卡号码" - }, - "phone": { - // credit: jquery.h5validate.js / orefalo - "regex": /^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/, - "alertText": "* 无效的电话号码" - }, - "email": { - // Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/ - "regex": /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, - "alertText": "* 邮件地址无效" - }, - "integer": { - "regex": /^[\-\+]?\d+$/, - "alertText": "* 不是有效的整数" - }, - "number": { - // Number, including positive, negative, and floating decimal. credit: orefalo - "regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/, - "alertText": "* 无效的数字" - }, - "date": { - "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/, - "alertText": "* 无效的日期,格式必需为 YYYY-MM-DD" - }, - "ipv4": { - "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/, - "alertText": "* 无效的 IP 地址" - }, - "url": { - "regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i, - "alertText": "* Invalid URL" - }, - "onlyNumberSp": { - "regex": /^[0-9\ ]+$/, - "alertText": "* 只能填数字" - }, - "onlyLetterSp": { - "regex": /^[a-zA-Z\ \']+$/, - "alertText": "* 只接受英文字母大小写" - }, - "onlyLetterNumber": { - "regex": /^[0-9a-zA-Z]+$/, - "alertText": "* 不接受特殊字符" - }, - // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings - "ajaxUserCall": { - "url": "ajaxValidateFieldUser", - // you may want to pass extra data on the ajax call - "extraData": "name=eric", - "alertText": "* 此名称已被其他人使用", - "alertTextLoad": "* 正在确认名称是否有其他人使用,请稍等。" - }, - "ajaxUserCallPhp": { - "url": "phpajax/ajaxValidateFieldUser.php", - // you may want to pass extra data on the ajax call - "extraData": "name=eric", - // if you provide an "alertTextOk", it will show as a green prompt when the field validates - "alertTextOk": "* 此帐号名称可以使用", - "alertText": "* 此名称已被其他人使用", - "alertTextLoad": "* 正在确认帐号名称是否有其他人使用,请稍等。" - }, - "ajaxNameCall": { - // remote json service location - "url": "ajaxValidateFieldName", - // error - "alertText": "* 此名称可以使用", - // if you provide an "alertTextOk", it will show as a green prompt when the field validates - "alertTextOk": "* 此名称已被其他人使用", - // speaks by itself - "alertTextLoad": "* 正在确认名称是否有其他人使用,请稍等。" - }, - "ajaxNameCallPhp": { - // remote json service location - "url": "phpajax/ajaxValidateFieldName.php", - // error - "alertText": "* 此名称已被其他人使用", - // speaks by itself - "alertTextLoad": "* 正在确认名称是否有其他人使用,请稍等。" - }, - "validate2fields": { - "alertText": "* 请输入 HELLO" - }, - //tls warning:homegrown not fielded - "dateFormat":{ - "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/, - "alertText": "* 无效的日期格式" - }, - //tls warning:homegrown not fielded - "dateTimeFormat": { - "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1}$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^((1[012]|0?[1-9]){1}\/(0?[1-9]|[12][0-9]|3[01]){1}\/\d{2,4}\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1})$/, - "alertText": "* 无效的日期或时间格式", - "alertText2": "可接受的格式: ", - "alertText3": "mm/dd/yyyy hh:mm:ss AM|PM 或 ", - "alertText4": "yyyy-mm-dd hh:mm:ss AM|PM" - } - }; - - } - }; - $.validationEngineLanguage.newLang(); -})(jQuery); diff --git a/WebRoot/js/jquery.validationEngine.js b/WebRoot/js/jquery.validationEngine.js deleted file mode 100644 index b3b1caf..0000000 --- a/WebRoot/js/jquery.validationEngine.js +++ /dev/null @@ -1,2066 +0,0 @@ -/* - * Inline Form Validation Engine 2.6.2, jQuery plugin - * - * Copyright(c) 2010, Cedric Dugas - * http://www.position-absolute.com - * - * 2.0 Rewrite by Olivier Refalo - * http://www.crionics.com - * - * Form validation engine allowing custom regex rules to be added. - * Licensed under the MIT License - */ - (function($) { - - "use strict"; - - var methods = { - - /** - * Kind of the constructor, called before any action - * @param {Map} user options - */ - init: function(options) { - var form = this; - if (!form.data('jqv') || form.data('jqv') == null ) { - options = methods._saveOptions(form, options); - // bind all formError elements to close on click - $(document).on("click", ".formError", function() { - $(this).fadeOut(150, function() { - // remove prompt once invisible - $(this).parent('.formErrorOuter').remove(); - $(this).remove(); - }); - }); - } - return this; - }, - /** - * Attachs jQuery.validationEngine to form.submit and field.blur events - * Takes an optional params: a list of options - * ie. jQuery("#formID1").validationEngine('attach', {promptPosition : "centerRight"}); - */ - attach: function(userOptions) { - - var form = this; - var options; - - if(userOptions) - options = methods._saveOptions(form, userOptions); - else - options = form.data('jqv'); - - options.validateAttribute = (form.find("[data-validation-engine*=validate]").length) ? "data-validation-engine" : "class"; - if (options.binded) { - - // delegate fields - form.on(options.validationEventTrigger, "["+options.validateAttribute+"*=validate]:not([type=checkbox]):not([type=radio]):not(.datepicker)", methods._onFieldEvent); - form.on("click", "["+options.validateAttribute+"*=validate][type=checkbox],["+options.validateAttribute+"*=validate][type=radio]", methods._onFieldEvent); - form.on(options.validationEventTrigger,"["+options.validateAttribute+"*=validate][class*=datepicker]", {"delay": 300}, methods._onFieldEvent); - } - if (options.autoPositionUpdate) { - $(window).bind("resize", { - "noAnimation": true, - "formElem": form - }, methods.updatePromptsPosition); - } - form.on("click","a[data-validation-engine-skip], a[class*='validate-skip'], button[data-validation-engine-skip], button[class*='validate-skip'], input[data-validation-engine-skip], input[class*='validate-skip']", methods._submitButtonClick); - form.removeData('jqv_submitButton'); - - // bind form.submit - form.on("submit", methods._onSubmitEvent); - return this; - }, - /** - * Unregisters any bindings that may point to jQuery.validaitonEngine - */ - detach: function() { - - var form = this; - var options = form.data('jqv'); - - // unbind fields - form.find("["+options.validateAttribute+"*=validate]").not("[type=checkbox]").off(options.validationEventTrigger, methods._onFieldEvent); - form.find("["+options.validateAttribute+"*=validate][type=checkbox],[class*=validate][type=radio]").off("click", methods._onFieldEvent); - - // unbind form.submit - form.off("submit", methods._onSubmitEvent); - form.removeData('jqv'); - - form.off("click", "a[data-validation-engine-skip], a[class*='validate-skip'], button[data-validation-engine-skip], button[class*='validate-skip'], input[data-validation-engine-skip], input[class*='validate-skip']", methods._submitButtonClick); - form.removeData('jqv_submitButton'); - - if (options.autoPositionUpdate) - $(window).off("resize", methods.updatePromptsPosition); - - return this; - }, - /** - * Validates either a form or a list of fields, shows prompts accordingly. - * Note: There is no ajax form validation with this method, only field ajax validation are evaluated - * - * @return true if the form validates, false if it fails - */ - validate: function() { - var element = $(this); - var valid = null; - - if (element.is("form") || element.hasClass("validationEngineContainer")) { - if (element.hasClass('validating')) { - // form is already validating. - // Should abort old validation and start new one. I don't know how to implement it. - return false; - } else { - element.addClass('validating'); - var options = element.data('jqv'); - var valid = methods._validateFields(this); - - // If the form doesn't validate, clear the 'validating' class before the user has a chance to submit again - setTimeout(function(){ - element.removeClass('validating'); - }, 100); - if (valid && options.onSuccess) { - options.onSuccess(); - } else if (!valid && options.onFailure) { - options.onFailure(); - } - } - } else if (element.is('form') || element.hasClass('validationEngineContainer')) { - element.removeClass('validating'); - } else { - // field validation - var form = element.closest('form, .validationEngineContainer'), - options = (form.data('jqv')) ? form.data('jqv') : $.validationEngine.defaults, - valid = methods._validateField(element, options); - - if (valid && options.onFieldSuccess) - options.onFieldSuccess(); - else if (options.onFieldFailure && options.InvalidFields.length > 0) { - options.onFieldFailure(); - } - } - if(options.onValidationComplete) { - // !! ensures that an undefined return is interpreted as return false but allows a onValidationComplete() to possibly return true and have form continue processing - return !!options.onValidationComplete(form, valid); - } - return valid; - }, - /** - * Redraw prompts position, useful when you change the DOM state when validating - */ - updatePromptsPosition: function(event) { - - if (event && this == window) { - var form = event.data.formElem; - var noAnimation = event.data.noAnimation; - } - else - var form = $(this.closest('form, .validationEngineContainer')); - - var options = form.data('jqv'); - // No option, take default one - form.find('['+options.validateAttribute+'*=validate]').not(":disabled").each(function(){ - var field = $(this); - if (options.prettySelect && field.is(":hidden")) - field = form.find("#" + options.usePrefix + field.attr('id') + options.useSuffix); - var prompt = methods._getPrompt(field); - var promptText = $(prompt).find(".formErrorContent").html(); - - if(prompt) - methods._updatePrompt(field, $(prompt), promptText, undefined, false, options, noAnimation); - }); - return this; - }, - /** - * Displays a prompt on a element. - * Note that the element needs an id! - * - * @param {String} promptText html text to display type - * @param {String} type the type of bubble: 'pass' (green), 'load' (black) anything else (red) - * @param {String} possible values topLeft, topRight, bottomLeft, centerRight, bottomRight - */ - showPrompt: function(promptText, type, promptPosition, showArrow) { - var form = this.closest('form, .validationEngineContainer'); - var options = form.data('jqv'); - // No option, take default one - if(!options) - options = methods._saveOptions(this, options); - if(promptPosition) - options.promptPosition=promptPosition; - options.showArrow = showArrow==true; - - methods._showPrompt(this, promptText, type, false, options); - return this; - }, - /** - * Closes form error prompts, CAN be invidual - */ - hide: function() { - var form = $(this).closest('form, .validationEngineContainer'); - var options = form.data('jqv'); - var fadeDuration = (options && options.fadeDuration) ? options.fadeDuration : 0.3; - var closingtag; - - if($(this).is("form") || $(this).hasClass("validationEngineContainer")) { - closingtag = "parentForm"+methods._getClassName($(this).attr("id")); - } else { - closingtag = methods._getClassName($(this).attr("id")) +"formError"; - } - $('.'+closingtag).fadeTo(fadeDuration, 0.3, function() { - $(this).parent('.formErrorOuter').remove(); - $(this).remove(); - }); - return this; - }, - /** - * Closes all error prompts on the page - */ - hideAll: function() { - - var form = this; - var options = form.data('jqv'); - var duration = options ? options.fadeDuration:300; - $('.formError').fadeTo(duration, 300, function() { - $(this).parent('.formErrorOuter').remove(); - $(this).remove(); - }); - return this; - }, - /** - * Typically called when user exists a field using tab or a mouse click, triggers a field - * validation - */ - _onFieldEvent: function(event) { - var field = $(this); - var form = field.closest('form, .validationEngineContainer'); - var options = form.data('jqv'); - options.eventTrigger = "field"; - // validate the current field - window.setTimeout(function() { - methods._validateField(field, options); - if (options.InvalidFields.length == 0 && options.onFieldSuccess) { - options.onFieldSuccess(); - } else if (options.InvalidFields.length > 0 && options.onFieldFailure) { - options.onFieldFailure(); - } - }, (event.data) ? event.data.delay : 0); - - }, - /** - * Called when the form is submited, shows prompts accordingly - * - * @param {jqObject} - * form - * @return false if form submission needs to be cancelled - */ - _onSubmitEvent: function() { - var form = $(this); - var options = form.data('jqv'); - - //check if it is trigger from skipped button - if (form.data("jqv_submitButton")){ - var submitButton = $("#" + form.data("jqv_submitButton")); - if (submitButton){ - if (submitButton.length > 0){ - if (submitButton.hasClass("validate-skip") || submitButton.attr("data-validation-engine-skip") == "true") - return true; - } - } - } - - options.eventTrigger = "submit"; - - // validate each field - // (- skip field ajax validation, not necessary IF we will perform an ajax form validation) - var r=methods._validateFields(form); - - if (r && options.ajaxFormValidation) { - methods._validateFormWithAjax(form, options); - // cancel form auto-submission - process with async call onAjaxFormComplete - return false; - } - - if(options.onValidationComplete) { - // !! ensures that an undefined return is interpreted as return false but allows a onValidationComplete() to possibly return true and have form continue processing - return !!options.onValidationComplete(form, r); - } - return r; - }, - /** - * Return true if the ajax field validations passed so far - * @param {Object} options - * @return true, is all ajax validation passed so far (remember ajax is async) - */ - _checkAjaxStatus: function(options) { - var status = true; - $.each(options.ajaxValidCache, function(key, value) { - if (!value) { - status = false; - // break the each - return false; - } - }); - return status; - }, - - /** - * Return true if the ajax field is validated - * @param {String} fieldid - * @param {Object} options - * @return true, if validation passed, false if false or doesn't exist - */ - _checkAjaxFieldStatus: function(fieldid, options) { - return options.ajaxValidCache[fieldid] == true; - }, - /** - * Validates form fields, shows prompts accordingly - * - * @param {jqObject} - * form - * @param {skipAjaxFieldValidation} - * boolean - when set to true, ajax field validation is skipped, typically used when the submit button is clicked - * - * @return true if form is valid, false if not, undefined if ajax form validation is done - */ - _validateFields: function(form) { - var options = form.data('jqv'); - - // this variable is set to true if an error is found - var errorFound = false; - - // Trigger hook, start validation - form.trigger("jqv.form.validating"); - // first, evaluate status of non ajax fields - var first_err=null; - form.find('['+options.validateAttribute+'*=validate]').not(":disabled").each( function() { - var field = $(this); - var names = []; - if ($.inArray(field.attr('name'), names) < 0) { - errorFound |= methods._validateField(field, options); - if (errorFound && first_err==null) - if (field.is(":hidden") && options.prettySelect) - first_err = field = form.find("#" + options.usePrefix + methods._jqSelector(field.attr('id')) + options.useSuffix); - else { - - //Check if we need to adjust what element to show the prompt on - //and and such scroll to instead - if(field.data('jqv-prompt-at') instanceof jQuery ){ - field = field.data('jqv-prompt-at'); - } else if(field.data('jqv-prompt-at')) { - field = $(field.data('jqv-prompt-at')); - } - first_err=field; - } - if (options.doNotShowAllErrosOnSubmit) - return false; - names.push(field.attr('name')); - - //if option set, stop checking validation rules after one error is found - if(options.showOneMessage == true && errorFound){ - return false; - } - } - }); - - // second, check to see if all ajax calls completed ok - // errorFound |= !methods._checkAjaxStatus(options); - - // third, check status and scroll the container accordingly - form.trigger("jqv.form.result", [errorFound]); - - if (errorFound) { - if (options.scroll) { - var destination=first_err.offset().top; - var fixleft = first_err.offset().left; - - //prompt positioning adjustment support. Usage: positionType:Xshift,Yshift (for ex.: bottomLeft:+20 or bottomLeft:-20,+10) - var positionType=options.promptPosition; - if (typeof(positionType)=='string' && positionType.indexOf(":")!=-1) - positionType=positionType.substring(0,positionType.indexOf(":")); - - if (positionType!="bottomRight" && positionType!="bottomLeft") { - var prompt_err= methods._getPrompt(first_err); - if (prompt_err) { - destination=prompt_err.offset().top; - } - } - - // Offset the amount the page scrolls by an amount in px to accomodate fixed elements at top of page - if (options.scrollOffset) { - destination -= options.scrollOffset; - } - - // get the position of the first error, there should be at least one, no need to check this - //var destination = form.find(".formError:not('.greenPopup'):first").offset().top; - if (options.isOverflown) { - var overflowDIV = $(options.overflownDIV); - if(!overflowDIV.length) return false; - var scrollContainerScroll = overflowDIV.scrollTop(); - var scrollContainerPos = -parseInt(overflowDIV.offset().top); - - destination += scrollContainerScroll + scrollContainerPos - 5; - var scrollContainer = $(options.overflownDIV + ":not(:animated)"); - - scrollContainer.animate({ scrollTop: destination }, 1100, function(){ - if(options.focusFirstField) first_err.focus(); - }); - - } else { - $("html, body").animate({ - scrollTop: destination - }, 1100, function(){ - if(options.focusFirstField) first_err.focus(); - }); - $("html, body").animate({scrollLeft: fixleft},1100) - } - - } else if(options.focusFirstField) - first_err.focus(); - return false; - } - return true; - }, - /** - * This method is called to perform an ajax form validation. - * During this process all the (field, value) pairs are sent to the server which returns a list of invalid fields or true - * - * @param {jqObject} form - * @param {Map} options - */ - _validateFormWithAjax: function(form, options) { - - var data = form.serialize(); - var type = (options.ajaxFormValidationMethod) ? options.ajaxFormValidationMethod : "GET"; - var url = (options.ajaxFormValidationURL) ? options.ajaxFormValidationURL : form.attr("action"); - var dataType = (options.dataType) ? options.dataType : "json"; - $.ajax({ - type: type, - url: url, - cache: false, - dataType: dataType, - data: data, - form: form, - methods: methods, - options: options, - beforeSend: function() { - return options.onBeforeAjaxFormValidation(form, options); - }, - error: function(data, transport) { - methods._ajaxError(data, transport); - }, - success: function(json) { - if ((dataType == "json") && (json !== true)) { - // getting to this case doesn't necessary means that the form is invalid - // the server may return green or closing prompt actions - // this flag helps figuring it out - var errorInForm=false; - for (var i = 0; i < json.length; i++) { - var value = json[i]; - - var errorFieldId = value[0]; - var errorField = $($("#" + errorFieldId)[0]); - - // make sure we found the element - if (errorField.length == 1) { - - // promptText or selector - var msg = value[2]; - // if the field is valid - if (value[1] == true) { - - if (msg == "" || !msg){ - // if for some reason, status==true and error="", just close the prompt - methods._closePrompt(errorField); - } else { - // the field is valid, but we are displaying a green prompt - if (options.allrules[msg]) { - var txt = options.allrules[msg].alertTextOk; - if (txt) - msg = txt; - } - if (options.showPrompts) methods._showPrompt(errorField, msg, "pass", false, options, true); - } - } else { - // the field is invalid, show the red error prompt - errorInForm|=true; - if (options.allrules[msg]) { - var txt = options.allrules[msg].alertText; - if (txt) - msg = txt; - } - if(options.showPrompts) methods._showPrompt(errorField, msg, "", false, options, true); - } - } - } - options.onAjaxFormComplete(!errorInForm, form, json, options); - } else - options.onAjaxFormComplete(true, form, json, options); - - } - }); - - }, - /** - * Validates field, shows prompts accordingly - * - * @param {jqObject} - * field - * @param {Array[String]} - * field's validation rules - * @param {Map} - * user options - * @return false if field is valid (It is inversed for *fields*, it return false on validate and true on errors.) - */ - _validateField: function(field, options, skipAjaxValidation) { - if (!field.attr("id")) { - field.attr("id", "form-validation-field-" + $.validationEngine.fieldIdCounter); - ++$.validationEngine.fieldIdCounter; - } - - if (!options.validateNonVisibleFields && (field.is(":hidden") && !options.prettySelect || field.parent().is(":hidden"))) - return false; - - var rulesParsing = field.attr(options.validateAttribute); - var getRules = /validate\[(.*)\]/.exec(rulesParsing); - - if (!getRules) - return false; - var str = getRules[1]; - var rules = str.split(/\[|,|\]/); - - // true if we ran the ajax validation, tells the logic to stop messing with prompts - var isAjaxValidator = false; - var fieldName = field.attr("name"); - var promptText = ""; - var promptType = ""; - var required = false; - var limitErrors = false; - options.isError = false; - options.showArrow = true; - - // If the programmer wants to limit the amount of error messages per field, - if (options.maxErrorsPerField > 0) { - limitErrors = true; - } - - var form = $(field.closest("form, .validationEngineContainer")); - // Fix for adding spaces in the rules - for (var i = 0; i < rules.length; i++) { - rules[i] = rules[i].replace(" ", ""); - // Remove any parsing errors - if (rules[i] === '') { - delete rules[i]; - } - } - - for (var i = 0, field_errors = 0; i < rules.length; i++) { - - // If we are limiting errors, and have hit the max, break - if (limitErrors && field_errors >= options.maxErrorsPerField) { - // If we haven't hit a required yet, check to see if there is one in the validation rules for this - // field and that it's index is greater or equal to our current index - if (!required) { - var have_required = $.inArray('required', rules); - required = (have_required != -1 && have_required >= i); - } - break; - } - - - var errorMsg = undefined; - switch (rules[i]) { - - case "required": - required = true; - errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._required); - break; - case "custom": - errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._custom); - break; - case "groupRequired": - // Check is its the first of group, if not, reload validation with first field - // AND continue normal validation on present field - var classGroup = "["+options.validateAttribute+"*=" +rules[i + 1] +"]"; - var firstOfGroup = form.find(classGroup).eq(0); - if(firstOfGroup[0] != field[0]){ - - methods._validateField(firstOfGroup, options, skipAjaxValidation); - options.showArrow = true; - - } - errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._groupRequired); - if(errorMsg) required = true; - options.showArrow = false; - break; - case "ajax": - // AJAX defaults to returning it's loading message - errorMsg = methods._ajax(field, rules, i, options); - if (errorMsg) { - promptType = "load"; - } - break; - case "minSize": - errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._minSize); - break; - case "maxSize": - errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._maxSize); - break; - case "min": - errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._min); - break; - case "max": - errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._max); - break; - case "past": - errorMsg = methods._getErrorMessage(form, field,rules[i], rules, i, options, methods._past); - break; - case "future": - errorMsg = methods._getErrorMessage(form, field,rules[i], rules, i, options, methods._future); - break; - case "dateRange": - var classGroup = "["+options.validateAttribute+"*=" + rules[i + 1] + "]"; - options.firstOfGroup = form.find(classGroup).eq(0); - options.secondOfGroup = form.find(classGroup).eq(1); - - //if one entry out of the pair has value then proceed to run through validation - if (options.firstOfGroup[0].value || options.secondOfGroup[0].value) { - errorMsg = methods._getErrorMessage(form, field,rules[i], rules, i, options, methods._dateRange); - } - if (errorMsg) required = true; - options.showArrow = false; - break; - - case "dateTimeRange": - var classGroup = "["+options.validateAttribute+"*=" + rules[i + 1] + "]"; - options.firstOfGroup = form.find(classGroup).eq(0); - options.secondOfGroup = form.find(classGroup).eq(1); - - //if one entry out of the pair has value then proceed to run through validation - if (options.firstOfGroup[0].value || options.secondOfGroup[0].value) { - errorMsg = methods._getErrorMessage(form, field,rules[i], rules, i, options, methods._dateTimeRange); - } - if (errorMsg) required = true; - options.showArrow = false; - break; - case "maxCheckbox": - field = $(form.find("input[name='" + fieldName + "']")); - errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._maxCheckbox); - break; - case "minCheckbox": - field = $(form.find("input[name='" + fieldName + "']")); - errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._minCheckbox); - break; - case "equals": - errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._equals); - break; - case "funcCall": - errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._funcCall); - break; - case "creditCard": - errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._creditCard); - break; - case "condRequired": - errorMsg = methods._getErrorMessage(form, field, rules[i], rules, i, options, methods._condRequired); - if (errorMsg !== undefined) { - required = true; - } - break; - - default: - } - - var end_validation = false; - - // If we were passed back an message object, check what the status was to determine what to do - if (typeof errorMsg == "object") { - switch (errorMsg.status) { - case "_break": - end_validation = true; - break; - // If we have an error message, set errorMsg to the error message - case "_error": - errorMsg = errorMsg.message; - break; - // If we want to throw an error, but not show a prompt, return early with true - case "_error_no_prompt": - return true; - break; - // Anything else we continue on - default: - break; - } - } - - // If it has been specified that validation should end now, break - if (end_validation) { - break; - } - - // If we have a string, that means that we have an error, so add it to the error message. - if (typeof errorMsg == 'string') { - promptText += errorMsg + "
"; - options.isError = true; - field_errors++; - } - } - // If the rules required is not added, an empty field is not validated - if(!required && !(field.val()) && field.val().length < 1) options.isError = false; - - // Hack for radio/checkbox group button, the validation go into the - // first radio/checkbox of the group - var fieldType = field.prop("type"); - var positionType=field.data("promptPosition") || options.promptPosition; - - if ((fieldType == "radio" || fieldType == "checkbox") && form.find("input[name='" + fieldName + "']").size() > 1) { - if(positionType === 'inline') { - field = $(form.find("input[name='" + fieldName + "'][type!=hidden]:last")); - } else { - field = $(form.find("input[name='" + fieldName + "'][type!=hidden]:first")); - } - options.showArrow = false; - } - - if(field.is(":hidden") && options.prettySelect) { - field = form.find("#" + options.usePrefix + methods._jqSelector(field.attr('id')) + options.useSuffix); - } - - if (options.isError && options.showPrompts){ - methods._showPrompt(field, promptText, promptType, false, options); - }else{ - if (!isAjaxValidator) methods._closePrompt(field); - } - - if (!isAjaxValidator) { - field.trigger("jqv.field.result", [field, options.isError, promptText]); - } - - /* Record error */ - var errindex = $.inArray(field[0], options.InvalidFields); - if (errindex == -1) { - if (options.isError) - options.InvalidFields.push(field[0]); - } else if (!options.isError) { - options.InvalidFields.splice(errindex, 1); - } - - methods._handleStatusCssClasses(field, options); - - /* run callback function for each field */ - if (options.isError && options.onFieldFailure) - options.onFieldFailure(field); - - if (!options.isError && options.onFieldSuccess) - options.onFieldSuccess(field); - - return options.isError; - }, - /** - * Handling css classes of fields indicating result of validation - * - * @param {jqObject} - * field - * @param {Array[String]} - * field's validation rules - * @private - */ - _handleStatusCssClasses: function(field, options) { - /* remove all classes */ - if(options.addSuccessCssClassToField) - field.removeClass(options.addSuccessCssClassToField); - - if(options.addFailureCssClassToField) - field.removeClass(options.addFailureCssClassToField); - - /* Add classes */ - if (options.addSuccessCssClassToField && !options.isError) - field.addClass(options.addSuccessCssClassToField); - - if (options.addFailureCssClassToField && options.isError) - field.addClass(options.addFailureCssClassToField); - }, - - /******************** - * _getErrorMessage - * - * @param form - * @param field - * @param rule - * @param rules - * @param i - * @param options - * @param originalValidationMethod - * @return {*} - * @private - */ - _getErrorMessage:function (form, field, rule, rules, i, options, originalValidationMethod) { - // If we are using the custon validation type, build the index for the rule. - // Otherwise if we are doing a function call, make the call and return the object - // that is passed back. - var rule_index = jQuery.inArray(rule, rules); - if (rule === "custom" || rule === "funcCall") { - var custom_validation_type = rules[rule_index + 1]; - rule = rule + "[" + custom_validation_type + "]"; - // Delete the rule from the rules array so that it doesn't try to call the - // same rule over again - delete(rules[rule_index]); - } - // Change the rule to the composite rule, if it was different from the original - var alteredRule = rule; - - - var element_classes = (field.attr("data-validation-engine")) ? field.attr("data-validation-engine") : field.attr("class"); - var element_classes_array = element_classes.split(" "); - - // Call the original validation method. If we are dealing with dates or checkboxes, also pass the form - var errorMsg; - if (rule == "future" || rule == "past" || rule == "maxCheckbox" || rule == "minCheckbox") { - errorMsg = originalValidationMethod(form, field, rules, i, options); - } else { - errorMsg = originalValidationMethod(field, rules, i, options); - } - - // If the original validation method returned an error and we have a custom error message, - // return the custom message instead. Otherwise return the original error message. - if (errorMsg != undefined) { - var custom_message = methods._getCustomErrorMessage($(field), element_classes_array, alteredRule, options); - if (custom_message) errorMsg = custom_message; - } - return errorMsg; - - }, - _getCustomErrorMessage:function (field, classes, rule, options) { - var custom_message = false; - var validityProp = /^custom\[.*\]$/.test(rule) ? methods._validityProp["custom"] : methods._validityProp[rule]; - // If there is a validityProp for this rule, check to see if the field has an attribute for it - if (validityProp != undefined) { - custom_message = field.attr("data-errormessage-"+validityProp); - // If there was an error message for it, return the message - if (custom_message != undefined) - return custom_message; - } - custom_message = field.attr("data-errormessage"); - // If there is an inline custom error message, return it - if (custom_message != undefined) - return custom_message; - var id = '#' + field.attr("id"); - // If we have custom messages for the element's id, get the message for the rule from the id. - // Otherwise, if we have custom messages for the element's classes, use the first class message we find instead. - if (typeof options.custom_error_messages[id] != "undefined" && - typeof options.custom_error_messages[id][rule] != "undefined" ) { - custom_message = options.custom_error_messages[id][rule]['message']; - } else if (classes.length > 0) { - for (var i = 0; i < classes.length && classes.length > 0; i++) { - var element_class = "." + classes[i]; - if (typeof options.custom_error_messages[element_class] != "undefined" && - typeof options.custom_error_messages[element_class][rule] != "undefined") { - custom_message = options.custom_error_messages[element_class][rule]['message']; - break; - } - } - } - if (!custom_message && - typeof options.custom_error_messages[rule] != "undefined" && - typeof options.custom_error_messages[rule]['message'] != "undefined"){ - custom_message = options.custom_error_messages[rule]['message']; - } - return custom_message; - }, - _validityProp: { - "required": "value-missing", - "custom": "custom-error", - "groupRequired": "value-missing", - "ajax": "custom-error", - "minSize": "range-underflow", - "maxSize": "range-overflow", - "min": "range-underflow", - "max": "range-overflow", - "past": "type-mismatch", - "future": "type-mismatch", - "dateRange": "type-mismatch", - "dateTimeRange": "type-mismatch", - "maxCheckbox": "range-overflow", - "minCheckbox": "range-underflow", - "equals": "pattern-mismatch", - "funcCall": "custom-error", - "creditCard": "pattern-mismatch", - "condRequired": "value-missing" - }, - /** - * Required validation - * - * @param {jqObject} field - * @param {Array[String]} rules - * @param {int} i rules index - * @param {Map} - * user options - * @param {bool} condRequired flag when method is used for internal purpose in condRequired check - * @return an error string if validation failed - */ - _required: function(field, rules, i, options, condRequired) { - switch (field.prop("type")) { - case "text": - case "password": - case "textarea": - case "file": - case "select-one": - case "select-multiple": - default: - var field_val = $.trim( field.val() ); - var dv_placeholder = $.trim( field.attr("data-validation-placeholder") ); - var placeholder = $.trim( field.attr("placeholder") ); - if ( - ( !field_val ) - || ( dv_placeholder && field_val == dv_placeholder ) - || ( placeholder && field_val == placeholder ) - ) { - return options.allrules[rules[i]].alertText; - } - break; - case "radio": - case "checkbox": - // new validation style to only check dependent field - if (condRequired) { - if (!field.attr('checked')) { - return options.allrules[rules[i]].alertTextCheckboxMultiple; - } - break; - } - // old validation style - var form = field.closest("form, .validationEngineContainer"); - var name = field.attr("name"); - if (form.find("input[name='" + name + "']:checked").size() == 0) { - if (form.find("input[name='" + name + "']:visible").size() == 1) - return options.allrules[rules[i]].alertTextCheckboxe; - else - return options.allrules[rules[i]].alertTextCheckboxMultiple; - } - break; - } - }, - /** - * Validate that 1 from the group field is required - * - * @param {jqObject} field - * @param {Array[String]} rules - * @param {int} i rules index - * @param {Map} - * user options - * @return an error string if validation failed - */ - _groupRequired: function(field, rules, i, options) { - var classGroup = "["+options.validateAttribute+"*=" +rules[i + 1] +"]"; - var isValid = false; - // Check all fields from the group - field.closest("form, .validationEngineContainer").find(classGroup).each(function(){ - if(!methods._required($(this), rules, i, options)){ - isValid = true; - return false; - } - }); - - if(!isValid) { - return options.allrules[rules[i]].alertText; - } - }, - /** - * Validate rules - * - * @param {jqObject} field - * @param {Array[String]} rules - * @param {int} i rules index - * @param {Map} - * user options - * @return an error string if validation failed - */ - _custom: function(field, rules, i, options) { - var customRule = rules[i + 1]; - var rule = options.allrules[customRule]; - var fn; - if(!rule) { - alert("jqv:custom rule not found - "+customRule); - return; - } - - if(rule["regex"]) { - var ex=rule.regex; - if(!ex) { - alert("jqv:custom regex not found - "+customRule); - return; - } - var pattern = new RegExp(ex); - - if (!pattern.test(field.val())) return options.allrules[customRule].alertText; - - } else if(rule["func"]) { - fn = rule["func"]; - - if (typeof(fn) !== "function") { - alert("jqv:custom parameter 'function' is no function - "+customRule); - return; - } - - if (!fn(field, rules, i, options)) - return options.allrules[customRule].alertText; - } else { - alert("jqv:custom type not allowed "+customRule); - return; - } - }, - /** - * Validate custom function outside of the engine scope - * - * @param {jqObject} field - * @param {Array[String]} rules - * @param {int} i rules index - * @param {Map} - * user options - * @return an error string if validation failed - */ - _funcCall: function(field, rules, i, options) { - var functionName = rules[i + 1]; - var fn; - if(functionName.indexOf('.') >-1) - { - var namespaces = functionName.split('.'); - var scope = window; - while(namespaces.length) - { - scope = scope[namespaces.shift()]; - } - fn = scope; - } - else - fn = window[functionName] || options.customFunctions[functionName]; - if (typeof(fn) == 'function') - return fn(field, rules, i, options); - - }, - /** - * Field match - * - * @param {jqObject} field - * @param {Array[String]} rules - * @param {int} i rules index - * @param {Map} - * user options - * @return an error string if validation failed - */ - _equals: function(field, rules, i, options) { - var equalsField = rules[i + 1]; - - if (field.val() != $("#" + equalsField).val()) - return options.allrules.equals.alertText; - }, - /** - * Check the maximum size (in characters) - * - * @param {jqObject} field - * @param {Array[String]} rules - * @param {int} i rules index - * @param {Map} - * user options - * @return an error string if validation failed - */ - _maxSize: function(field, rules, i, options) { - var max = rules[i + 1]; - var len = field.val().length; - - if (len > max) { - var rule = options.allrules.maxSize; - return rule.alertText + max + rule.alertText2; - } - }, - /** - * Check the minimum size (in characters) - * - * @param {jqObject} field - * @param {Array[String]} rules - * @param {int} i rules index - * @param {Map} - * user options - * @return an error string if validation failed - */ - _minSize: function(field, rules, i, options) { - var min = rules[i + 1]; - var len = field.val().length; - - if (len < min) { - var rule = options.allrules.minSize; - return rule.alertText + min + rule.alertText2; - } - }, - /** - * Check number minimum value - * - * @param {jqObject} field - * @param {Array[String]} rules - * @param {int} i rules index - * @param {Map} - * user options - * @return an error string if validation failed - */ - _min: function(field, rules, i, options) { - var min = parseFloat(rules[i + 1]); - var len = parseFloat(field.val()); - - if (len < min) { - var rule = options.allrules.min; - if (rule.alertText2) return rule.alertText + min + rule.alertText2; - return rule.alertText + min; - } - }, - /** - * Check number maximum value - * - * @param {jqObject} field - * @param {Array[String]} rules - * @param {int} i rules index - * @param {Map} - * user options - * @return an error string if validation failed - */ - _max: function(field, rules, i, options) { - var max = parseFloat(rules[i + 1]); - var len = parseFloat(field.val()); - - if (len >max ) { - var rule = options.allrules.max; - if (rule.alertText2) return rule.alertText + max + rule.alertText2; - //orefalo: to review, also do the translations - return rule.alertText + max; - } - }, - /** - * Checks date is in the past - * - * @param {jqObject} field - * @param {Array[String]} rules - * @param {int} i rules index - * @param {Map} - * user options - * @return an error string if validation failed - */ - _past: function(form, field, rules, i, options) { - - var p=rules[i + 1]; - var fieldAlt = $(form.find("input[name='" + p.replace(/^#+/, '') + "']")); - var pdate; - - if (p.toLowerCase() == "now") { - pdate = new Date(); - } else if (undefined != fieldAlt.val()) { - if (fieldAlt.is(":disabled")) - return; - pdate = methods._parseDate(fieldAlt.val()); - } else { - pdate = methods._parseDate(p); - } - var vdate = methods._parseDate(field.val()); - - if (vdate > pdate ) { - var rule = options.allrules.past; - if (rule.alertText2) return rule.alertText + methods._dateToString(pdate) + rule.alertText2; - return rule.alertText + methods._dateToString(pdate); - } - }, - /** - * Checks date is in the future - * - * @param {jqObject} field - * @param {Array[String]} rules - * @param {int} i rules index - * @param {Map} - * user options - * @return an error string if validation failed - */ - _future: function(form, field, rules, i, options) { - - var p=rules[i + 1]; - var fieldAlt = $(form.find("input[name='" + p.replace(/^#+/, '') + "']")); - var pdate; - - if (p.toLowerCase() == "now") { - pdate = new Date(); - } else if (undefined != fieldAlt.val()) { - if (fieldAlt.is(":disabled")) - return; - pdate = methods._parseDate(fieldAlt.val()); - } else { - pdate = methods._parseDate(p); - } - var vdate = methods._parseDate(field.val()); - - if (vdate < pdate ) { - var rule = options.allrules.future; - if (rule.alertText2) - return rule.alertText + methods._dateToString(pdate) + rule.alertText2; - return rule.alertText + methods._dateToString(pdate); - } - }, - /** - * Checks if valid date - * - * @param {string} date string - * @return a bool based on determination of valid date - */ - _isDate: function (value) { - var dateRegEx = new RegExp(/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/); - return dateRegEx.test(value); - }, - /** - * Checks if valid date time - * - * @param {string} date string - * @return a bool based on determination of valid date time - */ - _isDateTime: function (value){ - var dateTimeRegEx = new RegExp(/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1}$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^((1[012]|0?[1-9]){1}\/(0?[1-9]|[12][0-9]|3[01]){1}\/\d{2,4}\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1})$/); - return dateTimeRegEx.test(value); - }, - //Checks if the start date is before the end date - //returns true if end is later than start - _dateCompare: function (start, end) { - return (new Date(start.toString()) < new Date(end.toString())); - }, - /** - * Checks date range - * - * @param {jqObject} first field name - * @param {jqObject} second field name - * @return an error string if validation failed - */ - _dateRange: function (field, rules, i, options) { - //are not both populated - if ((!options.firstOfGroup[0].value && options.secondOfGroup[0].value) || (options.firstOfGroup[0].value && !options.secondOfGroup[0].value)) { - return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; - } - - //are not both dates - if (!methods._isDate(options.firstOfGroup[0].value) || !methods._isDate(options.secondOfGroup[0].value)) { - return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; - } - - //are both dates but range is off - if (!methods._dateCompare(options.firstOfGroup[0].value, options.secondOfGroup[0].value)) { - return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; - } - }, - /** - * Checks date time range - * - * @param {jqObject} first field name - * @param {jqObject} second field name - * @return an error string if validation failed - */ - _dateTimeRange: function (field, rules, i, options) { - //are not both populated - if ((!options.firstOfGroup[0].value && options.secondOfGroup[0].value) || (options.firstOfGroup[0].value && !options.secondOfGroup[0].value)) { - return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; - } - //are not both dates - if (!methods._isDateTime(options.firstOfGroup[0].value) || !methods._isDateTime(options.secondOfGroup[0].value)) { - return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; - } - //are both dates but range is off - if (!methods._dateCompare(options.firstOfGroup[0].value, options.secondOfGroup[0].value)) { - return options.allrules[rules[i]].alertText + options.allrules[rules[i]].alertText2; - } - }, - /** - * Max number of checkbox selected - * - * @param {jqObject} field - * @param {Array[String]} rules - * @param {int} i rules index - * @param {Map} - * user options - * @return an error string if validation failed - */ - _maxCheckbox: function(form, field, rules, i, options) { - - var nbCheck = rules[i + 1]; - var groupname = field.attr("name"); - var groupSize = form.find("input[name='" + groupname + "']:checked").size(); - if (groupSize > nbCheck) { - options.showArrow = false; - if (options.allrules.maxCheckbox.alertText2) - return options.allrules.maxCheckbox.alertText + " " + nbCheck + " " + options.allrules.maxCheckbox.alertText2; - return options.allrules.maxCheckbox.alertText; - } - }, - /** - * Min number of checkbox selected - * - * @param {jqObject} field - * @param {Array[String]} rules - * @param {int} i rules index - * @param {Map} - * user options - * @return an error string if validation failed - */ - _minCheckbox: function(form, field, rules, i, options) { - - var nbCheck = rules[i + 1]; - var groupname = field.attr("name"); - var groupSize = form.find("input[name='" + groupname + "']:checked").size(); - if (groupSize < nbCheck) { - options.showArrow = false; - return options.allrules.minCheckbox.alertText + " " + nbCheck + " " + options.allrules.minCheckbox.alertText2; - } - }, - /** - * Checks that it is a valid credit card number according to the - * Luhn checksum algorithm. - * - * @param {jqObject} field - * @param {Array[String]} rules - * @param {int} i rules index - * @param {Map} - * user options - * @return an error string if validation failed - */ - _creditCard: function(field, rules, i, options) { - //spaces and dashes may be valid characters, but must be stripped to calculate the checksum. - var valid = false, cardNumber = field.val().replace(/ +/g, '').replace(/-+/g, ''); - - var numDigits = cardNumber.length; - if (numDigits >= 14 && numDigits <= 16 && parseInt(cardNumber) > 0) { - - var sum = 0, i = numDigits - 1, pos = 1, digit, luhn = new String(); - do { - digit = parseInt(cardNumber.charAt(i)); - luhn += (pos++ % 2 == 0) ? digit * 2 : digit; - } while (--i >= 0) - - for (i = 0; i < luhn.length; i++) { - sum += parseInt(luhn.charAt(i)); - } - valid = sum % 10 == 0; - } - if (!valid) return options.allrules.creditCard.alertText; - }, - /** - * Ajax field validation - * - * @param {jqObject} field - * @param {Array[String]} rules - * @param {int} i rules index - * @param {Map} - * user options - * @return nothing! the ajax validator handles the prompts itself - */ - _ajax: function(field, rules, i, options) { - - var errorSelector = rules[i + 1]; - var rule = options.allrules[errorSelector]; - var extraData = rule.extraData; - var extraDataDynamic = rule.extraDataDynamic; - var data = { - "fieldId" : field.attr("id"), - "fieldValue" : field.val() - }; - - if (typeof extraData === "object") { - $.extend(data, extraData); - } else if (typeof extraData === "string") { - var tempData = extraData.split("&"); - for(var i = 0; i < tempData.length; i++) { - var values = tempData[i].split("="); - if (values[0] && values[0]) { - data[values[0]] = values[1]; - } - } - } - - if (extraDataDynamic) { - var tmpData = []; - var domIds = String(extraDataDynamic).split(","); - for (var i = 0; i < domIds.length; i++) { - var id = domIds[i]; - if ($(id).length) { - var inputValue = field.closest("form, .validationEngineContainer").find(id).val(); - var keyValue = id.replace('#', '') + '=' + escape(inputValue); - data[id.replace('#', '')] = inputValue; - } - } - } - - // If a field change event triggered this we want to clear the cache for this ID - if (options.eventTrigger == "field") { - delete(options.ajaxValidCache[field.attr("id")]); - } - - // If there is an error or if the the field is already validated, do not re-execute AJAX - if (!options.isError && !methods._checkAjaxFieldStatus(field.attr("id"), options)) { - $.ajax({ - type: options.ajaxFormValidationMethod, - url: rule.url, - cache: false, - dataType: "json", - data: data, - field: field, - rule: rule, - methods: methods, - options: options, - beforeSend: function() {}, - error: function(data, transport) { - methods._ajaxError(data, transport); - }, - success: function(json) { - - // asynchronously called on success, data is the json answer from the server - var errorFieldId = json[0]; - //var errorField = $($("#" + errorFieldId)[0]); - var errorField = $("#"+ errorFieldId).eq(0); - - // make sure we found the element - if (errorField.length == 1) { - var status = json[1]; - // read the optional msg from the server - var msg = json[2]; - if (!status) { - // Houston we got a problem - display an red prompt - options.ajaxValidCache[errorFieldId] = false; - options.isError = true; - - // resolve the msg prompt - if(msg) { - if (options.allrules[msg]) { - var txt = options.allrules[msg].alertText; - if (txt) { - msg = txt; - } - } - } - else - msg = rule.alertText; - - if (options.showPrompts) methods._showPrompt(errorField, msg, "", true, options); - } else { - options.ajaxValidCache[errorFieldId] = true; - - // resolves the msg prompt - if(msg) { - if (options.allrules[msg]) { - var txt = options.allrules[msg].alertTextOk; - if (txt) { - msg = txt; - } - } - } - else - msg = rule.alertTextOk; - - if (options.showPrompts) { - // see if we should display a green prompt - if (msg) - methods._showPrompt(errorField, msg, "pass", true, options); - else - methods._closePrompt(errorField); - } - - // If a submit form triggered this, we want to re-submit the form - if (options.eventTrigger == "submit") - field.closest("form").submit(); - } - } - errorField.trigger("jqv.field.result", [errorField, options.isError, msg]); - } - }); - - return rule.alertTextLoad; - } - }, - /** - * Common method to handle ajax errors - * - * @param {Object} data - * @param {Object} transport - */ - _ajaxError: function(data, transport) { - if(data.status == 0 && transport == null) - alert("The page is not served from a server! ajax call failed"); - else if(typeof console != "undefined") - console.log("Ajax error: " + data.status + " " + transport); - }, - /** - * date -> string - * - * @param {Object} date - */ - _dateToString: function(date) { - return date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate(); - }, - /** - * Parses an ISO date - * @param {String} d - */ - _parseDate: function(d) { - - var dateParts = d.split("-"); - if(dateParts==d) - dateParts = d.split("/"); - if(dateParts==d) { - dateParts = d.split("."); - return new Date(dateParts[2], (dateParts[1] - 1), dateParts[0]); - } - return new Date(dateParts[0], (dateParts[1] - 1) ,dateParts[2]); - }, - /** - * Builds or updates a prompt with the given information - * - * @param {jqObject} field - * @param {String} promptText html text to display type - * @param {String} type the type of bubble: 'pass' (green), 'load' (black) anything else (red) - * @param {boolean} ajaxed - use to mark fields than being validated with ajax - * @param {Map} options user options - */ - _showPrompt: function(field, promptText, type, ajaxed, options, ajaxform) { - //Check if we need to adjust what element to show the prompt on - if(field.data('jqv-prompt-at') instanceof jQuery ){ - field = field.data('jqv-prompt-at'); - } else if(field.data('jqv-prompt-at')) { - field = $(field.data('jqv-prompt-at')); - } - - var prompt = methods._getPrompt(field); - // The ajax submit errors are not see has an error in the form, - // When the form errors are returned, the engine see 2 bubbles, but those are ebing closed by the engine at the same time - // Because no error was found befor submitting - if(ajaxform) prompt = false; - // Check that there is indded text - if($.trim(promptText)){ - if (prompt) - methods._updatePrompt(field, prompt, promptText, type, ajaxed, options); - else - methods._buildPrompt(field, promptText, type, ajaxed, options); - } - }, - /** - * Builds and shades a prompt for the given field. - * - * @param {jqObject} field - * @param {String} promptText html text to display type - * @param {String} type the type of bubble: 'pass' (green), 'load' (black) anything else (red) - * @param {boolean} ajaxed - use to mark fields than being validated with ajax - * @param {Map} options user options - */ - _buildPrompt: function(field, promptText, type, ajaxed, options) { - - // create the prompt - var prompt = $('
'); - prompt.addClass(methods._getClassName(field.attr("id")) + "formError"); - // add a class name to identify the parent form of the prompt - prompt.addClass("parentForm"+methods._getClassName(field.closest('form, .validationEngineContainer').attr("id"))); - prompt.addClass("formError"); - - switch (type) { - case "pass": - prompt.addClass("greenPopup"); - break; - case "load": - prompt.addClass("blackPopup"); - break; - default: - /* it has error */ - //alert("unknown popup type:"+type); - } - if (ajaxed) - prompt.addClass("ajaxed"); - - // create the prompt content - var promptContent = $('
').addClass("formErrorContent").html(promptText).appendTo(prompt); - - // determine position type - var positionType=field.data("promptPosition") || options.promptPosition; - - // create the css arrow pointing at the field - // note that there is no triangle on max-checkbox and radio - if (options.showArrow) { - var arrow = $('
').addClass("formErrorArrow"); - - //prompt positioning adjustment support. Usage: positionType:Xshift,Yshift (for ex.: bottomLeft:+20 or bottomLeft:-20,+10) - if (typeof(positionType)=='string') - { - var pos=positionType.indexOf(":"); - if(pos!=-1) - positionType=positionType.substring(0,pos); - } - - switch (positionType) { - case "bottomLeft": - case "bottomRight": - prompt.find(".formErrorContent").before(arrow); - arrow.addClass("formErrorArrowBottom").html('
'); - break; - case "topLeft": - case "topRight": - arrow.html('
'); - prompt.append(arrow); - break; - } - } - // Add custom prompt class - if (options.addPromptClass) - prompt.addClass(options.addPromptClass); - - // Add custom prompt class defined in element - var requiredOverride = field.attr('data-required-class'); - if(requiredOverride !== undefined) { - prompt.addClass(requiredOverride); - } else { - if(options.prettySelect) { - if($('#' + field.attr('id')).next().is('select')) { - var prettyOverrideClass = $('#' + field.attr('id').substr(options.usePrefix.length).substring(options.useSuffix.length)).attr('data-required-class'); - if(prettyOverrideClass !== undefined) { - prompt.addClass(prettyOverrideClass); - } - } - } - } - - prompt.css({ - "opacity": 0 - }); - if(positionType === 'inline') { - prompt.addClass("inline"); - if(typeof field.attr('data-prompt-target') !== 'undefined' && $('#'+field.attr('data-prompt-target')).length > 0) { - prompt.appendTo($('#'+field.attr('data-prompt-target'))); - } else { - field.after(prompt); - } - } else { - field.before(prompt); - } - - var pos = methods._calculatePosition(field, prompt, options); - prompt.css({ - 'position': positionType === 'inline' ? 'relative' : 'absolute', - "top": pos.callerTopPosition, - "left": pos.callerleftPosition, - "marginTop": pos.marginTopSize, - "opacity": 0 - }).data("callerField", field); - - - if (options.autoHidePrompt) { - setTimeout(function(){ - prompt.animate({ - "opacity": 0 - },function(){ - prompt.closest('.formErrorOuter').remove(); - prompt.remove(); - }); - }, options.autoHideDelay); - } - return prompt.animate({ - "opacity": 0.87 - }); - }, - /** - * Updates the prompt text field - the field for which the prompt - * @param {jqObject} field - * @param {String} promptText html text to display type - * @param {String} type the type of bubble: 'pass' (green), 'load' (black) anything else (red) - * @param {boolean} ajaxed - use to mark fields than being validated with ajax - * @param {Map} options user options - */ - _updatePrompt: function(field, prompt, promptText, type, ajaxed, options, noAnimation) { - - if (prompt) { - if (typeof type !== "undefined") { - if (type == "pass") - prompt.addClass("greenPopup"); - else - prompt.removeClass("greenPopup"); - - if (type == "load") - prompt.addClass("blackPopup"); - else - prompt.removeClass("blackPopup"); - } - if (ajaxed) - prompt.addClass("ajaxed"); - else - prompt.removeClass("ajaxed"); - - prompt.find(".formErrorContent").html(promptText); - - var pos = methods._calculatePosition(field, prompt, options); - var css = {"top": pos.callerTopPosition, - "left": pos.callerleftPosition, - "marginTop": pos.marginTopSize}; - - if (noAnimation) - prompt.css(css); - else - prompt.animate(css); - } - }, - /** - * Closes the prompt associated with the given field - * - * @param {jqObject} - * field - */ - _closePrompt: function(field) { - var prompt = methods._getPrompt(field); - if (prompt) - prompt.fadeTo("fast", 0, function() { - prompt.parent('.formErrorOuter').remove(); - prompt.remove(); - }); - }, - closePrompt: function(field) { - return methods._closePrompt(field); - }, - /** - * Returns the error prompt matching the field if any - * - * @param {jqObject} - * field - * @return undefined or the error prompt (jqObject) - */ - _getPrompt: function(field) { - var formId = $(field).closest('form, .validationEngineContainer').attr('id'); - var className = methods._getClassName(field.attr("id")) + "formError"; - var match = $("." + methods._escapeExpression(className) + '.parentForm' + methods._getClassName(formId))[0]; - if (match) - return $(match); - }, - /** - * Returns the escapade classname - * - * @param {selector} - * className - */ - _escapeExpression: function (selector) { - return selector.replace(/([#;&,\.\+\*\~':"\!\^$\[\]\(\)=>\|])/g, "\\$1"); - }, - /** - * returns true if we are in a RTLed document - * - * @param {jqObject} field - */ - isRTL: function(field) - { - var $document = $(document); - var $body = $('body'); - var rtl = - (field && field.hasClass('rtl')) || - (field && (field.attr('dir') || '').toLowerCase()==='rtl') || - $document.hasClass('rtl') || - ($document.attr('dir') || '').toLowerCase()==='rtl' || - $body.hasClass('rtl') || - ($body.attr('dir') || '').toLowerCase()==='rtl'; - return Boolean(rtl); - }, - /** - * Calculates prompt position - * - * @param {jqObject} - * field - * @param {jqObject} - * the prompt - * @param {Map} - * options - * @return positions - */ - _calculatePosition: function (field, promptElmt, options) { - - var promptTopPosition, promptleftPosition, marginTopSize; - var fieldWidth = field.width(); - var fieldLeft = field.position().left; - var fieldTop = field.position().top; - var fieldHeight = field.height(); - var promptHeight = promptElmt.height(); - - - // is the form contained in an overflown container? - promptTopPosition = promptleftPosition = 0; - // compensation for the arrow - marginTopSize = -promptHeight; - - - //prompt positioning adjustment support - //now you can adjust prompt position - //usage: positionType:Xshift,Yshift - //for example: - // bottomLeft:+20 means bottomLeft position shifted by 20 pixels right horizontally - // topRight:20, -15 means topRight position shifted by 20 pixels to right and 15 pixels to top - //You can use +pixels, - pixels. If no sign is provided than + is default. - var positionType=field.data("promptPosition") || options.promptPosition; - var shift1=""; - var shift2=""; - var shiftX=0; - var shiftY=0; - if (typeof(positionType)=='string') { - //do we have any position adjustments ? - if (positionType.indexOf(":")!=-1) { - shift1=positionType.substring(positionType.indexOf(":")+1); - positionType=positionType.substring(0,positionType.indexOf(":")); - - //if any advanced positioning will be needed (percents or something else) - parser should be added here - //for now we use simple parseInt() - - //do we have second parameter? - if (shift1.indexOf(",") !=-1) { - shift2=shift1.substring(shift1.indexOf(",") +1); - shift1=shift1.substring(0,shift1.indexOf(",")); - shiftY=parseInt(shift2); - if (isNaN(shiftY)) shiftY=0; - }; - - shiftX=parseInt(shift1); - if (isNaN(shift1)) shift1=0; - - }; - }; - - - switch (positionType) { - default: - case "topRight": - promptleftPosition += fieldLeft + fieldWidth - 30; - promptTopPosition += fieldTop; - break; - - case "topLeft": - promptTopPosition += fieldTop; - promptleftPosition += fieldLeft; - break; - - case "centerRight": - promptTopPosition = fieldTop+4; - marginTopSize = 0; - promptleftPosition= fieldLeft + field.outerWidth(true)+5; - break; - case "centerLeft": - promptleftPosition = fieldLeft - (promptElmt.width() + 2); - promptTopPosition = fieldTop+4; - marginTopSize = 0; - - break; - - case "bottomLeft": - promptTopPosition = fieldTop + field.height() + 5; - marginTopSize = 0; - promptleftPosition = fieldLeft; - break; - case "bottomRight": - promptleftPosition = fieldLeft + fieldWidth - 30; - promptTopPosition = fieldTop + field.height() + 5; - marginTopSize = 0; - break; - case "inline": - promptleftPosition = 0; - promptTopPosition = 0; - marginTopSize = 0; - }; - - - - //apply adjusments if any - promptleftPosition += shiftX; - promptTopPosition += shiftY; - - return { - "callerTopPosition": promptTopPosition + "px", - "callerleftPosition": promptleftPosition + "px", - "marginTopSize": marginTopSize + "px" - }; - }, - /** - * Saves the user options and variables in the form.data - * - * @param {jqObject} - * form - the form where the user option should be saved - * @param {Map} - * options - the user options - * @return the user options (extended from the defaults) - */ - _saveOptions: function(form, options) { - - // is there a language localisation ? - if ($.validationEngineLanguage) - var allRules = $.validationEngineLanguage.allRules; - else - $.error("jQuery.validationEngine rules are not loaded, plz add localization files to the page"); - // --- Internals DO NOT TOUCH or OVERLOAD --- - // validation rules and i18 - $.validationEngine.defaults.allrules = allRules; - - var userOptions = $.extend(true,{},$.validationEngine.defaults,options); - - form.data('jqv', userOptions); - return userOptions; - }, - - /** - * Removes forbidden characters from class name - * @param {String} className - */ - _getClassName: function(className) { - if(className) - return className.replace(/:/g, "_").replace(/\./g, "_"); - }, - /** - * Escape special character for jQuery selector - * http://totaldev.com/content/escaping-characters-get-valid-jquery-id - * @param {String} selector - */ - _jqSelector: function(str){ - return str.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1'); - }, - /** - * Conditionally required field - * - * @param {jqObject} field - * @param {Array[String]} rules - * @param {int} i rules index - * @param {Map} - * user options - * @return an error string if validation failed - */ - _condRequired: function(field, rules, i, options) { - var idx, dependingField; - - for(idx = (i + 1); idx < rules.length; idx++) { - dependingField = jQuery("#" + rules[idx]).first(); - - /* Use _required for determining wether dependingField has a value. - * There is logic there for handling all field types, and default value; so we won't replicate that here - * Indicate this special use by setting the last parameter to true so we only validate the dependingField on chackboxes and radio buttons (#462) - */ - if (dependingField.length && methods._required(dependingField, ["required"], 0, options, true) == undefined) { - /* We now know any of the depending fields has a value, - * so we can validate this field as per normal required code - */ - return methods._required(field, ["required"], 0, options); - } - } - }, - - _submitButtonClick: function(event) { - var button = $(this); - var form = button.closest('form, .validationEngineContainer'); - form.data("jqv_submitButton", button.attr("id")); - } - }; - - /** - * Plugin entry point. - * You may pass an action as a parameter or a list of options. - * if none, the init and attach methods are being called. - * Remember: if you pass options, the attached method is NOT called automatically - * - * @param {String} - * method (optional) action - */ - $.fn.validationEngine = function(method) { - - var form = $(this); - if(!form[0]) return form; // stop here if the form does not exist - - if (typeof(method) == 'string' && method.charAt(0) != '_' && methods[method]) { - - // make sure init is called once - if(method != "showPrompt" && method != "hide" && method != "hideAll") - methods.init.apply(form); - - return methods[method].apply(form, Array.prototype.slice.call(arguments, 1)); - } else if (typeof method == 'object' || !method) { - - // default constructor with or without arguments - methods.init.apply(form, arguments); - return methods.attach.apply(form); - } else { - $.error('Method ' + method + ' does not exist in jQuery.validationEngine'); - } - }; - - - - // LEAK GLOBAL OPTIONS - $.validationEngine= {fieldIdCounter: 0,defaults:{ - - // Name of the event triggering field validation - validationEventTrigger: "blur", - // Automatically scroll viewport to the first error - scroll: true, - // Focus on the first input - focusFirstField:true, - // Show prompts, set to false to disable prompts - showPrompts: true, - // Should we attempt to validate non-visible input fields contained in the form? (Useful in cases of tabbed containers, e.g. jQuery-UI tabs) - validateNonVisibleFields: false, - // Opening box position, possible locations are: topLeft, - // topRight, bottomLeft, centerRight, bottomRight, inline - // inline gets inserted after the validated field or into an element specified in data-prompt-target - promptPosition: "topRight", - bindMethod:"bind", - // internal, automatically set to true when it parse a _ajax rule - inlineAjax: false, - // if set to true, the form data is sent asynchronously via ajax to the form.action url (get) - ajaxFormValidation: false, - // The url to send the submit ajax validation (default to action) - ajaxFormValidationURL: false, - // HTTP method used for ajax validation - ajaxFormValidationMethod: 'get', - // Ajax form validation callback method: boolean onComplete(form, status, errors, options) - // retuns false if the form.submit event needs to be canceled. - onAjaxFormComplete: $.noop, - // called right before the ajax call, may return false to cancel - onBeforeAjaxFormValidation: $.noop, - // Stops form from submitting and execute function assiciated with it - onValidationComplete: false, - - // Used when you have a form fields too close and the errors messages are on top of other disturbing viewing messages - doNotShowAllErrosOnSubmit: false, - // Object where you store custom messages to override the default error messages - custom_error_messages:{}, - // true if you want to vind the input fields - binded: true, - // set to true, when the prompt arrow needs to be displayed - showArrow: true, - // did one of the validation fail ? kept global to stop further ajax validations - isError: false, - // Limit how many displayed errors a field can have - maxErrorsPerField: false, - - // Caches field validation status, typically only bad status are created. - // the array is used during ajax form validation to detect issues early and prevent an expensive submit - ajaxValidCache: {}, - // Auto update prompt position after window resize - autoPositionUpdate: false, - - InvalidFields: [], - onFieldSuccess: false, - onFieldFailure: false, - onSuccess: false, - onFailure: false, - validateAttribute: "class", - addSuccessCssClassToField: "", - addFailureCssClassToField: "", - - // Auto-hide prompt - autoHidePrompt: false, - // Delay before auto-hide - autoHideDelay: 10000, - // Fade out duration while hiding the validations - fadeDuration: 0.3, - // Use Prettify select library - prettySelect: false, - // Add css class on prompt - addPromptClass : "", - // Custom ID uses prefix - usePrefix: "", - // Custom ID uses suffix - useSuffix: "", - // Only show one message per error prompt - showOneMessage: false - }}; - $(function(){$.validationEngine.defaults.promptPosition = methods.isRTL()?'topLeft':"topRight"}); -})(jQuery); - - diff --git a/WebRoot/js/kindeditor/kindeditor-min.js b/WebRoot/js/kindeditor/kindeditor-min.js new file mode 100644 index 0000000..842584a --- /dev/null +++ b/WebRoot/js/kindeditor/kindeditor-min.js @@ -0,0 +1,173 @@ +/* KindEditor 4.0.6 (2012-03-18), Copyright (C) kindsoft.net, Licence: http://www.kindsoft.net/license.php */(function(z,j){function ba(a){if(!a)return!1;return Object.prototype.toString.call(a)==="[object Array]"}function $a(a){if(!a)return!1;return Object.prototype.toString.call(a)==="[object Function]"}function L(a,b){for(var c=0,d=b.length;c=0}function p(a){return a&&/^\d+$/.test(a)?a+"px":a}function t(a){var b;return a&&(b=/(\d+)/.exec(a))?parseInt(b[1],10):0}function B(a){return a.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function ab(a){return a.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function ca(a){var b=a.split("-"),a="";m(b,function(b,d){a+=b>0?d.charAt(0).toUpperCase()+d.substr(1): +d});return a}function na(a){function b(a){a=parseInt(a,10).toString(16).toUpperCase();return a.length>1?a:"0"+a}return a.replace(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/ig,function(a,d,e,g){return"#"+b(d)+b(e)+b(g)})}function u(a,b){var b=b===j?",":b,c={},d=ba(a)?a:a.split(b),e;m(d,function(a,b){if(e=/^(\d+)\.\.(\d+)$/.exec(b))for(var d=parseInt(e[1],10);d<=parseInt(e[2],10);d++)c[d.toString()]=!0;else c[b]=!0});return c}function Ea(a,b){return Array.prototype.slice.call(a,b||0)}function l(a, +b){return a===j?b:a}function D(a,b,c){c||(c=b,b=null);var d;if(b){var e=function(){};e.prototype=b.prototype;d=new e;m(c,function(a,b){d[a]=b})}else d=c;d.constructor=a;a.prototype=d;a.parent=b?b.prototype:null}function bb(a){var b;if(b=/\{[\s\S]*\}|\[[\s\S]*\]/.exec(a))a=b[0];b=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;b.lastIndex=0;b.test(a)&&(a=a.replace(b,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})); +if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return eval("("+a+")");throw"JSON parse error";}function Ob(a,b,c){a.addEventListener?a.addEventListener(b,c,cb):a.attachEvent&&a.attachEvent("on"+b,c)}function oa(a,b,c){a.removeEventListener?a.removeEventListener(b,c,cb):a.detachEvent&&a.detachEvent("on"+b,c)}function db(a,b){this.init(a,b)}function eb(a){try{delete a[V]}catch(b){a.removeAttribute&& +a.removeAttribute(V)}}function W(a,b,c){if(b.indexOf(",")>=0)m(b.split(","),function(){W(a,this,c)});else{var d=a[V]||null;d||(a[V]=++fb,d=fb);q[d]===j&&(q[d]={});var e=q[d][b];e&&e.length>0?oa(a,b,e[0]):(q[d][b]=[],q[d].el=a);e=q[d][b];e.length===0&&(e[0]=function(b){var c=b?new db(a,b):j;m(e,function(b,d){b>0&&d&&d.call(a,c)})});L(c,e)<0&&e.push(c);Ob(a,b,e[0])}}function da(a,b,c){if(b&&b.indexOf(",")>=0)m(b.split(","),function(){da(a,this,c)});else{var d=a[V]||null;if(d)if(b===j)d in q&&(m(q[d], +function(b,c){b!="el"&&c.length>0&&oa(a,b,c[0])}),delete q[d],eb(a));else if(q[d]){var e=q[d][b];if(e&&e.length>0){c===j?(oa(a,b,e[0]),delete q[d][b]):(m(e,function(a,b){a>0&&b===c&&e.splice(a,1)}),e.length==1&&(oa(a,b,e[0]),delete q[d][b]));var g=0;m(q[d],function(){g++});g<2&&(delete q[d],eb(a))}}}}function gb(a,b){if(b.indexOf(",")>=0)m(b.split(","),function(){gb(a,this)});else{var c=a[V]||null;if(c){var d=q[c][b];if(q[c]&&d&&d.length>0)d[0]()}}}function Fa(a,b,c){b=/^\d{2,}$/.test(b)?b:b.toUpperCase().charCodeAt(0); +W(a,"keydown",function(d){d.ctrlKey&&d.which==b&&!d.shiftKey&&!d.altKey&&(c.call(a),d.stop())})}function ea(a){for(var b={},c=/\s*([\w\-]+)\s*:([^;]*)(;|$)/g,d;d=c.exec(a);){var e=A(d[1].toLowerCase());d=A(na(d[2]));b[e]=d}return b}function J(a){for(var b={},c=/\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g,d;d=c.exec(a);){var e=(d[1]||d[2]||d[4]||d[6]).toLowerCase();b[e]=(d[2]?d[3]:d[4]?d[5]:d[7])||""}return b}function Pb(a,b){return a= +/\s+class\s*=/.test(a)?a.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/,function(a,d,e,g){return(" "+e+" ").indexOf(" "+b+" ")<0?e===""?d+b+g:d+e+" "+b+g:a}):a.substr(0,a.length-1)+' class="'+b+'">'}function Qb(a){var b="";m(ea(a),function(a,d){b+=a+":"+d+";"});return b}function pa(a,b,c,d){function e(a){for(var a=a.split("/"),b=[],c=0,d=a.length;c0&&b.pop():e!==""&&e!="."&&b.push(e)}return"/"+b.join("/")}function g(b,c){if(a.substr(0,b.length)===b){for(var e=[], +h=0;h0&&(h+="/"+e.join("/"));d=="/"&&(h+="/");return h+a.substr(b.length)}else if(f=/^(.*)\//.exec(b))return g(f[1],++c)}b=l(b,"").toLowerCase();if(L(b,["absolute","relative","domain"])<0)return a;c=c||location.protocol+"//"+location.host;if(d===j)var h=location.pathname.match(/^(\/.*)\//),d=h?h[1]:"";var f;if(f=/^(\w+:\/\/[^\/]*)/.exec(a)){if(f[1]!==c)return a}else if(/^\w+:/.test(a))return a;/^\//.test(a)?a=c+e(a.substr(1)):/^\w+:\/\//.test(a)||(a=c+e(d+"/"+a)); +b==="relative"?a=g(c+d,0).substr(2):b==="absolute"&&a.substr(0,c.length)===c&&(a=a.substr(c.length));return a}function Q(a,b,c,d,e){var c=c||"",d=l(d,!1),e=l(e,"\t"),g="xx-small,x-small,small,medium,large,x-large,xx-large".split(","),a=a.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig,function(a,b,c,d){return b+c.replace(/<(?:br|br\s[^>]*)>/ig,"\n")+d}),a=a.replace(/<(?:br|br\s[^>]*)\s*\/?>\s*<\/p>/ig,"

"),a=a.replace(/(<(?:p|p\s[^>]*)>)\s*(<\/p>)/ig,"$1
$2"),a=a.replace(/\u200B/g,""), +h={};b&&(m(b,function(a,b){for(var c=a.split(","),d=0,e=c.length;d]*)>)([\s\S]*?)(<\/script>)/ig,"")),h.style||(a=a.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/ig,"")));var f=[],a=a.replace(/(\s*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>(\s*)/g,function(a,n,s,r,qa,C,E){var n=n||"",s=s||"",j=r.toLowerCase(),l=qa||"",r=C?" "+C:"",E=E|| +"";if(b&&!h[j])return"";r===""&&hb[j]&&(r=" /");ib[j]&&(n&&(n=" "),E&&(E=" "));Ga[j]&&(s?E="\n":n="\n");d&&j=="br"&&(E="\n");if(jb[j]&&!Ga[j])if(d){s&&f.length>0&&f[f.length-1]===j?f.pop():f.push(j);E=n="\n";qa=0;for(C=s?f.length:f.length-1;qa=0&&(w[a]=pa(d,c));(b&&a!=="style"&&!h[j]["*"]&&!h[j][a]||j==="body"&&a==="contenteditable"||/^kindeditor_\d+$/.test(a))&&delete w[a];if(a==="style"&&d!==""){var e=ea(d);m(e,function(a){b&&!h[j].style&&!h[j]["."+a]&&delete e[a]});var g="";m(e,function(a,b){g+=a+":"+b+";"});w.style=g}});l="";m(w,function(a, +b){a==="style"&&b===""||(b=b.replace(/"/g,"""),l+=" "+a+'="'+b+'"')})}j==="font"&&(j="span");return n+"<"+s+j+l+r+">"+E}),a=a.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig,function(a,b,c,d){return b+c.replace(/\n/g,'\n')+d}),a=a.replace(/\n\s*\n/g,"\n"),a=a.replace(/\n/g,"\n");return A(a)}function kb(a,b){a=a.replace(//ig,"").replace(//ig,"").replace(/]*>[\s\S]*?<\/style>/ig, +"").replace(/]*>[\s\S]*?<\/script>/ig,"").replace(/]+>[\s\S]*?<\/w:[^>]+>/ig,"").replace(/]+>[\s\S]*?<\/o:[^>]+>/ig,"").replace(/[\s\S]*?<\/xml>/ig,"").replace(/<(?:table|td)[^>]*>/ig,function(a){return a.replace(/border-bottom:([#\w\s]+)/ig,"border:$1")});return Q(a,b)}function lb(a){if(/\.(rm|rmvb)(\?|$)/i.test(a))return"audio/x-pn-realaudio-plugin";if(/\.(swf|flv)(\?|$)/i.test(a))return"application/x-shockwave-flash";return"video/x-ms-asf-plugin"}function mb(a){return J(unescape(a))} +function Ha(a){var b="0&&(h+="width:"+c+"px;");d>0&&(h+="height:"+d+"px;");c=/realaudio/i.test(e)?"ke-rm":/flash/i.test(e)?"ke-flash":"ke-media";c='';return c}function ta(a,b){if(a.nodeType==9&&b.nodeType!=9)return!0;for(;b=b.parentNode;)if(b==a)return!0;return!1} +function ua(a,b){var b=b.toLowerCase(),c=null;if(!Sb&&a.nodeName.toLowerCase()!="script"){var d=a.ownerDocument.createElement("div");d.appendChild(a.cloneNode(!1));d=J(ab(d.innerHTML));b in d&&(c=d[b])}else try{c=a.getAttribute(b,2)}catch(e){c=a.getAttribute(b,1)}b==="style"&&c!==null&&(c=Qb(c));return c}function va(a,b){function c(a){if(typeof a!="string")return a;return a.replace(/([^\w\-])/g,"\\$1")}function d(a,b){return a==="*"||a.toLowerCase()===c(b.toLowerCase())}function e(a,b,c){var e=[]; +(a=(c.ownerDocument||c).getElementById(a.replace(/\\/g,"")))&&d(b,a.nodeName)&&ta(c,a)&&e.push(a);return e}function g(a,b,c){var e=c.ownerDocument||c,g=[],h,f,i;if(c.getElementsByClassName){e=c.getElementsByClassName(a.replace(/\\/g,""));h=0;for(f=e.length;h-1&&g.push(i)}return g}function h(a,b,d,e){for(var g=[],d=e.getElementsByTagName(d),h=0,f=d.length;h])+)/.exec(a))?i[1]:"*";if(i=/#((?:[\w\-]|\\.)+)$/.exec(a))c=e(i[1],k,b);else if(i=/\.((?:[\w\-]|\\.)+)$/.exec(a))c=g(i[1],k,b);else if(i=/\[((?:[\w\-]|\\.)+)\]/.exec(a))c= +h(i[1].toLowerCase(),null,k,b);else if(i=/\[((?:[\w\-]|\\.)+)\s*=\s*['"]?((?:\\.|[^'"]+)+)['"]?\]/.exec(a)){c=i[1].toLowerCase();i=i[2];if(c==="id")k=e(i,k,b);else if(c==="class")k=g(i,k,b);else if(c==="name"){c=[];i=(b.ownerDocument||b).getElementsByName(i.replace(/\\/g,""));for(var n,r=0,s=i.length;r1){var n=[];m(k,function(){m(va(this,b),function(){L(this,n)<0&&n.push(this)})});return n}for(var b=b||document,k=[],s,r=/((?:\\.|[^\s>])+|[\s>])/g;s=r.exec(a);)s[1]!==" "&&k.push(s[1]);s=[];if(k.length==1)return f(k[0],b);var r=!1,j,C,l,o,ra,w,sa,H,p,t;w=0;for(lenth=k.length;w")r=!0;else{if(w>0){C=[];sa=0;for(p=s.length;sa
').css("background-color",b)):a.html(d.options.noColor);f(a).attr("unselectable","on");d._cells.push(a)},remove:function(){m(this._cells,function(){this.unbind()});za.parent.remove.call(this);return this}});f.colorpicker=Bb;D(Cb,{init:function(a){var b=f(a.button),c=a.fieldName||"file",d=a.url|| +"",e=b.val(),g=b[0].className||"",h="kindeditor_upload_iframe_"+(new Date).getTime();a.afterError=a.afterError||function(a){alert(a)};c=['
','','
','','',"",'',"
"].join("");c=f(c,b.doc);b.hide();b.before(c);this.div=c;this.button=b;this.iframe=f("iframe",c);this.form=f("form",c);b=a.width||f(".ke-button-common",c).width();this.fileBox=f(".ke-upload-file",c).width(b);this.options=a},submit:function(){var a=this,b=a.iframe;b.bind("load",function(){b.unbind();var c=document.createElement("form");a.fileBox.before(c);f(c).append(a.fileBox);c.reset();f(c).remove(!0);var c=f.iframeDoc(b),d=c.getElementsByTagName("pre")[0],e= +"",g,e=d?d.innerHTML:c.body.innerHTML;b[0].src="javascript:false";try{g=f.json(e)}catch(h){a.options.afterError.call(a,""+c.body.parentNode.innerHTML+"")}g&&a.options.afterUpload.call(a,g)});a.form[0].submit();return a},remove:function(){this.fileBox&&this.fileBox.unbind();this.iframe.remove();this.div.remove();this.button.show();return this}});f.uploadbutton=function(a){return new Cb(a)};D(Aa,P,{init:function(a){var b=l(a.shadowMode,!0);a.z=a.z||811213;a.shadowMode=!1; +Aa.parent.init.call(this,a);var c=a.title,d=f(a.body,this.doc),e=a.previewBtn,g=a.yesBtn,h=a.noBtn,i=a.closeBtn,k=l(a.showMask,!0);this.div.addClass("ke-dialog").bind("click,mousedown",function(a){a.stopPropagation()});var n=f('
').appendTo(this.div);o&&F<7?this.iframeMask=f('').appendTo(this.div):b&&f('
').appendTo(this.div);b=f('
'); +n.append(b);b.html(c);this.closeIcon=f('').click(i.click);b.append(this.closeIcon);this.draggable({clickEl:b,beforeDrag:a.beforeDrag});a=f('
');n.append(a);a.append(d);var j=f('');(e||g||h)&&n.append(j);m([{btn:e,name:"preview"},{btn:g,name:"yes"},{btn:h,name:"no"}],function(){if(this.btn){var a=this.btn,a=a||{},b=a.name||"",c=f(''),b=f('');a.click&&b.click(a.click);c.append(b);c.addClass("ke-dialog-"+this.name);j.append(c)}});this.height&&a.height(t(this.height)-b.height()-j.height());this.div.width(this.div.width());this.div.height(this.div.height());this.mask=null;if(k)d=I(this.doc),this.mask=Ta({x:0,y:0,z:this.z-1,cls:"ke-dialog-mask",width:Math.max(d.scrollWidth,d.clientWidth),height:Math.max(d.scrollHeight,d.clientHeight)});this.autoPos(this.div.width(), +this.div.height());this.footerDiv=j;this.bodyDiv=a;this.headerDiv=b},setMaskIndex:function(a){this.mask.div.css("z-index",a)},showLoading:function(a){var a=l(a,""),b=this.bodyDiv;this.loading=f('
'+a+"
").width(b.width()).height(b.height()).css("top",this.headerDiv.height()+"px");b.css("visibility","hidden").after(this.loading);return this},hideLoading:function(){this.loading&& +this.loading.remove();this.bodyDiv.css("visibility","visible");return this},remove:function(){this.options.beforeRemove&&this.options.beforeRemove.call(this);this.mask&&this.mask.remove();this.iframeMask&&this.iframeMask.remove();this.closeIcon.unbind();f("input",this.div).unbind();f("button",this.div).unbind();this.footerDiv.unbind();this.bodyDiv.unbind();this.headerDiv.unbind();f("iframe",this.div).each(function(){f(this).remove()});Aa.parent.remove.call(this);return this}});f.dialog=Db;f.tabs= +function(a){var b=Ta(a),c=b.remove,d=a.afterSelect,a=b.div,e=[];a.addClass("ke-tabs").bind("contextmenu,mousedown,mousemove",function(a){a.preventDefault()});var g=f('
    ');a.append(g);b.add=function(a){var b=f('
  • '+a.title+"
  • ");b.data("tab",a);e.push(b);g.append(b)};b.selectedIndex=0;b.select=function(a){b.selectedIndex=a;m(e,function(c,d){d.unbind();c===a?(d.addClass("ke-tabs-li-selected"),f(d.data("tab").panel).show("")):(d.removeClass("ke-tabs-li-selected").removeClass("ke-tabs-li-on").mouseover(function(){f(this).addClass("ke-tabs-li-on")}).mouseout(function(){f(this).removeClass("ke-tabs-li-on")}).click(function(){b.select(c)}), +f(d.data("tab").panel).hide())});d&&d.call(b,a)};b.remove=function(){m(e,function(){this.remove()});g.remove();c.call(b)};return b};f.loadScript=Wa;f.loadStyle=Xa;f.ajax=function(a,b,c,d,e){var c=c||"GET",e=e||"json",g=z.XMLHttpRequest?new z.XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");g.open(c,a,!0);g.onreadystatechange=function(){if(g.readyState==4&&g.status==200&&b){var a=A(g.responseText);e=="json"&&(a=bb(a));b(a)}};if(c=="POST"){var f=[];m(d,function(a,b){f.push(encodeURIComponent(a)+ +"="+encodeURIComponent(b))});try{g.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}catch(i){}g.send(f.join("&"))}else g.send(null)};var T={},K={};la.prototype={lang:function(a){return Hb(a,this.langType)},loadPlugin:function(a,b){var c=this;if(T[a]){if(c._calledPlugins[a])return b&&b.call(c),c;T[a].call(c,KindEditor);b&&b.call(c);c._calledPlugins[a]=!0;return c}if(c.isLoading)return c;c.isLoading=!0;Wa(c.pluginsPath+a+"/"+a+".js?ver="+encodeURIComponent(f.DEBUG?Ca:"4.0.6 (2012-03-18)"), +function(){c.isLoading=!1;T[a]&&c.loadPlugin(a,b)});return c},handler:function(a,b){var c=this;c._handlers[a]||(c._handlers[a]=[]);if($a(b))return c._handlers[a].push(b),c;m(c._handlers[a],function(){b=this.call(c,b)});return b},clickToolbar:function(a,b){var c=this,d="clickToolbar"+a;if(b===j){if(c._handlers[d])return c.handler(d);c.loadPlugin(a,function(){c.handler(d)});return c}return c.handler(d,b)},updateState:function(){var a=this;m("justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,subscript,superscript,bold,italic,underline,strikethrough".split(","), +function(b,c){a.cmd.state(c)?a.toolbar.select(c):a.toolbar.unselect(c)});return a},addContextmenu:function(a){this._contextmenus.push(a);return this},afterCreate:function(a){return this.handler("afterCreate",a)},beforeRemove:function(a){return this.handler("beforeRemove",a)},beforeGetHtml:function(a){return this.handler("beforeGetHtml",a)},beforeSetHtml:function(a){return this.handler("beforeSetHtml",a)},afterSetHtml:function(a){return this.handler("afterSetHtml",a)},create:function(){function a(){j.height()=== +0?setTimeout(a,100):c.resize(e,g)}function b(a,b,d){d=l(d,!0);if(a&&a>=c.minWidth&&(c.resize(a,null),d))c.width=p(a);if(b&&b>=c.minHeight&&(c.resize(null,b),d))c.height=p(b)}var c=this,d=c.fullscreenMode;if(c.isCreated)return c;d?I().style.overflow="hidden":I().style.overflow="";var e=d?I().clientWidth+"px":c.width,g=d?I().clientHeight+"px":c.height;if(o&&F<8||S)g=p(t(g)+2);var h=c.container=f(c.layout);d?f(document.body).append(h):c.srcElement.before(h);var i=f(".toolbar",h),k=f(".edit",h),j=c.statusbar= +f(".statusbar",h);h.removeClass("container").addClass("ke-container ke-container-"+c.themeType).css("width",e);if(d){h.css({position:"absolute",left:0,top:0,"z-index":811211});if(!ka)c._scrollPos=Y();z.scrollTo(0,0);f(document.body).css({height:"1px",overflow:"hidden"});f(document.body.parentNode).css("overflow","hidden");c._fullscreenExecuted=!0}else c._fullscreenExecuted&&(f(document.body).css({height:"",overflow:""}),f(document.body.parentNode).css("overflow","")),c._scrollPos&&z.scrollTo(c._scrollPos.x, +c._scrollPos.y);var m=[];f.each(c.items,function(a,b){b=="|"?m.push(''):b=="/"?m.push('
    '):(m.push(''),m.push(''))});var i=c.toolbar=Ab({src:i,html:m.join(""),noDisableItems:c.noDisableItems,click:function(a,b){a.stop();if(c.menu){var d=c.menu.name; +c.hideMenu();if(d===b)return}c.clickToolbar(b)}}),r=t(g)-i.div.height(),q=c.edit=yb({height:r>0&&t(g)>c.minHeight?r:c.minHeight,src:k,srcElement:c.srcElement,designMode:c.designMode,themesPath:c.themesPath,bodyClass:c.bodyClass,cssPath:c.cssPath,cssData:c.cssData,beforeGetHtml:function(a){a=c.beforeGetHtml(a);return Q(a,c.filterMode?c.htmlTags:null,c.urlType,c.wellFormatMode,c.indentChar)},beforeSetHtml:function(a){a=Q(a,c.filterMode?c.htmlTags:null,"",!1);return c.beforeSetHtml(a)},afterSetHtml:function(){c.edit= +q=this;c.afterSetHtml()},afterCreate:function(){c.edit=q=this;c.cmd=q.cmd;c._docMousedownFn=function(){c.menu&&c.hideMenu()};f(q.doc,document).mousedown(c._docMousedownFn);Xb.call(c);Yb.call(c);Zb.call(c);$b.call(c);q.afterChange(function(){q.designMode&&(c.updateState(),c.addBookmark(),c.options.afterChange&&c.options.afterChange.call(c))});q.textarea.keyup(function(a){!a.ctrlKey&&!a.altKey&&Mb[a.which]&&c.options.afterChange&&c.options.afterChange.call(c)});c.readonlyMode&&c.readonly();c.isCreated= +!0;if(c.initContent==="")c.initContent=c.html();c.afterCreate();c.options.afterCreate&&c.options.afterCreate.call(c)}});j.removeClass("statusbar").addClass("ke-statusbar").append('').append('');f(z).unbind("resize");a();d?(f(z).bind("resize",function(){c.isCreated&&b(I().clientWidth,I().clientHeight,!1)}),i.select("fullscreen"),j.first().css("visibility","hidden"),j.last().css("visibility", +"hidden")):(ka&&f(z).bind("scroll",function(){c._scrollPos=Y()}),c.resizeType>0?Ra({moveEl:h,clickEl:j,moveFn:function(a,c,d,e,g,f){e+=f;b(null,e)}}):j.first().css("visibility","hidden"),c.resizeType===2?Ra({moveEl:h,clickEl:j.last(),moveFn:function(a,c,d,e,g,f){d+=g;e+=f;b(d,e)}}):j.last().css("visibility","hidden"));return c},remove:function(){var a=this;if(!a.isCreated)return a;a.beforeRemove();a.menu&&a.hideMenu();m(a.dialogs,function(){a.hideDialog()});f(document).unbind("mousedown",a._docMousedownFn); +a.toolbar.remove();a.edit.remove();a.statusbar.last().unbind();a.statusbar.unbind();a.container.remove();a.container=a.toolbar=a.edit=a.menu=null;a.dialogs=[];a.isCreated=!1;return a},resize:function(a,b){a!==null&&t(a)>this.minWidth&&this.container.css("width",p(a));b!==null&&(b=t(b)-this.toolbar.div.height()-this.statusbar.height(),b>0&&t(b)>this.minHeight&&this.edit.setHeight(b));return this},select:function(){this.isCreated&&this.cmd.select();return this},html:function(a){if(a===j)return this.isCreated? +this.edit.html():ja(this.srcElement);this.isCreated?this.edit.html(a):ja(this.srcElement,a);return this},fullHtml:function(){return this.isCreated?this.edit.html(j,!0):""},text:function(a){return a===j?A(this.html().replace(/<(?!img|embed).*?>/ig,"").replace(/ /ig," ")):this.html(B(a))},isEmpty:function(){return A(this.text().replace(/\r\n|\n|\r/,""))===""},isDirty:function(){return A(this.initContent.replace(/\r\n|\n|\r|t/g,""))!==A(this.html().replace(/\r\n|\n|\r|t/g,""))},selectedHtml:function(){return this.isCreated? +this.cmd.range.html():""},count:function(a){a=(a||"html").toLowerCase();if(a==="html")return U(Ya(this.html())).length;if(a==="text")return this.text().replace(/<(?:img|embed).*?>/ig,"K").replace(/\r\n|\n|\r/g,"").length;return 0},exec:function(a){var a=a.toLowerCase(),b=this.cmd,c=L(a,"selectall,copy,paste,print".split(","))<0;c&&this.addBookmark(!1);b[a].apply(b,Ea(arguments,1));c&&(this.updateState(),this.addBookmark(!1),this.options.afterChange&&this.options.afterChange.call(this));return this}, +insertHtml:function(a){if(!this.isCreated)return this;a=this.beforeSetHtml(a);this.exec("inserthtml",a);return this},appendHtml:function(a){this.html(this.html()+a);if(this.isCreated)a=this.cmd,a.range.selectNodeContents(a.doc.body).collapse(!1),a.select();return this},sync:function(){ja(this.srcElement,this.html());return this},focus:function(){this.isCreated?this.edit.focus():this.srcElement[0].focus();return this},blur:function(){this.isCreated?this.edit.blur():this.srcElement[0].blur();return this}, +addBookmark:function(a){var a=l(a,!0),b=this.edit,c=b.doc.body,d=Ya(c.innerHTML);if(a&&this._undoStack.length>0&&Math.abs(d.length-U(this._undoStack[this._undoStack.length-1].html).length)0){var c=b.dialogs[b.dialogs.length-1];b.dialogs[0].setMaskIndex(c.z+2);a.z=c.z+3;a.showMask=!1}a=Db(a);b.dialogs.push(a);return a},hideDialog:function(){this.dialogs.length>0&&this.dialogs.pop().remove(); +this.dialogs.length>0&&this.dialogs[0].setMaskIndex(this.dialogs[this.dialogs.length-1].z-1);return this},errorDialog:function(a){var b=this.createDialog({width:750,title:this.lang("uploadError"),body:'
    '}),b=f("iframe",b.div),c=f.iframeDoc(b);c.open();c.write(a);c.close();f(c.body).css("background-color","#FFF");b[0].contentWindow.focus();return this}};o&&F<7&&N(document,"BackgroundImageCache", +!0);f.EditorClass=la;f.editor=function(a){return new la(a)};f.create=function(a,b){function c(a){m(T,function(b,c){c.call(a,KindEditor)});return a.create()}b=b||{};b.basePath=l(b.basePath,f.basePath);b.themesPath=l(b.themesPath,b.basePath+"themes/");b.langPath=l(b.langPath,b.basePath+"lang/");b.pluginsPath=l(b.pluginsPath,b.basePath+"plugins/");if(l(b.loadStyleMode,f.options.loadStyleMode)){var d=l(b.themeType,f.options.themeType);Xa(b.themesPath+"default/default.css");Xa(b.themesPath+d+"/"+d+".css")}if(d= +f(a)){b.srcElement=d[0];if(!b.width)b.width=d[0].style.width||d.width();if(!b.height)b.height=d[0].style.height||d.height();var e=new la(b);if(K[e.langType])return c(e);Wa(e.langPath+e.langType+".js?ver="+encodeURIComponent(f.DEBUG?Ca:"4.0.6 (2012-03-18)"),function(){return c(e)});return e}};f.plugin=Fb;f.lang=Hb;Fb("core",function(a){var b=this,c={undo:"Z",redo:"Y",bold:"B",italic:"I",underline:"U",print:"P",selectall:"A"};b.afterSetHtml(function(){b.options.afterChange&&b.options.afterChange.call(b)}); +b.afterCreate(function(){if(b.syncType=="form"){for(var c=a(b.srcElement),d=!1;c=c.parent();)if(c.name=="form"){d=!0;break}if(d){c.bind("submit",function(){b.sync();a(z).bind("unload",function(){b.edit.textarea.remove()})});var f=a('[type="reset"]',c);f.click(function(){b.html(b.initContent);b.cmd.selection()});b.beforeRemove(function(){c.unbind();f.unbind()})}}});b.clickToolbar("source",function(){b.edit.designMode?(b.toolbar.disableAll(!0),b.edit.design(!1),b.toolbar.select("source")):(b.toolbar.disableAll(!1), +b.edit.design(!0),b.toolbar.unselect("source"));b.designMode=b.edit.designMode});b.afterCreate(function(){b.designMode||b.toolbar.disableAll(!0).select("source")});b.clickToolbar("fullscreen",function(){b.fullscreen()});var d=!1;b.afterCreate(function(){a(b.edit.doc,b.edit.textarea).keyup(function(a){a.which==27&&setTimeout(function(){b.fullscreen()},0)});if(d){if(o&&!b.designMode)return;b.focus()}d||(d=!0)});m("undo,redo".split(","),function(a,d){c[d]&&b.afterCreate(function(){Fa(this.edit.doc,c[d], +function(){b.clickToolbar(d)})});b.clickToolbar(d,function(){b[d]()})});b.clickToolbar("formatblock",function(){var a=b.lang("formatblock.formatBlock"),c={h1:28,h2:24,h3:18,H4:14,p:12},d=b.cmd.val("formatblock"),f=b.createMenu({name:"formatblock",width:b.langType=="en"?200:150});m(a,function(a,e){var j="font-size:"+c[a]+"px;";a.charAt(0)==="h"&&(j+="font-weight:bold;");f.addItem({title:''+e+"",height:c[a]+12,checked:d===a||d===e,click:function(){b.select().exec("formatblock", +"<"+a+">").hideMenu()}})})});b.clickToolbar("fontname",function(){var a=b.cmd.val("fontname"),c=b.createMenu({name:"fontname",width:150});m(b.lang("fontname.fontName"),function(d,f){c.addItem({title:''+f+"",checked:a===d.toLowerCase()||a===f.toLowerCase(),click:function(){b.exec("fontname",d).hideMenu()}})})});b.clickToolbar("fontsize",function(){var a=b.cmd.val("fontsize"),c=b.createMenu({name:"fontsize",width:150});m(b.fontSizeTable,function(d, +f){c.addItem({title:''+f+"",height:t(f)+12,checked:a===f,click:function(){b.exec("fontsize",f).hideMenu()}})})});m("forecolor,hilitecolor".split(","),function(a,c){b.clickToolbar(c,function(){b.createMenu({name:c,selectedColor:b.cmd.val(c)||"default",colors:b.colorTable,click:function(a){b.exec(c,a).hideMenu()}})})});m("cut,copy,paste".split(","),function(a,c){b.clickToolbar(c,function(){b.focus();try{b.exec(c,null)}catch(a){alert(b.lang(c+"Error"))}})}); +b.clickToolbar("about",function(){b.createDialog({name:"about",width:300,title:b.lang("about"),body:'
    KindEditor 4.0.6 (2012-03-18)
    Copyright © kindsoft.net All rights reserved.
    '})});b.plugin.getSelectedLink=function(){return b.cmd.commonAncestor("a")};b.plugin.getSelectedImage=function(){return Ba(b.edit.cmd.range,function(a){return!/^ke-\w+$/i.test(a[0].className)})};b.plugin.getSelectedFlash= +function(){return Ba(b.edit.cmd.range,function(a){return a[0].className=="ke-flash"})};b.plugin.getSelectedMedia=function(){return Ba(b.edit.cmd.range,function(a){return a[0].className=="ke-media"||a[0].className=="ke-rm"})};b.plugin.getSelectedAnchor=function(){return Ba(b.edit.cmd.range,function(a){return a[0].className=="ke-anchor"})};m("link,image,flash,media,anchor".split(","),function(a,c){var d=c.charAt(0).toUpperCase()+c.substr(1);m("edit,delete".split(","),function(a,e){b.addContextmenu({title:b.lang(e+ +d),click:function(){b.loadPlugin(c,function(){b.plugin[c][e]();b.hideMenu()})},cond:b.plugin["getSelected"+d],width:150,iconClass:e=="edit"?"ke-icon-"+c:j})});b.addContextmenu({title:"-"})});b.plugin.getSelectedTable=function(){return b.cmd.commonAncestor("table")};b.plugin.getSelectedRow=function(){return b.cmd.commonAncestor("tr")};b.plugin.getSelectedCell=function(){return b.cmd.commonAncestor("td")};m("prop,cellprop,colinsertleft,colinsertright,rowinsertabove,rowinsertbelow,rowmerge,colmerge,rowsplit,colsplit,coldelete,rowdelete,insert,delete".split(","), +function(a,c){var d=L(c,["prop","delete"])<0?b.plugin.getSelectedCell:b.plugin.getSelectedTable;b.addContextmenu({title:b.lang("table"+c),click:function(){b.loadPlugin("table",function(){b.plugin.table[c]();b.hideMenu()})},cond:d,width:170,iconClass:"ke-icon-table"+c})});b.addContextmenu({title:"-"});m("selectall,justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,indent,outdent,subscript,superscript,hr,print,bold,italic,underline,strikethrough,removeformat,unlink".split(","), +function(a,d){c[d]&&b.afterCreate(function(){Fa(this.edit.doc,c[d],function(){b.cmd.selection();b.clickToolbar(d)})});b.clickToolbar(d,function(){b.focus().exec(d,null)})});b.afterCreate(function(){function c(){f.range.moveToBookmark(i);f.select();aa&&(a("div."+j,k).each(function(){a(this).after("
    ").remove(!0)}),a("span.Apple-style-span",k).remove(!0),a("meta",k).remove());var d=k[0].innerHTML;k.remove();d!==""&&(b.pasteType===2&&(/schemas-microsoft-com|worddocument|mso-\w+/i.test(d)?d=kb(d, +b.filterMode?b.htmlTags:a.options.htmlTags):(d=Q(d,b.filterMode?b.htmlTags:null),d=b.beforeSetHtml(d))),b.pasteType===1&&(d=d.replace(/]*>/ig,"\n"),d=d.replace(/<\/p>]*>/ig,"\n"),d=d.replace(/<[^>]+>/g,""),d=d.replace(/ /ig," "),d=d.replace(/\n\s*\n/g,"\n"),d=d.replace(/ {2}/g,"  "),b.newlineTag=="p"?/\n/.test(d)&&(d=d.replace(/^/,"

    ").replace(/$/,"

    ").replace(/\n/g,"

    ")):d=d.replace(/\n/g,"
    $&")),b.insertHtml(d,!0))}var d=b.edit.doc,f,i,k,j="__kindeditor_paste__", +l=!1;a(d.body).bind("paste",function(m){if(b.pasteType===0)m.stop();else if(!l){l=!0;a("div."+j,d).remove();f=b.cmd.selection();i=f.range.createBookmark();k=a('

    ',d).css({position:"absolute",width:"1px",height:"1px",overflow:"hidden",left:"-1981px",top:a(i.start).pos().y+"px","white-space":"nowrap"});a(d.body).append(k);if(o){var p=f.range.get(!0);p.moveToElementText(k[0]);p.select();p.execCommand("paste");m.preventDefault()}else f.range.selectNodeContents(k[0]),f.select(); +setTimeout(function(){c();l=!1},0)}})});b.beforeGetHtml(function(a){return a.replace(/]*class="?ke-(flash|rm|media)"?[^>]*>/ig,function(a){var a=J(a),b=ea(a.style||""),c=mb(a["data-ke-tag"]);c.width=l(a.width,t(l(b.width,"")));c.height=l(a.height,t(l(b.height,"")));return Ha(c)}).replace(/]*class="?ke-anchor"?[^>]*>/ig,function(a){a=J(a);return''}).replace(/]*data-ke-script-attr="([^"]*)"[^>]*>([\s\S]*?)<\/div>/ig,function(a,b, +c){return""+unescape(c)+"<\/script>"}).replace(/(<[^>]*)data-ke-src="([^"]*)"([^>]*>)/ig,function(a,b,c){a=a.replace(/(\s+(?:href|src)=")[^"]*(")/i,"$1"+c+"$2");return a=a.replace(/\s+data-ke-src="[^"]*"/i,"")}).replace(/(<[^>]+\s)data-ke-(on\w+="[^"]*"[^>]*>)/ig,function(a,b,c){return b+c})});b.beforeSetHtml(function(a){return a.replace(/]*type="([^"]+)"[^>]*>(?:<\/embed>)?/ig,function(a){a=J(a);a.src=l(a.src,"");a.width=l(a.width,0);a.height=l(a.height,0);return nb(b.themesPath+ +"common/blank.gif",a)}).replace(/]*name="([^"]+)"[^>]*>(?:<\/a>)?/ig,function(a){var c=J(a);if(c.href!==j)return a;return''}).replace(/]*)>([\s\S]*?)<\/script>/ig,function(a,b,c){return'
    '+escape(c)+"
    "}).replace(/(<[^>]*)(href|src)="([^"]*)"([^>]*>)/ig,function(a,b,c,d,e){if(a.match(/\sdata-ke-src="[^"]*"/i))return a;return b+ +c+'="'+d+'" data-ke-src="'+d+'"'+e}).replace(/(<[^>]+\s)(on\w+="[^"]*"[^>]*>)/ig,function(a,b,c){return b+"data-ke-"+c}).replace(/]*\s+border="0"[^>]*>/ig,function(a){if(a.indexOf("ke-zeroborder")>=0)return a;return Pb(a,"ke-zeroborder")})})})}})(window); diff --git a/WebRoot/js/kindeditor/plugins/anchor/anchor.js b/WebRoot/js/kindeditor/plugins/anchor/anchor.js new file mode 100644 index 0000000..11d261a --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/anchor/anchor.js @@ -0,0 +1,46 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('anchor', function(K) { + var self = this, name = 'anchor', lang = self.lang(name + '.'); + self.plugin.anchor = { + edit : function() { + var html = ['
    ', + '
    ', + '', + '', + '
    ', + '
    '].join(''); + var dialog = self.createDialog({ + name : name, + width : 300, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + self.insertHtml('').hideDialog().focus(); + } + } + }); + var div = dialog.div, + nameBox = K('input[name="name"]', div); + var img = self.plugin.getSelectedAnchor(); + if (img) { + nameBox.val(unescape(img.attr('data-ke-name'))); + } + nameBox[0].focus(); + nameBox[0].select(); + }, + 'delete' : function() { + self.plugin.getSelectedAnchor().remove(); + } + }; + self.clickToolbar(name, self.plugin.anchor.edit); +}); diff --git a/WebRoot/js/kindeditor/plugins/clearhtml/clearhtml.js b/WebRoot/js/kindeditor/plugins/clearhtml/clearhtml.js new file mode 100644 index 0000000..1bf0e5d --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/clearhtml/clearhtml.js @@ -0,0 +1,29 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('clearhtml', function(K) { + var self = this, name = 'clearhtml'; + self.clickToolbar(name, function() { + self.focus(); + var html = self.html(); + html = html.replace(/(]*>)([\s\S]*?)(<\/script>)/ig, ''); + html = html.replace(/(]*>)([\s\S]*?)(<\/style>)/ig, ''); + html = K.formatHtml(html, { + a : ['href', 'target'], + embed : ['src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'], + img : ['src', 'width', 'height', 'border', 'alt', 'title', '.width', '.height'], + table : ['border'], + 'td,th' : ['rowspan', 'colspan'], + 'div,hr,br,tbody,tr,p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [] + }); + self.html(html); + self.cmd.selection(true); + self.addBookmark(); + }); +}); diff --git a/WebRoot/js/kindeditor/plugins/code/code.js b/WebRoot/js/kindeditor/plugins/code/code.js new file mode 100644 index 0000000..a083cc2 --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/code/code.js @@ -0,0 +1,57 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +// google code prettify: http://google-code-prettify.googlecode.com/ +// http://google-code-prettify.googlecode.com/ + +KindEditor.plugin('code', function(K) { + var self = this, name = 'code'; + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + html = ['
    ', + '
    ', + '', + '
    ', + '', + '
    '].join(''), + dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var type = K('.ke-code-type', dialog.div).val(), + code = textarea.val(), + cls = type === '' ? '' : ' lang-' + type, + html = '
    \n' + K.escape(code) + '
    '; + self.insertHtml(html).hideDialog().focus(); + } + } + }), + textarea = K('textarea', dialog.div); + textarea[0].focus(); + }); +}); diff --git a/WebRoot/js/kindeditor/plugins/code/prettify.css b/WebRoot/js/kindeditor/plugins/code/prettify.css new file mode 100644 index 0000000..b8287e5 --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/code/prettify.css @@ -0,0 +1,13 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} + +pre.prettyprint { + border: 0; + border-left: 3px solid rgb(204, 204, 204); + margin-left: 2em; + padding: 0.5em; + font-size: 110%; + display: block; + font-family: "Consolas", "Monaco", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; + margin: 1em 0px; + white-space: pre; +} diff --git a/WebRoot/js/kindeditor/plugins/code/prettify.js b/WebRoot/js/kindeditor/plugins/code/prettify.js new file mode 100644 index 0000000..eef5ad7 --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/code/prettify.js @@ -0,0 +1,28 @@ +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), +["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", +/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('emoticons', function(K) { + var self = this, name = 'emoticons', + path = (self.emoticonsPath || self.pluginsPath + 'emoticons/images/'), + allowPreview = self.allowPreviewEmoticons === undefined ? true : self.allowPreviewEmoticons, + currentPageNum = 1; + self.clickToolbar(name, function() { + var rows = 5, cols = 9, total = 135, startNum = 0, + cells = rows * cols, pages = Math.ceil(total / cells), + colsHalf = Math.floor(cols / 2), + wrapperDiv = K('
    '), + elements = [], + menu = self.createMenu({ + name : name, + beforeRemove : function() { + removeEvent(); + } + }); + menu.div.append(wrapperDiv); + var previewDiv, previewImg; + if (allowPreview) { + previewDiv = K('
    ').css('right', 0); + previewImg = K(''); + wrapperDiv.append(previewDiv); + previewDiv.append(previewImg); + } + function bindCellEvent(cell, j, num) { + if (previewDiv) { + cell.mouseover(function() { + if (j > colsHalf) { + previewDiv.css('left', 0); + previewDiv.css('right', ''); + } else { + previewDiv.css('left', ''); + previewDiv.css('right', 0); + } + previewImg.attr('src', path + num + '.gif'); + K(this).addClass('ke-on'); + }); + } else { + cell.mouseover(function() { + K(this).addClass('ke-on'); + }); + } + cell.mouseout(function() { + K(this).removeClass('ke-on'); + }); + cell.click(function(e) { + self.insertHtml('').hideMenu().focus(); + e.stop(); + }); + } + function createEmoticonsTable(pageNum, parentDiv) { + var table = document.createElement('table'); + parentDiv.append(table); + if (previewDiv) { + K(table).mouseover(function() { + previewDiv.show(); + }); + K(table).mouseout(function() { + previewDiv.hide(); + }); + elements.push(K(table)); + } + table.className = 'ke-table'; + table.cellPadding = 0; + table.cellSpacing = 0; + table.border = 0; + var num = (pageNum - 1) * cells + startNum; + for (var i = 0; i < rows; i++) { + var row = table.insertRow(i); + for (var j = 0; j < cols; j++) { + var cell = K(row.insertCell(j)); + cell.addClass('ke-cell'); + bindCellEvent(cell, j, num); + var span = K('') + .css('background-position', '-' + (24 * num) + 'px 0px') + .css('background-image', 'url(' + path + 'static.gif)'); + cell.append(span); + elements.push(cell); + num++; + } + } + return table; + } + var table = createEmoticonsTable(currentPageNum, wrapperDiv); + function removeEvent() { + K.each(elements, function() { + this.unbind(); + }); + } + var pageDiv; + function bindPageEvent(el, pageNum) { + el.click(function(e) { + removeEvent(); + table.parentNode.removeChild(table); + pageDiv.remove(); + table = createEmoticonsTable(pageNum, wrapperDiv); + createPageTable(pageNum); + currentPageNum = pageNum; + e.stop(); + }); + } + function createPageTable(currentPageNum) { + pageDiv = K('
    '); + wrapperDiv.append(pageDiv); + for (var pageNum = 1; pageNum <= pages; pageNum++) { + if (currentPageNum !== pageNum) { + var a = K('
    [' + pageNum + ']'); + bindPageEvent(a, pageNum); + pageDiv.append(a); + elements.push(a); + } else { + pageDiv.append(K('@[' + pageNum + ']')); + } + pageDiv.append(K('@ ')); + } + } + createPageTable(currentPageNum); + }); +}); diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/0.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/0.gif new file mode 100644 index 0000000..5be27cb Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/0.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/1.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/1.gif new file mode 100644 index 0000000..a2644a9 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/1.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/10.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/10.gif new file mode 100644 index 0000000..905c15b Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/10.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/100.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/100.gif new file mode 100644 index 0000000..92ad35d Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/100.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/101.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/101.gif new file mode 100644 index 0000000..1f27663 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/101.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/102.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/102.gif new file mode 100644 index 0000000..748ded1 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/102.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/103.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/103.gif new file mode 100644 index 0000000..be9eaa0 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/103.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/104.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/104.gif new file mode 100644 index 0000000..d7c2066 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/104.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/105.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/105.gif new file mode 100644 index 0000000..2f353ca Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/105.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/106.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/106.gif new file mode 100644 index 0000000..5193534 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/106.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/107.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/107.gif new file mode 100644 index 0000000..70d38d3 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/107.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/108.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/108.gif new file mode 100644 index 0000000..749d500 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/108.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/109.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/109.gif new file mode 100644 index 0000000..6f57d56 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/109.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/11.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/11.gif new file mode 100644 index 0000000..b512dd5 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/11.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/110.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/110.gif new file mode 100644 index 0000000..e253abc Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/110.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/111.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/111.gif new file mode 100644 index 0000000..0c56723 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/111.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/112.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/112.gif new file mode 100644 index 0000000..c8ddce8 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/112.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/113.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/113.gif new file mode 100644 index 0000000..2727104 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/113.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/114.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/114.gif new file mode 100644 index 0000000..53918e2 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/114.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/115.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/115.gif new file mode 100644 index 0000000..4db3369 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/115.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/116.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/116.gif new file mode 100644 index 0000000..57326bd Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/116.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/117.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/117.gif new file mode 100644 index 0000000..14611b6 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/117.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/118.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/118.gif new file mode 100644 index 0000000..8c25500 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/118.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/119.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/119.gif new file mode 100644 index 0000000..65bb468 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/119.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/12.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/12.gif new file mode 100644 index 0000000..547529c Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/12.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/120.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/120.gif new file mode 100644 index 0000000..5ce77c0 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/120.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/121.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/121.gif new file mode 100644 index 0000000..a021aba Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/121.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/122.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/122.gif new file mode 100644 index 0000000..9a79e11 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/122.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/123.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/123.gif new file mode 100644 index 0000000..b9480be Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/123.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/124.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/124.gif new file mode 100644 index 0000000..7fed477 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/124.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/125.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/125.gif new file mode 100644 index 0000000..e2c3c11 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/125.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/126.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/126.gif new file mode 100644 index 0000000..24105c9 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/126.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/127.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/127.gif new file mode 100644 index 0000000..0cead36 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/127.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/128.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/128.gif new file mode 100644 index 0000000..3185861 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/128.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/129.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/129.gif new file mode 100644 index 0000000..ffd7c6b Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/129.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/13.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/13.gif new file mode 100644 index 0000000..3475300 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/13.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/130.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/130.gif new file mode 100644 index 0000000..d828e3d Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/130.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/131.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/131.gif new file mode 100644 index 0000000..dcb096f Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/131.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/132.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/132.gif new file mode 100644 index 0000000..1b272a6 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/132.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/133.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/133.gif new file mode 100644 index 0000000..0d0e864 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/133.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/134.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/134.gif new file mode 100644 index 0000000..cf48356 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/134.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/14.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/14.gif new file mode 100644 index 0000000..6a788f8 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/14.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/15.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/15.gif new file mode 100644 index 0000000..debab8e Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/15.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/16.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/16.gif new file mode 100644 index 0000000..ed5d29f Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/16.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/17.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/17.gif new file mode 100644 index 0000000..85886fe Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/17.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/18.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/18.gif new file mode 100644 index 0000000..b6af218 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/18.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/19.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/19.gif new file mode 100644 index 0000000..e045ff2 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/19.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/2.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/2.gif new file mode 100644 index 0000000..40cfda4 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/2.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/20.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/20.gif new file mode 100644 index 0000000..efd650f Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/20.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/21.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/21.gif new file mode 100644 index 0000000..cb8cf6d Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/21.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/22.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/22.gif new file mode 100644 index 0000000..96b04df Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/22.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/23.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/23.gif new file mode 100644 index 0000000..96516b8 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/23.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/24.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/24.gif new file mode 100644 index 0000000..5f925c7 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/24.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/25.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/25.gif new file mode 100644 index 0000000..97f8b1a Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/25.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/26.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/26.gif new file mode 100644 index 0000000..a7cded7 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/26.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/27.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/27.gif new file mode 100644 index 0000000..bb46890 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/27.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/28.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/28.gif new file mode 100644 index 0000000..f59dd58 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/28.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/29.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/29.gif new file mode 100644 index 0000000..3c5227e Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/29.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/3.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/3.gif new file mode 100644 index 0000000..6d6f762 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/3.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/30.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/30.gif new file mode 100644 index 0000000..e24a180 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/30.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/31.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/31.gif new file mode 100644 index 0000000..073e743 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/31.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/32.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/32.gif new file mode 100644 index 0000000..772eff2 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/32.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/33.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/33.gif new file mode 100644 index 0000000..217c1c5 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/33.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/34.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/34.gif new file mode 100644 index 0000000..e9d4213 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/34.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/35.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/35.gif new file mode 100644 index 0000000..d6da2c3 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/35.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/36.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/36.gif new file mode 100644 index 0000000..c1e6ac9 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/36.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/37.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/37.gif new file mode 100644 index 0000000..92efec6 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/37.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/38.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/38.gif new file mode 100644 index 0000000..489f0f9 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/38.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/39.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/39.gif new file mode 100644 index 0000000..734f6d8 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/39.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/4.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/4.gif new file mode 100644 index 0000000..6ccdaa2 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/4.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/40.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/40.gif new file mode 100644 index 0000000..24a8eb6 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/40.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/41.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/41.gif new file mode 100644 index 0000000..99139e1 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/41.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/42.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/42.gif new file mode 100644 index 0000000..f60897e Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/42.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/43.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/43.gif new file mode 100644 index 0000000..4350491 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/43.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/44.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/44.gif new file mode 100644 index 0000000..650d3dd Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/44.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/45.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/45.gif new file mode 100644 index 0000000..5c8e071 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/45.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/46.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/46.gif new file mode 100644 index 0000000..f3cb074 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/46.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/47.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/47.gif new file mode 100644 index 0000000..5b3057a Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/47.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/48.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/48.gif new file mode 100644 index 0000000..27a30c1 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/48.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/49.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/49.gif new file mode 100644 index 0000000..dcfa48a Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/49.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/5.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/5.gif new file mode 100644 index 0000000..ab0b81b Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/5.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/50.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/50.gif new file mode 100644 index 0000000..029cf0f Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/50.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/51.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/51.gif new file mode 100644 index 0000000..69f183f Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/51.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/52.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/52.gif new file mode 100644 index 0000000..d41e8aa Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/52.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/53.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/53.gif new file mode 100644 index 0000000..56352dd Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/53.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/54.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/54.gif new file mode 100644 index 0000000..b28d848 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/54.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/55.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/55.gif new file mode 100644 index 0000000..e18da84 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/55.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/56.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/56.gif new file mode 100644 index 0000000..edf96f0 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/56.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/57.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/57.gif new file mode 100644 index 0000000..3f0e2b9 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/57.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/58.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/58.gif new file mode 100644 index 0000000..47b1aaa Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/58.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/59.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/59.gif new file mode 100644 index 0000000..918288b Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/59.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/6.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/6.gif new file mode 100644 index 0000000..ceab122 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/6.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/60.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/60.gif new file mode 100644 index 0000000..66d2113 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/60.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/61.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/61.gif new file mode 100644 index 0000000..034933e Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/61.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/62.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/62.gif new file mode 100644 index 0000000..8d5c4fd Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/62.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/63.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/63.gif new file mode 100644 index 0000000..d58fcf6 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/63.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/64.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/64.gif new file mode 100644 index 0000000..c4e00bd Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/64.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/65.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/65.gif new file mode 100644 index 0000000..da23bfa Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/65.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/66.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/66.gif new file mode 100644 index 0000000..310ec65 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/66.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/67.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/67.gif new file mode 100644 index 0000000..51761ba Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/67.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/68.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/68.gif new file mode 100644 index 0000000..345cb43 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/68.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/69.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/69.gif new file mode 100644 index 0000000..e0f28a0 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/69.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/7.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/7.gif new file mode 100644 index 0000000..2f45399 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/7.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/70.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/70.gif new file mode 100644 index 0000000..24284cf Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/70.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/71.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/71.gif new file mode 100644 index 0000000..a0ccf2e Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/71.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/72.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/72.gif new file mode 100644 index 0000000..7e113ee Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/72.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/73.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/73.gif new file mode 100644 index 0000000..c0293c3 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/73.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/74.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/74.gif new file mode 100644 index 0000000..1c52bde Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/74.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/75.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/75.gif new file mode 100644 index 0000000..9cb9aa7 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/75.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/76.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/76.gif new file mode 100644 index 0000000..27019f8 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/76.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/77.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/77.gif new file mode 100644 index 0000000..8f882f5 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/77.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/78.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/78.gif new file mode 100644 index 0000000..d0d0856 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/78.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/79.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/79.gif new file mode 100644 index 0000000..61652a7 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/79.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/8.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/8.gif new file mode 100644 index 0000000..f6c8834 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/8.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/80.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/80.gif new file mode 100644 index 0000000..9a77936 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/80.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/81.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/81.gif new file mode 100644 index 0000000..2329101 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/81.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/82.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/82.gif new file mode 100644 index 0000000..644748a Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/82.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/83.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/83.gif new file mode 100644 index 0000000..fbf275b Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/83.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/84.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/84.gif new file mode 100644 index 0000000..076f0c6 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/84.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/85.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/85.gif new file mode 100644 index 0000000..d254af4 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/85.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/86.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/86.gif new file mode 100644 index 0000000..8f09d33 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/86.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/87.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/87.gif new file mode 100644 index 0000000..df70756 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/87.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/88.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/88.gif new file mode 100644 index 0000000..4d8b15e Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/88.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/89.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/89.gif new file mode 100644 index 0000000..05726dc Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/89.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/9.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/9.gif new file mode 100644 index 0000000..c2d8450 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/9.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/90.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/90.gif new file mode 100644 index 0000000..adaf20e Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/90.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/91.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/91.gif new file mode 100644 index 0000000..608d0ad Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/91.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/92.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/92.gif new file mode 100644 index 0000000..b909e16 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/92.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/93.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/93.gif new file mode 100644 index 0000000..7f71a8c Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/93.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/94.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/94.gif new file mode 100644 index 0000000..4f26d7d Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/94.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/95.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/95.gif new file mode 100644 index 0000000..5ef6d38 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/95.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/96.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/96.gif new file mode 100644 index 0000000..2b709e1 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/96.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/97.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/97.gif new file mode 100644 index 0000000..cf29be8 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/97.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/98.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/98.gif new file mode 100644 index 0000000..c70e7d3 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/98.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/99.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/99.gif new file mode 100644 index 0000000..05c1863 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/99.gif differ diff --git a/WebRoot/js/kindeditor/plugins/emoticons/images/static.gif b/WebRoot/js/kindeditor/plugins/emoticons/images/static.gif new file mode 100644 index 0000000..b8c444b Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/emoticons/images/static.gif differ diff --git a/WebRoot/js/kindeditor/plugins/filemanager/filemanager.js b/WebRoot/js/kindeditor/plugins/filemanager/filemanager.js new file mode 100644 index 0000000..77af88e --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/filemanager/filemanager.js @@ -0,0 +1,189 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('filemanager', function(K) { + var self = this, name = 'filemanager', + fileManagerJson = K.undef(self.fileManagerJson, self.basePath + 'php/file_manager_json.php'), + imgPath = self.pluginsPath + name + '/images/', + lang = self.lang(name + '.'); + function makeFileTitle(filename, filesize, datetime) { + return filename + ' (' + Math.ceil(filesize / 1024) + 'KB, ' + datetime + ')'; + } + function bindTitle(el, data) { + if (data.is_dir) { + el.attr('title', data.filename); + } else { + el.attr('title', makeFileTitle(data.filename, data.filesize, data.datetime)); + } + } + self.plugin.filemanagerDialog = function(options) { + var width = K.undef(options.width, 520), + height = K.undef(options.height, 510), + dirName = K.undef(options.dirName, ''), + viewType = K.undef(options.viewType, 'VIEW').toUpperCase(), // "LIST" or "VIEW" + clickFn = options.clickFn; + var html = [ + '
    ', + // header start + '
    ', + // left start + '
    ', + ' ', + '' + lang.moveup + '', + '
    ', + // right start + '
    ', + lang.viewType + ' ', + lang.orderType + ' ', + '
    ', + '
    ', + '
    ', + // body start + '
    ', + '
    ' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : width, + height : height, + title : self.lang(name), + body : html + }), + div = dialog.div, + bodyDiv = K('.ke-plugin-filemanager-body', div), + moveupImg = K('[name="moveupImg"]', div), + moveupLink = K('[name="moveupLink"]', div), + viewServerBtn = K('[name="viewServer"]', div), + viewTypeBox = K('[name="viewType"]', div), + orderTypeBox = K('[name="orderType"]', div); + function reloadPage(path, order, func) { + var param = 'path=' + path + '&order=' + order + '&dir=' + dirName; + dialog.showLoading(self.lang('ajaxLoading')); + K.ajax(K.addParam(fileManagerJson, param + '&' + new Date().getTime()), function(data) { + dialog.hideLoading(); + func(data); + }); + } + var elList = []; + function bindEvent(el, result, data, createFunc) { + var fileUrl = K.formatUrl(result.current_url + data.filename, 'absolute'), + dirPath = encodeURIComponent(result.current_dir_path + data.filename + '/'); + if (data.is_dir) { + el.click(function(e) { + reloadPage(dirPath, orderTypeBox.val(), createFunc); + }); + } else if (data.is_photo) { + el.click(function(e) { + clickFn.call(this, fileUrl, data.filename); + }); + } else { + el.click(function(e) { + clickFn.call(this, fileUrl, data.filename); + }); + } + elList.push(el); + } + function createCommon(result, createFunc) { + // remove events + K.each(elList, function() { + this.unbind(); + }); + moveupLink.unbind(); + viewTypeBox.unbind(); + orderTypeBox.unbind(); + // add events + if (result.current_dir_path) { + moveupLink.click(function(e) { + reloadPage(result.moveup_dir_path, orderTypeBox.val(), createFunc); + }); + } + function changeFunc() { + if (viewTypeBox.val() == 'VIEW') { + reloadPage(result.current_dir_path, orderTypeBox.val(), createView); + } else { + reloadPage(result.current_dir_path, orderTypeBox.val(), createList); + } + } + viewTypeBox.change(changeFunc); + orderTypeBox.change(changeFunc); + bodyDiv.html(''); + } + function createList(result) { + createCommon(result, createList); + var table = document.createElement('table'); + table.className = 'ke-table'; + table.cellPadding = 0; + table.cellSpacing = 0; + table.border = 0; + bodyDiv.append(table); + var fileList = result.file_list; + for (var i = 0, len = fileList.length; i < len; i++) { + var data = fileList[i], row = K(table.insertRow(i)); + row.mouseover(function(e) { + K(this).addClass('ke-on'); + }) + .mouseout(function(e) { + K(this).removeClass('ke-on'); + }); + var iconUrl = imgPath + (data.is_dir ? 'folder-16.gif' : 'file-16.gif'), + img = K('' + data.filename + ''), + cell0 = K(row[0].insertCell(0)).addClass('ke-cell ke-name').append(img).append(document.createTextNode(' ' + data.filename)); + if (!data.is_dir || data.has_file) { + row.css('cursor', 'pointer'); + cell0.attr('title', data.filename); + bindEvent(cell0, result, data, createList); + } else { + cell0.attr('title', lang.emptyFolder); + } + K(row[0].insertCell(1)).addClass('ke-cell ke-size').html(data.is_dir ? '-' : Math.ceil(data.filesize / 1024) + 'KB'); + K(row[0].insertCell(2)).addClass('ke-cell ke-datetime').html(data.datetime); + } + } + function createView(result) { + createCommon(result, createView); + var fileList = result.file_list; + for (var i = 0, len = fileList.length; i < len; i++) { + var data = fileList[i], + div = K('
    '); + bodyDiv.append(div); + var photoDiv = K('
    ') + .mouseover(function(e) { + K(this).addClass('ke-on'); + }) + .mouseout(function(e) { + K(this).removeClass('ke-on'); + }); + div.append(photoDiv); + var fileUrl = result.current_url + data.filename, + iconUrl = data.is_dir ? imgPath + 'folder-64.gif' : (data.is_photo ? fileUrl : imgPath + 'file-64.gif'); + var img = K('' + data.filename + ''); + if (!data.is_dir || data.has_file) { + photoDiv.css('cursor', 'pointer'); + bindTitle(photoDiv, data); + bindEvent(photoDiv, result, data, createView); + } else { + photoDiv.attr('title', lang.emptyFolder); + } + photoDiv.append(img); + div.append('
    ' + data.filename + '
    '); + } + } + viewTypeBox.val(viewType); + reloadPage('', orderTypeBox.val(), viewType == 'VIEW' ? createView : createList); + return dialog; + } + +}); diff --git a/WebRoot/js/kindeditor/plugins/filemanager/images/file-16.gif b/WebRoot/js/kindeditor/plugins/filemanager/images/file-16.gif new file mode 100644 index 0000000..2cf6e47 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/filemanager/images/file-16.gif differ diff --git a/WebRoot/js/kindeditor/plugins/filemanager/images/file-64.gif b/WebRoot/js/kindeditor/plugins/filemanager/images/file-64.gif new file mode 100644 index 0000000..aa838d1 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/filemanager/images/file-64.gif differ diff --git a/WebRoot/js/kindeditor/plugins/filemanager/images/folder-16.gif b/WebRoot/js/kindeditor/plugins/filemanager/images/folder-16.gif new file mode 100644 index 0000000..850b5a3 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/filemanager/images/folder-16.gif differ diff --git a/WebRoot/js/kindeditor/plugins/filemanager/images/folder-64.gif b/WebRoot/js/kindeditor/plugins/filemanager/images/folder-64.gif new file mode 100644 index 0000000..11d3f17 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/filemanager/images/folder-64.gif differ diff --git a/WebRoot/js/kindeditor/plugins/filemanager/images/go-up.gif b/WebRoot/js/kindeditor/plugins/filemanager/images/go-up.gif new file mode 100644 index 0000000..92ae23d Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/filemanager/images/go-up.gif differ diff --git a/WebRoot/js/kindeditor/plugins/flash/flash.js b/WebRoot/js/kindeditor/plugins/flash/flash.js new file mode 100644 index 0000000..77d9472 --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/flash/flash.js @@ -0,0 +1,151 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('flash', function(K) { + var self = this, name = 'flash', lang = self.lang(name + '.'), + allowFlashUpload = K.undef(self.allowFlashUpload, true), + allowFileManager = K.undef(self.allowFileManager, false), + uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'); + self.plugin.flash = { + edit : function() { + var html = [ + '
    ', + //url + '
    ', + '', + '  ', + '  ', + '', + '', + '', + '
    ', + //width + '
    ', + '', + ' ', + '
    ', + //height + '
    ', + '', + ' ', + '
    ', + '
    ' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : 450, + height : 200, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var url = K.trim(urlBox.val()), + width = widthBox.val(), + height = heightBox.val(); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + var html = K.mediaImg(self.themesPath + 'common/blank.gif', { + src : url, + type : K.mediaType('.swf'), + width : width, + height : height, + quality : 'high' + }); + self.insertHtml(html).hideDialog().focus(); + } + } + }), + div = dialog.div, + urlBox = K('[name="url"]', div), + viewServerBtn = K('[name="viewServer"]', div), + widthBox = K('[name="width"]', div), + heightBox = K('[name="height"]', div); + urlBox.val('http://'); + + if (allowFlashUpload) { + var uploadbutton = K.uploadbutton({ + button : K('.ke-upload-button', div)[0], + fieldName : 'imgFile', + url : K.addParam(uploadJson, 'dir=flash'), + afterUpload : function(data) { + dialog.hideLoading(); + if (data.error === 0) { + var url = K.formatUrl(data.url, 'absolute'); + urlBox.val(url); + if (self.afterUpload) { + self.afterUpload.call(self, url); + } + alert(self.lang('uploadSuccess')); + } else { + alert(data.message); + } + }, + afterError : function(html) { + dialog.hideLoading(); + self.errorDialog(html); + } + }); + uploadbutton.fileBox.change(function(e) { + dialog.showLoading(self.lang('uploadLoading')); + uploadbutton.submit(); + }); + } else { + K('.ke-upload-button', div).hide(); + urlBox.width(250); + } + + if (allowFileManager) { + viewServerBtn.click(function(e) { + self.loadPlugin('filemanager', function() { + self.plugin.filemanagerDialog({ + viewType : 'LIST', + dirName : 'flash', + clickFn : function(url, title) { + if (self.dialogs.length > 1) { + K('[name="url"]', div).val(url); + self.hideDialog(); + } + } + }); + }); + }); + } else { + viewServerBtn.hide(); + } + + var img = self.plugin.getSelectedFlash(); + if (img) { + var attrs = K.mediaAttrs(img.attr('data-ke-tag')); + urlBox.val(attrs.src); + widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0); + heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0); + } + urlBox[0].focus(); + urlBox[0].select(); + }, + 'delete' : function() { + self.plugin.getSelectedFlash().remove(); + } + }; + self.clickToolbar(name, self.plugin.flash.edit); +}); diff --git a/WebRoot/js/kindeditor/plugins/image/image.js b/WebRoot/js/kindeditor/plugins/image/image.js new file mode 100644 index 0000000..2679ca0 --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/image/image.js @@ -0,0 +1,278 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('image', function(K) { + var self = this, name = 'image', + allowImageUpload = K.undef(self.allowImageUpload, true), + allowFileManager = K.undef(self.allowFileManager, false), + uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'), + imageTabIndex = K.undef(self.imageTabIndex, 0), + imgPath = self.pluginsPath + 'image/images/', + lang = self.lang(name + '.'); + + self.plugin.imageDialog = function(options) { + var imageUrl = options.imageUrl, + imageWidth = K.undef(options.imageWidth, ''), + imageHeight = K.undef(options.imageHeight, ''), + imageTitle = K.undef(options.imageTitle, ''), + imageAlign = K.undef(options.imageAlign, ''), + tabIndex = K.undef(options.tabIndex, 0), + clickFn = options.clickFn; + var html = [ + '
    ', + //tabs + '
    ', + //url or file + '
    ', + '', + '', + '
    ', + //size + '
    ', + '', + lang.width + ' ', + lang.height + ' ', + '', + '
    ', + //align + '
    ', + '', + ' ', + ' ', + ' ', + '
    ', + //title + '
    ', + '', + '
    ', + '
    ', + '
    ' + ].join(''); + var dialogWidth = allowImageUpload ? 450 : 400; + dialogHeight = allowImageUpload ? 300 : 250; + var dialog = self.createDialog({ + name : name, + width : dialogWidth, + height : dialogHeight, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + // insert local image + if (tabs && tabs.selectedIndex === 1) { + if (uploadbutton.fileBox.val() == '') { + alert(self.lang('pleaseSelectFile')); + return; + } + dialog.showLoading(self.lang('uploadLoading')); + uploadbutton.submit(); + localUrlBox.val(''); + return; + } + // insert remote image + var url = K.trim(urlBox.val()), + width = widthBox.val(), + height = heightBox.val(), + title = titleBox.val(), + align = ''; + alignBox.each(function() { + if (this.checked) { + align = this.value; + return false; + } + }); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + clickFn.call(self, url, title, width, height, 0, align); + } + }, + beforeRemove : function() { + viewServerBtn.unbind(); + widthBox.unbind(); + heightBox.unbind(); + refreshBtn.unbind(); + //uploadbutton.remove(); + } + }), + div = dialog.div; + + var tabs; + if (allowImageUpload) { + tabs = K.tabs({ + src : K('.tabs', div) + }); + tabs.add({ + title : lang.remoteImage, + panel : K('.tab1', div) + }); + tabs.add({ + title : lang.localImage, + panel : K('.tab2', div) + }); + tabs.select(tabIndex); + } else { + K('.tab1', div).show(); + } + + var urlBox = K('[name="url"]', div), + localUrlBox = K('[name="localUrl"]', div), + viewServerBtn = K('[name="viewServer"]', div), + widthBox = K('[name="width"]', div), + heightBox = K('[name="height"]', div), + refreshBtn = K('.ke-refresh-btn', div), + titleBox = K('[name="title"]', div), + alignBox = K('[name="align"]'); + + var uploadbutton = K.uploadbutton({ + button : K('.ke-upload-button', div)[0], + fieldName : 'imgFile', + url : K.addParam(uploadJson, 'dir=image'), + width: 60, + afterUpload : function(data) { + dialog.hideLoading(); + if (data.error === 0) { + var width = widthBox.val(), + height = heightBox.val(), + title = titleBox.val(), + align = ''; + alignBox.each(function() { + if (this.checked) { + align = this.value; + return false; + } + }); + var url = K.formatUrl(data.url, 'absolute'); + clickFn.call(self, url, title, width, height, 0, align); + if (self.afterUpload) { + self.afterUpload.call(self, url); + } + } else { + alert(data.message); + } + }, + afterError : function(html) { + dialog.hideLoading(); + self.errorDialog(html); + } + }); + uploadbutton.fileBox.change(function(e) { + localUrlBox.val(uploadbutton.fileBox.val()); + }); + if (allowFileManager) { + viewServerBtn.click(function(e) { + self.loadPlugin('filemanager', function() { + self.plugin.filemanagerDialog({ + viewType : 'VIEW', + dirName : 'image', + clickFn : function(url, title) { + if (self.dialogs.length > 1) { + K('[name="url"]', div).val(url); + self.hideDialog(); + } + } + }); + }); + }); + } else { + viewServerBtn.hide(); + } + var originalWidth = 0, originalHeight = 0; + function setSize(width, height) { + widthBox.val(width); + heightBox.val(height); + originalWidth = width; + originalHeight = height; + } + refreshBtn.click(function(e) { + var tempImg = K('', document).css({ + position : 'absolute', + visibility : 'hidden', + top : 0, + left : '-1000px' + }); + tempImg.bind('load', function() { + setSize(tempImg.width(), tempImg.height()); + tempImg.remove(); + }); + K(document.body).append(tempImg); + }); + widthBox.change(function(e) { + if (originalWidth > 0) { + heightBox.val(Math.round(originalHeight / originalWidth * parseInt(this.value, 10))); + } + }); + heightBox.change(function(e) { + if (originalHeight > 0) { + widthBox.val(Math.round(originalWidth / originalHeight * parseInt(this.value, 10))); + } + }); + urlBox.val(options.imageUrl); + setSize(options.imageWidth, options.imageHeight); + titleBox.val(options.imageTitle); + alignBox.each(function() { + if (this.value === options.imageAlign) { + this.checked = true; + return false; + } + }); + if (tabIndex === 0) { + urlBox[0].focus(); + urlBox[0].select(); + } + return dialog; + }; + self.plugin.image = { + edit : function() { + var img = self.plugin.getSelectedImage(); + self.plugin.imageDialog({ + imageUrl : img ? img.attr('data-ke-src') : 'http://', + imageWidth : img ? img.width() : '', + imageHeight : img ? img.height() : '', + imageTitle : img ? img.attr('title') : '', + imageAlign : img ? img.attr('align') : '', + tabIndex: img ? 0 : imageTabIndex, + clickFn : function(url, title, width, height, border, align) { + self.exec('insertimage', url, title, width, height, border, align); + // Bugfix: [Firefox] 上传图片后,总是出现正在加载的样式,需要延迟执行hideDialog + setTimeout(function() { + self.hideDialog().focus(); + }, 0); + } + }); + }, + 'delete' : function() { + self.plugin.getSelectedImage().remove(); + } + }; + self.clickToolbar(name, self.plugin.image.edit); +}); diff --git a/WebRoot/js/kindeditor/plugins/image/images/align_left.gif b/WebRoot/js/kindeditor/plugins/image/images/align_left.gif new file mode 100644 index 0000000..ab17f56 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/image/images/align_left.gif differ diff --git a/WebRoot/js/kindeditor/plugins/image/images/align_right.gif b/WebRoot/js/kindeditor/plugins/image/images/align_right.gif new file mode 100644 index 0000000..e8ebe6a Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/image/images/align_right.gif differ diff --git a/WebRoot/js/kindeditor/plugins/image/images/align_top.gif b/WebRoot/js/kindeditor/plugins/image/images/align_top.gif new file mode 100644 index 0000000..d8826a5 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/image/images/align_top.gif differ diff --git a/WebRoot/js/kindeditor/plugins/image/images/refresh.png b/WebRoot/js/kindeditor/plugins/image/images/refresh.png new file mode 100644 index 0000000..77e12d1 Binary files /dev/null and b/WebRoot/js/kindeditor/plugins/image/images/refresh.png differ diff --git a/WebRoot/js/kindeditor/plugins/insertfile/insertfile.js b/WebRoot/js/kindeditor/plugins/insertfile/insertfile.js new file mode 100644 index 0000000..3aaa045 --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/insertfile/insertfile.js @@ -0,0 +1,131 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('insertfile', function(K) { + var self = this, name = 'insertfile', + allowFileUpload = K.undef(self.allowFileUpload, true), + allowFileManager = K.undef(self.allowFileManager, false), + uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'), + lang = self.lang(name + '.'); + + self.plugin.fileDialog = function(options) { + var fileUrl = K.undef(options.fileUrl, 'http://'), + fileTitle = K.undef(options.fileTitle, ''), + clickFn = options.clickFn; + var html = [ + '
    ', + '
    ', + '', + '  ', + '  ', + '', + '', + '', + '
    ', + //title + '
    ', + '', + '
    ', + '
    ', + //form end + '', + '
    ' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : 450, + height : 180, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var url = K.trim(urlBox.val()), + title = titleBox.val(); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + if (K.trim(title) === '') { + title = url; + } + clickFn.call(self, url, title); + } + } + }), + div = dialog.div; + + var urlBox = K('[name="url"]', div), + viewServerBtn = K('[name="viewServer"]', div), + titleBox = K('[name="title"]', div); + + if (allowFileUpload) { + var uploadbutton = K.uploadbutton({ + button : K('.ke-upload-button', div)[0], + fieldName : 'imgFile', + url : K.addParam(uploadJson, 'dir=file'), + afterUpload : function(data) { + dialog.hideLoading(); + if (data.error === 0) { + var url = K.formatUrl(data.url, 'absolute'); + urlBox.val(url); + if (self.afterUpload) { + self.afterUpload.call(self, url); + } + alert(self.lang('uploadSuccess')); + } else { + alert(data.message); + } + }, + afterError : function(html) { + dialog.hideLoading(); + self.errorDialog(html); + } + }); + uploadbutton.fileBox.change(function(e) { + dialog.showLoading(self.lang('uploadLoading')); + uploadbutton.submit(); + }); + } else { + K('.ke-upload-button', div).hide(); + urlBox.width(250); + } + if (allowFileManager) { + viewServerBtn.click(function(e) { + self.loadPlugin('filemanager', function() { + self.plugin.filemanagerDialog({ + viewType : 'LIST', + dirName : 'file', + clickFn : function(url, title) { + if (self.dialogs.length > 1) { + K('[name="url"]', div).val(url); + self.hideDialog(); + } + } + }); + }); + }); + } else { + viewServerBtn.hide(); + } + urlBox.val(fileUrl); + titleBox.val(fileTitle); + urlBox[0].focus(); + urlBox[0].select(); + }; + self.clickToolbar(name, function() { + self.plugin.fileDialog({ + clickFn : function(url, title) { + var html = '' + title + ''; + self.insertHtml(html).hideDialog().focus(); + } + }); + }); +}); diff --git a/WebRoot/js/kindeditor/plugins/lineheight/lineheight.js b/WebRoot/js/kindeditor/plugins/lineheight/lineheight.js new file mode 100644 index 0000000..ae679d7 --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/lineheight/lineheight.js @@ -0,0 +1,38 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('lineheight', function(K) { + var self = this, name = 'lineheight', lang = self.lang(name + '.'); + self.clickToolbar(name, function() { + var curVal = '', commonNode = self.cmd.commonNode({'*' : '.line-height'}); + if (commonNode) { + curVal = commonNode.css('line-height'); + } + var menu = self.createMenu({ + name : name, + width : 150 + }); + K.each(lang.lineHeight, function(i, row) { + K.each(row, function(key, val) { + menu.addItem({ + title : val, + checked : curVal === key, + click : function() { + self.cmd.toggle('', { + span : '.line-height=' + key + }); + self.updateState(); + self.addBookmark(); + self.hideMenu(); + } + }); + }); + }); + }); +}); diff --git a/WebRoot/js/kindeditor/plugins/link/link.js b/WebRoot/js/kindeditor/plugins/link/link.js new file mode 100644 index 0000000..4df10be --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/link/link.js @@ -0,0 +1,66 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('link', function(K) { + var self = this, name = 'link'; + self.plugin.link = { + edit : function() { + var lang = self.lang(name + '.'), + html = '
    ' + + //url + '
    ' + + '' + + '
    ' + + //type + '
    ' + + '' + + '' + + '
    ' + + '
    ', + dialog = self.createDialog({ + name : name, + width : 400, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var url = K.trim(urlBox.val()); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + self.exec('createlink', url, typeBox.val()).hideDialog().focus(); + } + } + }), + div = dialog.div, + urlBox = K('input[name="url"]', div), + typeBox = K('select[name="type"]', div); + urlBox.val('http://'); + typeBox[0].options[0] = new Option(lang.newWindow, '_blank'); + typeBox[0].options[1] = new Option(lang.selfWindow, ''); + self.cmd.selection(); + var a = self.plugin.getSelectedLink(); + if (a) { + self.cmd.range.selectNode(a[0]); + self.cmd.select(); + urlBox.val(a.attr('data-ke-src')); + typeBox.val(a.attr('target')); + } + urlBox[0].focus(); + urlBox[0].select(); + }, + 'delete' : function() { + self.exec('unlink', null); + } + }; + self.clickToolbar(name, self.plugin.link.edit); +}); diff --git a/WebRoot/js/kindeditor/plugins/map/map.html b/WebRoot/js/kindeditor/plugins/map/map.html new file mode 100644 index 0000000..1a9ad7d --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/map/map.html @@ -0,0 +1,57 @@ + + + + + + + + + +
    + + \ No newline at end of file diff --git a/WebRoot/js/kindeditor/plugins/map/map.js b/WebRoot/js/kindeditor/plugins/map/map.js new file mode 100644 index 0000000..5290875 --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/map/map.js @@ -0,0 +1,137 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +// Google Maps: http://code.google.com/apis/maps/index.html + +KindEditor.plugin('map', function(K) { + var self = this, name = 'map', lang = self.lang(name + '.'); + self.clickToolbar(name, function() { + var html = ['
    ', + '
    ', + lang.address + ' ', + '', + '', + '', + '
    ', + '
    ', + '
    '].join(''); + var dialog = self.createDialog({ + name : name, + width : 600, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var geocoder = win.geocoder, + map = win.map, + center = map.getCenter().lat() + ',' + map.getCenter().lng(), + zoom = map.getZoom(), + maptype = map.getMapTypeId(), + url = 'http://maps.googleapis.com/maps/api/staticmap'; + url += '?center=' + encodeURIComponent(center); + url += '&zoom=' + encodeURIComponent(zoom); + url += '&size=558x360'; + url += '&maptype=' + encodeURIComponent(maptype); + url += '&markers=' + encodeURIComponent(center); + url += '&language=' + self.langType; + url += '&sensor=false'; + self.exec('insertimage', url).hideDialog().focus(); + } + }, + beforeRemove : function() { + searchBtn.remove(); + if (doc) { + doc.write(''); + } + iframe.remove(); + } + }); + var div = dialog.div, + addressBox = K('[name="address"]', div), + searchBtn = K('[name="searchBtn"]', div), + win, doc; + var iframeHtml = ['', + '', + '', + '', + '', + '', + '', + '
    ', + ''].join('\n'); + // TODO:用doc.write(iframeHtml)方式加载时,在IE6上第一次加载报错,暂时使用src方式 + var iframe = K(''); + function ready() { + win = iframe[0].contentWindow; + doc = K.iframeDoc(iframe); + //doc.open(); + //doc.write(iframeHtml); + //doc.close(); + } + iframe.bind('load', function() { + iframe.unbind('load'); + if (K.IE) { + ready(); + } else { + setTimeout(ready, 0); + } + }); + K('.ke-map', div).replaceWith(iframe); + // search map + searchBtn.click(function() { + win.search(addressBox.val()); + }); + }); +}); diff --git a/WebRoot/js/kindeditor/plugins/media/media.js b/WebRoot/js/kindeditor/plugins/media/media.js new file mode 100644 index 0000000..82d7bb3 --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/media/media.js @@ -0,0 +1,159 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('media', function(K) { + var self = this, name = 'media', lang = self.lang(name + '.'), + allowMediaUpload = K.undef(self.allowMediaUpload, true), + allowFileManager = K.undef(self.allowFileManager, false), + uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'); + self.plugin.media = { + edit : function() { + var html = [ + '
    ', + //url + '
    ', + '', + '  ', + '  ', + '', + '', + '', + '
    ', + //width + '
    ', + '', + '', + '
    ', + //height + '
    ', + '', + '', + '
    ', + //autostart + '
    ', + '', + ' ', + '
    ', + '
    ' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : 450, + height : 230, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var url = K.trim(urlBox.val()), + width = widthBox.val(), + height = heightBox.val(); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + var html = K.mediaImg(self.themesPath + 'common/blank.gif', { + src : url, + type : K.mediaType(url), + width : width, + height : height, + autostart : autostartBox[0].checked ? 'true' : 'false', + loop : 'true' + }); + self.insertHtml(html).hideDialog().focus(); + } + } + }), + div = dialog.div, + urlBox = K('[name="url"]', div), + viewServerBtn = K('[name="viewServer"]', div), + widthBox = K('[name="width"]', div), + heightBox = K('[name="height"]', div), + autostartBox = K('[name="autostart"]', div); + urlBox.val('http://'); + + if (allowMediaUpload) { + var uploadbutton = K.uploadbutton({ + button : K('.ke-upload-button', div)[0], + fieldName : 'imgFile', + url : K.addParam(uploadJson, 'dir=media'), + afterUpload : function(data) { + dialog.hideLoading(); + if (data.error === 0) { + var url = K.formatUrl(data.url, 'absolute'); + urlBox.val(url); + if (self.afterUpload) { + self.afterUpload.call(self, url); + } + alert(self.lang('uploadSuccess')); + } else { + alert(data.message); + } + }, + afterError : function(html) { + dialog.hideLoading(); + self.errorDialog(html); + } + }); + uploadbutton.fileBox.change(function(e) { + dialog.showLoading(self.lang('uploadLoading')); + uploadbutton.submit(); + }); + } else { + K('.ke-upload-button', div).hide(); + urlBox.width(250); + } + + if (allowFileManager) { + viewServerBtn.click(function(e) { + self.loadPlugin('filemanager', function() { + self.plugin.filemanagerDialog({ + viewType : 'LIST', + dirName : 'media', + clickFn : function(url, title) { + if (self.dialogs.length > 1) { + K('[name="url"]', div).val(url); + self.hideDialog(); + } + } + }); + }); + }); + } else { + viewServerBtn.hide(); + } + + var img = self.plugin.getSelectedMedia(); + if (img) { + var attrs = K.mediaAttrs(img.attr('data-ke-tag')); + urlBox.val(attrs.src); + widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0); + heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0); + autostartBox[0].checked = (attrs.autostart === 'true'); + } + urlBox[0].focus(); + urlBox[0].select(); + }, + 'delete' : function() { + self.plugin.getSelectedMedia().remove(); + } + }; + self.clickToolbar(name, self.plugin.media.edit); +}); diff --git a/WebRoot/js/kindeditor/plugins/pagebreak/pagebreak.js b/WebRoot/js/kindeditor/plugins/pagebreak/pagebreak.js new file mode 100644 index 0000000..5ba3adf --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/pagebreak/pagebreak.js @@ -0,0 +1,26 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('pagebreak', function(K) { + var self = this, name = 'pagebreak'; + self.clickToolbar(name, function() { + var cmd = self.cmd, range = cmd.range; + self.focus(); + range.enlarge(true); + cmd.split(true); + var tail = self.newlineTag == 'br' || K.WEBKIT ? '' : '

    '; + self.insertHtml('
    ' + tail); + if (tail !== '') { + var p = K('#__kindeditor_tail_tag__', self.edit.doc); + range.selectNodeContents(p[0]); + p.removeAttr('id'); + cmd.select(); + } + }); +}); diff --git a/WebRoot/js/kindeditor/plugins/plainpaste/plainpaste.js b/WebRoot/js/kindeditor/plugins/plainpaste/plainpaste.js new file mode 100644 index 0000000..8f7bed8 --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/plainpaste/plainpaste.js @@ -0,0 +1,41 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('plainpaste', function(K) { + var self = this, name = 'plainpaste'; + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + html = '
    ' + + '
    ' + lang.comment + '
    ' + + '' + + '
    ', + dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var html = textarea.val(); + html = K.escape(html); + html = html.replace(/ {2}/g, '  '); + if (self.newlineTag == 'p') { + html = html.replace(/^/, '

    ').replace(/$/, '

    ').replace(/\n/g, '

    '); + } else { + html = html.replace(/\n/g, '
    $&'); + } + self.insertHtml(html).hideDialog().focus(); + } + } + }), + textarea = K('textarea', dialog.div); + textarea[0].focus(); + }); +}); diff --git a/WebRoot/js/kindeditor/plugins/preview/preview.js b/WebRoot/js/kindeditor/plugins/preview/preview.js new file mode 100644 index 0000000..ef6e2cf --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/preview/preview.js @@ -0,0 +1,31 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('preview', function(K) { + var self = this, name = 'preview', undefined; + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + html = '

    ' + + '' + + '
    ', + dialog = self.createDialog({ + name : name, + width : 750, + title : self.lang(name), + body : html + }), + iframe = K('iframe', dialog.div), + doc = K.iframeDoc(iframe); + doc.open(); + doc.write(self.fullHtml()); + doc.close(); + K(doc.body).css('background-color', '#FFF'); + iframe[0].contentWindow.focus(); + }); +}); diff --git a/WebRoot/js/kindeditor/plugins/quickformat/quickformat.js b/WebRoot/js/kindeditor/plugins/quickformat/quickformat.js new file mode 100644 index 0000000..5b98c72 --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/quickformat/quickformat.js @@ -0,0 +1,81 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('quickformat', function(K) { + var self = this, name = 'quickformat', + blockMap = K.toMap('blockquote,center,div,h1,h2,h3,h4,h5,h6,p'); + function getFirstChild(knode) { + var child = knode.first(); + while (child && child.first()) { + child = child.first(); + } + return child; + } + self.clickToolbar(name, function() { + self.focus(); + var doc = self.edit.doc, + range = self.cmd.range, + child = K(doc.body).first(), next, + nodeList = [], subList = [], + bookmark = range.createBookmark(true); + while(child) { + next = child.next(); + var firstChild = getFirstChild(child); + if (!firstChild || firstChild.name != 'img') { + if (blockMap[child.name]) { + child.html(child.html().replace(/^(\s| | )+/ig, '')); + child.css('text-indent', '2em'); + } else { + subList.push(child); + } + if (!next || (blockMap[next.name] || blockMap[child.name] && !blockMap[next.name])) { + if (subList.length > 0) { + nodeList.push(subList); + } + subList = []; + } + } + child = next; + } + K.each(nodeList, function(i, subList) { + var wrapper = K('

    ', doc); + subList[0].before(wrapper); + K.each(subList, function(i, knode) { + wrapper.append(knode); + }); + }); + range.moveToBookmark(bookmark); + self.addBookmark(); + }); +}); + +/** +-------------------------- +abcd
    +1234
    + +to + +

    + abcd
    + 1234
    +

    + +-------------------------- + +  abcd1233 +

    1234

    + +to + +

    abcd1233

    +

    1234

    + +-------------------------- +*/ \ No newline at end of file diff --git a/WebRoot/js/kindeditor/plugins/table/table.js b/WebRoot/js/kindeditor/plugins/table/table.js new file mode 100644 index 0000000..8928547 --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/table/table.js @@ -0,0 +1,688 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('table', function(K) { + var self = this, name = 'table', lang = self.lang(name + '.'), zeroborder = 'ke-zeroborder'; + // 设置颜色 + function _setColor(box, color) { + color = color.toUpperCase(); + box.css('background-color', color); + box.css('color', color === '#000000' ? '#FFFFFF' : '#000000'); + box.html(color); + } + // 初始化取色器 + var pickerList = []; + function _initColorPicker(dialogDiv, colorBox) { + colorBox.bind('click,mousedown', function(e){ + e.stopPropagation(); + }); + function removePicker() { + K.each(pickerList, function() { + this.remove(); + }); + pickerList = []; + K(document).unbind('click,mousedown', removePicker); + dialogDiv.unbind('click,mousedown', removePicker); + } + colorBox.click(function(e) { + removePicker(); + var box = K(this), + pos = box.pos(); + var picker = K.colorpicker({ + x : pos.x, + y : pos.y + box.height(), + z : 811214, + selectedColor : K(this).html(), + colors : self.colorTable, + noColor : self.lang('noColor'), + shadowMode : self.shadowMode, + click : function(color) { + _setColor(box, color); + removePicker(); + } + }); + pickerList.push(picker); + K(document).bind('click,mousedown', removePicker); + dialogDiv.bind('click,mousedown', removePicker); + }); + } + // 取得下一行cell的index + function _getCellIndex(table, row, cell) { + var rowSpanCount = 0; + for (var i = 0, len = row.cells.length; i < len; i++) { + if (row.cells[i] == cell) { + break; + } + rowSpanCount += row.cells[i].rowSpan - 1; + } + return cell.cellIndex - rowSpanCount; + } + self.plugin.table = { + //insert or modify table + prop : function(isInsert) { + var html = [ + '
    ', + //rows, cols + '
    ', + '', + lang.rows + '   ', + lang.cols + ' ', + '
    ', + //width, height + '
    ', + '', + lang.width + '   ', + '   ', + lang.height + '   ', + '', + '
    ', + //space, padding + '
    ', + '', + lang.padding + '   ', + lang.spacing + ' ', + '
    ', + //align + '
    ', + '', + '', + '
    ', + //border + '
    ', + '', + lang.borderWidth + '   ', + lang.borderColor + ' ', + '
    ', + //background color + '
    ', + '', + '', + '
    ', + '
    ' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : 500, + height : 300, + title : self.lang(name), + body : html, + beforeRemove : function() { + colorBox.unbind(); + }, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var rows = rowsBox.val(), + cols = colsBox.val(), + width = widthBox.val(), + height = heightBox.val(), + widthType = widthTypeBox.val(), + heightType = heightTypeBox.val(), + padding = paddingBox.val(), + spacing = spacingBox.val(), + align = alignBox.val(), + border = borderBox.val(), + borderColor = K(colorBox[0]).html() || '', + bgColor = K(colorBox[1]).html() || ''; + if (rows == 0 || !/^\d+$/.test(rows)) { + alert(self.lang('invalidRows')); + rowsBox[0].focus(); + return; + } + if (cols == 0 || !/^\d+$/.test(cols)) { + alert(self.lang('invalidRows')); + colsBox[0].focus(); + return; + } + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + if (!/^\d*$/.test(padding)) { + alert(self.lang('invalidPadding')); + paddingBox[0].focus(); + return; + } + if (!/^\d*$/.test(spacing)) { + alert(self.lang('invalidSpacing')); + spacingBox[0].focus(); + return; + } + if (!/^\d*$/.test(border)) { + alert(self.lang('invalidBorder')); + borderBox[0].focus(); + return; + } + //modify table + if (table) { + if (width !== '') { + table.width(width + widthType); + } else { + table.css('width', ''); + } + if (table[0].width !== undefined) { + table.removeAttr('width'); + } + if (height !== '') { + table.height(height + heightType); + } else { + table.css('height', ''); + } + if (table[0].height !== undefined) { + table.removeAttr('height'); + } + table.css('background-color', bgColor); + if (table[0].bgColor !== undefined) { + table.removeAttr('bgColor'); + } + if (padding !== '') { + table[0].cellPadding = padding; + } else { + table.removeAttr('cellPadding'); + } + if (spacing !== '') { + table[0].cellSpacing = spacing; + } else { + table.removeAttr('cellSpacing'); + } + if (align !== '') { + table[0].align = align; + } else { + table.removeAttr('align'); + } + if (border !== '') { + table.attr('border', border); + } else { + table.removeAttr('border'); + } + if (border === '' || border === '0') { + table.addClass(zeroborder); + } else { + table.removeClass(zeroborder); + } + if (borderColor !== '') { + table.attr('borderColor', borderColor); + } else { + table.removeAttr('borderColor'); + } + self.hideDialog().focus(); + return; + } + //insert new table + var style = ''; + if (width !== '') { + style += 'width:' + width + widthType + ';'; + } + if (height !== '') { + style += 'height:' + height + heightType + ';'; + } + if (bgColor !== '') { + style += 'background-color:' + bgColor + ';'; + } + var html = '') + ''; + } + html += ''; + } + html += ''; + if (!K.IE) { + html += '
    '; + } + self.insertHtml(html); + self.select().hideDialog().focus(); + self.addBookmark(); + } + } + }), + div = dialog.div, + rowsBox = K('[name="rows"]', div).val(3), + colsBox = K('[name="cols"]', div).val(2), + widthBox = K('[name="width"]', div).val(100), + heightBox = K('[name="height"]', div), + widthTypeBox = K('[name="widthType"]', div), + heightTypeBox = K('[name="heightType"]', div), + paddingBox = K('[name="padding"]', div).val(2), + spacingBox = K('[name="spacing"]', div).val(0), + alignBox = K('[name="align"]', div), + borderBox = K('[name="border"]', div).val(1), + colorBox = K('.ke-input-color', div); + _initColorPicker(div, colorBox.eq(0)); + _initColorPicker(div, colorBox.eq(1)); + _setColor(colorBox.eq(0), '#000000'); + _setColor(colorBox.eq(1), ''); + // foucs and select + rowsBox[0].focus(); + rowsBox[0].select(); + var table; + if (isInsert) { + return; + } + //get selected table node + table = self.plugin.getSelectedTable(); + if (table) { + rowsBox.val(table[0].rows.length); + colsBox.val(table[0].rows.length > 0 ? table[0].rows[0].cells.length : 0); + rowsBox.attr('disabled', true); + colsBox.attr('disabled', true); + var match, + tableWidth = table[0].style.width || table[0].width, + tableHeight = table[0].style.height || table[0].height; + if (tableWidth !== undefined && (match = /^(\d+)((?:px|%)*)$/.exec(tableWidth))) { + widthBox.val(match[1]); + widthTypeBox.val(match[2]); + } else { + widthBox.val(''); + } + if (tableHeight !== undefined && (match = /^(\d+)((?:px|%)*)$/.exec(tableHeight))) { + heightBox.val(match[1]); + heightTypeBox.val(match[2]); + } + paddingBox.val(table[0].cellPadding || ''); + spacingBox.val(table[0].cellSpacing || ''); + alignBox.val(table[0].align || ''); + borderBox.val(table[0].border === undefined ? '' : table[0].border); + _setColor(colorBox.eq(0), K.toHex(table.attr('borderColor') || '')); + _setColor(colorBox.eq(1), K.toHex(table[0].style.backgroundColor || table[0].bgColor || '')); + widthBox[0].focus(); + widthBox[0].select(); + } + }, + //modify cell + cellprop : function() { + var html = [ + '
    ', + //width, height + '
    ', + '', + lang.width + '   ', + '   ', + lang.height + '   ', + '', + '
    ', + //align + '
    ', + '', + lang.textAlign + ' ', + lang.verticalAlign + ' ', + '
    ', + //border + '
    ', + '', + lang.borderWidth + '   ', + lang.borderColor + ' ', + '
    ', + //background color + '
    ', + '', + '', + '
    ', + '
    ' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : 500, + height : 220, + title : self.lang('tablecell'), + body : html, + beforeRemove : function() { + colorBox.unbind(); + }, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var width = widthBox.val(), + height = heightBox.val(), + widthType = widthTypeBox.val(), + heightType = heightTypeBox.val(), + padding = paddingBox.val(), + spacing = spacingBox.val(), + textAlign = textAlignBox.val(), + verticalAlign = verticalAlignBox.val(), + border = borderBox.val(), + borderColor = K(colorBox[0]).html() || '', + bgColor = K(colorBox[1]).html() || ''; + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + if (!/^\d*$/.test(border)) { + alert(self.lang('invalidBorder')); + borderBox[0].focus(); + return; + } + cell.css({ + width : width !== '' ? (width + widthType) : '', + height : height !== '' ? (height + heightType) : '', + 'background-color' : bgColor, + 'text-align' : textAlign, + 'vertical-align' : verticalAlign, + 'border-width' : border, + 'border-style' : border !== '' ? 'solid' : '', + 'border-color' : borderColor + }); + self.hideDialog().focus(); + self.addBookmark(); + } + } + }), + div = dialog.div, + widthBox = K('[name="width"]', div).val(100), + heightBox = K('[name="height"]', div), + widthTypeBox = K('[name="widthType"]', div), + heightTypeBox = K('[name="heightType"]', div), + paddingBox = K('[name="padding"]', div).val(2), + spacingBox = K('[name="spacing"]', div).val(0), + textAlignBox = K('[name="textAlign"]', div), + verticalAlignBox = K('[name="verticalAlign"]', div), + borderBox = K('[name="border"]', div).val(1), + colorBox = K('.ke-input-color', div); + _initColorPicker(div, colorBox.eq(0)); + _initColorPicker(div, colorBox.eq(1)); + _setColor(colorBox.eq(0), '#000000'); + _setColor(colorBox.eq(1), ''); + // foucs and select + widthBox[0].focus(); + widthBox[0].select(); + // get selected cell + var cell = self.plugin.getSelectedCell(); + var match, + cellWidth = cell[0].style.width || cell[0].width || '', + cellHeight = cell[0].style.height || cell[0].height || ''; + if ((match = /^(\d+)((?:px|%)*)$/.exec(cellWidth))) { + widthBox.val(match[1]); + widthTypeBox.val(match[2]); + } else { + widthBox.val(''); + } + if ((match = /^(\d+)((?:px|%)*)$/.exec(cellHeight))) { + heightBox.val(match[1]); + heightTypeBox.val(match[2]); + } + textAlignBox.val(cell[0].style.textAlign || ''); + verticalAlignBox.val(cell[0].style.verticalAlign || ''); + var border = cell[0].style.borderWidth || ''; + if (border) { + border = parseInt(border); + } + borderBox.val(border); + _setColor(colorBox.eq(0), K.toHex(cell[0].style.borderColor || '')); + _setColor(colorBox.eq(1), K.toHex(cell[0].style.backgroundColor || '')); + widthBox[0].focus(); + widthBox[0].select(); + }, + insert : function() { + this.prop(true); + }, + 'delete' : function() { + var table = self.plugin.getSelectedTable(); + self.cmd.range.setStartBefore(table[0]).collapse(true); + self.cmd.select(); + table.remove(); + self.addBookmark(); + }, + colinsert : function(offset) { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + index = cell.cellIndex + offset; + for (var i = 0, len = table.rows.length; i < len; i++) { + var newRow = table.rows[i], + newCell = newRow.insertCell(index); + newCell.innerHTML = K.IE ? '' : '
    '; + // 调整下一行的单元格index + index = _getCellIndex(table, newRow, newCell); + } + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + colinsertleft : function() { + this.colinsert(0); + }, + colinsertright : function() { + this.colinsert(1); + }, + rowinsert : function(offset) { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + newRow; + if (offset === 1) { + newRow = table.insertRow(row.rowIndex + (cell.rowSpan - 1) + offset); + } else { + newRow = table.insertRow(row.rowIndex); + } + for (var i = 0, len = row.cells.length; i < len; i++) { + var newCell = newRow.insertCell(i); + // copy colspan + if (offset === 1 && row.cells[i].colSpan > 1) { + newCell.colSpan = row.cells[i].colSpan; + } + newCell.innerHTML = K.IE ? '' : '
    '; + } + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + rowinsertabove : function() { + this.rowinsert(0); + }, + rowinsertbelow : function() { + this.rowinsert(1); + }, + rowmerge : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + rowIndex = row.rowIndex, // 当前行的index + nextRowIndex = rowIndex + cell.rowSpan, // 下一行的index + nextRow = table.rows[nextRowIndex]; // 下一行 + // 最后一行不能合并 + if (table.rows.length <= nextRowIndex) { + return; + } + var cellIndex = _getCellIndex(table, row, cell); // 下一行单元格的index + if (nextRow.cells.length <= cellIndex) { + return; + } + var nextCell = nextRow.cells[cellIndex]; // 下一行单元格 + // 上下行的colspan不一致时不能合并 + if (cell.colSpan !== nextCell.colSpan) { + return; + } + cell.rowSpan += nextCell.rowSpan; + nextRow.deleteCell(cellIndex); + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + colmerge : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + rowIndex = row.rowIndex, // 当前行的index + cellIndex = cell.cellIndex, + nextCellIndex = cellIndex + 1; + // 最后一列不能合并 + if (row.cells.length <= nextCellIndex) { + return; + } + var nextCell = row.cells[nextCellIndex]; + // 左右列的rowspan不一致时不能合并 + if (cell.rowSpan !== nextCell.rowSpan) { + return; + } + cell.colSpan += nextCell.colSpan; + row.deleteCell(nextCellIndex); + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + rowsplit : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + rowIndex = row.rowIndex; + // 不是可分割单元格 + if (cell.rowSpan === 1) { + return; + } + var cellIndex = _getCellIndex(table, row, cell); + for (var i = 1, len = cell.rowSpan; i < len; i++) { + var newRow = table.rows[rowIndex + i], + newCell = newRow.insertCell(cellIndex); + if (cell.colSpan > 1) { + newCell.colSpan = cell.colSpan; + } + newCell.innerHTML = K.IE ? '' : '
    '; + // 调整下一行的单元格index + cellIndex = _getCellIndex(table, newRow, newCell); + } + K(cell).removeAttr('rowSpan'); + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + colsplit : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + cellIndex = cell.cellIndex; + // 不是可分割单元格 + if (cell.colSpan === 1) { + return; + } + for (var i = 1, len = cell.colSpan; i < len; i++) { + var newCell = row.insertCell(cellIndex + i); + if (cell.rowSpan > 1) { + newCell.rowSpan = cell.rowSpan; + } + newCell.innerHTML = K.IE ? '' : '
    '; + } + K(cell).removeAttr('colSpan'); + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + coldelete : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + index = cell.cellIndex; + for (var i = 0, len = table.rows.length; i < len; i++) { + var newRow = table.rows[i], + newCell = newRow.cells[index]; + if (newCell.colSpan > 1) { + newCell.colSpan -= 1; + if (newCell.colSpan === 1) { + K(newCell).removeAttr('colSpan'); + } + } else { + newRow.deleteCell(index); + } + // 跳过不需要删除的行 + if (newCell.rowSpan > 1) { + i += newCell.rowSpan - 1; + } + } + if (row.cells.length === 0) { + self.cmd.range.setStartBefore(table).collapse(true); + self.cmd.select(); + K(table).remove(); + } else { + self.cmd.selection(true); + } + self.addBookmark(); + }, + rowdelete : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + rowIndex = row.rowIndex; + // 从下到上删除 + for (var i = cell.rowSpan - 1; i >= 0; i--) { + table.deleteRow(rowIndex + i); + } + if (table.rows.length === 0) { + self.cmd.range.setStartBefore(table).collapse(true); + self.cmd.select(); + K(table).remove(); + } else { + self.cmd.selection(true); + } + self.addBookmark(); + } + }; + self.clickToolbar(name, self.plugin.table.prop); +}); diff --git a/WebRoot/js/kindeditor/plugins/template/html/1.html b/WebRoot/js/kindeditor/plugins/template/html/1.html new file mode 100644 index 0000000..034126b --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/template/html/1.html @@ -0,0 +1,14 @@ + + + + + + +

    + 在此处输入标题 +

    +

    + 在此处输入内容 +

    + + \ No newline at end of file diff --git a/WebRoot/js/kindeditor/plugins/template/html/2.html b/WebRoot/js/kindeditor/plugins/template/html/2.html new file mode 100644 index 0000000..dc2584a --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/template/html/2.html @@ -0,0 +1,42 @@ + + + + + + +

    + 标题 +

    + + + + + + + + + + + + + + + +
    +

    标题1

    +
    +

    标题1

    +
    + 内容1 + + 内容2 +
    + 内容3 + + 内容4 +
    +

    + 表格说明 +

    + + \ No newline at end of file diff --git a/WebRoot/js/kindeditor/plugins/template/html/3.html b/WebRoot/js/kindeditor/plugins/template/html/3.html new file mode 100644 index 0000000..873f0c6 --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/template/html/3.html @@ -0,0 +1,36 @@ + + + + + + +

    + 在此处输入内容 +

    +
      +
    1. + 描述1 +
    2. +
    3. + 描述2 +
    4. +
    5. + 描述3 +
    6. +
    +

    + 在此处输入内容 +

    +
      +
    • + 描述1 +
    • +
    • + 描述2 +
    • +
    • + 描述3 +
    • +
    + + \ No newline at end of file diff --git a/WebRoot/js/kindeditor/plugins/template/template.js b/WebRoot/js/kindeditor/plugins/template/template.js new file mode 100644 index 0000000..9df2a57 --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/template/template.js @@ -0,0 +1,58 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('template', function(K) { + var self = this, name = 'template', lang = self.lang(name + '.'), + htmlPath = self.pluginsPath + name + '/html/'; + function getFilePath(fileName) { + return htmlPath + fileName + '?ver=' + encodeURIComponent(K.DEBUG ? K.TIME : K.VERSION); + } + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + arr = ['
    ', + '
    ', + // left start + '
    ', + lang. selectTemplate + '
    ', + // right start + '
    ', + ' ', + '
    ', + '
    ', + '
    ', + '', + '
    '].join(''); + var dialog = self.createDialog({ + name : name, + width : 500, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var doc = K.iframeDoc(iframe); + self[checkbox[0].checked ? 'html' : 'insertHtml'](doc.body.innerHTML).hideDialog().focus(); + } + } + }); + var selectBox = K('select', dialog.div), + checkbox = K('[name="replaceFlag"]', dialog.div), + iframe = K('iframe', dialog.div); + checkbox[0].checked = true; + iframe.attr('src', getFilePath(selectBox.val())); + selectBox.change(function() { + iframe.attr('src', getFilePath(this.value)); + }); + }); +}); diff --git a/WebRoot/js/kindeditor/plugins/wordpaste/wordpaste.js b/WebRoot/js/kindeditor/plugins/wordpaste/wordpaste.js new file mode 100644 index 0000000..22061e1 --- /dev/null +++ b/WebRoot/js/kindeditor/plugins/wordpaste/wordpaste.js @@ -0,0 +1,51 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('wordpaste', function(K) { + var self = this, name = 'wordpaste'; + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + html = '
    ' + + '
    ' + lang.comment + '
    ' + + '' + + '
    ', + dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var str = doc.body.innerHTML; + str = K.clearMsWord(str, self.filterMode ? self.htmlTags : K.options.htmlTags); + self.insertHtml(str).hideDialog().focus(); + } + } + }), + div = dialog.div, + iframe = K('iframe', div), + doc = K.iframeDoc(iframe); + if (!K.IE) { + doc.designMode = 'on'; + } + doc.open(); + doc.write('WordPaste'); + doc.write(''); + if (!K.IE) { + doc.write('
    '); + } + doc.write(''); + doc.close(); + if (K.IE) { + doc.body.contentEditable = 'true'; + } + iframe[0].contentWindow.focus(); + }); +}); diff --git a/WebRoot/js/kindeditor/themes/common/anchor.gif b/WebRoot/js/kindeditor/themes/common/anchor.gif new file mode 100644 index 0000000..61145ea Binary files /dev/null and b/WebRoot/js/kindeditor/themes/common/anchor.gif differ diff --git a/WebRoot/js/kindeditor/themes/common/blank.gif b/WebRoot/js/kindeditor/themes/common/blank.gif new file mode 100644 index 0000000..5bfd67a Binary files /dev/null and b/WebRoot/js/kindeditor/themes/common/blank.gif differ diff --git a/WebRoot/js/kindeditor/themes/common/flash.gif b/WebRoot/js/kindeditor/themes/common/flash.gif new file mode 100644 index 0000000..2cb12b2 Binary files /dev/null and b/WebRoot/js/kindeditor/themes/common/flash.gif differ diff --git a/WebRoot/js/kindeditor/themes/common/loading.gif b/WebRoot/js/kindeditor/themes/common/loading.gif new file mode 100644 index 0000000..c69e937 Binary files /dev/null and b/WebRoot/js/kindeditor/themes/common/loading.gif differ diff --git a/WebRoot/js/kindeditor/themes/common/media.gif b/WebRoot/js/kindeditor/themes/common/media.gif new file mode 100644 index 0000000..e1c0e30 Binary files /dev/null and b/WebRoot/js/kindeditor/themes/common/media.gif differ diff --git a/WebRoot/js/kindeditor/themes/common/rm.gif b/WebRoot/js/kindeditor/themes/common/rm.gif new file mode 100644 index 0000000..d013d55 Binary files /dev/null and b/WebRoot/js/kindeditor/themes/common/rm.gif differ diff --git a/WebRoot/js/kindeditor/themes/default/background.png b/WebRoot/js/kindeditor/themes/default/background.png new file mode 100644 index 0000000..bbfb056 Binary files /dev/null and b/WebRoot/js/kindeditor/themes/default/background.png differ diff --git a/WebRoot/js/kindeditor/themes/default/default.css b/WebRoot/js/kindeditor/themes/default/default.css new file mode 100644 index 0000000..a937239 --- /dev/null +++ b/WebRoot/js/kindeditor/themes/default/default.css @@ -0,0 +1,1029 @@ +/* common */ +.ke-inline-block { + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-clearfix { + zoom: 1; +} +.ke-clearfix:after { + content: "."; + display: block; + clear: both; + font-size: 0; + height: 0; + line-height: 0; + visibility: hidden; +} +.ke-shadow { + box-shadow: 1px 1px 3px #A0A0A0; + -moz-box-shadow: 1px 1px 3px #A0A0A0; + -webkit-box-shadow: 1px 1px 3px #A0A0A0; + filter: progid:DXImageTransform.Microsoft.Shadow(color='#A0A0A0', Direction=135, Strength=3); + background-color: #F0F0EE; +} +.ke-menu a, +.ke-menu a:hover, +.ke-dialog a, +.ke-dialog a:hover { + color: #337FE5; + text-decoration: none; +} +/* icons */ +.ke-icon-source { + background-position: 0px 0px; + width: 16px; + height: 16px; +} +.ke-icon-preview { + background-position: 0px -16px; + width: 16px; + height: 16px; +} +.ke-icon-print { + background-position: 0px -32px; + width: 16px; + height: 16px; +} +.ke-icon-undo { + background-position: 0px -48px; + width: 16px; + height: 16px; +} +.ke-icon-redo { + background-position: 0px -64px; + width: 16px; + height: 16px; +} +.ke-icon-cut { + background-position: 0px -80px; + width: 16px; + height: 16px; +} +.ke-icon-copy { + background-position: 0px -96px; + width: 16px; + height: 16px; +} +.ke-icon-paste { + background-position: 0px -112px; + width: 16px; + height: 16px; +} +.ke-icon-selectall { + background-position: 0px -128px; + width: 16px; + height: 16px; +} +.ke-icon-justifyleft { + background-position: 0px -144px; + width: 16px; + height: 16px; +} +.ke-icon-justifycenter { + background-position: 0px -160px; + width: 16px; + height: 16px; +} +.ke-icon-justifyright { + background-position: 0px -176px; + width: 16px; + height: 16px; +} +.ke-icon-justifyfull { + background-position: 0px -192px; + width: 16px; + height: 16px; +} +.ke-icon-insertorderedlist { + background-position: 0px -208px; + width: 16px; + height: 16px; +} +.ke-icon-insertunorderedlist { + background-position: 0px -224px; + width: 16px; + height: 16px; +} +.ke-icon-indent { + background-position: 0px -240px; + width: 16px; + height: 16px; +} +.ke-icon-outdent { + background-position: 0px -256px; + width: 16px; + height: 16px; +} +.ke-icon-subscript { + background-position: 0px -272px; + width: 16px; + height: 16px; +} +.ke-icon-superscript { + background-position: 0px -288px; + width: 16px; + height: 16px; +} +.ke-icon-date { + background-position: 0px -304px; + width: 25px; + height: 16px; +} +.ke-icon-time { + background-position: 0px -320px; + width: 25px; + height: 16px; +} +.ke-icon-formatblock { + background-position: 0px -336px; + width: 25px; + height: 16px; +} +.ke-icon-fontname { + background-position: 0px -352px; + width: 21px; + height: 16px; +} +.ke-icon-fontsize { + background-position: 0px -368px; + width: 23px; + height: 16px; +} +.ke-icon-forecolor { + background-position: 0px -384px; + width: 20px; + height: 16px; +} +.ke-icon-hilitecolor { + background-position: 0px -400px; + width: 23px; + height: 16px; +} +.ke-icon-bold { + background-position: 0px -416px; + width: 16px; + height: 16px; +} +.ke-icon-italic { + background-position: 0px -432px; + width: 16px; + height: 16px; +} +.ke-icon-underline { + background-position: 0px -448px; + width: 16px; + height: 16px; +} +.ke-icon-strikethrough { + background-position: 0px -464px; + width: 16px; + height: 16px; +} +.ke-icon-removeformat { + background-position: 0px -480px; + width: 16px; + height: 16px; +} +.ke-icon-image { + background-position: 0px -496px; + width: 16px; + height: 16px; +} +.ke-icon-flash { + background-position: 0px -512px; + width: 16px; + height: 16px; +} +.ke-icon-media { + background-position: 0px -528px; + width: 16px; + height: 16px; +} +.ke-icon-div { + background-position: 0px -544px; + width: 16px; + height: 16px; +} +.ke-icon-formula { + background-position: 0px -576px; + width: 16px; + height: 16px; +} +.ke-icon-hr { + background-position: 0px -592px; + width: 16px; + height: 16px; +} +.ke-icon-emoticons { + background-position: 0px -608px; + width: 16px; + height: 16px; +} +.ke-icon-link { + background-position: 0px -624px; + width: 16px; + height: 16px; +} +.ke-icon-unlink { + background-position: 0px -640px; + width: 16px; + height: 16px; +} +.ke-icon-fullscreen { + background-position: 0px -656px; + width: 16px; + height: 16px; +} +.ke-icon-about { + background-position: 0px -672px; + width: 16px; + height: 16px; +} +.ke-icon-plainpaste { + background-position: 0px -704px; + width: 16px; + height: 16px; +} +.ke-icon-wordpaste { + background-position: 0px -720px; + width: 16px; + height: 16px; +} +.ke-icon-table { + background-position: 0px -784px; + width: 16px; + height: 16px; +} +.ke-icon-tablemenu { + background-position: 0px -768px; + width: 16px; + height: 16px; +} +.ke-icon-tableinsert { + background-position: 0px -784px; + width: 16px; + height: 16px; +} +.ke-icon-tabledelete { + background-position: 0px -800px; + width: 16px; + height: 16px; +} +.ke-icon-tablecolinsertleft { + background-position: 0px -816px; + width: 16px; + height: 16px; +} +.ke-icon-tablecolinsertright { + background-position: 0px -832px; + width: 16px; + height: 16px; +} +.ke-icon-tablerowinsertabove { + background-position: 0px -848px; + width: 16px; + height: 16px; +} +.ke-icon-tablerowinsertbelow { + background-position: 0px -864px; + width: 16px; + height: 16px; +} +.ke-icon-tablecoldelete { + background-position: 0px -880px; + width: 16px; + height: 16px; +} +.ke-icon-tablerowdelete { + background-position: 0px -896px; + width: 16px; + height: 16px; +} +.ke-icon-tablecellprop { + background-position: 0px -912px; + width: 16px; + height: 16px; +} +.ke-icon-tableprop { + background-position: 0px -928px; + width: 16px; + height: 16px; +} +.ke-icon-checked { + background-position: 0px -944px; + width: 16px; + height: 16px; +} +.ke-icon-code { + background-position: 0px -960px; + width: 16px; + height: 16px; +} +.ke-icon-map { + background-position: 0px -976px; + width: 16px; + height: 16px; +} +.ke-icon-lineheight { + background-position: 0px -992px; + width: 16px; + height: 16px; +} +.ke-icon-clearhtml { + background-position: 0px -1008px; + width: 16px; + height: 16px; +} +.ke-icon-pagebreak { + background-position: 0px -1024px; + width: 16px; + height: 16px; +} +.ke-icon-insertfile { + background-position: 0px -1040px; + width: 16px; + height: 16px; +} +.ke-icon-quickformat { + background-position: 0px -1056px; + width: 16px; + height: 16px; +} +.ke-icon-template { + background-position: 0px -1072px; + width: 16px; + height: 16px; +} +.ke-icon-tablecellsplit { + background-position: 0px -1088px; + width: 16px; + height: 16px; +} +.ke-icon-tablerowmerge { + background-position: 0px -1104px; + width: 16px; + height: 16px; +} +.ke-icon-tablerowsplit { + background-position: 0px -1120px; + width: 16px; + height: 16px; +} +.ke-icon-tablecolmerge { + background-position: 0px -1136px; + width: 16px; + height: 16px; +} +.ke-icon-tablecolsplit { + background-position: 0px -1152px; + width: 16px; + height: 16px; +} +.ke-icon-anchor { + background-position: 0px -1168px; + width: 16px; + height: 16px; +} +.ke-icon-search { + background-position: 0px -1184px; + width: 16px; + height: 16px; +} +.ke-icon-new { + background-position: 0px -1200px; + width: 16px; + height: 16px; +} +.ke-icon-specialchar { + background-position: 0px -1216px; + width: 16px; + height: 16px; +} +/* container */ +.ke-container { + display: block; + border: 1px solid #CCCCCC; + background-color: #FFF; + overflow: hidden; + margin: 0; + padding: 0; +} +/* toolbar */ +.ke-toolbar { + border-bottom: 1px solid #CCC; + background-color: #F0F0EE; + padding: 2px 5px; + text-align: left; + overflow: hidden; + zoom: 1; +} +.ke-toolbar-icon { + background-repeat: no-repeat; + font-size: 0; + line-height: 0; + overflow: hidden; + display: block; +} +.ke-toolbar-icon-url { + background-image: url(default.png); +} +.ke-toolbar .ke-outline { + border: 1px solid #F0F0EE; + margin: 1px; + padding: 1px 2px; + font-size: 0; + line-height: 0; + overflow: hidden; + cursor: pointer; + display: block; + float: left; +} +.ke-toolbar .ke-on { + border: 1px solid #5690D2; +} +.ke-toolbar .ke-selected { + border: 1px solid #5690D2; + background-color: #E9EFF6; +} +.ke-toolbar .ke-disabled { + cursor: default; +} +.ke-toolbar .ke-separator { + height: 16px; + margin: 2px 3px; + border-left: 1px solid #A0A0A0; + border-right: 1px solid #FFFFFF; + border-top:0; + border-bottom:0; + width: 0; + font-size: 0; + line-height: 0; + overflow: hidden; + display: block; + float: left; +} +.ke-toolbar .ke-hr { + overflow: hidden; + height: 1px; + clear: both; +} +/* edit */ +.ke-edit { + padding: 0; +} +.ke-edit-iframe, +.ke-edit-textarea { + border: 0; + margin: 0; + padding: 0; + overflow: auto; +} +.ke-edit-textarea { + font: 12px/1.5 "Consolas", "Monaco", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; + color: #000; + overflow: auto; + resize: none; +} +.ke-edit-textarea:focus { + outline: none; +} +/* statusbar */ +.ke-statusbar { + position: relative; + background-color: #F0F0EE; + border-top: 1px solid #CCCCCC; + font-size: 0; + line-height: 0; + *height: 12px; + overflow: hidden; + text-align: center; + cursor: s-resize; +} +.ke-statusbar-center-icon { + background-position: -0px -754px; + width: 15px; + height: 11px; + background-image: url(default.png); +} +.ke-statusbar-right-icon { + position: absolute; + right: 0; + bottom: 0; + cursor: se-resize; + background-position: -5px -741px; + width: 11px; + height: 11px; + background-image: url(default.png); +} +/* menu */ +.ke-menu { + border: 1px solid #A0A0A0; + background-color: #F1F1F1; + color: #222222; + padding: 2px; + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + text-align: left; + overflow: hidden; +} +.ke-menu-item { + border: 1px solid #F1F1F1; + background-color: #F1F1F1; + color: #222222; + height: 24px; + overflow: hidden; + cursor: pointer; +} +.ke-menu-item-on { + border: 1px solid #5690D2; + background-color: #E9EFF6; +} +.ke-menu-item-left { + width: 27px; + text-align: center; + overflow: hidden; +} +.ke-menu-item-center { + width: 0; + height: 24px; + border-left: 1px solid #E3E3E3; + border-right: 1px solid #FFFFFF; + border-top: 0; + border-bottom: 0; +} +.ke-menu-item-center-on { + border-left: 1px solid #E9EFF6; + border-right: 1px solid #E9EFF6; +} +.ke-menu-item-right { + border: 0; + padding: 0 0 0 5px; + line-height: 24px; + text-align: left; + overflow: hidden; +} +.ke-menu-separator { + margin: 2px 0; + height: 0; + overflow: hidden; + border-top: 1px solid #CCCCCC; + border-bottom: 1px solid #FFFFFF; + border-left: 0; + border-right: 0; +} +/* colorpicker */ +.ke-colorpicker { + border: 1px solid #A0A0A0; + background-color: #F1F1F1; + color: #222222; + padding: 2px; +} +.ke-colorpicker-table { + border:0; + margin:0; + padding:0; + border-collapse: separate; +} +.ke-colorpicker-cell { + font-size: 0; + line-height: 0; + border: 1px solid #F0F0EE; + cursor: pointer; + margin:3px; + padding:0; +} +.ke-colorpicker-cell-top { + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + line-height: 24px; + border: 1px solid #F0F0EE; + cursor: pointer; + margin:0; + padding:0; + text-align: center; +} +.ke-colorpicker-cell-on { + border: 1px solid #5690D2; +} +.ke-colorpicker-cell-selected { + border: 1px solid #2446AB; +} +.ke-colorpicker-cell-color { + width: 14px; + height: 14px; + margin: 3px; + padding: 0; + border: 0; +} +/* dialog */ +.ke-dialog { + position: absolute; + margin: 0; + padding: 0; +} +.ke-dialog-content { + background-color: #FFF; + width: 100%; + height: 100%; + color: #333; + border: 1px solid #A0A0A0; +} +.ke-dialog-shadow { + position: absolute; + z-index: -1; + top: 0; + left: 0; + width: 100%; + height: 100%; + box-shadow: 3px 3px 7px #999; + -moz-box-shadow: 3px 3px 7px #999; + -webkit-box-shadow: 3px 3px 7px #999; + filter: progid:DXImageTransform.Microsoft.Blur(PixelRadius='3', MakeShadow='true', ShadowOpacity='0.4'); + background-color: #F0F0EE; +} +.ke-dialog-header { + border:0; + margin:0; + padding: 0 10px; + background: url(background.png) repeat scroll 0 0 #F0F0EE; + border-bottom: 1px solid #CFCFCF; + height: 25px; + font: 12px/25px "sans serif",tahoma,verdana,helvetica; + text-align: left; + color: #222; + cursor: move; +} +.ke-dialog-icon-close { + display: block; + background: url(default.png) no-repeat scroll 0px -688px; + width: 16px; + height: 16px; + position: absolute; + right: 6px; + top: 6px; + cursor: pointer; +} +.ke-dialog-body { + font: 12px/1.5 "sans serif",tahoma,verdana,helvetica; + text-align: left; + overflow: hidden; +} +.ke-dialog-body textarea { + display: block; + overflow: auto; + padding: 0; + resize: none; +} +.ke-dialog-body textarea:focus, +.ke-dialog-body input:focus, +.ke-dialog-body select:focus { + outline: none; +} +.ke-dialog-body label { + margin-right: 10px; + cursor: pointer; + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-dialog-body img { + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-dialog-body select { + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; + width: auto; +} +.ke-dialog-body .ke-textarea { + display: block; + width: 408px; + height: 260px; + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + border-color: #848484 #E0E0E0 #E0E0E0 #848484; + border-style: solid; + border-width: 1px; +} +.ke-dialog-body .ke-form { + margin: 0; + padding: 0; +} +.ke-dialog-loading { + position: absolute; + top: 0; + left: 1px; + z-index: 1; + text-align: center; +} +.ke-dialog-loading-content { + background: url("../common/loading.gif") no-repeat; + color: #666; + font-size: 14px; + font-weight: bold; + height: 31px; + line-height: 31px; + padding-left: 36px; +} +.ke-dialog-row { + margin-bottom: 10px; +} +.ke-dialog-footer { + font: 12px/1 "sans serif",tahoma,verdana,helvetica; + text-align: right; + padding:0 0 5px 0; + background-color: #FFF; +} +.ke-dialog-preview, +.ke-dialog-yes { + margin: 5px; +} +.ke-dialog-no { + margin: 5px 10px 5px 5px; +} +.ke-dialog-mask { + background-color:#FFF; + filter:alpha(opacity=50); + opacity:0.5; +} +.ke-button-common { + background: url(background.png) no-repeat scroll 0 -25px transparent; + cursor: pointer; + height: 23px; + line-height: 23px; + overflow: visible; + display: inline-block; + vertical-align: top; + cursor: pointer; +} +.ke-button-outer { + background-position: 0 -25px; + padding: 0; + position: relative; + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-button { + background-position: right -25px; + padding: 0 12px; + margin: 0; + font-family: "sans serif",tahoma,verdana,helvetica; + border: 0 none; + color: #333; + font-size: 12px; + left: 2px; + text-decoration: none; +} +/* inputbox */ +.ke-input-text { + background-color:#FFFFFF; + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + line-height: 17px; + height: 17px; + padding: 2px 4px; + border-color: #848484 #E0E0E0 #E0E0E0 #848484; + border-style: solid; + border-width: 1px; + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-input-number { + width: 50px; +} +.ke-input-color { + border: 1px solid #A0A0A0; + background-color: #FFFFFF; + font-size: 12px; + width: 60px; + height: 20px; + line-height: 20px; + padding-left: 5px; + overflow: hidden; + cursor: pointer; + display: -moz-inline-stack; + display: inline-block; + vertical-align: middle; + zoom: 1; + *display: inline; +} +.ke-upload-area { + position: relative; + overflow: hidden; + margin: 0; + padding: 0; +} +.ke-upload-area .ke-upload-file { + position: absolute; + top: 0; + right: 0; + height: 25px; + padding: 0; + margin: 0; + z-index: 811212; + border: 0 none; + opacity: 0; + filter: alpha(opacity=0); +} +/* tabs */ +.ke-tabs { + font: 12px/1 "sans serif",tahoma,verdana,helvetica; + border-bottom:1px solid #A0A0A0; + padding-left:5px; + margin-bottom:10px; +} +.ke-tabs-ul { + list-style-image:none; + list-style-position:outside; + list-style-type:none; + margin:0; + padding:0; +} +.ke-tabs-li { + position: relative; + border: 1px solid #A0A0A0; + background-color: #F0F0EE; + margin: 0 2px -1px 0; + padding: 0 20px; + float: left; + line-height: 25px; + text-align: center; + color: #555555; + cursor: pointer; +} +.ke-tabs-li-selected { + background-color: #FFF; + border-bottom: 1px solid #FFF; + color: #000; + cursor: default; +} +.ke-tabs-li-on { + background-color: #FFF; + color: #000; +} +/* emoticons */ +.ke-plugin-emoticons { + position: relative; +} +.ke-plugin-emoticons .ke-preview { + position: absolute; + text-align: center; + margin: 2px; + padding: 10px; + top: 0; + border: 1px solid #A0A0A0; + background-color: #FFFFFF; + display: none; +} +.ke-plugin-emoticons .ke-preview-img { + border:0; + margin:0; + padding:0; +} +.ke-plugin-emoticons .ke-table { + border:0; + margin:0; + padding:0; + border-collapse:separate; +} +.ke-plugin-emoticons .ke-cell { + margin:0; + padding:1px; + border:1px solid #F0F0EE; + cursor:pointer; +} +.ke-plugin-emoticons .ke-on { + border: 1px solid #5690D2; + background-color: #E9EFF6; +} +.ke-plugin-emoticons .ke-img { + display:block; + background-repeat:no-repeat; + overflow:hidden; + margin:2px; + width:24px; + height:24px; + margin: 0; + padding: 0; + border: 0; +} +.ke-plugin-emoticons .ke-page { + text-align: right; + margin: 5px; + padding: 0; + border: 0; + font: 12px/1 "sans serif",tahoma,verdana,helvetica; + color: #333; + text-decoration: none; +} +.ke-plugin-plainpaste-textarea, +.ke-plugin-wordpaste-iframe { + display: block; + width: 408px; + height: 260px; + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + border-color: #848484 #E0E0E0 #E0E0E0 #848484; + border-style: solid; + border-width: 1px; +} +/* filemanager */ +.ke-plugin-filemanager-header { + width: 100%; + margin-bottom: 10px; +} +.ke-plugin-filemanager-header .ke-left { + float: left; +} +.ke-plugin-filemanager-header .ke-right { + float: right; +} +.ke-plugin-filemanager-body { + overflow: scroll; + background-color:#FFFFFF; + border-color: #848484 #E0E0E0 #E0E0E0 #848484; + border-style: solid; + border-width: 1px; + width: 470px; + height: 370px; + padding: 5px; +} +.ke-plugin-filemanager-body .ke-item { + width: 100px; + margin: 5px; +} +.ke-plugin-filemanager-body .ke-photo { + border: 1px solid #DDDDDD; + background-color:#FFFFFF; + padding: 10px; +} +.ke-plugin-filemanager-body .ke-name { + width: 100px; + text-align: center; + overflow: hidden; + height:16px; +} +.ke-plugin-filemanager-body .ke-on { + border: 1px solid #5690D2; + background-color: #E9EFF6; +} +.ke-plugin-filemanager-body .ke-table { + width: 95%; + border: 0; + margin: 0; + padding: 0; + border-collapse: separate; +} +.ke-plugin-filemanager-body .ke-table .ke-cell { + margin: 0; + padding: 0; + border: 0; +} +.ke-plugin-filemanager-body .ke-table .ke-name { + width: 55%; + text-align: left; +} +.ke-plugin-filemanager-body .ke-table .ke-size { + width: 15%; + text-align: left; +} +.ke-plugin-filemanager-body .ke-table .ke-datetime { + width: 30%; + text-align: center; +} +/* template */ +.ke-plugin-template .ke-header { + width: 100%; + margin-bottom: 10px; +} +.ke-plugin-template label { + margin-right: 0; + cursor: pointer; + font-weight: normal; + display: inline; + vertical-align: top; +} +.ke-plugin-template .ke-left { + float: left; +} +.ke-plugin-template .ke-right { + float: right; +} \ No newline at end of file diff --git a/WebRoot/js/kindeditor/themes/default/default.png b/WebRoot/js/kindeditor/themes/default/default.png new file mode 100644 index 0000000..6e9098e Binary files /dev/null and b/WebRoot/js/kindeditor/themes/default/default.png differ diff --git a/WebRoot/js/kindeditor/themes/simple/simple.css b/WebRoot/js/kindeditor/themes/simple/simple.css new file mode 100644 index 0000000..4c76cf9 --- /dev/null +++ b/WebRoot/js/kindeditor/themes/simple/simple.css @@ -0,0 +1,100 @@ +/* container */ +.ke-container-simple { + display: block; + border: 1px solid #CCC; + background-color: #FFF; + overflow: hidden; +} +/* toolbar */ +.ke-container-simple .ke-toolbar { + border-bottom: 1px solid #CCC; + background-color: #FFF; + padding: 2px 5px; + overflow: hidden; +} +.ke-container-simple .ke-toolbar .ke-outline { + border: 1px solid #FFF; + background-color: transparent; + margin: 1px; + padding: 1px 2px; + font-size: 0; + line-height: 0; + overflow: hidden; + cursor: pointer; +} +.ke-container-simple .ke-toolbar .ke-on { + border: 1px solid #5690D2; +} +.ke-container-simple .ke-toolbar .ke-selected { + border: 1px solid #5690D2; + background-color: #E9EFF6; +} +.ke-container-simple .ke-toolbar .ke-disabled { + cursor: default; +} +/* statusbar */ +.ke-container-simple .ke-statusbar { + position: relative; + background-color: #FFF; + border-top: 1px solid #CCCCCC; + font-size: 0; + line-height: 0; + *height: 12px; + overflow: hidden; + text-align: center; + cursor: s-resize; +} +/* menu */ +.ke-menu-simple { + border: 1px solid #A0A0A0; + background-color: #FFF; + color: #222222; + padding: 2px; + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + text-align: left; + overflow: hidden; +} +.ke-menu-simple .ke-menu-item { + border: 1px solid #FFF; + background-color: #FFF; + color: #222222; + height: 24px; + overflow: hidden; + cursor: pointer; +} +.ke-menu-simple .ke-menu-item-on { + border: 1px solid #5690D2; + background-color: #FFF; +} +/* colorpicker */ +.ke-colorpicker-simple { + border: 1px solid #A0A0A0; + background-color: #FEFEFE; + color: #222222; + padding: 2px; +} +.ke-colorpicker-simple .ke-colorpicker-cell { + font-size: 0; + line-height: 0; + border: 1px solid #FEFEFE; + cursor: pointer; + margin:3px; + padding:0; +} +.ke-colorpicker-simple .ke-colorpicker-cell-top { + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + line-height: 24px; + border: 1px solid #FEFEFE; + cursor: pointer; + margin:0; + padding:0; + text-align: center; +} +.ke-colorpicker-simple .ke-colorpicker-cell-on { + border: 1px solid #5690D2; +} +.ke-colorpicker-simple .ke-colorpicker-cell-selected { + border: 1px solid #2446AB; +} diff --git a/WebRoot/js/kindeditor/zh_CN.js b/WebRoot/js/kindeditor/zh_CN.js new file mode 100644 index 0000000..47d9d77 --- /dev/null +++ b/WebRoot/js/kindeditor/zh_CN.js @@ -0,0 +1,218 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.lang({ + source : 'HTML代码', + preview : '预览', + undo : '后退(Ctrl+Z)', + redo : '前进(Ctrl+Y)', + cut : '剪切(Ctrl+X)', + copy : '复制(Ctrl+C)', + paste : '粘贴(Ctrl+V)', + plainpaste : '粘贴为无格式文本', + wordpaste : '从Word粘贴', + selectall : '全选(Ctrl+A)', + justifyleft : '左对齐', + justifycenter : '居中', + justifyright : '右对齐', + justifyfull : '两端对齐', + insertorderedlist : '编号', + insertunorderedlist : '项目符号', + indent : '增加缩进', + outdent : '减少缩进', + subscript : '下标', + superscript : '上标', + formatblock : '段落', + fontname : '字体', + fontsize : '文字大小', + forecolor : '文字颜色', + hilitecolor : '文字背景', + bold : '粗体(Ctrl+B)', + italic : '斜体(Ctrl+I)', + underline : '下划线(Ctrl+U)', + strikethrough : '删除线', + removeformat : '删除格式', + image : '图片', + flash : 'Flash', + media : '视音频', + table : '表格', + tablecell : '单元格', + hr : '插入横线', + emoticons : '插入表情', + link : '超级链接', + unlink : '取消超级链接', + fullscreen : '全屏显示(Esc)', + about : '关于', + print : '打印(Ctrl+P)', + filemanager : '浏览服务器', + code : '插入程序代码', + map : 'Google地图', + lineheight : '行距', + clearhtml : '清理HTML代码', + pagebreak : '插入分页符', + quickformat : '一键排版', + insertfile : '插入文件', + template : '插入模板', + anchor : '锚点', + yes : '确定', + no : '取消', + close : '关闭', + editImage : '图片属性', + deleteImage : '删除图片', + editFlash : 'Flash属性', + deleteFlash : '删除Flash', + editMedia : '视音频属性', + deleteMedia : '删除视音频', + editLink : '超级链接属性', + deleteLink : '取消超级链接', + editAnchor : '锚点属性', + deleteAnchor : '删除锚点', + tableprop : '表格属性', + tablecellprop : '单元格属性', + tableinsert : '插入表格', + tabledelete : '删除表格', + tablecolinsertleft : '左侧插入列', + tablecolinsertright : '右侧插入列', + tablerowinsertabove : '上方插入行', + tablerowinsertbelow : '下方插入行', + tablerowmerge : '向下合并单元格', + tablecolmerge : '向右合并单元格', + tablerowsplit : '拆分行', + tablecolsplit : '拆分列', + tablecoldelete : '删除列', + tablerowdelete : '删除行', + noColor : '无颜色', + pleaseSelectFile : '请选择文件。', + invalidImg : "请输入有效的URL地址。\n只允许jpg,gif,bmp,png格式。", + invalidMedia : "请输入有效的URL地址。\n只允许swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb格式。", + invalidWidth : "宽度必须为数字。", + invalidHeight : "高度必须为数字。", + invalidBorder : "边框必须为数字。", + invalidUrl : "请输入有效的URL地址。", + invalidRows : '行数为必选项,只允许输入大于0的数字。', + invalidCols : '列数为必选项,只允许输入大于0的数字。', + invalidPadding : '边距必须为数字。', + invalidSpacing : '间距必须为数字。', + invalidJson : '服务器发生故障。', + uploadSuccess : '上传成功。', + cutError : '您的浏览器安全设置不允许使用剪切操作,请使用快捷键(Ctrl+X)来完成。', + copyError : '您的浏览器安全设置不允许使用复制操作,请使用快捷键(Ctrl+C)来完成。', + pasteError : '您的浏览器安全设置不允许使用粘贴操作,请使用快捷键(Ctrl+V)来完成。', + ajaxLoading : '加载中,请稍候 ...', + uploadLoading : '上传中,请稍候 ...', + uploadError : '上传错误', + 'plainpaste.comment' : '请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。', + 'wordpaste.comment' : '请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。', + 'link.url' : 'URL', + 'link.linkType' : '打开类型', + 'link.newWindow' : '新窗口', + 'link.selfWindow' : '当前窗口', + 'flash.url' : 'URL', + 'flash.width' : '宽度', + 'flash.height' : '高度', + 'flash.upload' : '上传', + 'flash.viewServer' : '浏览', + 'media.url' : 'URL', + 'media.width' : '宽度', + 'media.height' : '高度', + 'media.autostart' : '自动播放', + 'media.upload' : '上传', + 'media.viewServer' : '浏览', + 'image.remoteImage' : '远程图片', + 'image.localImage' : '本地上传', + 'image.remoteUrl' : '图片地址', + 'image.localUrl' : '图片地址', + 'image.size' : '图片大小', + 'image.width' : '宽', + 'image.height' : '高', + 'image.resetSize' : '重置大小', + 'image.align' : '对齐方式', + 'image.defaultAlign' : '默认方式', + 'image.leftAlign' : '左对齐', + 'image.rightAlign' : '右对齐', + 'image.imgTitle' : '图片说明', + 'image.viewServer' : '浏览...', + 'filemanager.emptyFolder' : '空文件夹', + 'filemanager.moveup' : '移到上一级文件夹', + 'filemanager.viewType' : '显示方式:', + 'filemanager.viewImage' : '缩略图', + 'filemanager.listImage' : '详细信息', + 'filemanager.orderType' : '排序方式:', + 'filemanager.fileName' : '名称', + 'filemanager.fileSize' : '大小', + 'filemanager.fileType' : '类型', + 'insertfile.url' : 'URL', + 'insertfile.title' : '文件说明', + 'insertfile.upload' : '上传', + 'insertfile.viewServer' : '浏览', + 'table.cells' : '单元格数', + 'table.rows' : '行数', + 'table.cols' : '列数', + 'table.size' : '大小', + 'table.width' : '宽度', + 'table.height' : '高度', + 'table.percent' : '%', + 'table.px' : 'px', + 'table.space' : '边距间距', + 'table.padding' : '边距', + 'table.spacing' : '间距', + 'table.align' : '对齐方式', + 'table.textAlign' : '水平对齐', + 'table.verticalAlign' : '垂直对齐', + 'table.alignDefault' : '默认', + 'table.alignLeft' : '左对齐', + 'table.alignCenter' : '居中', + 'table.alignRight' : '右对齐', + 'table.alignTop' : '顶部', + 'table.alignMiddle' : '中部', + 'table.alignBottom' : '底部', + 'table.alignBaseline' : '基线', + 'table.border' : '边框', + 'table.borderWidth' : '边框', + 'table.borderColor' : '颜色', + 'table.backgroundColor' : '背景颜色', + 'map.address' : '地址: ', + 'map.search' : '搜索', + 'anchor.name' : '锚点名称', + 'formatblock.formatBlock' : { + h1 : '标题 1', + h2 : '标题 2', + h3 : '标题 3', + h4 : '标题 4', + p : '正 文' + }, + 'fontname.fontName' : { + 'SimSun' : '宋体', + 'NSimSun' : '新宋体', + 'FangSong_GB2312' : '仿宋_GB2312', + 'KaiTi_GB2312' : '楷体_GB2312', + 'SimHei' : '黑体', + 'Microsoft YaHei' : '微软雅黑', + 'Arial' : 'Arial', + 'Arial Black' : 'Arial Black', + 'Times New Roman' : 'Times New Roman', + 'Courier New' : 'Courier New', + 'Tahoma' : 'Tahoma', + 'Verdana' : 'Verdana' + }, + 'lineheight.lineHeight' : [ + {'1' : '单倍行距'}, + {'1.5' : '1.5倍行距'}, + {'2' : '2倍行距'}, + {'2.5' : '2.5倍行距'}, + {'3' : '3倍行距'} + ], + 'template.selectTemplate' : '可选模板', + 'template.replaceContent' : '替换当前内容', + 'template.fileList' : { + '1.html' : '图片和文字', + '2.html' : '表格', + '3.html' : '项目编号' + } +}, 'zh_CN'); diff --git a/WebRoot/layout/_layout.html b/WebRoot/layout/_layout.html index 984cf3f..a585596 100644 --- a/WebRoot/layout/_layout.html +++ b/WebRoot/layout/_layout.html @@ -18,7 +18,6 @@ -