一行代码,轻松将浏览器变成临时编辑器
如果您发现本文排版有问题,可以先点击下面的链接切换至老版进行查看!!!
一行代码,轻松将浏览器变成临时编辑器




ace/mode/ruby 改成
ace/mode/python
,那么就得到了一个 Python 版的编辑器咯。其他语言依此类推。
● jdkanani 后来的补充:(2013-1-30 22:06:48 更新)
[code]
改造成支持其他语言语法高亮的,可把 ace/mode/ruby 替换为:
Python -> ace/mode/python
C/C++ -> ace/mode/c_cpp
Javscript -> ace/mode/javascript
Java -> ace/mode/java
Scala -> ace/mode/scala
Markdown -> ace/mode/markdown
CoffeeScript -> ace/mode/coffee
其他……
jakeonrails 语法高亮风格用的是 monokai。
如果需要换成其他风格,,可把 ace/theme/monokai 替换为:
Eclipse -> ace/theme/eclipse
TextMate -> ace/theme/textmate
其他……
[/code]
不想复制粘贴代码的懒汉童鞋,可以直接戳下面这些链接:
Ruby 编辑器 、Python 编辑器、PHP 编辑器 、Javascript 编辑器 、Java 编辑器 、C/C++ 编辑器 (也可把这些链接作为浏览器书签收藏哦。)
● montas 的改造:You can use textarea and make it “invisible” if you want autofocus.
[code lang="php"]
data:text/html, <textarea style="font-size: 1.5em; width: 100%; height: 100%; border: none; outline: none" autofocus />
[/code]
或直接戳 链接。
● bgrins 的改造:编辑内容时,自动变换背景颜色;停止后变换白色。
[code lang="php"]
data:text/html, <html><head><link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'><style type="text/css"> html { font-family: "Open Sans" } * { -webkit-transition: all linear 1s; }</style><script>window.onload=function(){var e=false;var t=0;setInterval(function(){if(!e){t=Math.round(Math.max(0,t-Math.max(t/3,1)))}var n=(255-t*2).toString(16);document.body.style.backgroundColor="#ff"+n+""+n},1e3);var n=null;document.onkeydown=function(){t=Math.min(128,t+2);e=true;clearTimeout(n);n=setTimeout(function(){e=false},1500)}}</script></head><body contenteditable style="font-size:2rem;line-height:1.4;max-width:60rem;margin:0 auto;padding:4rem;">
[/code]
● fvsch 的改造:
[code lang="php"]
data:text/html, <body contenteditable style="font-size:2rem;line-height:1.4;max-width:60rem;margin:0 auto;padding:4rem;">
[/code]
或直接戳 链接。
这些个奇淫技巧就到此为止吧。
转载自:伯乐在线- 分类:
- 吐槽
更新时间:
上一篇:下一篇: