- Click-to-copy (semi-trusted): https://gist.github.com/JamesMGreene/8597596
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var reporterInterface = { | |
"start": function(data) { | |
/* | |
data: { | |
} | |
*/ | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hasModernClipboardApi, queryCopySupported, syntheticCopySupported, button; | |
hasModernClipboardApi = window.ClipboardEvent != null; | |
try { | |
queryCopySupported = document.queryCommandSupported("click-to-copy") === true; | |
} | |
catch (e) { | |
queryCopySupported = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function runQueryCommand(command, showUI, value) { | |
var commandWorked = false, | |
initialDesignMode = document.designMode || "off"; | |
try { | |
document.designMode = "on"; | |
commandWorked = !!( | |
document.queryCommandSupported(command) && | |
document.queryCommandEnabled(command) && | |
document.queryCommand(command, showUI, value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Basic `document.readyState`/`script.readyState` tests</title> | |
<script id="loadFirst"> | |
function getScriptIds(scriptEls) { | |
var scriptIds = []; | |
if (scriptEls) { | |
for (var i = 0, len = scriptEls.length; i < len; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Basic `script.readyState`/`document.readyState` tests</title> | |
<script id="loadFirst"> | |
window.console && console && console.log && console.log("loadFirst script, evaluating first line"); | |
function _write(msg) { | |
var bod = document.body || document.getElementsByTagName("body")[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>currentScript Example</title> | |
<script type="text/javascript" id="mainscript" async> | |
if (document.currentScript && document.currentScript.async) { | |
console.log("Executing asynchronously"); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(exports) { | |
/** | |
* @namespace My namespace! | |
*/ | |
exports.MyNS = { | |
/** | |
* Returns the namespace object specified and creates it if it doesn't exist. | |
* Does NOT enforce that any requested namespace is attached to the MyNS root namespace. | |
* | |
* @param {String} nsString A string representation of the desired namespace. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Response to question on PhantomJS forum: https://groups.google.com/forum/#!topic/phantomjs/DouaSrjwwCE | |
function doAlpha(url) { | |
var page = require('webpage').create(); | |
page.open(url, function(status) { | |
if (status === 'success') { | |
elements = page.evaluate(function() { | |
// ... | |
return result; | |
}); |
OlderNewer