Skip to content
Browse files

update cross-cookie to v0.1111 and using cookie to get script version

  • Loading branch information...
1 parent 9b96f41 commit 4fef6de97020f7589c6175e79631cde8b475f1ea Binux committed Nov 24, 2011
Showing with 17 additions and 4 deletions.
  1. +3 −1 main.py
  2. +3 −3 static/{cross-cookie.userscript.js → cross-cookie.user.js}
  3. +3 −0 templates/front.html
  4. +8 −0 templates/lixian.html
View
4 main.py
@@ -25,7 +25,9 @@
help="enable mem cache")
define("cross_userscript", default="http://userscripts.org/scripts/show/117745",
help="the web url of cross cookie userscirpt")
-define("cross_userscript_local", default="/static/cross-cookie.userscript.js",
+define("cross_cookie_version", default="0.1111",
+ help="cross cookie user script version")
+define("cross_userscript_local", default="/static/cross-cookie.user.js",
help="the local path of cross cookie userscirpt")
define("cross_cookie_url", default="http://vip.xunlei.com/gen/yuanxun/gennew/newyx.html",
help="the url to insert to")
View
6 static/cross-cookie.userscript.js → static/cross-cookie.user.js
@@ -1,7 +1,7 @@
// ==UserScript==
// @name cross-cookie
// @namespace http://loli.lu/
-// @version 0.111
+// @version 0.1111
// @description enter something useful
// @include http://127.0.0.1:*/*
// @include http://loli.lu/*
@@ -16,6 +16,8 @@ var _gc = function(name) {
return document.getElementsByClassName(name);
};
+document.cookie = "cross-cookie=0.1111";
+
if ('loading' != document.readyState) {
var cookies = _gc("cross-cookie");
for (var i = 0; i < cookies.length; i++) {
@@ -33,8 +35,6 @@ if ('loading' != document.readyState) {
document.body.appendChild(iframe);
}
- console.log(location.href, GM_getValue(location.href));
-
if (GM_getValue(location.href) != undefined) {
var cookie = GM_getValue(location.href);
document.cookie = cookie;
View
3 templates/front.html
@@ -46,5 +46,8 @@
<div class="clearfix"><div>
<script>
$("#add-task").fancybox({width: 700, height: 250});
+ function check_cross_cookie() {
+ document.cookie.match(/cross-cookie\s*=\s*{{ options.cross_cookie_version }}/i) ? true : false;
+ }
</script>
{% end %}
View
8 templates/lixian.html
@@ -26,3 +26,11 @@
</ul>
</div>
{% end %}
+
+{% block foot %}
+<script>
+ function check_cross_cookie() {
+ document.cookie.match(/cross-cookie\s*=\s*{{ options.cross_cookie_version }}/i) ? true : false;
+ }
+</script>
+{% end %}

0 comments on commit 4fef6de

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