summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-02-09 20:19:20 +0100
committerDan McGee <dan@archlinux.org>2013-02-09 20:19:20 +0100
commitbec4e798cb2a4c585e01884f06a3c741f1f55b7d (patch)
tree48b3e09472e28e78c43a3a5ce428568e1202022c
parentca4106a7c0f797ba06e15f777c94cddd5d82a3dc (diff)
downloadarchweb-bec4e798cb2a4c585e01884f06a3c741f1f55b7d.tar.gz
archweb-bec4e798cb2a4c585e01884f06a3c741f1f55b7d.tar.xz
Update Konami JS
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--sitestatic/konami.min.js4
-rw-r--r--sitestatic/konami.pack.js1
-rw-r--r--templates/public/index.html9
3 files changed, 7 insertions, 7 deletions
diff --git a/sitestatic/konami.min.js b/sitestatic/konami.min.js
new file mode 100644
index 0000000..f69ca4f
--- /dev/null
+++ b/sitestatic/konami.min.js
@@ -0,0 +1,4 @@
+var Konami=function(t){var e={addEvent:function(t,e,n,i){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&(t["e"+e+n]=n,t[e+n]=function(){t["e"+e+n](window.event,i)},t.attachEvent("on"+e,t[e+n]))},input:"",pattern:"3838404037393739666513",load:function(t){this.addEvent(document,"keydown",function(n,i){return i&&(e=i),e.input+=n?n.keyCode:event.keyCode,e.input.length>e.pattern.length&&(e.input=e.input.substr(e.input.length-e.pattern.length)),e.input==e.pattern?(e.code(t),e.input="",void 0):void 0},this),this.iphone.load(t)},code:function(t){window.location=t},iphone:{start_x:0,start_y:0,stop_x:0,stop_y:0,tap:!1,capture:!1,orig_keys:"",keys:["UP","UP","DOWN","DOWN","LEFT","RIGHT","LEFT","RIGHT","TAP","TAP","TAP"],code:function(t){e.code(t)},load:function(t){this.orig_keys=this.keys,e.addEvent(document,"touchmove",function(t){if(1==t.touches.length&&e.iphone.capture===!0){var n=t.touches[0]
+ e.iphone.stop_x=n.pageX,e.iphone.stop_y=n.pageY,e.iphone.tap=!1,e.iphone.capture=!1,e.iphone.check_direction()}}),e.addEvent(document,"touchend",function(){e.iphone.tap===!0&&e.iphone.check_direction(t)},!1),e.addEvent(document,"touchstart",function(t){e.iphone.start_x=t.changedTouches[0].pageX,e.iphone.start_y=t.changedTouches[0].pageY,e.iphone.tap=!0,e.iphone.capture=!0})},check_direction:function(t){var e=Math.abs(this.start_x-this.stop_x),n=Math.abs(this.start_y-this.stop_y),i=0>this.start_x-this.stop_x?"RIGHT":"LEFT",o=0>this.start_y-this.stop_y?"DOWN":"UP",s=e>n?i:o
+ s=this.tap===!0?"TAP":s,s==this.keys[0]&&(this.keys=this.keys.slice(1,this.keys.length)),0==this.keys.length&&(this.keys=this.orig_keys,this.code(t))}}}
+return"string"==typeof t&&e.load(t),"function"==typeof t&&(e.code=t,e.load()),e}
diff --git a/sitestatic/konami.pack.js b/sitestatic/konami.pack.js
deleted file mode 100644
index bff279f..0000000
--- a/sitestatic/konami.pack.js
+++ /dev/null
@@ -1 +0,0 @@
-(function(){"use strict";var a=Function("return this")(),b=function(){var a={addEvent:function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&(a["e"+b+c]=c,a[b+c]=function(){a["e"+b+c](window.event,d)},a.attachEvent("on"+b,a[b+c]))},input:"",pattern:"3838404037393739666513",load:function(b){this.addEvent(document,"keydown",function(c,d){return d&&(a=d),a.input+=c?c.keyCode:event.keyCode,a.input.length>a.pattern.length&&(a.input=a.input.substr(a.input.length-a.pattern.length)),a.input==a.pattern?(a.code(b),a.input="",void 0):void 0},this),this.iphone.load(b)},code:function(a){window.location=a},iphone:{start_x:0,start_y:0,stop_x:0,stop_y:0,tap:!1,capture:!1,orig_keys:"",keys:["UP","UP","DOWN","DOWN","LEFT","RIGHT","LEFT","RIGHT","TAP","TAP","TAP"],code:function(b){a.code(b)},load:function(b){this.orig_keys=this.keys,a.addEvent(document,"touchmove",function(b){if(1==b.touches.length&&1==a.iphone.capture){var c=b.touches[0];a.iphone.stop_x=c.pageX,a.iphone.stop_y=c.pageY,a.iphone.tap=!1,a.iphone.capture=!1,a.iphone.check_direction()}}),a.addEvent(document,"touchend",function(){1==a.iphone.tap&&a.iphone.check_direction(b)},!1),a.addEvent(document,"touchstart",function(b){a.iphone.start_x=b.changedTouches[0].pageX,a.iphone.start_y=b.changedTouches[0].pageY,a.iphone.tap=!0,a.iphone.capture=!0})},check_direction:function(a){x_magnitude=Math.abs(this.start_x-this.stop_x),y_magnitude=Math.abs(this.start_y-this.stop_y),x=0>this.start_x-this.stop_x?"RIGHT":"LEFT",y=0>this.start_y-this.stop_y?"DOWN":"UP",result=x_magnitude>y_magnitude?x:y,result=1==this.tap?"TAP":result,result==this.keys[0]&&(this.keys=this.keys.slice(1,this.keys.length)),0==this.keys.length&&(this.keys=this.orig_keys,this.code(a))}}};return a};"undefined"!=typeof module?module.exports=b:a.Konami=b})();
diff --git a/templates/public/index.html b/templates/public/index.html
index 8926a06..89aa3b8 100644
--- a/templates/public/index.html
+++ b/templates/public/index.html
@@ -213,7 +213,7 @@
{% load cdn %}{% jquery %}
<script type="text/javascript" src="{% static "bootstrap-typeahead.min.js" %}"></script>
-<script type="text/javascript" src="{% static "konami.pack.js" %}"></script>
+<script type="text/javascript" src="{% static "konami.min.js" %}"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#pkgsearch-field').typeahead({
@@ -229,8 +229,7 @@ $(document).ready(function() {
}).attr('autocomplete', 'off');
});
$(document).ready(function() {
- var konami = new Konami();
- konami.code = function() {
+ var konami = new Konami(function() {
$('#konami').html('<img src="{% static "vector_tux.png" %}" alt=""/>');
setTimeout(function() {
$('#konami').fadeIn(500);
@@ -238,9 +237,7 @@ $(document).ready(function() {
$('#konami').click(function() {
$('#konami').fadeOut(500);
});
- };
- konami.iphone.code = konami.code;
- konami.load();
+ });
});
</script>
{% endblock %}