Check out my
new book!
HTML5 Games book
Wiki Summary Box 0.1.2 update A few updates to the Wiki Summary Box.

The first change is that it now uses the proper Mediawiki API to retrieve the article text instead of relying on the AppJet gateway. Of course now the user's browser has to download and parse the entire article text instead of just getting the small summary bit, but this way still feels a lot better.

Second, there is now a list of Wiki sources that the script checks against, making it more a general Wiki box rather than something tied to Wikipedia. Any links that match this list will get the summary box. Sources supported out of the box include Wikipedia, Wikiquote, Wikispecies, Wikinews, Wikisource, Wikibooks, Wiktionary and Wikiversity. It's relatively easy to add more sources, just be sure that the Wiki is a Mediawiki and that the API is available. There is more info in the JavaScript file about this. And do note that if the Wiki is very different from Wikipedia, the script might not be able to extract anything and/or look odd. The Wiki text can of course be styled with CSS like anything else, but you'll have to find the class names / element id's yourself. This has already been done to hide some elements from Wiktionary and Wikispecies.

If you know of any other Wikis that would be interesting to add, please leave a comment!

An 'loading' indicator has been added. As it is now, it's just a simple text that says "Loading..." but it's easily changed and styled in the CSS file if that's not good enough.

I've also added a small delay before showing and hiding the box, default is 200 and 300 ms, respectively. You can find these at the very top of the script if you want to alter them.

Also, I had to make an ugly workaround to deal with IE's inability to handle relative paths in the href attribute on links. I hope I can find a better way..

Test links:

Wikiquote test: Albert Einstein
Wikinews test: Scientology vs. Anonymous
Wikisource test: Obama saves the day
Wikispecies test: Tyrannosaurus rex, Eukaryota
Wiktionary test: consequently
Wikiversity test: Quantum mechanics study guide
Wikibooks test: Linear algebra

Thanks for the feedback in the earlier post!

Current version: 0.1.2
Files: sumbox.js and sumbox.css

⇓ 8 comments Beben

its not work in blog bro ? hiks ... ?

January 18, 2010 at 1:48 PM

its woooooooooooooooooorkkkkk...
by the way, with the css can't put eksternal link must add in html css ... aw aw aw

January 19, 2010 at 3:33 AM

Nice work ! I'm actually trying to write the same thing in PHP but I dont see how you manage to have only the summary.
I was not able to find a rule to extract only the summary.
Could you give me some pointers ?

April 14, 2010 at 3:27 AM
Jacob Seidelin

@djpate: It actually just assumes that the first section (up until the second header) is a summary. So it just takes everything until it meets a H1 or H2 tag and uses that content.

April 14, 2010 at 6:17 AM

Is this script inactive, or does it only work in IE? I do not get any reaction from the links....

May 17, 2011 at 11:53 AM

doesn't work

March 10, 2012 at 2:34 AM

Its not working

August 18, 2012 at 5:07 AM

شركة تنظيف بيارات بالرياض
شركة نقل اثاث بالرياض
شركة نقل عفش بالرياض
شركة تخزين اثاث بالرياض
مستودعات تخزين اثاث بالرياض
شركة تخزين عفش بالرياض
شركة مكافحة حشرات بالرياض
شركة مكافحة حشرات
شركة مكافحة الصراصير بالرياض
شركة رش مبيدات بالرياض
شركة مكافحة النمل الأبيض بالرياض
شركة تنظيف مسابح بالرياض
تنظيف مسابح بالرياض
شركة تنظيف بالرياض
شركة نظافة بالرياض

August 8, 2014 at 7:41 AM
Post a Comment