Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension does not work any more due to changes in Gmail structure #1

Closed
jamesmortensen opened this issue Aug 18, 2013 · 1 comment
Closed

Comments

@jamesmortensen
Copy link

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

@raisen
Copy link
Owner

raisen commented Sep 25, 2013

Hey James,

Thanks for your fix! I actually just noticed your message when I was updating this extension today - sorry about that. The extension should be now compatible with the new Gmail interface.

Weydson

@raisen raisen closed this as completed Sep 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants