update
Former-commit-id: bdede6ed1b6f578f2ef046c338caf02d0b29d453 [formerly 7187de361b53e9c8ec121df379b762f2db736ea2] Former-commit-id: 447d58460fbbfd05ffe08428a1288e392637561d
BIN
_embed/public/ace/demo/bookmarklet/images/ace.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
_embed/public/ace/demo/bookmarklet/images/background.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
_embed/public/ace/demo/bookmarklet/images/body_background.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
_embed/public/ace/demo/bookmarklet/images/bottombar.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
_embed/public/ace/demo/bookmarklet/images/fork_on_github.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
_embed/public/ace/demo/bookmarklet/images/logo.png
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
_embed/public/ace/demo/bookmarklet/images/logo_half.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
112
_embed/public/ace/demo/bookmarklet/index.html
Normal file
@@ -0,0 +1,112 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<link href="style.css" rel="stylesheet" type="text/css">
|
||||
<title>Ace Bookmarklet Builder</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="wrapper">
|
||||
|
||||
<div class="content" style="width: 950px">
|
||||
<div class="column1" style="margin-top: 47px">
|
||||
<textarea id="textarea" style="width:300px; height:300px">
|
||||
/**
|
||||
* This is Ace injected using a bookmarklet.
|
||||
*/
|
||||
function foo() {
|
||||
var bar = true;
|
||||
}</textarea><br>
|
||||
SourceUrl: <br>
|
||||
<input id="srcURL" style="width:300px" value="http://ajaxorg.github.com/ace-builds/src-noconflict"></input><br>
|
||||
<button id="buBuild">Build Link</button> <br> <a href="#"></a>
|
||||
<a href="https://github.com/ajaxorg/ace/">
|
||||
<div class="fork_on_github" ></div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="column2">
|
||||
<h1>Ace Bookmarklet Builder</h1>
|
||||
|
||||
<p id="first">
|
||||
<strong>WARNING:</strong> Currently, this is only supported in non IE browsers.
|
||||
</p>
|
||||
|
||||
<h2>How to use it:</h2>
|
||||
<ul>
|
||||
<li>Select the options as you want them to be by default.</li>
|
||||
<li>Enter the "SourceUrl". This has to be the URL pointing to build/textarea/src/ (you can leave the default to server the scripts from GitHub).</li>
|
||||
<li>Click the "Build Link" button to generate your custom Ace Bookmarklet.</li>
|
||||
<li>Drag the generated link to your toolbar or store it somewhere else.</li>
|
||||
<li>Go to a page with a textarea element and click the bookmarklet - wait a little bit till the files are loaded.</li>
|
||||
<li>Click three times on the textarea you want to replace - Ace will replace it.</li>
|
||||
<li>To change settings, just click the red icon in the bottom right corner.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
function inject(options, callback) {
|
||||
var baseUrl = options.baseUrl || "../../src-noconflict";
|
||||
|
||||
var load = function(path, callback) {
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
var s = document.createElement('script');
|
||||
|
||||
s.src = baseUrl + "/" + path;
|
||||
head.appendChild(s);
|
||||
|
||||
s.onload = s.onreadystatechange = function(_, isAbort) {
|
||||
if (isAbort || !s.readyState || s.readyState == "loaded" || s.readyState == "complete") {
|
||||
s = s.onload = s.onreadystatechange = null;
|
||||
if (!isAbort)
|
||||
callback();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
load("ace.js", function() {
|
||||
ace.config.loadModule("ace/ext/textarea", function() {
|
||||
var event = ace.require("ace/lib/event");
|
||||
var areas = document.getElementsByTagName("textarea");
|
||||
for (var i = 0; i < areas.length; i++) {
|
||||
event.addListener(areas[i], "click", function(e) {
|
||||
if (e.detail == 3) {
|
||||
ace.transformTextarea(e.target, options.ace);
|
||||
}
|
||||
});
|
||||
}
|
||||
callback && callback();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Call the inject function to load the ace files.
|
||||
var textAce;
|
||||
inject({}, function () {
|
||||
// Transform the textarea on the page into an ace editor.
|
||||
var t = document.querySelector("textarea");
|
||||
textAce = ace.require("ace/ext/textarea").transformTextarea(t);
|
||||
setTimeout(function(){textAce.setDisplaySettings(true)});
|
||||
});
|
||||
|
||||
|
||||
document.getElementById("buBuild").onclick = function() {
|
||||
var injectSrc = inject.toString().split("\n").join("");
|
||||
injectSrc = injectSrc.replace(/\s+/g, " ");
|
||||
|
||||
var options = textAce.getOptions();
|
||||
options.baseUrl = document.getElementById("srcURL").value;
|
||||
|
||||
var a = document.querySelector("a");
|
||||
a.href = "javascript:(" + injectSrc + ")(" + JSON.stringify(options) + ")";
|
||||
a.innerHTML = "Ace Bookmarklet Link";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
228
_embed/public/ace/demo/bookmarklet/style.css
Normal file
@@ -0,0 +1,228 @@
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
background-color:#e6f5fc;
|
||||
|
||||
}
|
||||
|
||||
H2, H3, H4 {
|
||||
font-family:Trebuchet MS;
|
||||
font-weight:bold;
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
H2 {
|
||||
font-size:28px;
|
||||
color:#263842;
|
||||
padding-bottom:6px;
|
||||
}
|
||||
|
||||
H3 {
|
||||
font-family:Trebuchet MS;
|
||||
font-weight:bold;
|
||||
font-size:22px;
|
||||
color:#253741;
|
||||
margin-top:43px;
|
||||
margin-bottom:8px;
|
||||
}
|
||||
|
||||
H4 {
|
||||
font-family:Trebuchet MS;
|
||||
font-weight:bold;
|
||||
font-size:21px;
|
||||
color:#222222;
|
||||
margin-bottom:4px;
|
||||
}
|
||||
|
||||
P {
|
||||
padding:13px 0;
|
||||
margin:0;
|
||||
line-height:22px;
|
||||
}
|
||||
|
||||
UL{
|
||||
line-height : 22px;
|
||||
}
|
||||
|
||||
PRE{
|
||||
background : #333;
|
||||
color : white;
|
||||
padding : 10px;
|
||||
}
|
||||
|
||||
#header {
|
||||
height : 227px;
|
||||
position:relative;
|
||||
overflow:hidden;
|
||||
background: url(images/background.png) repeat-x 0 0;
|
||||
border-bottom:1px solid #c9e8fa;
|
||||
}
|
||||
|
||||
#header .content .signature {
|
||||
font-family:Trebuchet MS;
|
||||
font-size:11px;
|
||||
color:#ebe4d6;
|
||||
position:absolute;
|
||||
bottom:5px;
|
||||
right:42px;
|
||||
letter-spacing : 1px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width:970px;
|
||||
position:relative;
|
||||
margin:0 auto;
|
||||
}
|
||||
|
||||
#header .content {
|
||||
height:184px;
|
||||
margin-top:22px;
|
||||
}
|
||||
|
||||
#header .content .logo {
|
||||
width : 282px;
|
||||
height : 184px;
|
||||
background:url(images/logo.png) no-repeat 0 0;
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
}
|
||||
|
||||
#header .content .title {
|
||||
width : 605px;
|
||||
height : 58px;
|
||||
background:url(images/ace.png) no-repeat 0 0;
|
||||
position:absolute;
|
||||
top:98px;
|
||||
left:329px;
|
||||
}
|
||||
|
||||
#wrapper {
|
||||
background:url(images/body_background.png) repeat-x 0 0;
|
||||
min-height:250px;
|
||||
}
|
||||
|
||||
#wrapper .content {
|
||||
font-family:Arial;
|
||||
font-size:14px;
|
||||
color:#222222;
|
||||
width:1000px;
|
||||
}
|
||||
|
||||
#wrapper .content .column1 {
|
||||
position:relative;
|
||||
float:left;
|
||||
width:315px;
|
||||
margin-right:31px;
|
||||
}
|
||||
|
||||
#wrapper .content .column2 {
|
||||
position:relative;
|
||||
overflow:hidden;
|
||||
float:left;
|
||||
width:600px;
|
||||
padding-top:47px;
|
||||
}
|
||||
|
||||
.fork_on_github {
|
||||
width:310px;
|
||||
height:80px;
|
||||
background:url(images/fork_on_github.png) no-repeat 0 0;
|
||||
position:relative;
|
||||
overflow:hidden;
|
||||
margin-top:49px;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.fork_on_github:hover {
|
||||
background-position:0 -80px;
|
||||
}
|
||||
|
||||
.divider {
|
||||
height:3px;
|
||||
background-color:#bedaea;
|
||||
margin-bottom:3px;
|
||||
}
|
||||
|
||||
.menu {
|
||||
padding:23px 0 0 24px;
|
||||
}
|
||||
|
||||
UL.content-list {
|
||||
padding:15px;
|
||||
margin:0;
|
||||
}
|
||||
|
||||
UL.menu-list {
|
||||
padding:0;
|
||||
margin:0 0 20px 0;
|
||||
list-style-type:none;
|
||||
line-height : 16px;
|
||||
}
|
||||
|
||||
UL.menu-list LI {
|
||||
color:#2557b4;
|
||||
font-family:Trebuchet MS;
|
||||
font-size:14px;
|
||||
padding:7px 0;
|
||||
border-bottom:1px dotted #d6e2e7;
|
||||
}
|
||||
|
||||
UL.menu-list LI:last-child {
|
||||
border-bottom:0;
|
||||
}
|
||||
|
||||
A {
|
||||
color:#2557b4;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
A:hover {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
P#first{
|
||||
background : rgba(255,255,255,0.5);
|
||||
padding : 20px;
|
||||
font-size : 16px;
|
||||
line-height : 24px;
|
||||
margin : 0 0 20px 0;
|
||||
}
|
||||
|
||||
#footer {
|
||||
height:40px;
|
||||
position:relative;
|
||||
overflow:hidden;
|
||||
background:url(images/bottombar.png) repeat-x 0 0;
|
||||
position:relative;
|
||||
margin-top:40px;
|
||||
}
|
||||
|
||||
UL.menu-footer {
|
||||
padding:0;
|
||||
margin:8px 11px 0 0;
|
||||
list-style-type:none;
|
||||
float:right;
|
||||
}
|
||||
|
||||
UL.menu-footer LI {
|
||||
color:white;
|
||||
font-family:Arial;
|
||||
font-size:12px;
|
||||
display:inline-block;
|
||||
margin:0 1px;
|
||||
}
|
||||
|
||||
UL.menu-footer LI A {
|
||||
color:#8dd0ff;
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
UL.menu-footer LI A:hover {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||