Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

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

Closed
jamesmortensen opened this Issue August 18, 2013 · 1 comment

2 participants

James Weydson Lima
James

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

Weydson Lima
Owner

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

Weydson Lima raisen closed this September 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.