mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 23:57:59 +01:00
move the global copyToClipboard() to a slot in vimperator
This commit is contained in:
@@ -1324,13 +1324,6 @@ function scrollBufferAbsolute(horizontal, vertical)
|
|||||||
// misc helper functions ///////////////////////////////////////////////
|
// misc helper functions ///////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
function copyToClipboard(str)
|
|
||||||
{
|
|
||||||
var clipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
|
|
||||||
.getService(Components.interfaces.nsIClipboardHelper);
|
|
||||||
clipboardHelper.copyString(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns an XPathResult object
|
// returns an XPathResult object
|
||||||
function evaluateXPath(expression, doc, ordered)
|
function evaluateXPath(expression, doc, ordered)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -517,7 +517,7 @@ function Hints() //{{{
|
|||||||
// disable the hints before we can echo() an information
|
// disable the hints before we can echo() an information
|
||||||
this.disableHahMode(null, true);
|
this.disableHahMode(null, true);
|
||||||
|
|
||||||
copyToClipboard(loc);
|
vimperator.copyToClipboard(loc);
|
||||||
vimperator.echo("Yanked " + loc);
|
vimperator.echo("Yanked " + loc);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -540,7 +540,7 @@ function Hints() //{{{
|
|||||||
// disable the hints before we can echo() an information
|
// disable the hints before we can echo() an information
|
||||||
this.disableHahMode(null, true);
|
this.disableHahMode(null, true);
|
||||||
|
|
||||||
copyToClipboard(loc);
|
vimperator.copyToClipboard(loc);
|
||||||
vimperator.echo("Yanked " + loc);
|
vimperator.echo("Yanked " + loc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -539,7 +539,7 @@ function Mappings() //{{{
|
|||||||
function()
|
function()
|
||||||
{
|
{
|
||||||
var loc = getCurrentLocation();
|
var loc = getCurrentLocation();
|
||||||
copyToClipboard(loc);
|
vimperator.copyToClipboard(loc);
|
||||||
vimperator.echo("Yanked " + loc);
|
vimperator.echo("Yanked " + loc);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -551,7 +551,7 @@ function Mappings() //{{{
|
|||||||
function()
|
function()
|
||||||
{
|
{
|
||||||
var sel = window.content.document.getSelection();
|
var sel = window.content.document.getSelection();
|
||||||
copyToClipboard(sel);
|
vimperator.copyToClipboard(sel);
|
||||||
vimperator.echo("Yanked " + sel);
|
vimperator.echo("Yanked " + sel);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -207,6 +207,13 @@ const vimperator = (function() //{{{
|
|||||||
sound_service.beep();
|
sound_service.beep();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
copyToClipboard: function(str)
|
||||||
|
{
|
||||||
|
var clipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
|
||||||
|
.getService(Components.interfaces.nsIClipboardHelper);
|
||||||
|
clipboardHelper.copyString(str);
|
||||||
|
},
|
||||||
|
|
||||||
execute: function(string, modifiers)
|
execute: function(string, modifiers)
|
||||||
{
|
{
|
||||||
// skip comments and blank lines
|
// skip comments and blank lines
|
||||||
|
|||||||
Reference in New Issue
Block a user