raisen / random-quotes Goto Github PK
View Code? Open in Web Editor NEWRandom Quotes Chrome Extension
Home Page: https://chrome.google.com/webstore/detail/random-quotes/bhoalcabjhbiahfjlmhfcjkhfcdbfake
License: MIT License
Random Quotes Chrome Extension
Home Page: https://chrome.google.com/webstore/detail/random-quotes/bhoalcabjhbiahfjlmhfcjkhfcdbfake
License: MIT License
I wasn't sure how to contact you, but I fixed your Random Quotes extension and included the changes here. The changes are all limited to one file.
Note that you may need to update to manifest version 2, as version 1 will soon be discontinued in the Chrome Store.
Below is the bsearch.js file I modified:
var iv_triggered=0;
function insert_quote_in_textarea(textarea, quote) {
// textarea.value = textarea.value + quote;
textarea.innerHTML = textarea.innerHTML + quote;
}
function find_text_area() {
//var iframe = document.getElementById('canvas_frame');
//var idoc = iframe.contentDocument;
//console.log(idoc.getElementsByTagName('textarea'));
//tareas = idoc.getElementsByTagName('textarea');
console.info("contents of window = " + document.querySelector('[g_editable="true"]').innerHTML); //('[g_editable="true"]').innerHTML);
textarea = document.querySelector('[g_editable="true"]');
return textarea;
/*for (var i=0; i < tareas.length; i++) {
textarea = tareas[i];
if (textarea.getAttribute && (textarea.getAttribute('id') == ':n4' || textarea.getAttribute('id') == ':1h9' || textarea.name == 'body' )) {
return textarea;
}
}*/
//return null;
}
function get_quote(textarea) {
chrome.extension.sendRequest({method: "get_quote"}, function(response) {
if (response && response.quote) {
quote=response.quote;
insert_quote_in_textarea(textarea, quote);
}
});
}
var iv = window.setInterval(function() {
if (window.location.href.indexOf('compose') > 0) {
if (!iv_triggered) {
iv_triggered=1;
tarea = find_text_area();
if (tarea) get_quote(textarea);
}
} else {
iv_triggered=0;
}
}, 2000);
Also, check my Github profile, I just created a similar extension as I didn't have any luck finding something like this that worked.
Hope this helps!
James
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.