I am trying to customize the disqus comments count in my blog page http://www.lowcoupling.com
the problem is although, as you can see, I have manage to remove the word Comment(s) I can't see how to disable/remove the reactions count.
Is there any way to do that? I can't find it in the settings page
Go to your Disqus admin and add the HTML tags there like so:
Zero Comments | 0<span style="display:none;">
One Comment | 1<span style="display:none;">
Multiple Comments | {num}<span style="display:none;">
Zero Reactions | 0 Reactions</span>
One Reaction | 1 Reaction</span>
Multiple Reactions | {num} Reactions</span>
Related
I'm using a template {{MyTemplate|foo}} which consists of the following code:
{{#switch: {{{1}}}
| foo = [[Category:Foo]]
| bar = [[Category:Bar]]
| #default = [[Category:Unknown]]
}}
When I'm using it on a page, the categories show up nicely as wished at the bottom of that page. But unfortunately inside of that category-page (Category:Foo for example) the page doesn't show up.
If I add [[Category:Foo]] manually to that page, the page shows up in the Foo-category-page.
Any suggestions why this doesn't work via the template?
Does the template page that contain the previous code appear under Unknown category?. If yes, then any page contain that template must appear in it's category. You may just have to clear cache, and wait few seconds if you have a large wiki.
Make sure that foo & bar categories are not hidden in your wiki. See this: https://www.mediawiki.org/wiki/Help:Categories#Hidden_categories
EDIT
Also, try one of these solutions, which can do the same goal:
{{#switch: {{{1}}}
| foo = [[Category:Foo]]
| bar = [[Category:Bar]]
| #default = [[Category:Unknown]]
}}
OR
{{#ifeq: {{{1}}} | foo | [[Category:Foo]] | {{#ifeq: {{{1}}} | bar | [[Category:Bar]] | [[Category:Unknown]]}} }}
Do you run the jobqueue on your wiki? Linkstables are updated asynchronously and not at page save time.
https://www.mediawiki.org/wiki/Manual:Job_queue
https://www.mediawiki.org/wiki/Manual:RunJobs.php
Cant understand the description to your problem, but anyway, it seems like you could achieve the same goal by:
{{#vardefine: my_category |wow}}
[[Category: {{#ifeq: {{#var:my_category}}| default| unknown| {{#var:my_category}} }} ]]
Which adds this category to the page,
In my opinion, you should use switch when you are adding category in any case but also decide not to add category in another case.
If you are adding category in all cases, you can write as i wrote above, or export the final category to another variable and use it inside the category.
As for your problem, you can use "?action=purge" for this page, if that wont work, write here some more info.
I'm trying to scrape the helpful Infobox from most Automobile pages, however I'm messing up the syntax. From other helpful SO posts, I've found a handy method of scraping a standard Infobox template (the example given was for hydrogen):
https://en.m.wikipedia.org/w/index.php?action=raw&title=Template:Infobox%20hydrogen
I can use a similar process to pull the Ford Pinto page (using this as it only has a single Infobox, as there was only one, infamous, model generation):
https://en.m.wikipedia.org/w/index.php?action=raw&title=Ford_Pinto
This page, and most automobile pages, used one of the vehicle-specific Infobox templates, in this case "Infobox automobile" (sorry for the massive block, I'm going to edit this once it's posted as I'm on mobile and I read up on SO formatting):
{{Infobox automobile
| name = Ford Pinto
| image = Ford Pinto.jpg
| caption = Ford Pinto
| manufacturer = [[Ford Motor Company|Ford]]
| aka = Mercury Bobcat
| production = September 1970–1980
| model_years = 1971–1980 (Pinto)<br> 1974–1980 (Bobcat)
| assembly = '''United States:''' {{ubl|[[Edison, New Jersey]] ([[Edison Assembly]])|[[Milpitas, California]] ([[San Jose Assembly Plant|San Jose Assembly]])}}'''Canada:''' {{ubl|[[Southwold, Ontario]] ([[St. Thomas Assembly]])}}
| designer = Robert Eidschun (1968)<ref name=bbw20091030>
...
Snipped some useless stuff
...
</ref>
| class = [[Subcompact car]]
| body_style = 2-door [[Sedan (automobile)|sedan]]<br/>2-door [[sedan delivery]]<br/>2-door [[station wagon]]<br/> 3-door [[hatchback]]
| related = [[Ford Pinto#Mercury Bobcat (1974–1980)|Mercury Bobcat]]<br>[[Ford Mustang (second generation)|Ford Mustang II]]<br> [[Pangra]]
| layout = [[Front-engine, rear-wheel-drive layout|FR layout]]
| engine = {{unbulleted list
| 1.6L ''[[Ford Kent engine|Kent]]'' I4
| 2.0L ''[[Ford Pinto engine|EAO]]'' I4
| 2.3L ''[[Ford Pinto engine|OHC]]'' I4
| 2.8L ''[[Ford Cologne engine|Cologne]]'' V6
}}
| transmission = {{unbulleted list
| 4-speed manual
| 3-speed ''[[Ford C3 transmission|C3/"Selectshift/Cruise-O-Matic"]]'' automatic
...
Snipped
...
</ref>
|wheelbase = {{convert|94.0|in|mm|abbr=on}}<ref>
...
Snipped
...
}}
| wheelbase = {{convert|94.0|in|mm|abbr=on}}<ref>
...
Snipped
...
</ref>
| length = {{convert|163|in|mm|abbr=on}}
| width = {{convert|69.4|in|mm|abbr=on}}
| height = {{convert|50|in|mm|abbr=on}}
| weight = {{convert|2015|–|2270|lb|abbr=on}} (1971)
| predecessor = [[Ford Cortina|Ford Cortina (captive import)]]
| successor = [[Ford Escort (North America)|Ford Escort]]
}}
Though not as pretty as the above, another alternative is to use the REST API and slim the page down to just the article, in HTML, which will let me use a standard HTML parser to pull just the Infobox HTML table (link should work in chrome, but will definitely work on an Android device):
view-source:https://en.wikipedia.org/api/rest_v1/page/html/Ford_Pinto
<table class="infobox hproduct" style="width:22em" about="#mwt7" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Infobox automobile\n","href":"./Template:Infobox_automobile"}
I can handle parsing either of these for the information I want, namely performance information - model, years, drivetrain layout, engines, transmissions, wheelbase, weight - however despite trying various API/other urls, I've yet been unable to directly scrape just the Infobox using the API alone. Also, I'm not exactly sure what the difference is between using an api.php? action=parse url vs an index.php? action=raw - any clarification here is welcome, though I don't think directly relevant. Here are some unsuccessful examples of what I have tried, each with different errors/results:
https://en.wikipedia.org/w/ <- append the following to this base link as I can't post a bunch of links
api.php?action=parse&page=Template:Infobox%20automobile%20Ford_Pinto&format=json
api.php?action=query&titles=Template:Infobox%20automobile%20Ford%20Pinto&prop=revisions&rvprop=content&format=json&formatversion=2
api.php?action=query&titles=Template:Infobox%20automobile%20Ford_Pinto&prop=revisions&rvprop=content&format=json&formatversion=2
index.php?action=raw&title=Template:Infobox%20automobile%20Ford_Pinto
index.php?action=raw&title=Template:Infobox%20automobile%20Ford%20Pinto
index.php?action=raw&titles=Template:Infobox%20automobile%20Ford_Pinto
index.php?action=raw&titles=Template:Infobox%20automobile%20Ford%20Pinto
This is different from various other Infobox scraping questions as these articles use a specific Infobox template that prevents me from using the very successful API url I've posted above, although I'm sure this is user error and a simple fix. Thank you for your time in reading and assisting!
Edit: the suggested page is the way I'm already trying, and failing. Per that page, I am attempting the 'wrong' way until someone, including myself, figures out what I'm doing wrong - assuming there is a right way for the non standardized/base Infobox Templates. Failing any new information in a day or so, I'll just accept the currently suggested answer to reward that user's helpfulness - but I really hoped I'd get a few more attempts, which is why I created an account and asked the hive mind after searching and failing to find an answer from the many other questions I checked. By the way, any attention is good attention, so thank you kindly for taking the time to look over this!
Wikipedia infoboxes are not designed to be scrapeable. They are primarily a (front-end!) templating mechanism; the fact that they sometimes contain structured data is incidental.
The difference between action=raw and action=parse is simply that raw gives you the original wikitext (like you'd see if you clicked the "Edit" link on the article), and parse gives you the rendered HTML. Neither of these is likely to be much use for your purposes.
Your best bet will be to use data from a downstream project like DBpedia which has already done the dirty work of parsing these articles. For instance, here's their parsed data for the Ford Pinto:
http://dbpedia.org/snorql/?describe=http%3A//dbpedia.org/resource/Ford_Pinto
You could use the Parsoid output of the page https://en.wikipedia.org/api/rest_v1/page/html/Ford_Pinto, which has a table with class infobox and a data-mw with some JSON encoded data.
I would look for the infoboxes (CSS selector table.infobox) and run a JSON.parse on the data-mw value. Check if the infobox has href ./Template:Infobox_automobile then look for the right parameter (in the params field).
Here's a sample request:
curl -X GET --header 'Accept: text/html; charset=utf-8; profile="https://www.mediawiki.org/wiki/Specs/HTML/1.6.1"' 'https://en.wikipedia.org/api/rest_v1/page/html/Ford_Pinto'
In addition to the Accept header it's also good to set the User-Agent header to a unique string.
I would like to display in the same query properties of a page which is related to the pages im querying for.
Let's say I would like to query all the pages in the City category, which are located in Germany, and I want to display the title of the page, but also I want to display the surface data of Germany, for example.
Something like this: {{#ask: [[Category:City]] [[location::Germany]] |?mainlabel |?Location.surface }}
I know this wont work, but you can see what I want to achieve.
I'm not sure if there's a way to nest queries directly inside other queries. The normal method of doing it is using a template. So you might define a template (or subpage of the template if this going into a template) called {{tablerow}} that consists of:
<includeonly>
|- valign="top"
| [[{{{1|}}}]]
| {{#show: {{{1|}}} | ?surface }}</includeonly>
The <includeonly> tags are important for reasons I don't really understand, it produces errors sometimes if you leave them out. Then you just run an #ask query with format = template. (You can build the header into the query, but I find it simpler to just put it outside.)
{| class="wikitable smwtable sortable"
|- valign="bottom"
! [[City]]
! [[Surface]]
{{#ask: [[Category:City]] [[location::Germany]]
| format = template
| template = tablerow
| link = none
}}
|}
That will punch each result returned by the query through the template as {{{1}}} and generate a row based on it. If you have other data to return from the main query, additional properties that you ask for will come out as consecutive unnamed parameters (so if you include | ?population, that will go into the template as {{{2}}} and will need to be added to the row structure or it will be dropped).
Background
I am presenting data using a HTML frameset. The left-side frame is a navigation tree-table constructed as an HTML table. Only minimal data is shown in this frame because I want to use the right-side "details" frame to give the user more details when he selects one of the navigation table rows.
+----------------------------+
| | |
| tree | "details" |
| table | pertaining to |
| nav. | selected |
| | row |
|=selected=| |
| | |
| | |
| | |
+----------------------------+
Think of this like a directory browser where you can see filesize, type, modification date, etc. on the right when you select an item in the left-hand tree.
Obtaining item details server-side is a sequential task, i.e. to get details on the nth item, the server has to work through all n-1 preceding items. For this reason, I think the most straightforward way to present the detailed data to the user is to have the server embed all detailed information within the navigation table rows and have a script generate the details page in a right-hand frame.
Question
How should I represent the detailed data within the navigation table HTML? Should I make up my own element tagnames? Should I use extra columns that are not displayed? Or something else? The data is typically name-value pairs - both name and value can be text. Each element may have a different set of data pairs. Is there a standard way to represent user data within an (X)HTML document?
NEVER, EVER EVER EVER EVER EVER EVER mix data and display. I also think you can easily get around the iterating over n elements to get the data you require. Here is how you do it.
Create a model (your data storage) in the javascript.
var data = [
{
title: "item 1",
foo: "bar",
baz: 10
},
{
title: "item 2",
foo: "bazbar",
baz: 20
}
];
Then, using Javascript, you could use the above data to create the following table on the left
<table>
<tr><td>item 1</td></tr>
<tr><td>item 2</td></tr>
</table>
So then you would have your show details function
function showDetails(index){
var currentData = data[index];
/* Do something with data */
}
I have created a working example here. There is an error in that code that says showDetails is not defined, but that is due to a jsfiddle issue, the code will work if put into a HTML page. ALSO, be sure to use the strict doctype at the top (to avoid cross browser quirsk).
Might I also suggest, that you look at YUI 2's layout manager instead of using a frameset. Framesets require multiple pages with javascript snaked throughout and can be a maintenance nightmare down the road.
This is an odd question, and I think it belongs on Stack Overflow since it has to do with HTML/Javascript - if it doesn't belong, let me know and I'll ask it elsewhere.
I am trying to implement a component in my web application, but I do not know what it is called, so I don't know how to search for help on it!
It is where you have a list of things in a combo box on the left side, some arrows in the middle to send list items between combo boxes, and a combo box on the right side that shows the items you have selected.
Here is a "picture" of what I mean:
+-------+ +-------+
| item1 | ---> | item2 |
| item3 | | |
| item4 | <--- | |
+-------+ +-------+
I'm sure there is a JQuery plugin for this too, so if anyone has any recommendations, I'd appreciate it. Thanks in advance!
There is no 'component' that will do this. This thread should help:
Moving items in Dual Listboxes
You have both a jQuery and native javascript example.
There isn't an HTML tag for this, it has to be implemented in JavaScript. It wouldn't be all that hard even without jQuery.
There is also a jQuery plugin here. The examples aren't very flashy, but they do the job.