PDA

View Full Version : Mozilla Jetpack. Wow.



monsterstack
May 28th, 2009, 07:05 PM
Has anyone seen or heard about Mozilla's Jetpack (http://labs.mozilla.com/2009/05/introducing-jetpack-call-for-participation/) [mozilla.com]? It's an add-on for Firefox. This thing looks incredible. It's like greasemonkey, in that you can modify web pages and sites to do different things, except it's better. You can go right ahead and modify the entire lot: HTML, CSS, and the javascript. The idea is that if you have the knowledge to create a web page, then you have the power to edit any site you please. The system also allows you to go right ahead and make extensions for Firefox extremely quickly. You can make a button in the taskbar that checks twitter, or your gmail inbox, or to hide embedded elements on the page as and when you like it, with minimal lines of code.

Personally, I think this has the potential to be totally game-changing. A fully democratic and interactive web for everybody. I have to say I'm pretty excited.

What do you think?

BackwardsDown
May 28th, 2009, 07:09 PM
Let's make an opensource version of every site! yay haha :D

monsterstack
May 28th, 2009, 07:14 PM
Let's make an opensource version of every site! yay haha :D

Go to a random web-site of your choice and right-click "View Source". You'll soon find that the web is already open-source. Obfuscated javascript blobs in your cache may be difficult and obscure, but it's still source code at the end of the day.

Hyper Tails
May 28th, 2009, 07:30 PM
Probably not going to be better than firefox

but it stills sounds decent

gn2
May 28th, 2009, 07:37 PM
I think I'll never use it, just can't see what I would want to use it for.

monsterstack
May 28th, 2009, 07:39 PM
Some ideas for some popular sites I'd like to try out:

Myspace

Alert the user to a url that points to a Myspace profile;
remove any stupid transparency settings;
automatically hide embedded objects;
force the page to not have a horizontal scroll bar;
make the colours bearable.


Microsoft.com

Replace all urls with links to Jaunty Jackalope ISO images;
replace the Microsoft logo with Ubuntu's.


Slashdot

Disable some of the more ridiculous scripts they seem to love so much;
collapsable thread discussions.


Ubuntuforums

Have +/- buttons to hide chunks of <code> I don't want to look at;
append the domain of linked-to sites in people's post (you know the really annoying way I link to sites like this: google (http://www.google.com) [google.com]? I want all posted urls to do that!);
highlight the posts of people I respect and admire;
change the theme to blue--I like blue.


How would you edit the web?


Probably not going to be better than firefox

but it stills sounds decent

Oh I should have mentioned in the OP, it's a Firefox add-on.

happysmileman
May 28th, 2009, 08:06 PM
I think OP doesn't make it fully clear the aims of Jetpack, it allows you to add statusbar buttons, toolbar icons and stuff too, whereas greasemonkey allows you to run scripts to affect the site you're on, this allows you to access browser features that greasemonkey can't.

I have no idea if it aims to replace extensions or anything (it would need a lot of work before it's that good, it may not provide as much access to the browser, such as changing configuration settings), but it does allow you to do a lot of things that up till now have only been possible with extensions, and it seems a lot easier to create scripts for (though I've never made an extension, just browsed through docs out of curiousity).

monsterstack
May 28th, 2009, 08:13 PM
I think OP doesn't make it fully clear the aims of Jetpack, it allows you to add statusbar buttons, toolbar icons and stuff too, whereas greasemonkey allows you to run scripts to affect the site you're on, this allows you to access browser features that greasemonkey can't.

I have no idea if it aims to replace extensions or anything (it would need a lot of work before it's that good, it may not provide as much access to the browser, such as changing configuration settings), but it does allow you to do a lot of things that up till now have only been possible with extensions, and it seems a lot easier to create scripts for (though I've never made an extension, just browsed through docs out of curiousity).

Yes, thanks for that. I didn't really comment on the extension features at all. OP updated to compensate.

Saint Angeles
May 28th, 2009, 08:27 PM
Go to a random web-site of your choice and right-click "View Source". You'll soon find that the web is already open-source. Obfuscated javascript blobs in your cache may be difficult and obscure, but it's still source code at the end of the day.
HTML is not the source code for dynamic webpages. HTML is spit out after being parsed by the server. its like saying that a program is open source because you can view the program.

