Skip to content

Instantly share code, notes, and snippets.

@rproenca
rproenca / Clipboard.js
Last active May 28, 2024 08:57
Copy text to clipboard using Javascript. It works on Safari (iOS) and other browsers.
window.Clipboard = (function(window, document, navigator) {
var textArea,
copy;
function isOS() {
return navigator.userAgent.match(/ipad|iphone/i);
}
function createTextArea(text) {
textArea = document.createElement('textArea');
@alecperkins
alecperkins / gist:3889507
Created October 14, 2012 19:03
Detect any XMLHttpRequests
// From: http://stackoverflow.com/questions/3596583/javascript-detect-an-ajax-event
var s_ajaxListener = new Object();
s_ajaxListener.tempOpen = XMLHttpRequest.prototype.open;
s_ajaxListener.tempSend = XMLHttpRequest.prototype.send;
s_ajaxListener.callback = function () {
// this.method :the ajax method used
// this.url :the url of the requested script (including query string, if any) (urlencoded)
// this.data :the data sent, if any ex: foo=bar&a=b (urlencoded)
console.log(this.method);