The version of vichan running on lainchan.org
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

118 行
2.9KB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  5. <title>SCEditor Demo</title>
  6. <link rel="stylesheet" href="./minified/themes/default.min.css" type="text/css" />
  7. <script
  8. src="https://code.jquery.com/jquery-3.1.0.min.js"
  9. integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s="
  10. crossorigin="anonymous"></script>
  11. <script src="./minified/jquery.sceditor.bbcode.min.js"></script>
  12. <style>
  13. html {
  14. font-family: Arial, Helvetica, sans-serif;
  15. font-size: 13px;
  16. }
  17. form div {
  18. padding: .5em;
  19. }
  20. code:before {
  21. position: absolute;
  22. content: 'Code:';
  23. top: -1.35em;
  24. left: 0;
  25. }
  26. code {
  27. margin-top: 1.5em;
  28. position: relative;
  29. background: #eee;
  30. border: 1px solid #aaa;
  31. white-space: pre;
  32. padding: .25em;
  33. min-height: 1.25em;
  34. }
  35. code:before, code {
  36. display: block;
  37. text-align: left;
  38. }
  39. </style>
  40. <script>
  41. // Source: http://www.backalleycoder.com/2011/03/20/link-tag-css-stylesheet-load-event/
  42. var loadCSS = function(url, callback){
  43. var link = document.createElement('link');
  44. link.type = 'text/css';
  45. link.rel = 'stylesheet';
  46. link.href = url;
  47. link.id = 'theme-style';
  48. document.getElementsByTagName('head')[0].appendChild(link);
  49. var img = document.createElement('img');
  50. img.onerror = function(){
  51. if(callback) callback(link);
  52. }
  53. img.src = url;
  54. }
  55. $(function() {
  56. var initEditor = function() {
  57. $('textarea').sceditor({
  58. plugins: 'bbcode',
  59. style: './minified/jquery.sceditor.default.min.css'
  60. });
  61. };
  62. $('#theme').change(function() {
  63. var theme = './minified/themes/' + $(this).val() + '.min.css';
  64. $('textarea').sceditor('instance').destroy();
  65. $('link:first').remove();
  66. $('#theme-style').remove();
  67. loadCSS(theme, initEditor);
  68. });
  69. initEditor();
  70. });
  71. </script>
  72. </head>
  73. <body>
  74. <form action="" method="post">
  75. <div>
  76. <textarea name="bbcode_field" style="height:300px;width:600px;">[center][size=3][b]BBCode SCEditor[/b][/size][/center]
  77. Give it a try! :)
  78. [color=#ff00]Red text! [/color][color=#3399ff]Blue?[/color]
  79. [ul][li]A simple list[/li][li]list item 2[/li][/ul]
  80. If you are using IE9+ or any non-IE browser just type [b]:[/b]) and it should be converted into :) as you type.</textarea>
  81. <p>If you are using IE9+ or any other browser then it should automatically replace
  82. :) and other emoticon codes with theit emoticon images.</p>
  83. </div>
  84. <div>
  85. <label for="theme">Theme:</label>
  86. <select id="theme">
  87. <option value="default">Default</option>
  88. <option value="modern">Modern</option>
  89. <option value="office-toolbar">Office Toolbar</option>
  90. <option value="office">Office</option>
  91. <option value="square">Square</option>
  92. </select>
  93. </div>
  94. </form>
  95. <p>SCEditor is licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT</a></p>
  96. </body>
  97. </html>