首页 > 语言 > JavaScript > 正文

Javascript代码实现仿实例化类

2024-05-06 16:18:17
字体:大 中 小
来源:转载
供稿:网友

这篇文章主要介绍了Javascript代码实现仿实例化类的相关资料并附上示例,非常不错的文章,需要的朋友可以参考下

Javascript能做的事情越发的多了起来,随之而来的问题即是Js代码量的增加,面对代码的加多,我选择了仿面向对像类实例化里的构造函数自动启动的方式,把所有的js代码,以注册的形式,类化了起来。

代码

 

 
  1. /** 
  2. * @version $Id$ 
  3. * @author xjiujiu <xjiujiu@foxmail.com> 
  4. * @description HHJsLib Framework Apps 
  5. * @copyright Copyright (c) 2011-2012 http://www.xjiujiu.com.All right reserved 
  6. */ 
  7.  
  8. HHJsLib.register({ 
  9. init: function() { 
  10. this.bindPreviewBtn(); 
  11. this.bindUploadEleImageBtn(); 
  12. this.bindUploadEleAudioBtn('a.audio-upload-btn'); 
  13. this.bindUploadEleVideoBtn('a.video-upload-btn'); 
  14. this.bindDownloadEleAudioBtn(); 
  15. this.bindNewConBtn(); 
  16. this.bindDelConBtn('a.btn-del-con'); 
  17. this.bindDelItemBtn('a.btn-del-item'); 
  18. this.bindNewItemBoxClose('div.item-box'); 
  19. this.bindPlusBtn('a.btn-plus'); 
  20. this.bindAppendNewElement('div.new-item-box ul li a'); 
  21. this.bindSetPreviewVideo(); 
  22. this.bindAddAnswerBtn('a.btn-add-answer'); 
  23. this.bindDelAnswerBtn('a.btn-del-answer'); 
  24. this.bindDelImageBtn('a.btn-del-image'); 
  25. this.bindDelAudioBtn('a.btn-del-audio'); 
  26. this.initPlusBtn(); 
  27. }, 
  28. bindUploadEleVideoBtn: function(dom) { 
  29. var self = this; 
  30. $(dom).click(function() { 
  31. var $this = $(this); 
  32. var t = HHJsLib.modal.confirm( 
  33. '上传本地视频', 
  34. '<div class="text-center">' 
  35. + ' <p>浏览您电脑里,从中选择一个视频文件。</p>' 
  36. + ' <div class="btn-box btn btn-blue">' 
  37. + ' <div id="upload-btn">从电脑上传</div>' 
  38. + ' </div>' 
  39. + ' </div>' 
  40. ); 
  41. var uploader = HJZUploader.createVideo( 
  42. '#upload-btn',  
  43. {  
  44. formData: {model: 'timeline'}, 
  45. }, 
  46. function(response) { 
  47. if(false == response.rs) { 
  48. self.setDemoBoxInit($this); 
  49. return HHJsLib.warn(response.message); 
  50. } 
  51. self.setDemoAudioInfo($this, response.data); 
  52. $('#dialog-box-' + t).modal('hide'); 
  53. } 
  54. ); 
  55. uploader.on('uploadProgress', function(file) { 
  56. self.setDemoBoxLoading($this); 
  57. }); 
  58.  
  59. return uploader; 
  60. }); 
  61. }, 
  62. bindDelAudioBtn: function(dom) { 
  63. this.bindDelFileBtn(dom, '真的要删除这个音频吗?'); 
  64. }, 
  65. bindDelImageBtn: function(dom) { 
  66. this.bindDelFileBtn(dom, '真的要删除这个图片吗?'); 
  67. }, 
  68. bindDelFileBtn: function(dom, msg) { 
  69. var self = this; 
  70. $(dom).click(function() { 
  71. var $target = $(this); 
  72. var t = HHJsLib.initPopover($(this), msg); 
  73. $('#btn-sure-' + t).click(function() { 
  74. if(1 != $target.attr('data-new')) { 
  75. $.get( 
  76. queryUrl + 'timelineele/adel', 
  77. {id: $target.attr('data-id')}, 
  78. function(response) { 
  79. if(false === response.rs) { 
  80. return HHJsLib.warn(response.message); 
  81. } 
  82. self.delDemoFieldInfo($target); 
  83. $target.popover('destroy'); 
  84. } 
  85. ); 
  86. return; 
  87. } 
  88. self.delDemoFieldInfo($target); 
  89. $target.popover('destroy'); 
  90. }); 
  91. }); 
  92. }, 
  93. delDemoFieldInfo: function($target) { 
  94. $($target.attr('data-demo-box')).html(''); 
  95. $($target.attr('data-box')).removeClass('uploaded').addClass('no-file'); 
  96. $($target.attr('data-field')).attr('data-id', '').attr('data-src', ''); 
  97. }, 
  98. bindAddAnswerBtn: function(dom) { 
  99. var self = this; 
  100. $(dom).click(function() { 
  101. var id = $(this).attr('data-id'); 
  102. var answerHtml = eleTplMap.answerTpl.replace(/{id}/g, id); 
  103. $('#answer-box-' + id).append(answerHtml); 
  104. self.bindDelAnswerBtn('#answer-box-' + id + ' a.btn-del-answer'); 
  105. }); 
  106. }, 
  107. bindDelAnswerBtn: function(dom) { 
  108. var self = this; 
  109. $(dom).click(function() { 
  110. var $target = $(this); 
  111. if(2 > $target.parent().parent().find('textarea.answer-editor').length) { 
  112. return HHJsLib.warn('至少需要有一个答案!'); 
  113. } 
  114. var t = HHJsLib.initPopover($target, '您确定要删除这个答案吗?'); 
  115. $('#btn-sure-' + t).click(function() { 
  116. $target.parent().remove(); 
  117. }); 
  118. }); 
  119. }, 
  120. bindAppendNewElement: function(dom) { 
  121. var self = this; 
  122. $(dom).unbind('click').click(function() { 
  123. var type = $(this).attr('data-type'); 
  124. var heading = $(this).parent().parent().attr('data-heading-id'); 
  125. if('heading' == type) { 
  126. self.addNewElePartBox(); 
  127. $("#new-item-box-" + heading).hide(); 
  128. return; 
  129. } 
  130. self.addNewEleToPartBox(heading, type); 
  131. }); 
  132. }, 
  133. addNewElePartBox: function() { 
  134. var t = this.getTimestamp(); 
  135. var partBoxHtml = eleTplMap.partBox.replace(/{t}/g, t); 
  136. var headingHtml = this.initItemTplByType('heading', t, t); 
  137. var itemHtml = this.initItemTplByType('text', t, t); 
  138. var itemBoxHtml = this.initItemBoxTpl(itemHtml, t, t, 'left', 'text'); 
  139. partBoxHtml = partBoxHtml.replace(/{heading}/g, headingHtml); 
  140. partBoxHtml = partBoxHtml.replace(/{item}/g, itemBoxHtml); 
  141. $("#main-box").append(partBoxHtml); 
  142. this.bindDelItemBtn('#item-' + t + ' a.btn-del-item'); 
  143. this.movePlusBtnBox(t); 
  144. }, 
  145. addNewEleToPartBox: function(heading, type) { 
  146. var total = $('#ele-part-box-' + heading + ' div.item-ele-box').length; 
  147. var side = total % 2 === 0 ? 'left' : 'right'; 
  148. var t = this.getTimestamp(); 
  149. var itemHtml = this.initItemTplByType(type, t, heading); 
  150. var itemBoxHtml = this.initItemBoxTpl(itemHtml, heading, t, side, type); 
  151. //清掉原有高度DIV 
  152. $('#clearfix-' + heading).remove(); 
  153. $('#ele-part-box-' + heading).find('div.eles-box').append(itemBoxHtml); 
  154. //绑定Dom事件 
  155. this.bindDelItemBtn('#item-' + t + ' a.btn-del-item'); 
  156. this.movePlusBtnBox(heading); 
  157. this.bindNewEleUpload(type); 
  158. }, 
  159. bindNewEleUpload: function(type) { 
  160. var self = this; 
  161. switch(type) { 
  162. case 'image': 
  163. case 'question': 
  164. case 'know': 
  165. self.bindUploadModal('a.btn-upload'); 
  166. break; 
  167. case 'audio': 
  168. self.bindUploadEleAudioBtn('a.audio-upload-btn'); 
  169. self.bindDelAudioBtn('a.btn-del-audio'); 
  170. break; 
  171. } 
  172. }, 
  173. initItemTplByType: function(type, t, heading) { 
  174. var itemHtml = eleTplMap[type].replace(/{t}/g, t); 
  175. itemHtml = itemHtml.replace(/{sort_num}/g, this.getNewEleSortNum(heading)); 
  176.  
  177. return itemHtml.replace(/{headingId}/g, heading); 
  178. }, 
  179. initItemBoxTpl: function(content, heading, t, side, type) { 
  180. var itemBoxHtml = eleTplMap.itemBox.replace(/{t}/g, t); 
  181. itemBoxHtml = itemBoxHtml.replace(/{headingId}/g, heading); 
  182. itemBoxHtml = itemBoxHtml.replace(/{side}/g, side); 
  183. itemBoxHtml = itemBoxHtml.replace(/{content}/g, content); 
  184. itemBoxHtml = itemBoxHtml.replace(/{hash}/g, hex_md5(t)); 
  185. itemBoxHtml += '<div class="clearfix" id="clearfix-' + heading + '"></div>'; 
  186.  
  187. return itemBoxHtml.replace(/{type}/g, type); 
  188. }, 
  189. movePlusBtnBox: function(heading) { 
  190. //删除原有 
  191. $('#new-item-box-' + heading).remove(); 
  192. //加入新 
  193. var plusBtnHtml = eleTplMap.plusBtn.replace(/{headingId}/g, heading); 
  194. $(plusBtnHtml).insertBefore('#clearfix-' + heading); 
  195. var $items = $('#ele-part-box-' + heading).find('div.item-ele-box'); 
  196. if($items.length < 2) { 
  197. $($items[0]).find('a.btn-del-item').hide(); 
  198. } else { 
  199. $($items[0]).find('a.btn-del-item').show(); 
  200. } 
  201. //绑定事件 
  202. this.bindAppendNewElement('#new-item-box-' + heading + " ul.new-item-list-box li a"); 
  203. this.bindPlusBtn('#btn-plus-' + heading); 
  204. }, 
  205. bindNewItemBoxClose: function(dom) { 
  206. $(dom).click(function() { 
  207. $('div.new-item-box').hide(); 
  208. }); 
  209. }, 
  210. bindPlusBtn: function(dom) { 
  211. $(dom).click(function(event) { 
  212. $('div.new-item-box').hide(); 
  213. var id = $(this).attr('data-heading-id'); 
  214. $('#new-item-box-' + id + ' div.new-item-box').removeClass('hide').attr('data-show', '1').show(); 
  215. event.preventDefault(); 
  216. }); 
  217. }, 
  218. initPlusBtn: function() { 
  219. var self = this; 
  220. $('div.ele-part-box').each(function() { 
  221. var dataId = $(this).attr('data-heading'); 
  222. self.movePlusBtnBox(dataId); 
  223. }); 
  224. }, 
  225. bindDelItemBtn: function(dom) { 
  226. var self = this; 
  227. $(dom).click(function() { 
  228. var $target = $(this); 
  229. var t = HHJsLib.initPopover($target, '您确定要删除这项吗?'); 
  230. var id = $target.attr('data-id'); 
  231. var heading = $('#item-' + id).attr('data-heading-id'); 
  232. $('#btn-sure-' + t).click(function() { 
  233. if(1 == $target.attr('data-new')) { 
  234. $.get( 
  235. queryUrl + 'timelineele/adel', 
  236. {id: $target.attr('data-id')}, 
  237. function(response) { 
  238. if(false === response.rs) { 
  239. return HHJsLib.warn(response.message); 
  240. } 
  241. $('#item-' + id).fadeOut('fast', function() { 
  242. $(this).remove(); 
  243. self.movePlusBtnBox(heading); 
  244. self.reArrangeItem(heading); 
  245. }); 
  246. $target.popover('destroy'); 
  247. } 
  248. ); 
  249. return; 
  250. } 
  251. $target.popover('destroy'); 
  252. $('#item-' + id).fadeOut('fast', function() { 
  253. $(this).remove(); 
  254. self.movePlusBtnBox(heading); 
  255. self.reArrangeItem(heading); 
  256. }); 
  257. }); 
  258. }); 
  259. }, 
  260. reArrangeItem: function(heading) { 
  261. var rank = 1; 
  262. $('#ele-part-box-' + heading).find('div.item-ele-box').each(function() { 
  263. if(rank % 2 === 0) { 
  264. $(this).removeClass('pull-left item-left') 
  265. .addClass('pull-right item-right'); 
  266. } else { 
  267. $(this).removeClass('pull-right item-right') 
  268. .addClass('pull-left item-left'); 
  269. } 
  270. rank ++; 
  271. }); 
  272. }, 
  273. bindNewConBtn: function() { 
  274. var self = this; 
  275. $('#btn-new-con-item').click(function() { 
  276. var t = self.getTimestamp(); 
  277. var conItemHtml = eleTplMap.conItemTpl.replace(/{t}/g, t); 
  278. $('#conclusion-box').append(conItemHtml); 
  279. self.bindDelConBtn('#btn-del-con-' + t); 
  280. self.bindUploadModal('a.btn-upload'); 
  281. }); 
  282. }, 
  283. bindDelConBtn: function(dom) { 
  284. var self = this; 
  285. $(dom).click(function() { 
  286. var $target = $(this); 
  287. var t = HHJsLib.initPopover($target, '您确定要删除这个结论吗?'); 
  288. var id = $target.attr('data-id'); 
  289. $('#btn-sure-' + t).click(function() { 
  290. if(1 == $target.attr('data-new')) { 
  291. $.get( 
  292. queryUrl + 'timelineele/adel', 
  293. {id: $target.attr('data-id')}, 
  294. function(response) { 
  295. if(false === response.rs) { 
  296. return HHJsLib.warn(response.message); 
  297. } 
  298. $('#item-con-' + id).fadeOut('fast', function() { 
  299. $(this).remove(); 
  300. }); 
  301. $target.popover('destroy'); 
  302. } 
  303. ); 
  304. return; 
  305. } 
  306. $target.popover('destroy'); 
  307. $('#item-con-' + id).fadeOut('fast', function() { 
  308. $(this).remove(); 
  309. }); 
  310. }); 
  311. }); 
  312. }, 
  313. getNewEleSortNum: function(heading) { 
  314. return parseInt(this.getMaxSortNum(heading)) + 1; 
  315. }, 
  316. getMaxSortNum: function(heading) { 
  317. var sortNums = []; 
  318. $('.ele-sort-' + heading).each(function() { 
  319. sortNums.push($(this).val()); 
  320. }); 
  321. sortNums = sortNums.sort(function(a, b) { 
  322. if (a === b) { 
  323. return 0; 
  324. } 
  325. if (typeof a === typeof b) { 
  326. return a > b ? -1 : 1; 
  327. } 
  328. return typeof a > typeof b ? -1 : 1; 
  329. }); 
  330.  
  331. return sortNums[0] == null ? 0 : sortNums[0]; 
  332. }, 
  333. bindUploadEleImageBtn: function() { 
  334. this.bindUploadModal('a.btn-upload'); 
  335. }, 
  336. bindUploadEleAudioBtn: function(dom) { 
  337. var self = this; 
  338. $(dom).click(function() { 
  339. var $this = $(this); 
  340. var t = HHJsLib.modal.confirm( 
  341. '上传音频', 
  342. '<div class="text-center">' 
  343. + ' <p>浏览您电脑里,从中选择一个音频文件。</p>' 
  344. + ' <div class="btn-box btn btn-blue">' 
  345. + ' <div id="upload-btn">从电脑上传</div>' 
  346. + ' </div>' 
  347. + ' </div>' 
  348. ); 
  349. var uploader = HJZUploader.createAudio( 
  350. '#upload-btn',  
  351. {  
  352. formData: {model: 'timeline'}, 
  353. }, 
  354. function(response) { 
  355. if(false == response.rs) { 
  356. self.setDemoBoxInit($this); 
  357. return HHJsLib.warn(response.message); 
  358. } 
  359. self.setDemoAudioInfo($this, response.data); 
  360. $('#dialog-box-' + t).modal('hide'); 
  361. } 
  362. ); 
  363. uploader.on('uploadProgress', function(file) { 
  364. self.setDemoBoxLoading($this); 
  365. }); 
  366.  
  367. return uploader; 
  368. }); 
  369. }, 
  370. setDemoAudioInfo: function($target, data) { 
  371. var audioHtml = '<audio controls="controls"><source src="' + siteUrl + data.src + '" /></audio>'; 
  372. $($target.attr('data-demo-box')).html(audioHtml).show(); 
  373. $($target.attr('data-field')).attr('data-id', data.id).attr('data-src', data.src); 
  374. }, 
  375. bindUploadModal: function(dom) { 
  376. var self = this; 
  377. $(dom).unbind('click').click(function() { 
  378. var $this = $(this); 
  379. var t = HHJsLib.modal.confirm( 
  380. '上传图片', 
  381. '<div class="text-center">' 
  382. + ' <p>浏览您电脑里的图片,从中选择一张。</p>' 
  383. + '<div class="btn-box btn btn-blue">' 
  384. + ' <div id="upload-btn">从电脑上传</div>' 
  385. + ' </div>' 
  386. + ' </div>' 
  387. ); 
  388. var uploader = HJZUploader.createImage( 
  389. '#upload-btn',  
  390. {  
  391. formData: {model: 'timeline'} 
  392. }, 
  393. function(response) { 
  394. if(false == response.rs) { 
  395. self.setDemoBoxInit($this); 
  396. return HHJsLib.warn(response.message); 
  397. } 
  398. var imgHtml = '<img src="' 
  399. + siteUrl + response.data.src 
  400. + '" alt="' + response.data.name + '" />'; 
  401. $($this.attr('data-demo-box')).html(imgHtml).show(); 
  402. $($this.attr('data-field')).val(response.data.id).attr('data-src', response.data.src); 
  403. $('#dialog-box-' + t).modal('hide'); 
  404. } 
  405. ); 
  406. uploader.on('uploadProgress', function(file) { 
  407. self.setDemoBoxLoading($this); 
  408. }); 
  409. self.bindDelImageBtn('a.btn-del-image'); 
  410.  
  411. return uploader; 
  412. }); 
  413. }, 
  414. bindPreviewBtn: function() { 
  415. var self = this; 
  416. $('#edit-btn, #preview-btn').click(function() { 
  417. try{ 
  418. self.verifyBaseInfo(); 
  419. self.verifyEleInfo(); 
  420. self.verifyConclusionInfo(); 
  421. $('#timeline-form').submit(); 
  422. }catch(e) { 
  423. return HHJsLib.warn(e); 
  424. } 
  425. }); 
  426. }, 
  427. verifyBaseInfo: function() { 
  428. HHJsLib.isEmptyByDom('#image-path', '时间轴大图'); 
  429. HHJsLib.isEmptyByDom('#cover', '时间轴封面'); 
  430. HHJsLib.isEmptyByDom('#name', '标题'); 
  431. HHJsLib.isEmptyByDom('#description', '描述'); 
  432. }, 
  433. verifyEleInfo: function() { 
  434. this.verifyHeaderEleInfo(); 
  435. this.verifyTextEleInfo(); 
  436. this.verifyImageEleInfo(); 
  437. this.verifyVideoEleInfo(); 
  438. this.verifyAudioEleInfo(); 
  439. this.verifyQuestionEleInfo(); 
  440. this.verifyKnowEleInfo(); 
  441. }, 
  442. verifyHeaderEleInfo: function() { 
  443. $('div.item-heading-box').each(function() { 
  444. HHJsLib.isEmpty($(this).find('textarea').val(), '头条内容');  
  445. }); 
  446. }, 
  447. verifyTextEleInfo: function() { 
  448. $('div.item-text-box').each(function() { 
  449. HHJsLib.isEmptyByDom('#ele-text-' + $(this).attr('data-id'), '文本内容元素'); 
  450. }); 
  451. }, 
  452. verifyImageEleInfo: function() { 
  453. $('div.item-image-box').each(function() { 
  454. HHJsLib.isEmptyByDom('#ele-image-hash-' + $(this).attr('data-id'), '图片地址'); 
  455. HHJsLib.isEmptyByDom('#ele-image-content-' + $(this).attr('data-id'), '图片介绍'); 
  456. }); 
  457. }, 
  458. verifyVideoEleInfo: function() { 
  459. $('div.item-video-box').each(function() { 
  460. HHJsLib.isEmptyByDom('#ele-video-hash-' + $(this).attr('data-id'), '视频地址'); 
  461. HHJsLib.isEmptyByDom('#ele-video-content-' + $(this).attr('data-id'), '视频介绍'); 
  462. }); 
  463. }, 
  464. verifyAudioEleInfo: function() { 
  465. $('div.item-audio-box').each(function() { 
  466. HHJsLib.isEmptyByDom('#ele-audio-hash-' + $(this).attr('data-id'), '音频地址'); 
  467. HHJsLib.isEmptyByDom('#ele-audio-content-' + $(this).attr('data-id'), '音频介绍'); 
  468. }); 
  469. }, 
  470. verifyQuestionEleInfo: function() { 
  471. $('div.item-question-box').each(function() { 
  472. HHJsLib.isEmptyByDom('#ele-question-content-' + $(this).attr('data-id'), '问题内容'); 
  473. HHJsLib.isEmptyByDom('#ele-question-extend-' + $(this).attr('data-id'), '问题答案解释'); 
  474. HHJsLib.isEmpty(answerLen, '问题答案'); 
  475. $('#answer-box-' + $(this).attr('data-id')).find('textarea').each(function() { 
  476. HHJsLib.isEmpty($(this).val(), '问题答案'); 
  477. }); 
  478. }); 
  479. }, 
  480. verifyKnowEleInfo: function() { 
  481. $('div.item-know-box').each(function() {  
  482. HHJsLib.isEmptyByDom('#ele-know-hash-' + $(this).attr('data-id'), '知道图片地址'); 
  483. HHJsLib.isEmptyByDom('#ele-know-content-' + $(this).attr('data-id'), '知道介绍'); 
  484. }); 
  485. }, 
  486. verifyConclusionInfo: function() { 
  487. var length = $('#conclusion-box div.item-con').length; 
  488. HHJsLib.isEmpty(length, '总结'); 
  489. $('#conclusion-box div.item-con').each(function() { 
  490. var dataId = $(this).attr('data-id'); 
  491. HHJsLib.isEmptyByDom('#ele-con-hash-' + dataId, '总结图片'); 
  492. HHJsLib.isEmptyByDom('#ele-con-content-' + dataId, '总结详情'); 
  493. }); 
  494. }, 
  495. bindDownloadEleAudioBtn: function() { 
  496. var self = this; 
  497. $('a.download-audio-btn').click(function() { 
  498. var $this = $(this); 
  499. try{ 
  500. HHJsLib.isEmptyByDom("#item-audio-upload-hash-" + $this.attr('data-id'), '下载地址'); 
  501. var url = $("#item-audio-upload-hash-" + $this.attr('data-id')).val(); 
  502. if('mp3' != url.substring(url.lastIndexOf('.') + 1).toLowerCase()) { 
  503. return HHJsLib.warn('格式不支持,必须是Mp3格式!'); 
  504. }  
  505. var t = HHJsLib.modal.info( 
  506. '下载音频', 
  507. '<p class="text-center">正在下载音频文件中,请稍等...<p>' 
  508. ); 
  509. self.setDemoBoxLoading($this); 
  510. $.getJSON( 
  511. siteUrl + 'index.php/public/resource/adownload',  
  512. {url: encodeURIComponent(url)},  
  513. function(response) { 
  514. if(false == response.rs) { 
  515. self.setDemoBoxInit($this); 
  516. return HHJsLib.warn(response.message); 
  517. } 
  518. $('#dialog-box-' + t).modal('hide'); 
  519. self.setDemoAudioInfo($this, response.data); 
  520. } 
  521. ); 
  522. } catch(e) { 
  523. return HHJsLib.warn(e); 
  524. } 
  525. }); 
  526. }, 
  527. setDemoBoxLoading: function($target) { 
  528. $($target.attr('data-box')).removeClass('no-file').addClass('uploaded'); 
  529. $($target.attr('data-file-box')).html(''); 
  530. }, 
  531. setDemoBoxInit: function($target) { 
  532. $($target.attr('data-box')).removeClass('uploaded').addClass('no-file'); 
  533. $($target.attr('data-file-box')).html(''); 
  534. }, 
  535. bindSetPreviewVideo: function() { 
  536. $('input.ele-video').change(function() { 
  537. var url = $(this).val(); 
  538. if(url != '') { 
  539. if('swf' != url.substring(url.lastIndexOf('.') +1 ).toLowerCase()) { 
  540. return HHJsLib.warn('视频地址不合法,请输入有效的在线观看Flash地址!'); 
  541. } 
  542. var previewHtml = '<embed src="' + url + '" quality="high" width="495" height="220" align="middle" allowScriptAccess="always" allowFullScreen="true" mode="transparent" type="application/x-shockwave-flash"></embed>'; 
  543. $($(this).attr('data-demo-box')).html(previewHtml); 
  544. } 
  545. }); 
  546. }, 
  547. bindDelEleBtnFormEdit: function() { 
  548. this.bindDelUploadImgBtn(); 
  549. }, 
  550. getTimestamp: function() { 
  551. return (new Date()).getTime(); 
  552. } 
  553. }); 

以上所述就是本文给大家分享的全部内容了,希望能够对大家学习javascript有所帮助。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选