Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var editor = ace.edit("editor");
- editor.setTheme("ace/theme/ambiance");
- editor.getSession().setMode("ace/mode/lua");
- // Save to local command
- editor.commands.addCommand({
- name: 'save',
- bindKey: {win: 'Ctrl-M', mac: 'Command-M'},
- exec: function(editor) {
- var parts = window.location.search.substr(1).split("&");
- var $_GET = {};
- for (var i = 0; i < parts.length; i++) {
- var temp = parts[i].split("=");
- $_GET[decodeURIComponent(temp[0])] = decodeURIComponent(temp[1]);
- }
- var filename = typeof $_GET['name'] == 'undefined' ? prompt("Enter name of file","aichan") : $_GET['name'];
- var fileid = typeof $_GET['id'] == 'undefined' ? prompt("Enter ID of turtle","") : $_GET['id'];
- var filepass = typeof $_GET['pass'] == 'undefined' ? prompt("Enter password of turtle","") : $_GET['pass'];
- $.ajax({
- type: "POST",
- url: "edit.php",
- data: { source: editor.getValue(), id: fileid, name: filename, pass: filepass}
- }).done(function( msg ) {
- alert( "Response: " + msg );
- });
- },
- readOnly: true
- });
- // Save to pastebin command
- editor.commands.addCommand({
- name: 'pastebin',
- bindKey: {win: 'Ctrl-P', mac: 'Command-P'},
- exec: function(editor) {
- var parts = window.location.search.substr(1).split("&");
- var $_GET = {};
- for (var i = 0; i < parts.length; i++) {
- var temp = parts[i].split("=");
- $_GET[decodeURIComponent(temp[0])] = decodeURIComponent(temp[1]);
- }
- var pastename = typeof $_GET['name'] == 'undefined' ? prompt("Enter name of paste","CC lua script") : $_GET['name'];
- $.ajax({
- type: "POST",
- url: "pastebin.php",
- data: { source: editor.getValue(), name: pastename}
- }).done(function( msg ) {
- prompt( "URL: ", msg );
- });
- },
- readOnly: true
- });
- // Login to pastebin command
- editor.commands.addCommand({
- name: 'login',
- bindKey: {win: 'Ctrl-I', mac: 'Command-I'},
- exec: function(editor) {
- var login = prompt("Pastebin login","");
- var pass = prompt("Pastebin password","");
- $.ajax({
- type: "POST",
- url: "paste_login.php",
- data: { user: login, password: pass}
- }).done(function( msg ) {
- alert( "Response: " + msg );
- });
- },
- readOnly: true
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement