MediaWiki Table of Contents (ToC) FileTree - mediawiki

I would like to turn the standard Media Wiki ToC to a FileTree structure.
Where you can expand and contract each section.
I want to support unlimited numbers of levels.
A Expand All and Collapase All link would also be nice.
The name of the MediaWiki Extention and a list of URLs (sites)
that implement this type of TreeList for MediaWiki's ToC
so I can read the code, would be very helpful.
Here are example pages that show FileTree structures,
but I don't think they apply to Media Wiki ToC.
http://commons.wikimedia.org/wiki/Template:Category_tree_all
The following is 5 levels deep.
Films of Australia?
The Adventures of Priscilla, Queen of the Desert?
Stephan Elliott?
A Few Best Men?
A Few Best Men premiere in Sydney?
http://risdpedia.net/index.php/Category:Materials
The following is 3 levels deep.
Category:Screen Printing
Category:Screen Printing Ink
Category:Fabric Screen Printing Ink
http://wiki.team-mediaportal.com/Wiki_Help/4_Contribute_to_Wiki/Collapsible_Lists%2F%2FTrees
http://test.wikipedia.org/wiki/User%3aKrinkle/CollapsingTestpageMw
Here are MediaWiki Extensions that may do the trick,
but I can't seem to make them work.
http://www.mediawiki.org/wiki/Extension_Matrix
http://www.mediawiki.org/wiki/Extension:TocTree
http://www.mediawiki.org/wiki/Extension:Treeview
http://www.mediawiki.org/wiki/Extension:Semantic_TreeView
http://www.mediawiki.org/wiki/Extension:TreeAndMenu
http://www.mediawiki.org/wiki/Manual%3aTag_extensions
Here are some resources that mention this type of TreeList for MediaWiki.
But there are no answers for them yet.
https://stackoverflow.com/questions/20490034/treeview-not-working-on-sidebar-in-mediawiki

I figure out where User Preferences > Misc is located.
Special:Preferences#mw-prefsection-misc

Related

Squarespace Custom Product Post Type

