Labs/Bespin/Commands/Pastebox: Difference between revisions

From MozillaWiki
< Labs‎ | Bespin‎ | Commands
Jump to navigation Jump to search
(New page: Thanks to "antimatter" for contributing this command: { name: 'pastebox', takes: [], preview: 'Creates a new window where you can paste stuff in', execute: function(self, ar...)
 
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
Thanks to "antimatter" for contributing this command:
Thanks to [http://antimatter15.com/ antimatter] for contributing this command:


   {
   {
Line 8: Line 8:
     var pbw = window.open("", "PasteBox", "width=400,height=300");
     var pbw = window.open("", "PasteBox", "width=400,height=300");
     pbw.document.open();
     pbw.document.open();
 
 
     pbw.document.write("<h3>Paste Something in this textbox <button
     pbw.document.write("&lt;h3&gt;Paste Something in this textbox &lt;button
onclick='window.opener.pasteboxfinish(window)'>Paste</button></h3>"+
    onclick='window.opener.pasteboxfinish(window)'&gt;Paste&lt;/button&gt;&lt;
    "<textarea id='tp' style='width: 100%;height: 80%'></
    /h3&gt;" + "&lt;textarea id='tp' style='width: 100%;height: 80%'&gt;&lt;/textarea&gt;&lt;br&gt;");
textarea><br>");
     pbw.document.close();
     pbw.document.close();
 
 
     pbw.document.getElementById("tp").value =
     pbw.document.getElementById("tp").value = self.editor.model.getDocument();
self.editor.model.getDocument();
 
 
 
     window.pasteboxfinish = function(pw){
     window.pasteboxfinish = function(pw){
       self.editor.model.insertDocument(pw.document.getElementById
       self.editor.model.insertDocument(pw.document.getElementById("tp").value);
("tp").value);
 
 
       _commandLine.showInfo("Done! It hopefully worked!");
       _commandLine.showInfo("Done! It hopefully worked!");
     }
     }
   }
   }
   }
   }

Latest revision as of 03:07, 27 February 2009

Thanks to antimatter for contributing this command:

 {
  name: 'pastebox',
  takes: [],
  preview: 'Creates a new window where you can paste stuff in',
  execute: function(self, args) {
    var pbw = window.open("", "PasteBox", "width=400,height=300");
    pbw.document.open();
 
    pbw.document.write("<h3>Paste Something in this textbox <button
    onclick='window.opener.pasteboxfinish(window)'>Paste</button><
    /h3>" + "<textarea id='tp' style='width: 100%;height: 80%'></textarea><br>");
    pbw.document.close();
 
    pbw.document.getElementById("tp").value = self.editor.model.getDocument();
 
    window.pasteboxfinish = function(pw){
      self.editor.model.insertDocument(pw.document.getElementById("tp").value);
 
      _commandLine.showInfo("Done! It hopefully worked!");
    }
  }
 }