123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <title></title>
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
- <script type="text/javascript" src="../internal.js"></script>
- <style type="text/css">
- .wrapper{width: 600px;padding: 10px;height: 352px;overflow: hidden;position: relative;border-bottom: 1px solid #d7d7d7}
- .localPath input{float: left;width: 350px;line-height: 20px;height: 20px;}
- #clipboard{float:left;width: 70px;height: 30px; }
- .description{ color: #0066cc; margin-top: 2px; width: 450px; height: 45px;float: left;line-height: 22px}
- #upload{width: 100px;height: 30px;float: right; margin:10px 2px 0 0;cursor: pointer;}
- #msg{ width: 140px; height: 30px; line-height:25px;float: left;color: red}
- </style>
- </head>
- <body>
- <div class="wrapper">
- <div class="localPath">
- <input id="localPath" type="text" readonly />
- <div id="clipboard"></div>
- <div id="msg"></div>
- </div>
- <div id="flashContainer"></div>
- <div>
- <div id="upload" style="display: none" ><img id="uploadBtn"></div>
- <div class="description">
- <span style="color: red"><var id="lang_resave"></var>: </span><var id="lang_step"></var>
- </div>
- </div>
- </div>
- <script type="text/javascript" src="tangram.js"></script>
- <script type="text/javascript" src="wordimage.js"></script>
- <script type="text/javascript">
- editor.setOpt({
- wordImageFieldName:"upfile",
- compressSide:0,
- maxImageSideLength:900
- });
-
- var imageUrls = [],
- selectedImageCount = 0,
- optImageUrl = editor.getActionUrl(editor.getOpt('imageActionName')),
- optImageFieldName = editor.getOpt('imageFieldName'),
- optImageCompressBorder = editor.getOpt('imageCompressEnable') ? editor.getOpt('imageCompressBorder'):null,
- maxSize = editor.getOpt('imageMaxSize') / 1024,
- extension = editor.getOpt('imageAllowFiles').join(';').replace(/\./g, '*.');
-
- var params = utils.serializeParam(editor.queryCommandValue('serverparam')) || '',
- urlWidthParams = optImageUrl + (optImageUrl.indexOf('?') == -1 ? '?':'&') + params;
- utils.domReady(function(){
-
- var flashOptions = {
- container:"flashContainer",
- url:urlWidthParams,
- ext:editor.queryCommandValue('serverParam') || {},
- fileType:'{"description":"'+lang.fileType+'", "extension":"' + extension + '"}',
- flashUrl:'imageUploader.swf',
- width:600,
- height:272,
- gridWidth:120,
- gridHeight:120,
- picWidth:100,
- picHeight:100,
- uploadDataFieldName: optImageFieldName,
- picDescFieldName:'pictitle',
- maxSize: maxSize,
- compressSize:1,
- maxNum:32,
- compressSide: 0,
- compressLength: optImageCompressBorder
- };
-
- var callbacks={
- selectFileCallback: function(selectFiles){
- selectedImageCount += selectFiles.length;
- if(selectedImageCount) baidu.g("upload").style.display = "";
- dialog.buttons[0].setDisabled(true);
- },
- deleteFileCallback: function(delFiles){
- selectedImageCount -= delFiles.length;
- if (!selectedImageCount) {
- baidu.g("upload").style.display = "none";
- dialog.buttons[0].setDisabled(false);
- }
- },
- uploadCompleteCallback: function(data){
- try{var info = eval("(" + data.info + ")");
- info && imageUrls.push(info);
- selectedImageCount--;
- }catch(e){}
- },
- uploadErrorCallback: function (data){
- console && console.log(data);
- },
- allCompleteCallback: function(){
- dialog.buttons[0].setDisabled(false);
- }
-
-
- };
- wordImage.init(flashOptions,callbacks);
- });
- </script>
- </body>
- </html>
|