Philip Cheang 11 роки тому
батько
коміт
bdadc3a20a

+ 39 - 1
themes/pleasant2/assets/css/theme.css

@@ -257,4 +257,42 @@ footer {
 		font-size: 1.4em;
 	}
 
-}
+}
+
+header {
+	-webkit-perspective: 800;
+	   -moz-perspective: 800;
+		-ms-perspective: 800;
+			perspective: 800;			
+}
+
+.thomas {
+	position: relative;
+	display: inline-block;
+	-webkit-transform-style: preserve-3d;
+	   -moz-transform-style: preserve-3d;
+		-ms-transform-style: preserve-3d;
+			transform-style: preserve-3d;
+	-webkit-transition: all 0.4s;
+	   -moz-transition: all 0.4s;
+		-ms-transition: all 0.4s;
+			transition: all 0.4s;
+}
+
+.thomas.whoa {
+	-webkit-transform: rotateY(180deg);
+	   -moz-transform: rotateY(180deg);
+		-ms-transform: rotateY(180deg);
+			transform: rotateY(180deg);		
+}
+
+.thomas img:nth-child(2) {
+	position: relative;
+}
+
+.thomas img:nth-child(1) {
+	position: absolute;
+	top: 0;
+	left: 0;
+	-webkit-transform: rotateY(180deg) translateZ(0.1px);
+}

BIN
themes/pleasant2/assets/img/thomas.gif


BIN
themes/pleasant2/assets/img/thomas.png


+ 106 - 0
themes/pleasant2/assets/js/konami.js

@@ -0,0 +1,106 @@
+/*
+ * Konami-JS ~ 
+ * :: Now with support for touch events and multiple instances for 
+ * :: those situations that call for multiple easter eggs!
+ * Code: http://konami-js.googlecode.com/
+ * Examples: http://www.snaptortoise.com/konami-js
+ * Copyright (c) 2009 George Mandis (georgemandis.com, snaptortoise.com)
+ * Version: 1.4.1 (3/1/2013)
+ * Licensed under the GNU General Public License v3
+ * http://www.gnu.org/copyleft/gpl.html
+ * Tested in: Safari 4+, Google Chrome 4+, Firefox 3+, IE7+, Mobile Safari 2.2.1 and Dolphin Browser
+ */
+
+var Konami = function (callback) {
+	var konami = {
+		addEvent: function (obj, type, fn, ref_obj) {
+			if (obj.addEventListener)
+				obj.addEventListener(type, fn, false);
+			else if (obj.attachEvent) {
+				// IE
+				obj["e" + type + fn] = fn;
+				obj[type + fn] = function () {
+					obj["e" + type + fn](window.event, ref_obj);
+				}
+				obj.attachEvent("on" + type, obj[type + fn]);
+			}
+		},
+		input: "",
+		pattern: "38384040373937396665",
+		load: function (link) {
+			this.addEvent(document, "keydown", function (e, ref_obj) {
+				if (ref_obj) konami = ref_obj; // IE
+				konami.input += e ? e.keyCode : event.keyCode;
+				if (konami.input.length > konami.pattern.length)
+					konami.input = konami.input.substr((konami.input.length - konami.pattern.length));
+				if (konami.input == konami.pattern) {
+					konami.code(link);
+					konami.input = "";
+					e.preventDefault();
+					return false;
+				}
+			}, this);
+			this.iphone.load(link);
+		},
+		code: function (link) {
+			window.location = link
+		},
+		iphone: {
+			start_x: 0,
+			start_y: 0,
+			stop_x: 0,
+			stop_y: 0,
+			tap: false,
+			capture: false,
+			orig_keys: "",
+			keys: ["UP", "UP", "DOWN", "DOWN", "LEFT", "RIGHT", "LEFT", "RIGHT", "TAP", "TAP"],
+			code: function (link) {
+				konami.code(link);
+			},
+			load: function (link) {
+				this.orig_keys = this.keys;
+				konami.addEvent(document, "touchmove", function (e) {
+					if (e.touches.length == 1 && konami.iphone.capture == true) {
+						var touch = e.touches[0];
+						konami.iphone.stop_x = touch.pageX;
+						konami.iphone.stop_y = touch.pageY;
+						konami.iphone.tap = false;
+						konami.iphone.capture = false;
+						konami.iphone.check_direction();
+					}
+				});
+				konami.addEvent(document, "touchend", function (evt) {
+					if (konami.iphone.tap == true) konami.iphone.check_direction(link);
+				}, false);
+				konami.addEvent(document, "touchstart", function (evt) {
+					konami.iphone.start_x = evt.changedTouches[0].pageX;
+					konami.iphone.start_y = evt.changedTouches[0].pageY;
+					konami.iphone.tap = true;
+					konami.iphone.capture = true;
+				});
+			},
+			check_direction: function (link) {
+				x_magnitude = Math.abs(this.start_x - this.stop_x);
+				y_magnitude = Math.abs(this.start_y - this.stop_y);
+				x = ((this.start_x - this.stop_x) < 0) ? "RIGHT" : "LEFT";
+				y = ((this.start_y - this.stop_y) < 0) ? "DOWN" : "UP";
+				result = (x_magnitude > y_magnitude) ? x : y;
+				result = (this.tap == true) ? "TAP" : result;
+
+				if (result == this.keys[0]) this.keys = this.keys.slice(1, this.keys.length);
+				if (this.keys.length == 0) {
+					this.keys = this.orig_keys;
+					this.code(link);
+				}
+			}
+		}
+	}
+
+	typeof callback === "string" && konami.load(callback);
+	if (typeof callback === "function") {
+		konami.code = callback;
+		konami.load();
+	}
+
+	return konami;
+};

+ 17 - 1
themes/pleasant2/templates/base.tmpl

@@ -14,7 +14,10 @@ ${set_locale(lang)}
     <header>
         ## TODO: fix this shit
         <a href="${abs_link('/')}" title="${blog_title}">
-            <img src="/assets/img/thomas.png" alt="${blog_title}">
+            <div class="thomas">
+                <img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+                <img src="/assets/img/thomas.png" alt="${blog_title}">
+            </div>
             <h1 id="blog-title">
                 ${blog_title}
             </h1>
@@ -39,6 +42,19 @@ ${set_locale(lang)}
     </div>
     <footer>
         <small>${content_footer}</small>
+        <script src="/assets/js/konami.js"></script>
+        <script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
+        <script>
+            var easter_egg = new Konami();
+            easter_egg.code = function() { 
+                $(".thomas").toggleClass("whoa");
+                $("body").scrollTo(0);
+            }
+            easter_egg.load();
+
+            // love you, thomas!
+            // yours, @_phi + @meggykawsek
+        </script>
     </footer>