ueditor_rails4 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.markdown +45 -0
- data/Rakefile +40 -0
- data/app/assets/images/ueditor/themes/default/anchor.gif +0 -0
- data/app/assets/images/ueditor/themes/default/arrow.png +0 -0
- data/app/assets/images/ueditor/themes/default/button-bg.gif +0 -0
- data/app/assets/images/ueditor/themes/default/cancelbutton.gif +0 -0
- data/app/assets/images/ueditor/themes/default/cursor_h.gif +0 -0
- data/app/assets/images/ueditor/themes/default/cursor_h.png +0 -0
- data/app/assets/images/ueditor/themes/default/cursor_v.gif +0 -0
- data/app/assets/images/ueditor/themes/default/cursor_v.png +0 -0
- data/app/assets/images/ueditor/themes/default/dialog-title-bg.png +0 -0
- data/app/assets/images/ueditor/themes/default/filescan.png +0 -0
- data/app/assets/images/ueditor/themes/default/highlighted.gif +0 -0
- data/app/assets/images/ueditor/themes/default/icons-all.gif +0 -0
- data/app/assets/images/ueditor/themes/default/icons.gif +0 -0
- data/app/assets/images/ueditor/themes/default/icons.png +0 -0
- data/app/assets/images/ueditor/themes/default/lock.gif +0 -0
- data/app/assets/images/ueditor/themes/default/neweditor-tab-bg.png +0 -0
- data/app/assets/images/ueditor/themes/default/pagebreak.gif +0 -0
- data/app/assets/images/ueditor/themes/default/scale.png +0 -0
- data/app/assets/images/ueditor/themes/default/spacer.gif +0 -0
- data/app/assets/images/ueditor/themes/default/sparator_v.png +0 -0
- data/app/assets/images/ueditor/themes/default/toolbar_bg.png +0 -0
- data/app/assets/images/ueditor/themes/default/unhighlighted.gif +0 -0
- data/app/assets/images/ueditor/themes/default/upload.png +0 -0
- data/app/assets/images/ueditor/themes/default/videologo.gif +0 -0
- data/app/assets/images/ueditor/themes/default/word.gif +0 -0
- data/app/assets/images/ueditor/themes/default/wordpaste.png +0 -0
- data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_chm.gif +0 -0
- data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_default.png +0 -0
- data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_doc.gif +0 -0
- data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_exe.gif +0 -0
- data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_mp3.gif +0 -0
- data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_mv.gif +0 -0
- data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_pdf.gif +0 -0
- data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_ppt.gif +0 -0
- data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_psd.gif +0 -0
- data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_rar.gif +0 -0
- data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_txt.gif +0 -0
- data/app/assets/images/ueditor_rails/dialogs/attachment/fileTypeImages/icon_xls.gif +0 -0
- data/app/assets/images/ueditor_rails/dialogs/image/center_focus.jpg +0 -0
- data/app/assets/images/ueditor_rails/dialogs/image/left_focus.jpg +0 -0
- data/app/assets/images/ueditor_rails/dialogs/image/none_focus.jpg +0 -0
- data/app/assets/images/ueditor_rails/dialogs/image/right_focus.jpg +0 -0
- data/app/assets/images/ueditor_rails/dialogs/scrawl/addimg.png +0 -0
- data/app/assets/images/ueditor_rails/dialogs/scrawl/brush.png +0 -0
- data/app/assets/images/ueditor_rails/dialogs/scrawl/delimg.png +0 -0
- data/app/assets/images/ueditor_rails/dialogs/scrawl/delimgH.png +0 -0
- data/app/assets/images/ueditor_rails/dialogs/scrawl/empty.png +0 -0
- data/app/assets/images/ueditor_rails/dialogs/scrawl/emptyH.png +0 -0
- data/app/assets/images/ueditor_rails/dialogs/scrawl/eraser.png +0 -0
- data/app/assets/images/ueditor_rails/dialogs/scrawl/redo.png +0 -0
- data/app/assets/images/ueditor_rails/dialogs/scrawl/redoH.png +0 -0
- data/app/assets/images/ueditor_rails/dialogs/scrawl/scale.png +0 -0
- data/app/assets/images/ueditor_rails/dialogs/scrawl/scaleH.png +0 -0
- data/app/assets/images/ueditor_rails/dialogs/scrawl/size.png +0 -0
- data/app/assets/images/ueditor_rails/dialogs/scrawl/undo.png +0 -0
- data/app/assets/images/ueditor_rails/dialogs/scrawl/undoH.png +0 -0
- data/app/assets/javascripts/ueditor_rails/_config.js.erb +211 -0
- data/app/assets/javascripts/ueditor_rails/dialogs/attachment.js +5 -0
- data/app/assets/javascripts/ueditor_rails/dialogs/attachment/_callbacks.js +166 -0
- data/app/assets/javascripts/ueditor_rails/dialogs/attachment/_file_type_maps.js.erb +14 -0
- data/app/assets/javascripts/ueditor_rails/dialogs/image.js.erb +724 -0
- data/app/assets/javascripts/ueditor_rails/dialogs/scrawl.js +655 -0
- data/app/assets/javascripts/ueditor_rails/dialogs/wordimage.js +154 -0
- data/app/assets/javascripts/ueditor_rails/init.js +12 -0
- data/app/assets/stylesheets/ueditor/themes/default/dialogbase.css.erb +100 -0
- data/app/assets/stylesheets/ueditor/themes/default/ueditor.css +1582 -0
- data/app/assets/stylesheets/ueditor/themes/iframe.css +1 -0
- data/app/assets/stylesheets/ueditor_rails/dialogs/attachment.css.erb +161 -0
- data/app/assets/stylesheets/ueditor_rails/dialogs/image.css.erb +69 -0
- data/app/assets/stylesheets/ueditor_rails/dialogs/scrawl.css.erb +72 -0
- data/app/controllers/ueditor_rails/application_controller.rb +5 -0
- data/app/controllers/ueditor_rails/dialogs_controller.rb +21 -0
- data/app/controllers/ueditor_rails/libs_controller.rb +33 -0
- data/app/helpers/ueditor_rails/application_helper.rb +27 -0
- data/app/views/ueditor_rails/dialogs/attachment.html.erb +124 -0
- data/app/views/ueditor_rails/dialogs/image.html.erb +203 -0
- data/app/views/ueditor_rails/dialogs/scrawl.html.erb +96 -0
- data/app/views/ueditor_rails/dialogs/wordimage.html.erb +155 -0
- data/config/routes.rb +11 -0
- data/lib/generators/ueditor_rails/USAGE +8 -0
- data/lib/generators/ueditor_rails/install_generator.rb +15 -0
- data/lib/generators/ueditor_rails/templates/ueditor_config.js.erb +216 -0
- data/lib/tasks/ueditor_rails_tasks.rake +4 -0
- data/lib/ueditor_rails/engine.rb +17 -0
- data/lib/ueditor_rails/helpers/form_builder.rb +11 -0
- data/lib/ueditor_rails/helpers/form_helper.rb +37 -0
- data/lib/ueditor_rails/helpers/view_helper.rb +21 -0
- data/lib/ueditor_rails/util.rb +42 -0
- data/lib/ueditor_rails/version.rb +3 -0
- data/lib/ueditor_rails4.rb +32 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +16 -0
- data/test/dummy/app/assets/javascripts/posts.js +2 -0
- data/test/dummy/app/assets/javascripts/ueditor_config.js.erb +208 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/assets/stylesheets/posts.css +4 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/posts_controller.rb +83 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/posts_helper.rb +2 -0
- data/test/dummy/app/models/post.rb +3 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/posts/_form.html.erb +25 -0
- data/test/dummy/app/views/posts/edit.html.erb +6 -0
- data/test/dummy/app/views/posts/index.html.erb +29 -0
- data/test/dummy/app/views/posts/new.html.erb +5 -0
- data/test/dummy/app/views/posts/show.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +61 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +8 -0
- data/test/dummy/db/migrate/20130327173045_create_posts.rb +10 -0
- data/test/dummy/db/schema.rb +23 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/test/fixtures/posts.yml +9 -0
- data/test/dummy/test/functional/posts_controller_test.rb +49 -0
- data/test/dummy/test/unit/helpers/posts_helper_test.rb +4 -0
- data/test/dummy/test/unit/post_test.rb +7 -0
- data/test/functional/ueditor_rails/dialogs_controller_test.rb +16 -0
- data/test/functional/ueditor_rails/libs_controller_test.rb +21 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +15 -0
- data/test/ueditor_rails_test.rb +7 -0
- data/vendor/assets/javascripts/ueditor/dialogs/anchor/anchor.html.erb +57 -0
- data/vendor/assets/javascripts/ueditor/dialogs/background/background.css +24 -0
- data/vendor/assets/javascripts/ueditor/dialogs/background/background.html.erb +55 -0
- data/vendor/assets/javascripts/ueditor/dialogs/background/background.js +348 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.css.erb +43 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.html.erb +54 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/emotion.js +186 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/0.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/bface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/cface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/fface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/jxface2.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/neweditor-tab-bg.png +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/tface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/wface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/emotion/images/yface.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/gmap/gmap.html.erb +89 -0
- data/vendor/assets/javascripts/ueditor/dialogs/help/help.css +7 -0
- data/vendor/assets/javascripts/ueditor/dialogs/help/help.html.erb +84 -0
- data/vendor/assets/javascripts/ueditor/dialogs/help/help.js +54 -0
- data/vendor/assets/javascripts/ueditor/dialogs/highlightcode/highlightcode.html.erb +131 -0
- data/vendor/assets/javascripts/ueditor/dialogs/insertframe/insertframe.html.erb +98 -0
- data/vendor/assets/javascripts/ueditor/dialogs/internal.js +79 -0
- data/vendor/assets/javascripts/ueditor/dialogs/link/link.html.erb +141 -0
- data/vendor/assets/javascripts/ueditor/dialogs/map/map.html.erb +105 -0
- data/vendor/assets/javascripts/ueditor/dialogs/music/music.css +30 -0
- data/vendor/assets/javascripts/ueditor/dialogs/music/music.html.erb +32 -0
- data/vendor/assets/javascripts/ueditor/dialogs/music/music.js +192 -0
- data/vendor/assets/javascripts/ueditor/dialogs/searchreplace/searchreplace.html.erb +74 -0
- data/vendor/assets/javascripts/ueditor/dialogs/searchreplace/searchreplace.js +160 -0
- data/vendor/assets/javascripts/ueditor/dialogs/snapscreen/snapscreen.html.erb +91 -0
- data/vendor/assets/javascripts/ueditor/dialogs/spechars/spechars.html.erb +21 -0
- data/vendor/assets/javascripts/ueditor/dialogs/spechars/spechars.js +56 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/dragicon.png +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.css +75 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.html.erb +57 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/edittable.js +182 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/edittd.html.erb +51 -0
- data/vendor/assets/javascripts/ueditor/dialogs/table/edittip.html.erb +33 -0
- data/vendor/assets/javascripts/ueditor/dialogs/tangram.js +1238 -0
- data/vendor/assets/javascripts/ueditor/dialogs/template/config.js +42 -0
- data/vendor/assets/javascripts/ueditor/dialogs/template/images/bg.gif +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre0.png +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre1.png +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre2.png +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre3.png +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/template/images/pre4.png +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/template/template.css +18 -0
- data/vendor/assets/javascripts/ueditor/dialogs/template/template.html.erb +26 -0
- data/vendor/assets/javascripts/ueditor/dialogs/template/template.js +53 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/images/center_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/images/left_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/images/none_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/images/right_focus.jpg +0 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/video.css +59 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/video.html.erb +78 -0
- data/vendor/assets/javascripts/ueditor/dialogs/video/video.js.erb +409 -0
- data/vendor/assets/javascripts/ueditor/dialogs/webapp/webapp.html.erb +64 -0
- data/vendor/assets/javascripts/ueditor/editor_all.js.erb +19133 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/copy.png +0 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/imglabel.png +0 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/localimage.png +0 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/music.png +0 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/images/upload.png +0 -0
- data/vendor/assets/javascripts/ueditor/lang/zh-cn/zh-cn.js +492 -0
- data/vendor/assets/javascripts/ueditor/third-party/SyntaxHighlighter/shCore.js +3655 -0
- data/vendor/assets/javascripts/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css +316 -0
- data/vendor/assets/javascripts/ueditor/third-party/codemirror/codemirror.css +104 -0
- data/vendor/assets/javascripts/ueditor/third-party/codemirror/codemirror.js +3581 -0
- data/vendor/assets/javascripts/ueditor/third-party/fClipboard_ueditor.swf +0 -0
- data/vendor/assets/javascripts/ueditor/third-party/imageUploader.swf +0 -0
- data/vendor/assets/javascripts/ueditor/third-party/snapscreen/UEditorSnapscreen.exe +0 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/fileprogress.js +215 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.cookies.js +53 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.js +1132 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.proxy.js +96 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.queue.js +98 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.speed.js +346 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload.swf +0 -0
- data/vendor/assets/javascripts/ueditor/third-party/swfupload/swfupload_fp9.swf +0 -0
- data/vendor/assets/javascripts/ueditor/uparse.js +348 -0
- metadata +363 -0
@@ -0,0 +1,105 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5
|
+
<title></title>
|
6
|
+
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.1&services=true"></script>
|
7
|
+
<style type="text/css">
|
8
|
+
.content{width:530px; height: 350px;margin: 10px auto;}
|
9
|
+
.content table{width: 100%}
|
10
|
+
.content table td{vertical-align: middle;}
|
11
|
+
#city,#address{height:21px;background: #FFF;border:1px solid #d7d7d7; line-height: 21px;}
|
12
|
+
#city{width:90px}
|
13
|
+
#address{width:220px}
|
14
|
+
</style>
|
15
|
+
</head>
|
16
|
+
<body>
|
17
|
+
<div class="content">
|
18
|
+
<table>
|
19
|
+
<tr>
|
20
|
+
<td><var id="lang_city"></var>:</td>
|
21
|
+
<td><input id="city" type="text" /></td>
|
22
|
+
<td><var id="lang_address"></var>:</td>
|
23
|
+
<td><input id="address" type="text" value="" /></td>
|
24
|
+
<td><a href="javascript:doSearch()" class="button"><var id="lang_search"></var></a></td>
|
25
|
+
</tr>
|
26
|
+
</table>
|
27
|
+
<div style="width:100%;height:340px;margin:5px auto;border:1px solid gray" id="container"></div>
|
28
|
+
|
29
|
+
</div>
|
30
|
+
<%= javascript_include_tag 'ueditor/dialogs/internal.js' %>
|
31
|
+
<script type="text/javascript">
|
32
|
+
var map = new BMap.Map("container"),marker,point,imgcss;
|
33
|
+
map.enableScrollWheelZoom();
|
34
|
+
map.enableContinuousZoom();
|
35
|
+
function doSearch(){
|
36
|
+
if (!document.getElementById('city').value) {
|
37
|
+
alert(lang.cityMsg);
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
var search = new BMap.LocalSearch(document.getElementById('city').value, {
|
41
|
+
onSearchComplete: function (results){
|
42
|
+
if (results && results.getNumPois()) {
|
43
|
+
var points = [];
|
44
|
+
for (var i=0; i<results.getCurrentNumPois(); i++) {
|
45
|
+
points.push(results.getPoi(i).point);
|
46
|
+
}
|
47
|
+
if (points.length > 1) {
|
48
|
+
map.setViewport(points);
|
49
|
+
} else {
|
50
|
+
map.centerAndZoom(points[0], 13);
|
51
|
+
}
|
52
|
+
point = map.getCenter();
|
53
|
+
marker.setPoint(point);
|
54
|
+
} else {
|
55
|
+
alert(lang.errorMsg);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
});
|
59
|
+
search.search(document.getElementById('address').value || document.getElementById('city').value);
|
60
|
+
}
|
61
|
+
//获得参数
|
62
|
+
function getPars(str,par){
|
63
|
+
var reg = new RegExp(par+"=((\\d+|[.,])*)","g");
|
64
|
+
return reg.exec(str)[1];
|
65
|
+
}
|
66
|
+
function init(){
|
67
|
+
var img = editor.selection.getRange().getClosedNode();
|
68
|
+
if(img && /api[.]map[.]baidu[.]com/ig.test(img.getAttribute("src"))){
|
69
|
+
var url = img.getAttribute("src"),centers;
|
70
|
+
centers = getPars(url,"center").split(",");
|
71
|
+
point = new BMap.Point(Number(centers[0]),Number(centers[1]));
|
72
|
+
map.addControl(new BMap.NavigationControl());
|
73
|
+
map.centerAndZoom(point, Number(getPars(url,"zoom")));
|
74
|
+
imgcss = img.style.cssText;
|
75
|
+
}else{
|
76
|
+
point = new BMap.Point(116.404, 39.915); // 创建点坐标
|
77
|
+
map.addControl(new BMap.NavigationControl());
|
78
|
+
map.centerAndZoom(point, 10); // 初始化地图,设置中心点坐标和地图级别。
|
79
|
+
}
|
80
|
+
marker = new BMap.Marker(point);
|
81
|
+
marker.enableDragging();
|
82
|
+
map.addOverlay(marker);
|
83
|
+
}
|
84
|
+
init();
|
85
|
+
document.getElementById('address').onkeydown = function (evt){
|
86
|
+
evt = evt || event;
|
87
|
+
if (evt.keyCode == 13) {
|
88
|
+
doSearch();
|
89
|
+
}
|
90
|
+
};
|
91
|
+
dialog.onok = function (){
|
92
|
+
var center = map.getCenter();
|
93
|
+
var zoom = map.zoomLevel;
|
94
|
+
var size = map.getSize();
|
95
|
+
var point = marker.getPoint();
|
96
|
+
var url = "http://api.map.baidu.com/staticimage?center=" + center.lng + ',' + center.lat +
|
97
|
+
"&zoom=" + zoom + "&width=" + size.width + '&height=' + size.height + "&markers=" + point.lng + ',' + point.lat;
|
98
|
+
editor.execCommand('inserthtml', '<img width="'+ size.width +'"height="'+ size.height +'" src="' + url + '"' + (imgcss ? ' style="' + imgcss + '"' :'') + '/>');
|
99
|
+
};
|
100
|
+
document.getElementById("address").focus();
|
101
|
+
</script>
|
102
|
+
|
103
|
+
|
104
|
+
</body>
|
105
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
.wrapper{margin: 5px 10px;}
|
2
|
+
|
3
|
+
.searchBar{height:30px;padding:7px 0 3px;text-align:center;}
|
4
|
+
.searchBtn{font-size:13px;height:24px;}
|
5
|
+
|
6
|
+
.resultBar{width:460px;margin:5px auto;border: 1px solid #CCC;border-radius: 5px;box-shadow: 2px 2px 5px #D3D6DA;overflow: hidden;}
|
7
|
+
|
8
|
+
.listPanel{overflow: hidden;}
|
9
|
+
.panelon{display:block;}
|
10
|
+
.paneloff{display:none}
|
11
|
+
|
12
|
+
.page{width:220px;margin:20px auto;overflow: hidden;}
|
13
|
+
.pageon{float:right;width:24px;line-height:24px;height:24px;margin-right: 5px;background: none;border: none;color: #000;font-weight: bold;text-align:center}
|
14
|
+
.pageoff{float:right;width:24px;line-height:24px;height:24px;cursor:pointer;background-color: #fff;
|
15
|
+
border: 1px solid #E7ECF0;color: #2D64B3;margin-right: 5px;text-decoration: none;text-align:center;}
|
16
|
+
|
17
|
+
.m-box{width:460px;}
|
18
|
+
.m-m{float: left;line-height: 20px;height: 20px;}
|
19
|
+
.m-h{height:24px;line-height:24px;padding-left: 46px;background-color:#FAFAFA;border-bottom: 1px solid #DAD8D8;font-weight: bold;font-size: 12px;color: #333;}
|
20
|
+
.m-l{float:left;width:40px; }
|
21
|
+
.m-t{float:left;width:140px;}
|
22
|
+
.m-s{float:left;width:110px;}
|
23
|
+
.m-z{float:left;width:100px;}
|
24
|
+
.m-try-t{float: left;width: 60px;;}
|
25
|
+
|
26
|
+
.m-try{float:left;width:20px;height:20px;background:url('http://static.tieba.baidu.com/tb/editor/images/try_music.gif') no-repeat ;}
|
27
|
+
.m-trying{float:left;width:20px;height:20px;background:url('http://static.tieba.baidu.com/tb/editor/images/stop_music.gif') no-repeat ;}
|
28
|
+
|
29
|
+
.loading{width:95px;height:7px;font-size:7px;margin:60px auto;background:url(http://static.tieba.baidu.com/tb/editor/images/loading.gif) no-repeat}
|
30
|
+
.empty{width:300px;height:40px;padding:2px;margin:50px auto;line-height:40px; color:#006699;text-align:center;}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
5
|
+
<title>插入音乐</title>
|
6
|
+
<%= stylesheet_link_tag 'ueditor/dialogs/music/music.css' %>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div class="wrapper">
|
10
|
+
<div class="searchBar">
|
11
|
+
<input id="J_searchName" type="text"/>
|
12
|
+
<input type="button" class="searchBtn" id="J_searchBtn">
|
13
|
+
</div>
|
14
|
+
<div class="resultBar" id="J_resultBar">
|
15
|
+
<div class="loading" style="display:none"></div>
|
16
|
+
<div class="empty"><var id="lang_input_tips"></var></div>
|
17
|
+
</div>
|
18
|
+
<div id="J_preview"></div>
|
19
|
+
</div>
|
20
|
+
<%= javascript_include_tag 'ueditor/dialogs/internal.js' %>
|
21
|
+
<%= javascript_include_tag 'ueditor/dialogs/music/music.js' %>
|
22
|
+
<script type="text/javascript">
|
23
|
+
var music = new Music;
|
24
|
+
dialog.onok = function () {
|
25
|
+
music.exec();
|
26
|
+
};
|
27
|
+
dialog.oncancel = function () {
|
28
|
+
$G('J_preview').innerHTML = "";
|
29
|
+
};
|
30
|
+
</script>
|
31
|
+
</body>
|
32
|
+
</html>
|
@@ -0,0 +1,192 @@
|
|
1
|
+
function Music() {
|
2
|
+
this.init();
|
3
|
+
}
|
4
|
+
(function () {
|
5
|
+
var pages = [],
|
6
|
+
panels = [],
|
7
|
+
selectedItem = null;
|
8
|
+
Music.prototype = {
|
9
|
+
total:70,
|
10
|
+
pageSize:10,
|
11
|
+
dataUrl:"http://tingapi.ting.baidu.com/v1/restserver/ting?method=baidu.ting.search.common",
|
12
|
+
playerUrl:"http://box.baidu.com/widget/flash/bdspacesong.swf",
|
13
|
+
|
14
|
+
init:function () {
|
15
|
+
var me = this;
|
16
|
+
domUtils.on($G("J_searchName"), "keyup", function (event) {
|
17
|
+
var e = window.event || event;
|
18
|
+
if (e.keyCode == 13) {
|
19
|
+
me.dosearch();
|
20
|
+
}
|
21
|
+
});
|
22
|
+
domUtils.on($G("J_searchBtn"), "click", function () {
|
23
|
+
me.dosearch();
|
24
|
+
});
|
25
|
+
},
|
26
|
+
callback:function (data) {
|
27
|
+
var me = this;
|
28
|
+
me.data = data.song_list;
|
29
|
+
setTimeout(function () {
|
30
|
+
$G('J_resultBar').innerHTML = me._renderTemplate(data.song_list);
|
31
|
+
}, 300);
|
32
|
+
},
|
33
|
+
dosearch:function () {
|
34
|
+
var me = this;
|
35
|
+
selectedItem = null;
|
36
|
+
var key = $G('J_searchName').value;
|
37
|
+
if (utils.trim(key) == "")return false;
|
38
|
+
key = encodeURIComponent(key);
|
39
|
+
me._sent(key);
|
40
|
+
},
|
41
|
+
doselect:function (i) {
|
42
|
+
var me = this;
|
43
|
+
if (typeof i == 'object') {
|
44
|
+
selectedItem = i;
|
45
|
+
} else if (typeof i == 'number') {
|
46
|
+
selectedItem = me.data[i];
|
47
|
+
}
|
48
|
+
},
|
49
|
+
onpageclick:function (id) {
|
50
|
+
var me = this;
|
51
|
+
for (var i = 0; i < pages.length; i++) {
|
52
|
+
$G(pages[i]).className = 'pageoff';
|
53
|
+
$G(panels[i]).className = 'paneloff';
|
54
|
+
}
|
55
|
+
$G('page' + id).className = 'pageon';
|
56
|
+
$G('panel' + id).className = 'panelon';
|
57
|
+
},
|
58
|
+
listenTest:function (elem) {
|
59
|
+
var me = this,
|
60
|
+
view = $G('J_preview'),
|
61
|
+
is_play_action = (elem.className == 'm-try'),
|
62
|
+
old_trying = me._getTryingElem();
|
63
|
+
|
64
|
+
if (old_trying) {
|
65
|
+
old_trying.className = 'm-try';
|
66
|
+
view.innerHTML = '';
|
67
|
+
}
|
68
|
+
if (is_play_action) {
|
69
|
+
elem.className = 'm-trying';
|
70
|
+
view.innerHTML = me._buildMusicHtml(me._getUrl(true));
|
71
|
+
}
|
72
|
+
},
|
73
|
+
_sent:function (param) {
|
74
|
+
var me = this;
|
75
|
+
$G('J_resultBar').innerHTML = '<div class="loading"></div>';
|
76
|
+
|
77
|
+
utils.loadFile(document, {
|
78
|
+
src:me.dataUrl + '&query=' + param + '&page_size=' + me.total + '&callback=music.callback()&.r=' + Math.random(),
|
79
|
+
tag:"script",
|
80
|
+
type:"text/javascript",
|
81
|
+
defer:"defer"
|
82
|
+
});
|
83
|
+
},
|
84
|
+
_removeHtml:function (str) {
|
85
|
+
var reg = /<\s*\/?\s*[^>]*\s*>/gi;
|
86
|
+
return str.replace(reg, "");
|
87
|
+
},
|
88
|
+
_getUrl:function (isTryListen) {
|
89
|
+
var me = this;
|
90
|
+
var param = 'from=tiebasongwidget&url=&name=' + encodeURIComponent(me._removeHtml(selectedItem.title)) + '&artist='
|
91
|
+
+ encodeURIComponent(me._removeHtml(selectedItem.author)) + '&extra='
|
92
|
+
+ encodeURIComponent(me._removeHtml(selectedItem.album_title))
|
93
|
+
+ '&autoPlay='+isTryListen+'' + '&loop=true';
|
94
|
+
return me.playerUrl + "?" + param;
|
95
|
+
},
|
96
|
+
_getTryingElem:function () {
|
97
|
+
var s = $G('J_listPanel').getElementsByTagName('span');
|
98
|
+
|
99
|
+
for (var i = 0; i < s.length; i++) {
|
100
|
+
if (s[i].className == 'm-trying')
|
101
|
+
return s[i];
|
102
|
+
}
|
103
|
+
return null;
|
104
|
+
},
|
105
|
+
_buildMusicHtml:function (playerUrl) {
|
106
|
+
var html = '<embed class="BDE_try_Music" allowfullscreen="false" pluginspage="http://www.macromedia.com/go/getflashplayer"';
|
107
|
+
html += ' src="' + playerUrl + '"';
|
108
|
+
html += ' width="1" height="1" style="position:absolute;left:-2000px;"';
|
109
|
+
html += ' type="application/x-shockwave-flash" wmode="transparent" play="true" loop="false"';
|
110
|
+
html += ' menu="false" allowscriptaccess="never" scale="noborder">';
|
111
|
+
return html;
|
112
|
+
},
|
113
|
+
_byteLength:function (str) {
|
114
|
+
return str.replace(/[^\u0000-\u007f]/g, "\u0061\u0061").length;
|
115
|
+
},
|
116
|
+
_getMaxText:function (s) {
|
117
|
+
var me = this;
|
118
|
+
s = me._removeHtml(s);
|
119
|
+
if (me._byteLength(s) > 12)
|
120
|
+
return s.substring(0, 5) + '...';
|
121
|
+
if (!s) s = " ";
|
122
|
+
return s;
|
123
|
+
},
|
124
|
+
_rebuildData:function (data) {
|
125
|
+
var me = this,
|
126
|
+
newData = [],
|
127
|
+
d = me.pageSize,
|
128
|
+
itembox;
|
129
|
+
for (var i = 0; i < data.length; i++) {
|
130
|
+
if ((i + d) % d == 0) {
|
131
|
+
itembox = [];
|
132
|
+
newData.push(itembox)
|
133
|
+
}
|
134
|
+
itembox.push(data[i]);
|
135
|
+
}
|
136
|
+
return newData;
|
137
|
+
},
|
138
|
+
_renderTemplate:function (data) {
|
139
|
+
var me = this;
|
140
|
+
if (data.length == 0)return '<div class="empty">' + lang.emptyTxt + '</div>';
|
141
|
+
data = me._rebuildData(data);
|
142
|
+
var s = [], p = [], t = [];
|
143
|
+
s.push('<div id="J_listPanel" class="listPanel">');
|
144
|
+
p.push('<div class="page">');
|
145
|
+
for (var i = 0, tmpList; tmpList = data[i++];) {
|
146
|
+
panels.push('panel' + i);
|
147
|
+
pages.push('page' + i);
|
148
|
+
if (i == 1) {
|
149
|
+
s.push('<div id="panel' + i + '" class="panelon">');
|
150
|
+
if (data.length != 1) {
|
151
|
+
t.push('<div id="page' + i + '" onclick="music.onpageclick(' + i + ')" class="pageon">' + (i ) + '</div>');
|
152
|
+
}
|
153
|
+
} else {
|
154
|
+
s.push('<div id="panel' + i + '" class="paneloff">');
|
155
|
+
t.push('<div id="page' + i + '" onclick="music.onpageclick(' + i + ')" class="pageoff">' + (i ) + '</div>');
|
156
|
+
}
|
157
|
+
s.push('<div class="m-box">');
|
158
|
+
s.push('<div class="m-h"><span class="m-t">' + lang.chapter + '</span><span class="m-s">' + lang.singer
|
159
|
+
+ '</span><span class="m-z">' + lang.special + '</span><span class="m-try-t">' + lang.listenTest + '</span></div>');
|
160
|
+
for (var j = 0, tmpObj; tmpObj = tmpList[j++];) {
|
161
|
+
s.push('<label for="radio-' + i + '-' + j + '" class="m-m">');
|
162
|
+
s.push('<input type="radio" id="radio-' + i + '-' + j + '" name="musicId" class="m-l" onclick="music.doselect(' + (me.pageSize * (i-1) + (j-1)) + ')"/>');
|
163
|
+
s.push('<span class="m-t">' + me._getMaxText(tmpObj.title) + '</span>');
|
164
|
+
s.push('<span class="m-s">' + me._getMaxText(tmpObj.author) + '</span>');
|
165
|
+
s.push('<span class="m-z">' + me._getMaxText(tmpObj.album_title) + '</span>');
|
166
|
+
s.push('<span class="m-try" onclick="music.doselect(' + (me.pageSize * (i-1) + (j-1)) + ');music.listenTest(this)"></span>');
|
167
|
+
s.push('</label>');
|
168
|
+
}
|
169
|
+
s.push('</div>');
|
170
|
+
s.push('</div>');
|
171
|
+
}
|
172
|
+
t.reverse();
|
173
|
+
p.push(t.join(''));
|
174
|
+
s.push('</div>');
|
175
|
+
p.push('</div>');
|
176
|
+
return s.join('') + p.join('');
|
177
|
+
},
|
178
|
+
exec:function () {
|
179
|
+
var me = this;
|
180
|
+
if (selectedItem == null) return;
|
181
|
+
$G('J_preview').innerHTML = "";
|
182
|
+
editor.execCommand('music', {
|
183
|
+
url:me._getUrl(false),
|
184
|
+
width:400,
|
185
|
+
height:95
|
186
|
+
});
|
187
|
+
}
|
188
|
+
};
|
189
|
+
})();
|
190
|
+
|
191
|
+
|
192
|
+
|
@@ -0,0 +1,74 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/html4/loose.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<title></title>
|
6
|
+
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
|
7
|
+
<style type="text/css">
|
8
|
+
.warpper{ position:relative;width: 380px;margin: 10px auto;}
|
9
|
+
.tabbody{height: 115px;}
|
10
|
+
.tabbody table{width:100%;border-collapse: separate;border-spacing: 3px;}
|
11
|
+
.tabbody .panel{width:373px;height:100%;padding-left: 5px;position: absolute;background-color: #fff;}
|
12
|
+
.tabbody input.int{ width:190px;height:21px;border:1px solid #d7d7d7;line-height:21px;}
|
13
|
+
.tabbody input.btn{padding: 0 5px; text-align:center;line-height:24px; text-decoration: none;height:24px;background:url("../../themes/default/images/dialog-title-bg.png") repeat-x;border:1px solid #ccc; }
|
14
|
+
</style>
|
15
|
+
</head>
|
16
|
+
<body>
|
17
|
+
<div class="warpper" id="searchtab">
|
18
|
+
<div id="head" class="tabhead">
|
19
|
+
<span tabsrc="find" class="focus"><var id="lang_tab_search"></var></span>
|
20
|
+
<span tabsrc="replace" ><var id="lang_tab_replace"></var></span>
|
21
|
+
</div>
|
22
|
+
<div class="tabbody">
|
23
|
+
<div class="panel" id="find">
|
24
|
+
<table>
|
25
|
+
<tr>
|
26
|
+
<td width="80"><var id="lang_search1"></var>: </td>
|
27
|
+
<td><input id="findtxt" type="text" class="int" /></td>
|
28
|
+
</tr>
|
29
|
+
<tr>
|
30
|
+
<td><var id="lang_case_sensitive1"></var></td>
|
31
|
+
<td>
|
32
|
+
<input id="matchCase" type="checkbox" />
|
33
|
+
</td>
|
34
|
+
</tr>
|
35
|
+
<tr>
|
36
|
+
<td colspan="2">
|
37
|
+
<input id="nextFindBtn" type="button" class="btn" />
|
38
|
+
<input id="preFindBtn" type="button" class="btn" />
|
39
|
+
</td>
|
40
|
+
</tr>
|
41
|
+
</table>
|
42
|
+
</div>
|
43
|
+
<div class="panel" id="replace">
|
44
|
+
<table>
|
45
|
+
<tr>
|
46
|
+
<td width="80"><var id="lang_search2"></var>: </td>
|
47
|
+
<td><input id="findtxt1" type="text" class="int" /></td>
|
48
|
+
</tr>
|
49
|
+
<tr>
|
50
|
+
<td><var id="lang_replace"></var>: </td>
|
51
|
+
<td><input id="replacetxt" type="text" class="int" /></td>
|
52
|
+
</tr>
|
53
|
+
<tr>
|
54
|
+
<td><var id="lang_case_sensitive2"></var></td>
|
55
|
+
<td>
|
56
|
+
<input id="matchCase1" type="checkbox" />
|
57
|
+
</td>
|
58
|
+
</tr>
|
59
|
+
<tr>
|
60
|
+
<td colspan="2">
|
61
|
+
<input id="nextReplaceBtn" type="button" class="btn" />
|
62
|
+
<input id="preReplaceBtn" type="button" class="btn" />
|
63
|
+
<input id="repalceBtn" type="button" class="btn" />
|
64
|
+
<input id="repalceAllBtn" type="button" class="btn" />
|
65
|
+
</td>
|
66
|
+
</tr>
|
67
|
+
</table>
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
</div>
|
71
|
+
<%= javascript_include_tag 'ueditor/dialogs/internal.js' %>
|
72
|
+
<%= javascript_include_tag 'ueditor/dialogs/searchreplace/searchreplace.js' %>
|
73
|
+
</body>
|
74
|
+
</html>
|
@@ -0,0 +1,160 @@
|
|
1
|
+
/**
|
2
|
+
* Created with JetBrains PhpStorm.
|
3
|
+
* User: xuheng
|
4
|
+
* Date: 12-9-26
|
5
|
+
* Time: 下午12:29
|
6
|
+
* To change this template use File | Settings | File Templates.
|
7
|
+
*/
|
8
|
+
|
9
|
+
//清空上次查选的痕迹
|
10
|
+
editor.firstForSR = 0;
|
11
|
+
editor.currentRangeForSR = null;
|
12
|
+
//给tab注册切换事件
|
13
|
+
/**
|
14
|
+
* tab点击处理事件
|
15
|
+
* @param tabHeads
|
16
|
+
* @param tabBodys
|
17
|
+
* @param obj
|
18
|
+
*/
|
19
|
+
function clickHandler( tabHeads,tabBodys,obj ) {
|
20
|
+
//head样式更改
|
21
|
+
for ( var k = 0, len = tabHeads.length; k < len; k++ ) {
|
22
|
+
tabHeads[k].className = "";
|
23
|
+
}
|
24
|
+
obj.className = "focus";
|
25
|
+
//body显隐
|
26
|
+
var tabSrc = obj.getAttribute( "tabSrc" );
|
27
|
+
for ( var j = 0, length = tabBodys.length; j < length; j++ ) {
|
28
|
+
var body = tabBodys[j],
|
29
|
+
id = body.getAttribute( "id" );
|
30
|
+
body.onclick = function(){
|
31
|
+
this.style.zoom = 1;
|
32
|
+
};
|
33
|
+
if ( id != tabSrc ) {
|
34
|
+
body.style.zIndex = 1;
|
35
|
+
} else {
|
36
|
+
body.style.zIndex = 200;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
}
|
41
|
+
|
42
|
+
/**
|
43
|
+
* TAB切换
|
44
|
+
* @param tabParentId tab的父节点ID或者对象本身
|
45
|
+
*/
|
46
|
+
function switchTab( tabParentId ) {
|
47
|
+
var tabElements = $G( tabParentId ).children,
|
48
|
+
tabHeads = tabElements[0].children,
|
49
|
+
tabBodys = tabElements[1].children;
|
50
|
+
|
51
|
+
for ( var i = 0, length = tabHeads.length; i < length; i++ ) {
|
52
|
+
var head = tabHeads[i];
|
53
|
+
if ( head.className === "focus" )clickHandler(tabHeads,tabBodys, head );
|
54
|
+
head.onclick = function () {
|
55
|
+
clickHandler(tabHeads,tabBodys,this);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
//是否区分大小写
|
61
|
+
function getMatchCase(id) {
|
62
|
+
return $G(id).checked ? true : false;
|
63
|
+
}
|
64
|
+
//查找
|
65
|
+
$G("nextFindBtn").onclick = function (txt, dir, mcase) {
|
66
|
+
var findtxt = $G("findtxt").value, obj;
|
67
|
+
if (!findtxt) {
|
68
|
+
return false;
|
69
|
+
}
|
70
|
+
obj = {
|
71
|
+
searchStr:findtxt,
|
72
|
+
dir:1,
|
73
|
+
casesensitive:getMatchCase("matchCase")
|
74
|
+
};
|
75
|
+
if (!frCommond(obj)) {
|
76
|
+
alert(lang.getEnd);
|
77
|
+
}
|
78
|
+
};
|
79
|
+
$G("nextReplaceBtn").onclick = function (txt, dir, mcase) {
|
80
|
+
var findtxt = $G("findtxt1").value, obj;
|
81
|
+
if (!findtxt) {
|
82
|
+
return false;
|
83
|
+
}
|
84
|
+
obj = {
|
85
|
+
searchStr:findtxt,
|
86
|
+
dir:1,
|
87
|
+
casesensitive:getMatchCase("matchCase1")
|
88
|
+
};
|
89
|
+
frCommond(obj);
|
90
|
+
};
|
91
|
+
$G("preFindBtn").onclick = function (txt, dir, mcase) {
|
92
|
+
var findtxt = $G("findtxt").value, obj;
|
93
|
+
if (!findtxt) {
|
94
|
+
return false;
|
95
|
+
}
|
96
|
+
obj = {
|
97
|
+
searchStr:findtxt,
|
98
|
+
dir:-1,
|
99
|
+
casesensitive:getMatchCase("matchCase")
|
100
|
+
};
|
101
|
+
if (!frCommond(obj)) {
|
102
|
+
alert(lang.getStart);
|
103
|
+
}
|
104
|
+
};
|
105
|
+
$G("preReplaceBtn").onclick = function (txt, dir, mcase) {
|
106
|
+
var findtxt = $G("findtxt1").value, obj;
|
107
|
+
if (!findtxt) {
|
108
|
+
return false;
|
109
|
+
}
|
110
|
+
obj = {
|
111
|
+
searchStr:findtxt,
|
112
|
+
dir:-1,
|
113
|
+
casesensitive:getMatchCase("matchCase1")
|
114
|
+
};
|
115
|
+
frCommond(obj);
|
116
|
+
};
|
117
|
+
//替换
|
118
|
+
$G("repalceBtn").onclick = function () {
|
119
|
+
var findtxt = $G("findtxt1").value.replace(/^\s|\s$/g, ""), obj,
|
120
|
+
replacetxt = $G("replacetxt").value.replace(/^\s|\s$/g, "");
|
121
|
+
if (!findtxt) {
|
122
|
+
return false;
|
123
|
+
}
|
124
|
+
if (findtxt == replacetxt || (!getMatchCase("matchCase1") && findtxt.toLowerCase() == replacetxt.toLowerCase())) {
|
125
|
+
return false;
|
126
|
+
}
|
127
|
+
obj = {
|
128
|
+
searchStr:findtxt,
|
129
|
+
dir:1,
|
130
|
+
casesensitive:getMatchCase("matchCase1"),
|
131
|
+
replaceStr:replacetxt
|
132
|
+
};
|
133
|
+
frCommond(obj);
|
134
|
+
};
|
135
|
+
//全部替换
|
136
|
+
$G("repalceAllBtn").onclick = function () {
|
137
|
+
var findtxt = $G("findtxt1").value.replace(/^\s|\s$/g, ""), obj,
|
138
|
+
replacetxt = $G("replacetxt").value.replace(/^\s|\s$/g, "");
|
139
|
+
if (!findtxt) {
|
140
|
+
return false;
|
141
|
+
}
|
142
|
+
if (findtxt == replacetxt || (!getMatchCase("matchCase1") && findtxt.toLowerCase() == replacetxt.toLowerCase())) {
|
143
|
+
return false;
|
144
|
+
}
|
145
|
+
obj = {
|
146
|
+
searchStr:findtxt,
|
147
|
+
casesensitive:getMatchCase("matchCase1"),
|
148
|
+
replaceStr:replacetxt,
|
149
|
+
all:true
|
150
|
+
};
|
151
|
+
var num = frCommond(obj);
|
152
|
+
if (num) {
|
153
|
+
alert(lang.countMsg.replace("{#count}", num));
|
154
|
+
}
|
155
|
+
};
|
156
|
+
//执行
|
157
|
+
var frCommond = function (obj) {
|
158
|
+
return editor.execCommand("searchreplace", obj);
|
159
|
+
};
|
160
|
+
switchTab("searchtab");
|