go ahead and view my personal website's source. you will not be able to see the PHP behind it (however, because i use drupal, you can go to their website and download the source (open source))

monsterstack
May 28th, 2009, 08:33 PM
HTML is not the source code for dynamic webpages. HTML is spit out after being parsed by the server. its like saying that a program is open source because you can view the program.

go ahead and view my personal website's source. you will not be able to see the PHP behind it (however, because i use drupal, you can go to their website and download the source (open source))

That's fair enough. I retract my original statement about that, then. Still, with Jetpack I could make an extension that completely butchers your web site. Remixing the regurgitated HTML, so to speak.

bryonak
May 28th, 2009, 08:39 PM
Looks like a polished merge of GreaseMonkey and Stylish. I like the FireBug integration (one of my favourite plugins).
I'm curious if Bespin's up to modern editors.


edit:
@monsterstack: take a close look at the screenshot ;) we've been able to do this for years... (cue: FireBug)

BackwardsDown
May 28th, 2009, 08:45 PM
Go to a random web-site of your choice and right-click "View Source". You'll soon find that the web is already open-source. Obfuscated javascript blobs in your cache may be difficult and obscure, but it's still source code at the end of the day.

Stallman was in the news again these weeks about: http://www.gnu.org/philosophy/javascript-trap.html

I was pointing in that direction. Google maps, reader, gmail and a lot of other web applications run obfuscated source on your computer with javascript. I was beïng sarcastic about turning every webpages javascript to opensource versions, but stallman is pretty serious about it.

monsterstack
May 28th, 2009, 08:48 PM
Stallman was in the news again these weeks about: http://www.gnu.org/philosophy/javascript-trap.html

I was pointing in that direction. Google maps, reader, gmail and a lot of other web applications run obfuscated source on your computer with javascript. I was beïng sarcastic about turning every webpages javascript to opensource versions, but stallman is pretty serious about it.

Yeah I've read his piece about that. I'm inclined to agree with him for the most part.


Looks like a polished merge of GreaseMonkey and Stylish. I like the FireBug integration (one of my favourite plugins).
I'm curious if Bespin's up to modern editors.


edit:
@monsterstack: take a close look at the screenshot ;) we've been able to do this for years... (cue: FireBug)

Heh heh. Clever stuff. Still if all this stuff puts more editor's tools in the hands of the masses I'm all for it.

days_of_ruin
May 28th, 2009, 09:18 PM
Has anyone made a rick roll alert addon?:p

