元气智驾官网后台前端页面
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 

135 lignes
4.8 KiB

  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 http-equiv="Content-Type" content="text/html;charset=utf-8"/>
  7. <script type="text/javascript" src="../internal.js"></script>
  8. <style type="text/css">
  9. *{margin:0;padding:0;color: #838383;}
  10. table{font-size: 12px;margin: 10px;line-height: 30px}
  11. .txt{width:300px;height:21px;line-height:21px;border:1px solid #d7d7d7;}
  12. </style>
  13. </head>
  14. <body>
  15. <table>
  16. <tr>
  17. <td><label for="text"> <var id="lang_input_text"></var></label></td>
  18. <td><input class="txt" id="text" type="text" disabled="true"/></td>
  19. </tr>
  20. <tr>
  21. <td><label for="href"> <var id="lang_input_url"></var></label></td>
  22. <td><input class="txt" id="href" type="text" /></td>
  23. </tr>
  24. <tr>
  25. <td><label for="title"> <var id="lang_input_title"></var></label></td>
  26. <td><input class="txt" id="title" type="text"/></td>
  27. </tr>
  28. <tr>
  29. <td colspan="2">
  30. <label for="target"><var id="lang_input_target"></var></label>
  31. <input id="target" type="checkbox"/>
  32. </td>
  33. </tr>
  34. <tr>
  35. <td colspan="2">
  36. <label for="rel">app跳转小程序链接</label>
  37. <input id="rel" type="checkbox"></tr>
  38. </td>
  39. <tr>
  40. <tr>
  41. <td colspan="2" id="msg"></td>
  42. </tr>
  43. </table>
  44. <script type="text/javascript">
  45. var range = editor.selection.getRange(),
  46. link = range.collapsed ? editor.queryCommandValue( "link" ) : editor.selection.getStart(),
  47. url,
  48. text = $G('text'),
  49. rangeLink = domUtils.findParentByTagName(range.getCommonAncestor(),'a',true),
  50. orgText;
  51. link = domUtils.findParentByTagName( link, "a", true );
  52. if(link){
  53. url = utils.html(link.getAttribute( '_href' ) || link.getAttribute( 'href', 2 ));
  54. if(rangeLink === link && !link.getElementsByTagName('img').length){
  55. text.removeAttribute('disabled');
  56. orgText = text.value = link[browser.ie ? 'innerText':'textContent'];
  57. }else{
  58. text.setAttribute('disabled','true');
  59. text.value = lang.validLink;
  60. }
  61. }else{
  62. if(range.collapsed){
  63. text.removeAttribute('disabled');
  64. text.value = '';
  65. }else{
  66. text.setAttribute('disabled','true');
  67. text.value = lang.validLink;
  68. }
  69. }
  70. $G("title").value = url ? link.title : "";
  71. $G("href").value = url ? url: '';
  72. $G("target").checked = url && link.target == "_blank" ? true : false;
  73. $G("rel").checked = url && link.className == "nofollow" ? true : false;
  74. $focus($G("href"));
  75. function handleDialogOk(){
  76. var href =$G('href').value.replace(/^\s+|\s+$/g, '');
  77. if(href){
  78. // if(!hrefStartWith(href,["http","/","ftp://",'#'])) {
  79. // href = "http://" + href;
  80. // }
  81. var obj = {
  82. 'href' : href,
  83. 'target' : $G("target").checked ? "_blank" : '_self',
  84. 'title' : $G("title").value.replace(/^\s+|\s+$/g, ''),
  85. 'class' : $G("rel").checked ? "nofollow" : '',
  86. '_href':href
  87. };
  88. //修改链接内容的情况太特殊了,所以先做到这里了
  89. //todo:情况多的时候,做到command里
  90. if(orgText && text.value != orgText){
  91. link[browser.ie ? 'innerText' : 'textContent'] = obj.textValue = text.value;
  92. range.selectNode(link).select()
  93. }
  94. if(range.collapsed){
  95. obj.textValue = text.value;
  96. }
  97. editor.execCommand('link',utils.clearEmptyAttrs(obj) );
  98. dialog.close();
  99. }
  100. }
  101. dialog.onok = handleDialogOk;
  102. $G('href').onkeydown = $G('title').onkeydown = function(evt){
  103. evt = evt || window.event;
  104. if (evt.keyCode == 13) {
  105. handleDialogOk();
  106. return false;
  107. }
  108. };
  109. // $G('href').onblur = function(){
  110. // if(!hrefStartWith(this.value,["http","/","ftp://",'#'])){
  111. // $G("msg").innerHTML = "<span style='color: red'>"+lang.httpPrompt+"</span>";
  112. // }else{
  113. // $G("msg").innerHTML = "";
  114. // }
  115. // };
  116. function hrefStartWith(href,arr){
  117. href = href.replace(/^\s+|\s+$/g, '');
  118. for(var i=0,ai;ai=arr[i++];){
  119. if(href.indexOf(ai)==0){
  120. return true;
  121. }
  122. }
  123. return false;
  124. }
  125. </script>
  126. </body>
  127. </html>