Index: trunk/extensions/CongressLookup/SpecialCongressLookup.php |
— | — | @@ -47,8 +47,6 @@ |
48 | 48 | |
49 | 49 | // Output beginning of the page |
50 | 50 | $htmlOut .= <<<HTML |
51 | | - |
52 | | - |
53 | 51 | <!DOCTYPE html> |
54 | 52 | <html lang="en" dir="ltr" class="client-nojs"> |
55 | 53 | <head> |
— | — | @@ -56,6 +54,52 @@ |
57 | 55 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
58 | 56 | <meta http-equiv="Content-Style-Type" content="text/css" /> |
59 | 57 | <meta name="generator" content="MediaWiki 1.18wmf1" /> |
| 58 | +<script src="//geoiplookup.wikimedia.org/" type="text/javascript"></script> |
| 59 | +<script type="text/javascript" src="/mediawiki/load.php?lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=20111213T185322Z"> </script> |
| 60 | +<script type="text/javascript"> |
| 61 | + |
| 62 | +$(document).ready(function() { |
| 63 | + |
| 64 | + var geoHasUsRep = [ |
| 65 | + 'US', // USA |
| 66 | + 'PR', // Puerto Rico |
| 67 | + 'VI', // Virgin Islands |
| 68 | + 'MP', // Northern Mariana Islands |
| 69 | + 'AS', // American Samoa |
| 70 | + 'GU' // Guam |
| 71 | + ]; |
| 72 | + |
| 73 | + // Fake country from get param |
| 74 | + // Parse out GET params from the URL |
| 75 | + var urlParams = {}; |
| 76 | + (function () { |
| 77 | + var e, |
| 78 | + a = /\+/g, |
| 79 | + r = /([^&=]+)=?([^&]*)/g, |
| 80 | + d = function (s) { return decodeURIComponent(s.replace(a, " ")); }, |
| 81 | + q = window.location.search.substring(1); |
| 82 | + |
| 83 | + while (e = r.exec(q)) { |
| 84 | + urlParams[d(e[1])] = d(e[2]); |
| 85 | + } |
| 86 | + })(); |
| 87 | + |
| 88 | + // Defaults to the US, so if we can't determine location, show form |
| 89 | + var country = 'US'; |
| 90 | + if ( urlParams.country ) { |
| 91 | + country = urlParams.country; |
| 92 | + } else if ( window.Geo && window.Geo.country ) { |
| 93 | + country = window.Geo.country; |
| 94 | + } |
| 95 | + |
| 96 | + var hasUsRep = ( $.inArray( country, geoHasUsRep ) === 0 ); |
| 97 | + if( !hasUsRep ) { |
| 98 | + $("#sopaShareOptions").show(); |
| 99 | + $("#sopaZipForm").hide(); |
| 100 | + } |
| 101 | + |
| 102 | +}); |
| 103 | +</script> |
60 | 104 | <style type="text/css"> |
61 | 105 | body { |
62 | 106 | color: #dedede; |
— | — | @@ -98,9 +142,9 @@ |
99 | 143 | } |
100 | 144 | div#contacts { |
101 | 145 | position: absolute; |
102 | | - top: 50px; |
103 | | - left: 50px; |
104 | | - width: 320px; |
| 146 | + top: 350px; |
| 147 | + left: 110px; |
| 148 | + width: 260px; |
105 | 149 | background-color: #161616; |
106 | 150 | padding: 5px 20px 20px 20px; |
107 | 151 | filter:alpha(opacity=90); |
— | — | @@ -144,6 +188,19 @@ |
145 | 189 | font-size: 1.2em; |
146 | 190 | margin-bottom: 0.2em; |
147 | 191 | } |
| 192 | +.sopaSocial { |
| 193 | + float: left; |
| 194 | + text-align: center; |
| 195 | + margin-right: 12px; |
| 196 | + margin-bttom: 3px; |
| 197 | + font-size: small; |
| 198 | +} |
| 199 | +.sopaActionHead { |
| 200 | + font-weight: bold |
| 201 | +} |
| 202 | +#sopaShareOptions { |
| 203 | + display: none; |
| 204 | +} |
148 | 205 | </style> |
149 | 206 | </head> |
150 | 207 | <body> |
— | — | @@ -179,6 +236,7 @@ |
180 | 237 | $htmlOut .= $this->getCongressTables(); |
181 | 238 | } else { |
182 | 239 | $htmlOut .= $this->getZipForm(); |
| 240 | + $htmlOut .= $this->getSocialMedia(); |
183 | 241 | } |
184 | 242 | |
185 | 243 | // Output end of the page |
— | — | @@ -300,8 +358,8 @@ |
301 | 359 | */ |
302 | 360 | private function getZipForm( $isError=false ) { |
303 | 361 | $htmlOut = <<<HTML |
| 362 | +<div id="sopaZipForm" class="sopaActionDiv"> |
304 | 363 | <h4>Contact your representatives</h4> |
305 | | -<div class="sopaActionDiv"> |
306 | 364 | HTML; |
307 | 365 | if ( $isError ) { |
308 | 366 | $htmlOut .= Html::element( 'p', array( 'class' => 'error' ), wfMsg( 'congresslookup-zipcode-error' )); |
— | — | @@ -322,32 +380,56 @@ |
323 | 381 | * @return string HTML for social media links |
324 | 382 | */ |
325 | 383 | private function getSocialMedia() { |
| 384 | + // Update links here. Currently pointing to example.com |
326 | 385 | $htmlOut = <<<HTML |
327 | | -<div class="sopaActionDiv"> |
328 | | - <div> |
329 | | - <div class="sopaSocial"> |
330 | | - <a style="text-decoration: none;" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fexample.com%2F"> |
331 | | - <img width="33" height="33" src="//upload.wikimedia.org/wikipedia/commons/2/2a/WP_SOPA_sm_icon_facebook_dedede.png"> |
332 | | - </a> |
333 | | - <br/> |
334 | | - <a style="text-decoration: none;" href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fexample.com%2F">Facebook</a> |
335 | | - </div> |
336 | | - <div class="sopaSocial"> |
337 | | - <a style="text-decoration: none;" href="https://m.google.com/app/plus/x/?v=compose&content=Google%20Plus%20Post%20Here%20http%3A%2F%2Fexample.com%2F"> |
338 | | - <img width="33" height="33" src="//upload.wikimedia.org/wikipedia/commons/0/08/WP_SOPA_sm_icon_gplus_dedede.png"> |
339 | | - </a> |
340 | | - <br/> |
341 | | - <a style="text-decoration: none; color:" href="https://m.google.com/app/plus/x/?v=compose&content=Google%20Plus%20Post%20Here%20http%3A%2F%2Fexample.com%2F">Google+</a> |
342 | | - </div> |
343 | | - <div class="sopaSocial"> |
344 | | - <a style="text-decoration: none;" href="https://twitter.com/intent/tweet?original_referer=http%3A%2F%2Ftest.wikipedia.org%2Fwiki%2FMain_Page%3Fbanner%3Dblackout&text=Tweet%20here%20%23WikipediaBlackout%20http%3A%2F%2Fexample.com%2F"> |
345 | | - <img width="33" height="33" src="//upload.wikimedia.org/wikipedia/commons/4/45/WP_SOPA_sm_icon_twitter_dedede.png"> |
346 | | - </a> |
347 | | - <br/> |
348 | | - <a style="text-decoration: none;" href="https://twitter.com/intent/tweet?original_referer=http%3A%2F%2Ftest.wikipedia.org%2Fwiki%2FMain_Page%3Fbanner%3Dblackout&text=Tweet%20here%20%23WikipediaBlackout%20http%3A%2F%2Fexample.com%2F">Twitter</a> |
349 | | - </div> |
350 | | - </div> |
351 | | - <div style="clear: both;"></div> |
| 386 | +<div id="sopaShareOptions" class="sopaActionDiv"> |
| 387 | +<p class="sopaActionHead">Make your voice heard</p> |
| 388 | + <div> |
| 389 | + <div class="sopaSocial"> |
| 390 | + <a style="text-decoration: none;" |
| 391 | + href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fexample.com%2F" |
| 392 | + target="wpblackout_Facebook_share"><img width="33" |
| 393 | + height="33" |
| 394 | + src= |
| 395 | + "//upload.wikimedia.org/wikipedia/commons/2/2a/WP_SOPA_sm_icon_facebook_dedede.png"></a><br> |
| 396 | + |
| 397 | + <a style="text-decoration: none; color: rgb(222, 222, 222);" |
| 398 | + href="https://www.facebook.com/sharer.php?u=http%3A%2F%2Fexample.com%2F" |
| 399 | + target="wpblackout_Facebook_share">Facebook</a> |
| 400 | + </div> |
| 401 | + |
| 402 | + <div class="sopaSocial"> |
| 403 | + <a style="text-decoration: none;" |
| 404 | + href= |
| 405 | + "https://m.google.com/app/plus/x/?v=compose&content=Google%20Plus%20Post%20Here%20http%3A%2F%2Fexample.com%2F"> |
| 406 | + <img width="33" |
| 407 | + height="33" |
| 408 | + src= |
| 409 | + "//upload.wikimedia.org/wikipedia/commons/0/08/WP_SOPA_sm_icon_gplus_dedede.png"></a><br> |
| 410 | + |
| 411 | + <a style="text-decoration: none;" |
| 412 | + href= |
| 413 | + "https://m.google.com/app/plus/x/?v=compose&content=Google%20Plus%20Post%20Here%20http%3A%2F%2Fexample.com%2F"> |
| 414 | + Google+</a> |
| 415 | + </div> |
| 416 | + |
| 417 | + <div class="sopaSocial"> |
| 418 | + <a style="text-decoration: none;" |
| 419 | + href= |
| 420 | + "https://twitter.com/intent/tweet?original_referer=http%3A%2F%2Ftest.wikipedia.org%2Fwiki%2FMain_Page%3Fbanner%3Dblackout%26country%3DUK&text=Tweet%20here%20%23WikipediaBlackout%20http%3A%2F%2Fexample.com%2F" |
| 421 | + target="wpblackout_Twitter_share"><img width="33" |
| 422 | + height="33" |
| 423 | + src= |
| 424 | + "//upload.wikimedia.org/wikipedia/commons/4/45/WP_SOPA_sm_icon_twitter_dedede.png"></a><br> |
| 425 | + |
| 426 | + <a style="text-decoration: none; color: rgb(222, 222, 222);" |
| 427 | + href= |
| 428 | + "https://twitter.com/intent/tweet?original_referer=http%3A%2F%2Ftest.wikipedia.org%2Fwiki%2FMain_Page%3Fbanner%3Dblackout%26country%3DUK&text=Tweet%20here%20%23WikipediaBlackout%20http%3A%2F%2Fexample.com%2F" |
| 429 | + target="wpblackout_Twitter_share">Twitter</a> |
| 430 | + </div> |
| 431 | + </div> |
| 432 | + |
| 433 | + <div style="clear: both;"></div> |
352 | 434 | </div> |
353 | 435 | HTML; |
354 | 436 | return $htmlOut; |