MediaWiki talk:Wikiminiatlas.js/Archives/2012

Add topic
Active discussions

Zoom with precision

--- Wikiminiatlas.js    2012-05-15 15:30:03.503647000 +0000
+++ Wikiminiatlas.js.new        2012-05-15 15:38:22.629156000 +0000
@@ -171,7 +171,7 @@
  page_title = (wgNamespaceNumber==0) ? encodeURIComponent(wgTitle) : '',

  bodyc,
- coord_filter = /^([\d+-.]+)_([\d+-.]*)_?([\d+-.]*)_?([NSZ])_([\d+-.]+)_([\d+-.]*)_?([\d+-.]*)_?([EOW])/,
+ coord_filter = /&params=([\d.+-]+)_([\d.+-]*)_?([\d.+-]*)_?([NSZ])_([\d.+-]+)_([\d.+-]*)_?([\d.+-]*)_?([EOW])([^&=<>|]{0,250})/,
  coord_list = [],
  coord_highlight = -1,
  //region_index = 0,
@@ -343,27 +343,20 @@
    return false; // break out of each
   }

-  function capitalize(s) { return s.substr(0,1).toUpperCase()+s.substr(1).toLowerCase(); }
-  if( /_globe:([^_&]+)/.exec(link.href) ) { globe = capitalize(RegExp.$1); }
-  if( globe!="Earth" && globe!="Moon" && globe!="Mars" && globe!="Venus" && globe!="Mercury" && globe!="Io" ) { return; }
-
-  coordinates = link.href.replace( /−/g, '-' );
-  coord_params = coordinates.match(/&params=([^&=<>|]{7,255})/);
-
-  if(!coord_params) { return true; }
-  coord_params = coord_params[1];
-
-  if(!coord_filter.test(coord_params)) {
+  if(!coord_filter.exec(link.href)){
    return true;
   }
-  coord_filter.exec(coord_params);
   marker.lat=(1.0*RegExp.$1) + ((RegExp.$2||0)/60.0) + ((RegExp.$3||0)/3600.0);
   if( RegExp.$4 !== 'N' ) { marker.lat*=-1; }
   marker.lon=(1.0*RegExp.$5) + ((RegExp.$6||0)/60.0) + ((RegExp.$7||0)/3600.0);
   if( RegExp.$8 === 'W' ) { marker.lon*=-1; }
+  coord_params = RegExp.$9;
+
+  // Zoom based on coordinate N/S precision
+  var coord_digits = RegExp.$3 ? 4 : RegExp.$2 ? 2 : RegExp.$1.length - (RegExp.$1+".").indexOf('.') - 1;
+  zoomlevel = coord_digits * Math.log(10)/Math.log(2);

   // Find a sensible Zoom-level based on type
-  zoomlevel = 1;
   if( /_type:(airport|edu|pass|landmark|railwaystation)/.test(coord_params) ) {
    zoomlevel = 8;
   } else if( /_type:(event|forest|glacier)/.test(coord_params) ) {
@@ -383,6 +376,10 @@
   if( wc.zoom !== -1 ) { zoomlevel = wc.zoom; }
   if( zoomlevel > 12 ) { zoomlevel = 12; }

+  function capitalize(s) { return s.substr(0,1).toUpperCase()+s.substr(1).toLowerCase(); }
+  if( /_globe:([^_&]+)/.test(coord_params) ) { globe = capitalize(RegExp.$1); }
+  if( globe!="Earth" && globe!="Moon" && globe!="Mars" && globe!="Venus" && globe!="Mercury" && globe!="Io" ) { return; }
+
   // Test the unicode Symbol
   if( site === 'de' && link.parentNode.id !== 'coordinates' ) {
    mapbutton = $('<span>♁</span>').css('color','blue');

So far Dschwen only incorperated part of my improvements I emailed to him. The other improvements (removed &minus; support due to ASCII-only support, less complicated parsing, and zoom based off N/S precision) have yet to be incorperated. So I have redone the patch with the current version. —Dispenser (talk) 15:54, 15 May 2012 (UTC)

Added yesterday. Thanks. --Dschwen (talk) 21:31, 16 May 2012 (UTC)

Breaks in IE on invalid link

In IE8 invalid external link (like http://Wikipedia:...) doesn't have href attribute (more ...) so the line

if(!coord_filter.exec(link.href)){

throws "Invalid argument" JS error. — AlexSm 20:44, 7 August 2012 (UTC)

Hey alex, where does this happen? Oh, wait, I see, if there is one invalid link anywhere on the page it will break the execution. Thanks for the pointer! --Dschwen (talk) 16:08, 9 August 2012 (UTC)

Finnish

{{editprotected}}

fi: 'muuttaa jonkin kokoa',
should be
fi: 'muuta kokoa',

--Stryn (talk) 11:17, 31 August 2012 (UTC)

  Done. Thanks. -- MarcoAurelio (talk) 20:06, 1 September 2012 (UTC)

Awareness tooltip

I strongly dislike the automatic awareness tooltip. This isn't Microsoft Word; we don't need Clippy popping up to explain all the interface features to us. Please use a title tooltip like the watchlist and wikilove buttons do. It is far less obtrusive and annoying. Kaldari (talk) 19:47, 9 September 2012 (UTC)

Kaldari, I can see that powerusers may dislike the tooltip, and that is why I only enabled it for anonymous users. Let's keep dirty words like "Clippy" out of this discussion please ;-). Can you point me to the tooltips you mentioned, I have not seen them (which actually indicates that they might not be appropriate for the job). The tooltip is an experiment currently, and I am still working on a good way to raise a bit more awareness for the WMA. Pretty much unanimous feedback at Wikimania was "great tool, I've never seen it". Tweets during my talk takked about the WMA "just bing enable on english wikipedia". The current tooltip provided a 10fold increase in click rate on the blue globe button. The placement of the tooltip above the title baseline should not have it occlude anything on the article pages. The tooltip does not contain flashy colors or images (or even animations as your slightly acerbic sounding comparison to that ms office abomination might suggest). By the way the tooltip (as you have surely seen in the source code) can be permanently disabled by clicking on it. Nonetheless, please point me towards the watchlist and love tooltips, it would of course be desireable to a) reuse code, and b) keep the look and feel of wikipedia as consistent as possible. --Dschwen (talk) 00:20, 10 September 2012 (UTC)
The Watchlist and WikiLove buttons just use standard title tooltips (i.e. the title attribute). It looks like the globe icon already uses this as well; if you hover over it, it says "Show location on an interactive map". That seems like adequate guidance for newbies to me. Honestly, I wouldn't mind the bubble tooltip if it weren't automatic. Maybe the Clippy analogy was going too far, but it definitely gives me flashbacks to using Windows (especially after I see it about 12 times in the same day) :P Kaldari (talk) 05:24, 10 September 2012 (UTC)
A hover tooltip just does not do the job. As I said, the WikiMiniAtlas suffers from not being noticed. The new tooltip increased clicks by an order of magnitude. I'd be very happy about suggestions how to make this UI element more self explanatory. I.e. make it stand out as a button and not look like an inactive decoration (which is how people perceive it. --Dschwen (talk) 15:05, 10 September 2012 (UTC)
I'm not surprised that it increased clicks, it's pretty hard to ignore, which is precisely why it becomes annoying after you see it numerous times a day. If the experiment were left as is, imagine how many times the average Wikipedia reader would see that pop-up over the course of their lifetime. Kaldari (talk) 19:28, 11 September 2012 (UTC)
He would only be forced to see it exactly one time. Then he could click on it to dismiss it forever (or the duration his browser's localStorage persists). Should I maybe make the option to dismiss the tooltip more prominent? Maybe with a second tooltip pointing to the first one! :-D --Dschwen (talk) 21:19, 11 September 2012 (UTC)
As there is no reason a user ever needs to read the explanation twice, why not just set the cookie/localstore immediately (i.e. without clicking)? (Although my preferred solution is still to use only a title tooltip.) Kaldari (talk) 04:33, 15 September 2012 (UTC)
Of course I agree there is no reason a user ever needs to read the explanation twice. That's exactly why I made the tooltip dismissable. Your suggestion of immediately setting the dismissed-flag is flawed, because there is no way of knowing if the user read it at all. I'm still experimenting with this. Let's see how the stats change if I only show it a few times. We should give it some time (at least a week) to get a good sample. Then we can reeveluate and see where this is going. Of course the whole test would be more efficient if I performed user tracking and offered different samples of users the tooltip for different times an compared the click through rate. But I'm not quite sure if this is permitted. Even if I'd use those powers for good ;-) --Dschwen (talk) 04:22, 16 September 2012 (UTC)
How are you evaluating this experiment? If you intend to pick whatever option gets you the most clicks, I'm certain that a blinking hot pink bubble with 30pt text will win. What data are you using to measure user annoyance? Kaldari (talk) 23:34, 17 September 2012 (UTC)
Right now I'm measuring user annoyance by number of users complaining. So far that number is 1. --Dschwen (talk) 17:43, 18 September 2012 (UTC)
Heh, guess I need some sockpuppets then ;) Kaldari (talk) 20:48, 19 September 2012 (UTC)

Script loading and bandwidth

Currently this script weighs in at a hefty 25K and is loaded by default on every en.wiki page view whether it is needed or not. That translates into 6+ terabytes of bandwidth usage per day (just for en.wiki). If our hosting costs were 10 cents per gigabyte, that would translate to $600 per day or $18,000 per month. Is there any way that we could load a smaller chunk by default and only load the full application if it's actually needed? Kaldari (talk) 19:43, 2 October 2012 (UTC)

Uhm, I'm sure this number is way overinflated. There should be a huge fraction of cache hits. You cannot simply multiply the size of the script buy the number of page hits. First and simplest step would be minifying the script. --Dschwen (talk) 22:04, 2 October 2012 (UTC)
Next step would be splitting this into a loader script that just detects the presence of coord templates and Attached KML templates. I'm off for a vacation now, but I'll keep this in mind. --Dschwen (talk) 22:06, 2 October 2012 (UTC)
And by the way, it's 23.7K, >$900 a month difference ;-) --Dschwen (talk) 22:10, 2 October 2012 (UTC)
gzipped (which is probably how most of the clients will receive the file) the size is 9.4K. Minified an gzipped it is 7.2K. But I still think the biggest flaw in this calculation is ignoring cache hits. --Dschwen (talk) 22:13, 2 October 2012 (UTC)
True. I'm sure at least half the loads will be cache hits. Anyway, just wanted to plant this idea in your head in case you have some ideas for improving the loading scheme. I guess I'll stop harassing you while you're on vacation though ;) Kaldari (talk) 05:22, 3 October 2012 (UTC)

kk language

Please add kk language. --Bolatbek (talk) 15:53, 5 October 2012 (UTC)

kk user interface translations, or kk labels? --Dschwen (talk) 07:50, 6 October 2012 (UTC)
Both. Is it possible? --Bolatbek (talk) 14:00, 9 October 2012 (UTC)
I'm adding kk labels right now. I'm not sure, why this language was not on my list. Userinterface translations will have to be provided by a kk speaker at Commons:WikiMiniAtlas/Translations. --Dschwen (talk) 17:38, 26 October 2012 (UTC)
Looks like the translations are already there. Let's test this. I'm continuing this on your kk talkpage. --Dschwen (talk) 17:50, 26 October 2012 (UTC)
Return to "Wikiminiatlas.js/Archives/2012" page.