Skip to content
Browse files

Simplified to use fancy new template.

  • Loading branch information...
1 parent 7d5624e commit f190e513ac9db9513c8cbdb67f0992c36dbe9279 @mcantelon committed Jan 15, 2012
Showing with 166 additions and 25 deletions.
  1. +1 −25 sopa.module
  2. +165 −0 template/sopa.html
View
26 sopa.module
@@ -8,10 +8,7 @@ $on_user_page = strpos($_REQUEST['q'], 'user') === 0;
if ($_GET['sopa_test'] || !($on_admin_page || $on_user_page)) {
if ($_GET['sopa_test'] || date('Y-m-d') == '2012-01-18') {
- $path_to_static = '/'. drupal_get_path('module', 'sopa') .'/template';
- print sopa_return_template_html('sopa', 'page.tpl.php', array(
- 'path_to_static' => $path_to_static
- ));
+ print file_get_contents(dirname(__FILE__) .'/template');
exit();
}
}
@@ -36,24 +33,3 @@ function sopa_help($section = '') {
return $output;
}
-
-function sopa_return_template_html($module, $template, $variables = array()) {
- // Create local copies of variables passed to template
- if (is_array($variables)) {
- reset($variables);
- while (list($key, $value) = each($variables)) {
- $$key = $value;
- }
- }
-
- // Use output buffering to capture included template output
- ob_start();
- if ($module) {
- include(drupal_get_path('module', $module) .'/template/'. $template);
- }
-
- $output = ob_get_contents();
- ob_end_clean();
-
- return $output;
-}
View
165 template/sopa.html
@@ -0,0 +1,165 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<title>STOP SOPA!</title>
+
+<style type="text/css" media="all">
+html,
+body {
+ margin: 0;
+ padding: 0;
+}
+
+#text-shadow-box {
+ position: fixed;
+ left: 0;
+ right: 0;
+ top: 0;
+ bottom: 0;
+ width: 100%;
+ height: 100%;
+ overflow: hidden;
+ background: #444;
+ font-family: Helvetica, Arial, sans-serif;
+ -webkit-tap-highlight-color: rgba(0,0,0,0);
+ -webkit-user-select: none;
+}
+
+#text-shadow-box #tsb-text,
+#text-shadow-box #tsb-link {
+ position: absolute;
+ top: 40%;
+ left: 0;
+ width: 100%;
+ height: 1em;
+ margin: -0.77em 0 0 0;
+ font-size: 90px;
+ line-height: 1em;
+ font-weight: bold;
+ text-align: center;
+}
+
+#text-shadow-box #tsb-text {
+ font-size: 100px;
+ color: transparent;
+}
+
+#text-shadow-box #tsb-link a {
+ color: #999;
+ text-decoration: none;
+}
+
+#text-shadow-box #tsb-box,
+#text-shadow-box #tsb-wall {
+ position: absolute;
+ top: 40%;
+ left: 0;
+ width: 100%;
+ height: 60%;
+}
+
+#text-shadow-box #tsb-wall {
+ background: #999;
+}
+
+#text-shadow-box #tsb-wall p {
+ font-size: 18px;
+ line-height: 1.5em;
+ text-align: justify;
+ color: #222;
+ width: 550px;
+ margin: 1.5em auto;
+}
+
+#text-shadow-box #tsb-wall p a {
+ color: #fff;
+}
+
+#text-shadow-box #tsb-wall p a:hover {
+ text-decoration: none;
+ color: #000;
+ background: #fff;
+}
+
+#tsb-spot {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 200%;
+ height: 200%;
+ pointer-events: none;
+ background: -webkit-gradient(radial, center center, 0, center center, 350, from(rgba(0,0,0,0)), to(rgba(0,0,0,1)));
+ background: -moz-radial-gradient(center 45deg, circle closest-side, transparent 0, black 350px);
+}
+</style>
+
+</head>
+<body>
+
+<div id="text-shadow-box">
+ <div id="tsb-box"></div>
+ <p id="tsb-text">STOP SOPA!</p>
+ <p id="tsb-link"><a href="http://americancensorship.org/">STOP SOPA!</a></p>
+ <div id="tsb-wall">
+ <p>This site has gone dark today in protest of the U.S. Stop Online Piracy Act (SOPA) and PROTECT-IP Act (PIPA). The U.S. Congress is about to censor the Internet, even though the vast majority of Americans are opposed. We need to kill these bills to protect our rights to free speech, privacy, and prosperity. Learn more at <a href="http://americancensorship.org/">AmericanCensorship.org</a></p>
+ </div>
+ <div id="tsb-spot"></div>
+</div>
+
+<script type="text/javascript" language="javascript" charset="utf-8">
+/**
+ * Zachary Johnson
+ * http://www.zachstronaut.com
+ * I place the following code in the public domain.
+ */
+
+var text = null;
+var spot = null;
+var box = null;
+var boxProperty = '';
+
+init();
+
+function init() {
+ text = document.getElementById('tsb-text');
+ spot = document.getElementById('tsb-spot');
+ box = document.getElementById('tsb-box');
+
+ if (typeof box.style.webkitBoxShadow == 'string') {
+ boxProperty = 'webkitBoxShadow';
+ } else if (typeof box.style.MozBoxShadow == 'string') {
+ boxProperty = 'MozBoxShadow';
+ } else if (typeof box.style.boxShadow == 'string') {
+ boxProperty = 'boxShadow';
+ }
+
+ if (text && spot && box) {
+ document.getElementById('text-shadow-box').onmousemove = onMouseMove;
+ document.getElementById('text-shadow-box').ontouchmove = function (e) {e.preventDefault(); e.stopPropagation(); onMouseMove({clientX: e.touches[0].clientX, clientY: e.touches[0].clientY});};
+ }
+
+ onMouseMove({clientX: Math.floor(window.innerWidth / 2), clientY: Math.floor(window.innerHeight / 2.75)});
+}
+
+function onMouseMove(e) {
+ var xm = (e.clientX - Math.floor(window.innerWidth / 2)) * 0.4;
+ var ym = (e.clientY - Math.floor(window.innerHeight / 3)) * 0.4;
+ var d = Math.round(Math.sqrt(xm*xm + ym*ym) / 5);
+ text.style.textShadow = -xm + 'px ' + -ym + 'px ' + (d + 10) + 'px black';
+
+ if (boxProperty) {
+ box.style[boxProperty] = '0 ' + -ym + 'px ' + (d + 30) + 'px black';
+ }
+
+ xm = e.clientX - window.innerWidth;
+ ym = e.clientY - window.innerHeight;
+ spot.style.backgroundPosition = xm + 'px ' + ym + 'px';
+}
+</script>
+
+</body>
+</html>

0 comments on commit f190e51

Please sign in to comment.
Something went wrong with that request. Please try again.