| |||||||
| Top Tip : Click here to Boost Your PC & Chrome Browsing Speed |
![]() |
| | Thread Tools | Display Modes |
|
#11
| |||
| |||
| I just installed the version from the link you posted and at no time does the content script use local storage, the settings are hard coded... // used until options page works var filterSide = "right"; /* left, right, original */ var filterPosition = "bottom"; /* bottom, top */ var filterScroll = "true"; /* true, false */ var friendConnectHide = "true"; /* true, false */ ...just do the background method, messaging sucks but its doable. |
|
#12
| ||||
| ||||
| i thought they were hard-coded, but they aren't if you change smth in the options and save, the options stays. I don't know how to make the "background method". Can you give me some clues? |
|
#13
| |||
| |||
| I havent played with this in a bit but basically Background pages can access local storage so you should send a one time request to the background page asking for the variable/s you want and the background page gets them from local storage and sends them back. If you need more help, do you just want to send me what you have so far and Ill see what I can do? Im not the best but Im sure I can help you with this. http://code.google.com/chrome/extensions/messaging.html EDIT: OH, and the facebook (yuk) extensions options page IS saveing and loading the options, but at no time does the content script use them Last edited by PAEz; 12-13-2009 at 04:52 PM.. |
|
#14
| ||||
| ||||
| Ok my current state is in the attachment. I tried making the response thingy with the ads.js and the background page, but can't make it work. So if you pls show me how it's done on this file maybe i'll understand it ![]() ps: do you have skype or some kind of im where we can discuss faster :P |
|
#15
| |||
| |||
| My quick response from looking at your code and the google docs would be.. ads.js Code: (function() {
chrome.extension.sendRequest({variable: "ads"}, function(response) {
if(response.answer == "1") {
var css = ".iY .Bu:last-child > .nH {\n height: 0px !important;\n overflow: hidden !important;\n width: 0px !important;\n}\n\n\n.iY .Bu:first-child + .Bu {\n display: none !important;\n}\n\n\n.iY {\n width: 100% !important;\n}\n\n\n\n\n.iY .Bu:last-child .nH > .nH > .nH:first-child {\n position: absolute !important;\n left: 12px!important;\n top: -73px !important;\n width: 100% !important;\n font-size: 70% !important;\n}\n\n\n.iY .Bu:last-child .hj {\n font-size: 100% !important;\n margin: 0 auto !important;\n float: right !important;\n padding: 5px 8px 0px !important;\n border-style: solid !important;\n border-width: 0px !important;\n border-bottom-width: 0px !important;\n -moz-border-radius-topleft: 4px !important;\n -moz-border-radius-topright: 4px !important;\n position: relative;\n}\n.iY .Bu:last-child .hj:hover {\n z-index: 2 !important;\n}\n.z .hj {\n \n}\n.B .hj {\n background: #C9EDCC !important;\n border-color: #69C17D !important;\n}\n.C .hj {\n background: #EEEEEE !important;\n border-color: #CCCCCC !important;\n}\n\n\n.iC .hj {\n font-size: 70% !important;\n margin-right: 4px !important;\n}\n\n\n.hk {\n float: left !important;\n padding: 0 !important;\n}\n\n\n.hk span {\n display: block !important;\n width: auto !important;\n height: 1.8em !important;\n line-height: 1.8em !important;\n padding: 0 8px !important;\n border: 1px solid #BBBBBB !important;\n border-left-color: #FFFFFF !important;\n background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAoCAAAAAAa3c+rAAAAAXNSR0IArs4c6QAAABJJREFUCNdj+MnEQBT8CsUEIACgKQMyxVIz6AAAAABJRU5ErkJggg==) repeat-x left center !important;\n color: #000000 !important;\n}\n.hk:first-child span {\n -moz-border-radius-topleft: 3px !important;\n -moz-border-radius-bottomleft: 3px !important;\n border-left-color: #BBBBBB !important;\n}\n.hk:last-child span {\n -moz-border-radius-topright: 3px !important;\n -moz-border-radius-bottomright: 3px !important;\n}\n.hk u {\n text-decoration: none !important;\n}\n.hk img {\n margin-bottom: 2px !important;\n}\n\n\n\n.hk span:hover {\n border-top-color: #939393 !important;\n border-bottom-color: #939393 !important;\n}\n.hk:first-child span:hover {\n border-left-color: #939393 !important;\n}\n.hk:last-child span:hover {\n border-right-color: #939393 !important;\n}\n\n\n\n.hk span:active {\n background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAoCAAAAAAa3c+rAAAAAXNSR0IArs4c6QAAABVJREFUCNdjeMzEQDTkZmJg+IlfDQBx9QI0/iX6wgAAAABJRU5ErkJggg==) !important;\n border-top-color: #444444 !important;\n border-bottom-color: #444444 !important;\n}\n.hk:first-child span:active {\n border-left-color: #444444 !important;\n}\n.hk:last-child span:active {\n border-right-color: #444444 !important;\n}\n\n\n\n.b8, .cd, .cc {\n padding: 3px 0 !important;\n}\n\n.b8 .ve, .cd .ve, .cc .ve {\n margin-left: 10px !important;\n position: relative !important;\n z-index: 1 !important;\n background-color: #FFFFFF !important;\n border: 2px solid #FFFFFF !important;\n border-collapse: separate !important;\n -moz-border-radius: 6px !important;\n}";
if (typeof GM_addStyle != "undefined") {
GM_addStyle(css);
} else if (typeof PRO_addStyle != "undefined") {
PRO_addStyle(css);
} else if (typeof addStyle != "undefined") {
addStyle(css);
} else {
var heads = document.getElementsByTagName("head");
if (heads.length > 0) {
var node = document.createElement("style");
node.type = "text/css";
node.appendChild(document.createTextNode(css));
heads[0].appendChild(node);
}
}
}
});
})(); Code: <html>
<script>
chrome.extension.onRequest.addListener(
function(request, sender, sendResponse) {
console.log(sender.tab ?
"from a content script:" + sender.tab.url :
"from the extension");
if (request.variable == "ads")
sendResponse({answer: localStorage["ads"]});
else
sendResponse({}); // snub them.
});
</script>
</html> Quote:
EDIT: Ooops, just noticed after posting the background only set lads once...code updated Last edited by PAEz; 12-13-2009 at 05:28 PM.. |
|
#16
| ||||
| ||||
| OMG it worked BUT i had to modify the background tab so: Code: <html>
<script>
chrome.extension.onRequest.addListener(
function(request, sender, sendResponse) {
console.log(sender.tab ?
"from a content script:" + sender.tab.url :
"from the extension");
if (request.variable == "ads")
sendResponse({answer: localStorage["ads"]});
else
sendResponse({}); // snub them.
});
</script>
</html> |
|
#17
| |||
| |||
| Cool, notice I edited it 6 minutes before your post to exactly the same :P Now just add a bunch of if else's or a case statement to your background and you should be good to go. ....I didnt go anywhere I just hoped you'd do it yourself If you ever need any help Im happy to help someone that helps them self |
|
#18
| ||||
| ||||
| Could you please test if this is working for you: http://arendvr.com/folders4gmail/ |
|
#19
| |||
| |||
| Not me .....too much hassle and I wouldnt use it |
|
#20
| |||
| |||
| hmm...i got it to pull my first variable... but how would i get the 2nd-4th?? background.html Code: <html>
<script>
chrome.extension.onRequest.addListener(
function(request, sender, sendResponse) {
console.log(sender.tab ?
"from a content script:" + sender.tab.url + " variable = " + request.variable :
"from the extension");
if (request.variable == "side")
sendResponse({side: localStorage["fbc_side"]});
else if (request.variable == "position")
sendResponse({position: localStorage["fbc_position"]});
else if (request.variable == "scroll")
sendResponse({scroll: localStorage["fbc_scroll"]});
else if (request.variable == "connect")
sendResponse({connect: localStorage["fbc_connect"]});
else
sendResponse({}); // snub them.
});
</script>
</html> Code: chrome.extension.sendRequest({variable: "side"}, function(response) {
(function() {
// change style of facebook
function styleChange(css) {
if (typeof GM_addStyle != "undefined") {
GM_addStyle(css);
}
else if (typeof PRO_addStyle != "undefined") {
PRO_addStyle(css);
}
else if (typeof addStyle != "undefined") {
addStyle(css);
}
else {
var heads = document.getElementsByTagName("head");
if (heads.length > 0) {
var node = document.createElement("style");
node.type = "text/css";
node.appendChild(document.createTextNode(css));
heads[0].appendChild(node);
}
}
};
// used until options page works
//var filterSide = "right"; /* left, right, original */
var filterPosition = "bottom"; /* bottom, top */
var filterScroll = "true"; /* true, false */
var friendConnectHide = "true"; /* true, false */
if(response.side == "right")
{
if(filterPosition == "top")
{
$("#home_filter_list").insertBefore("#pagelet_reqbox");
styleChange("#home_filter_list\n{width: 100% !important; margin: 0px 0px 15px; float: !important; clear: !important;}\n\n#pagelet_reqbox, #pagelet_pymkbox, #pagelet_connectbox\n{float: left !important;}\n\n#home_stream\n{width:auto !important;}\n\n#content, #pagefooter\n{display: block !important;}");
}
else if(filterPosition == "bottom")
{
$("#home_filter_list").insertAfter("#pagelet_syndicationbox");
styleChange("#home_filter_list\n{width: 100% !important; margin: 0px 0px 15px;}\n\n#home_stream\n{width:auto !important;}\n\n#content, #pagefooter\n{display: block !important;}");
}
else
{
}
}
else if(response.side == "left")
{
if(filterPosition == "top")
{
$("#home_filter_list").insertBefore("#pagelet_reqbox");
styleChange("#home_filter_list\n{width: 100% !important; display: block !important; margin: 0px 0px 15px;}\n\n#pagelet_reqbox, #pagelet_pymkbox, #pagelet_connectbox\n{float: left !important;}\n\n#home_stream\n{width:auto !important;}\n\n#home_left_column\n{float: right !important;}\n\n#content, #pagefooter\n{display: block !important;}");
}
else if(filterPosition == "bottom")
{
$("#home_filter_list").insertBefore("#pagelet_syndicationbox");
styleChange("#home_filter_list\n{width: 100% !important; display: block !important; margin: 0px 0px 15px;}\n\n#home_stream\n{width:auto !important;}\n\n#home_left_column\n{float: right !important;}\n\n#content, #pagefooter\n{display: block !important;}");
}
}
else if(response.side == "original")
{
if(filterScroll == "true")
{
styleChange("#home_filter_list\n{display: block !important; position: fixed !important;}\n\n#home_stream\n{float: right !important;}\n\n#home_sidebar\n{display: block;}\n\n#content, #pagefooter\n{display: block !important;}");
}
else if(filterScroll == "false")
{
styleChange("#home_filter_list\n{display: block !important;}\n\n#home_stream\n{float: right !important;}\n\n#home_sidebar\n{display: block;}\n\n#content, #pagefooter\n{display: block !important;}");
}
}
if(friendConnectHide == "true")
{
styleChange("#pagelet_connectbox\n{display: none !important;}");
}
})();
}); |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Cutting and Pasting Into Gmail | Professor K | Chrome Troubleshooting | 12 | 11-19-2009 01:47 AM |
| Chrome or gmail bug.. can't log in | Benni | Bugs and Vulnerabilities | 4 | 11-02-2009 02:59 PM |
| Gmail checker | toketin | Plugins Troubleshooting | 5 | 10-24-2009 06:20 PM |
| Gmail This Not Working | Hiqutipie | Plugins Troubleshooting | 1 | 08-19-2009 06:36 PM |
| Gmail delay | Growat | Chrome Talk | 0 | 11-05-2008 02:20 PM |