Copiar texto na extensão do Chrome

function copyToClipboard(text){ var copyDiv = document.createElement(‘div’); copyDiv.contentEditable = true; document.body.appendChild(copyDiv); copyDiv.innerHTML = text; copyDiv.unselectable = “off”; copyDiv.focus(); document.execCommand(‘SelectAll’); document.execCommand(“Copy”, false, null); document.body.removeChild(copyDiv);}

Continuar lendo

Notificação do Chrome

var notification = webkitNotifications.createNotification( ‘icon.png’, ‘title’, ‘text”);notification.show(); //cancel it after 5 seconds.setTimeout(function(){ notification.cancel();},5000); Em manifest.json: “permissions”: [ “notifications” ],”web_accessible_resources”: [ “icon.png” ]

Continuar lendo