Skip to content

Commit

Permalink
[Bug 702816] SOPA participation.
Browse files Browse the repository at this point in the history
  • Loading branch information
rlr committed Nov 16, 2011
1 parent 38fff11 commit e004f82
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
Binary file added media/img/mozillaorg_censorship_wht.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions media/js/sopa.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
(function($) {
var html = '<a style="width:400px;height:32px;vertical-align:middle;text-align:center;background-color:#000;position:absolute;z-index:5555;left:10px;background-image:url(%simg/mozillaorg_censorship_wht.png);background-position:center center;background-repeat:no-repeat;text-indent:-9999px;-moz-transform:rotate(-1deg);-webkit-transform:rotate(-1deg);transform:rotate(-1deg);top: 41px;" href="http://americancensorship.org">STOP CENSORSHIP</a>';

function isACD() {
var start = new Date('Wed Nov 16 2011 00:00:01'),
end = new Date('Thu Nov 17 2011 00:00:01'),
now = new Date();
return (start < now && now < end);
}

function isEnUS() {
return document.location.pathname.indexOf('/en-US/') === 0;
}

function isLandingPage() {
var view = document.location.pathname.slice(7);
return _.indexOf(['home', 'mobile', 'sync', 'firefox-home'], view) >= 0;
}

function isInProduct() {
return k.getReferrer(k.getQueryParamsAsDict()) === 'inproduct';
}

if (isACD() && isEnUS() && (isLandingPage() || isInProduct())) {
$('#masthead').append(interpolate(html, [$('body').data('media-url')]));
}

}(jQuery));
1 change: 1 addition & 0 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ def JINJA_CONFIG():
'js/main.js',
'js/format.js',
'js/loadtest.js',
'js/sopa.js',
),
'libs/jqueryui': (
'js/libs/jqueryui.min.js',
Expand Down
1 change: 1 addition & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
data-for-os="{{ for_os|json }}"
data-for-version="{{ for_version|json }}"
data-usernames-api="{{ url('users.api.usernames') }}"
data-media-url="{{ MEDIA_URL }}"
{% if extra_body_attrs -%}
{% for attr, val in extra_body_attrs.items() %}{{ attr }}="{{ val }}" {% endfor %}
{%- endif %}>
Expand Down

0 comments on commit e004f82

Please sign in to comment.