monsterstack
May 28th, 2009, 09:19 PM
Oh dear. Something bad happened. Is this just my problem or is anyone else seeing this here (https://jetpack.mozillalabs.com/index.html)?

ghindo
May 28th, 2009, 09:24 PM
Oh dear. Something bad happened. Is this just my problem or is anyone else seeing this here (https://jetpack.mozillalabs.com/index.html)?Site looks fine to me.

fatality_uk
May 28th, 2009, 09:53 PM
Looks ok, might have a play with it for a few ideas.

Side note,
JavaScript (officially called ECMAscript, but few use that name) is actually a variant in the same way JScript or a few others are. JavaScript is accessible from any web page and if you know what you are doing, can be read, even without whitespace.

happysmileman
May 29th, 2009, 01:45 AM
Just decided to mess around with it, and I made a little script for it, not very good but it almost works and it's too late to continue fixing it.


var wordList = new Array("LOL", "LMAO", "LMFAO", "ROFL", "ROTFL", "ROFLOL", "ROTFLOL", "ROTFLMAO", "ROFLMAO");

function filter(doc, word) {
var body = doc.body;
var regExp = new RegExp("\\b" + word + "\\b", "gi");

if ($(body).html().search(regExp) != -1) {
$('*:not(a,input,:has(a,input))', $(body)).each(function(i) {
var str = $(this).html();
var result = str.replace(regExp, "<span class='retarded'>" + word + "</span>");
$(this).html(result);
});
}
};

function applyFilter(doc) {
$(wordList).each(function(i) {
filter(doc, wordList[i]);
})
applyStyle(doc);
};

function applyStyle(doc) {
$(doc).find(".retarded")
.css("color", "red")
.hover(function hoverOn() {
$(this).css("opacity", "0.5");
}, function hoverOff() {
$(this).css("opacity", "1");
})
.click(function() {
$(this).hide();
});
}

jetpack.statusBar.append({
html: "Filter <input type='checkbox'>",
width: 130,
onReady: function(widget) {
$("input", widget).click(function() {
if (this.checked) {
jetpack.tabs.onReady(applyFilter);
applyFilter(jetpack.tabs.focused.contentDocument);
} else {
jetpack.tabs.onReady.unbind(applyFilter);
}
})
}
});

Basically it looks for any of the words in the wordlist array, puts them in capital red letters, they go transparent when you hover over them and disappear forever when you click on them.

A big problem is that it can't always catch them.
It won't match the "LOL" in "<p>Paragraph <a href='http://example.com'>link</a> LOL </p>", I couldn't really find a way to do this that was quick enough to not cause slowdown on every page load (even more than it does now, which is quite a lot if you have more than a couple of the words somewhere in the page) and that didn't mess up any links containing the words in Wordlist.

EDIT: Also it doesn't exclude textareas, which I forgot were separate tags to <input> so it ironically messed it up during my preview of the post... Another thing to fix.

lovinglinux
May 30th, 2009, 02:01 AM
I think it is interesting, specially the fact that you can incorporate the scripts on web sites. But how can I save a script to run locally? Do I have to put all my scripts in the "Develop" window in the "about:jetpack" page? I can't find a way to save my scripts as js files and then install them.

dragos240
May 30th, 2009, 02:05 AM
Probably not going to be better than firefox

but it stills sounds decent

It's an addon FOR firefox.

monsterstack
May 30th, 2009, 02:21 AM
I think it is interesting, specially the fact that you can incorporate the scripts on web sites. But how can I save a script to run locally? Do I have to put all my scripts in the "Develop" window in the "about:jetpack" page? I can't find a way to save my scripts as js files and then install them.

Yeah I had that problem, too. To be honest the whole thing feels pretty shaky on Firefox 3.5. But then Ubiquity felt the same when it was just starting out too, and that's one of my favourite Firefox plugins now. The promotional videos are full of "we haven't done this" or "we haven't done that yet". I guess we'll have to wait before we start seeing some good results. They'll have to act fast, though. If I recall correctly Google are attempting to do something similar for Chrome.

geoken
May 30th, 2009, 02:39 AM
Stallman was in the news again these weeks about: http://www.gnu.org/philosophy/javascript-trap.html

I was pointing in that direction. Google maps, reader, gmail and a lot of other web applications run obfuscated source on your computer with javascript. I was beïng sarcastic about turning every webpages javascript to opensource versions, but stallman is pretty serious about it.

Optimized/minimized != obfuscated.

Obfuscating code is a method of intentionally hiding it by trapping entire functions in encoded strings and various other methods.

Minimizing code in a manner so trivial that any decent editor can return it back to an easily readable format is not obfuscation.

If people want others to take them seriously (this is directed at Stallman and not you BackwardsDown) they should not try to sway people through the use of deceitfully inflammatory language. Obfuscation, by definition, suggests that the code was modified for the specific purpose of hiding it or making it difficult to understand.

That is not the case here. The code is minified because it cuts down on size (and by extension bandwidth). Take jQuery for example, it's 120kb in source format and 55kb minified to a single line with white space removed.

happysmileman
May 30th, 2009, 01:19 PM
I think it is interesting, specially the fact that you can incorporate the scripts on web sites. But how can I save a script to run locally? Do I have to put all my scripts in the "Develop" window in the "about:jetpack" page? I can't find a way to save my scripts as js files and then install them.

You can put them on a webpage, something like "<link rel='jetpack' src='whatever.js'/>" and then you get a dropdown asking you to install it. I don't know of any other way, excluding just putting it in the develop tab.