You can easily implement an online editor with only one line of code.

Source: Internet
Author: User

In most people's eyes, the Technology House gives people the impression that they are silent and cannot fully understand what they think, so they can keep a distance from each other. As a half-programmer, I think the real technology house has been entertaining for most of the time. It is the same as the geeks of most people. programmers also love to joke, I also like cooking and cooking. Although most of them are for decompression, it seems similar to ordinary people.

Different from each other, the Technology House advocates the ultimate, prefers minimalism, and hopes that simplicity is not simple. The technology house is constantly trying. I am watching a good show:



"Programmer Jose Jesus Perez Aguinaga shared a tip in CoderWall: enter a line of code in the browser address bar: data: text/html,

We can see from the introduction that the code is just a short section: data: text/html, Copy codeThe Code is as follows:
Data: text/html,
<Style type = "text/css">
# E {
Position: absolute;
Top: 0;
Right: 0;
Bottom: 0;
Left: 0;
Font-size: 16px;
}
</Style>
<Div id = "e"> </div>
<Script src = "http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js"> </script>
<Script src = "http://code.jquery.com/jquery-1.9.0.min.js"> </script>
<Script>
Var myKey = "SecretKeyz ";
$ (Document). ready (function (){
Var e = ace. edit ("e ");
Var url = "http://api.openkeyval.org/" + myKey;
$. Ajax ({
Url: url,
DataType: "jsonp ",
Success: function (data ){
E. setTheme ("ace/theme/tomorrow_night_eighties ");
E. getSession (). setMode ("ace/mode/markdown ");
E. setValue (data );
}
});

$ ("# E"). on ("keydown", function (B ){
If (B. ctrlKey & 83 = B. which ){
B. preventDefault ();
Var data = myKey + "=" + encodeURIComponent (e. getValue ());
$. Ajax ({
Data: data,
Url: "http://api.openkeyval.org/store ",
DataType: "jsonp ",
Success: function (data ){
Alert ("Saved .");
}
});
}
});
});
</Script>

Copy the above Code and paste it to the address bar of Chrome, Firefox, and Safari browsers (earlier IE browsers are not supported). Press enter to open it, wait for a moment and an online editor that supports CTRL + S to save the content is displayed.

With only one line of code, the implementation function is equivalent to the system's Notepad program. Do you feel the Artistic Accomplishments of the technology house ?~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.