Index: trunk/extensions/OWALiteTracker/OWALiteTracker.php |
— | — | @@ -0,0 +1,18 @@ |
| 2 | + |
| 3 | + |
| 4 | +//Must come after "CentralNotice", which creates the "Geo" object |
| 5 | + |
| 6 | +$wgHooks['SkinAfterBottomScripts'][] = 'efOWALiteTracker'; |
| 7 | + |
| 8 | +$wgOWAGeoTrackSites = array( |
| 9 | + array("country", "IN", "india-allproj.js"), |
| 10 | +); |
| 11 | + |
| 12 | +function efOWALiteTracker($skin, &$text){ |
| 13 | + if( count( $wgOWAGeoTrackSites ) <= 0 ){ return; } |
| 14 | + $text .= "<script> var includeOWA = false; if(Geo){"; |
| 15 | + foreach($condition in $wgOWAGeoTrackSites){ |
| 16 | + $text .= "if (Geo.{$condition[0]} && Geo.{$condition[0]} == \"{$condition[1]}\"){ if(!includeOWA){includeOWA=true; importScriptURI( document.location.protocol +'//owa.wikimedia.org/owa/modules/base/js/owa.tracker-combined-min.js');} importScriptURI( document.location.protocol + '//owa.wikimedia.org/resources/{$condition[2]}');}"; |
| 17 | + } |
| 18 | + $text .= "}</script>"; |
| 19 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/OWALiteTracker/OWALiteTracker.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 20 | + native |