I was thinking about creating different templates for products (not with different features but with different html organization and css) because the standard "pic on the left and data on the right" is not enough for a well-made user-centered ecommerce.
I tried the custom post types but they are blog post and can't access the product data.
in my custom product.conf i added my custom post data
"acceptTypes" : ["store_item", "custom-product-item"]
but obv. it won't work.
maybe if I could access the store_item could be easier to do this, but i can't find on the repo.
anyone has some suggestion?
Unfortunately, although it used to be possible to create custom post type products, that stopped being possible within the last year or so.
If you want to create your own template for products, you need to override the products.list and/or products.item files with your own. By placing them within your /collections folder, it will override the system default ones.
That means you have to write it entirely from scratch. Here are a couple resources that may help (despite being outdated):
http://www.bcarroll.us/developer-platform-tutorials/2014/10/20/products-pages
https://answers.squarespace.com/questions/57343/productsitem-for-adirondack-template.html
Having overridden products.item, if you want to have different templates for different products, you can do something like:
{.equal? item.urlId "myurlid1"}
{#|apply products1.block}
{.or equal? item.urlId "myurlid2"}
{#|apply products2.block}
{.or}
etc.

Multiple open graph tags, which one is prioritized?

I've seen various SO threads about FB open graph image tags such as this: Facebook multiple og:image tags - Which is Default?
These threads are 2.5 years old so I'm wondering if the rules have been updated. Also, the accepted answer of the highest resolution image being the one displayed seems imperfect. What if the images aren't the same? For example, how to have one image for the homepage and then a different one on AJAX loaded pages?
As these rules are used by FB, Reddit and many high-traffic sites obviously this information is very valuable. Thanks!
Since reddit is open-source, you can look at see what its behavior is.
The place you want to look is _find_thumbnail_image(). Right now, this is the code that pertains to Open Graph:
# Allow the content author to specify the thumbnail using the Open
# Graph protocol: http://ogp.me/
og_image = (soup.find('meta', property='og:image') or
soup.find('meta', attrs={'name': 'og:image'}))
if og_image and og_image['content']:
return og_image['content'], None
og_image = (soup.find('meta', property='og:image:url') or
soup.find('meta', attrs={'name': 'og:image:url'}))
if og_image and og_image['content']:
return og_image['content'], None
So, it'll use whatever Beautiful Soup's find() method returns, which should be the first matching tag.

Full urls of images of a given page on Wikipedia (only those I see on the page)

I'd want to extract all full urls of images of "Google"'s page on Wikipedia
I have tried with:
http://en.wikipedia.org/w/api.php?action=query&titles=Google&generator=images&gimlimit=10&prop=imageinfo&iiprop=url|dimensions|mime&format=json
but, in this way, I got also not google-related images, such as:
http://upload.wikimedia.org/wikipedia/en/a/a4/Flag_of_the_United_States.svg
http://upload.wikimedia.org/wikipedia/en/4/4a/Commons-logo.svg
http://upload.wikimedia.org/wikipedia/en/4/4a/Commons-logo.svg
http://upload.wikimedia.org/wikipedia/commons/f/fe/Crystal_Clear_app_browser.png
How can I extract just only images that I see on Google page
Retrieve page source code, https://en.wikipedia.org/w/index.php?title=Google&action=raw
Scan it for substrings like [[File:Google web search.png|thumb|left|On February 14, 2012, Google updated its homepage with a minor twist. There are no red lines above the options in the black bar, and there is a tab space before the "+You". The sign-in button has also changed, it is no longer in the black bar, instead under it as a button.]]
Ask API for all pictures on page, http://en.wikipedia.org/w/api.php?action=query&titles=Google&generator=images&gimlimit=10&prop=imageinfo&iiprop=url|dimensions|mime&format=json
Filter out urls but those which match picture names found in step 2.
Steps 2 and 4 need more explanation.
#2. Regexp /\b(File|Image):[^]|\n\r]+/ should be enough. In Ruby's regexps, \b denotes word boundary which might be unsupported in language of your choice. Regexp I proposed will match all cases which come to my mind: [[File:something.jpg]], gallery tags: <gallery>\nFile:one.jpg\nFile:two.jpg\n</gallery>, templates: {{Infobox|pic = File:something.jpg}}. However, it won't match filenames which contain ]. I'm not sure if they're legal, but if they are, they must be very uncommon and it should not be a big deal.
If you want to match only constructs like this: [[File:something.jpg|thumb|description]], following regexp will work better: /\[\[(File|Image):[^]|]+/
#4. I'd remove all characters from names which match /[^A-Za-z0-9]/. It's easier than escaping them and, in most cases, enough.
Icons are most often attached in templates, contrary to pictures related to article subject, which are most often attached directly ([[File:…]]). There are exceptions though, for example in some articles pictures are attached with {{Gallery}} template. There is also <gallery> tag which introduces special syntax for galleries. You got to tune my solution to your needs, and even then it won't be perfect, but it should be good enough.

Multilanguage select on dropdown, typing enable in textarea

I am working on a flex project. I want to implement a title window in which I have a dropdown with multi language options, selected one option e.g no_NO for Norwegian language. Now user should able to write in Norwegian language in a text area in that window.
Please guide.
Flex provides a mechanism using resource bundles and the ResourceManager. There should be some examples in the official documentation to support runtime localization. I implemented a smal example a while back which shows how to avoid using resources in the markup: localization example # github

design a java webapp that prints html signs and lables

I want to design a webapp that can print signs for various products, such as a big store.
The content of the signs (product names , descriptions ,prices ) comes from the server and changes daily. Each product can be printed to a A3 or A4 document.
It is also possible to have 3 signs in one A4 page.
In addition each product type has a differently desinged sign (Tv's have the price on the top of the page in RED, and printers have the price on bottom left in BOLD)
the idea is that the program will get the product data from the DB, push it in inside a html template according to the page size and product type and print the html (or convert the html to pdf and print)
some problems I faced so far:
- textfields from the DB can be to long, and overlap an area with other texts or scramble the rest of the sign.
- there are many product types and each one has its own html design and css so its very hard to maintain if i need to change things .
- different browsers show the sign differently .
- different printers print the sign differently.
What would be the best way to approach the problem? could css frameworks help?
I'm open for ideas.
I've developed an app that does printing, and HTML layout is about the furthest direction from the path that I would take. HTML printing loses elements such as background, positioning, etc very randomly....and it depends by printer brand and driver. If you're serious about going this route, the only two paths I'd consider doing are Postscript or Adobe PDF. HTML can be a valid "preview" but there again you will be fighting against the discrepancies between how the browsers render your code to the screen--no two are the same. Best still to do a .pdf and just display it.
On my app, I do general layout snapped to a draggable grid in Javascript, then output the coordinates and elements to a database that my (very specialized) printer picks up via an automated text document FTP and reassembles using a proprietary print server. From there, the print server puts all the elements together, positions via grid and outputs the job. It's been months in the making and a huge pain to build, but the outcome is just what my company needed for custom printing on demand. We train all our users to understand that layout is not guaranteed perfect like inDesign or Quark, and even then we get occasional complaints. Bottom line--the web wasn't made to be a print layout tool!
use xml + xslt serverbased transformation .
Keep data in standard XML (put that xml in DB)
Keep style in XSLT(Select XSLT depending on product company)
This could be pretty complex but you can apply style templates in form of xslt .
Most browser support this if you do it on server side and stream it .
If you want PDF , HTML ,word docs to be generated then just write XSLFO and use apache xalan framework to create them