From 639c398e41e1caa5849908cf12df1493ba7d745b Mon Sep 17 00:00:00 2001 From: nccu Date: Thu, 13 Nov 2014 17:38:44 +0800 Subject: [PATCH] update ipv4 & 6 block --- app/templates/nccu/assets/javascripts/app.js | 33 +++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/app/templates/nccu/assets/javascripts/app.js b/app/templates/nccu/assets/javascripts/app.js index cc13107..0ca8310 100644 --- a/app/templates/nccu/assets/javascripts/app.js +++ b/app/templates/nccu/assets/javascripts/app.js @@ -2,11 +2,7 @@ // Init functions function init() { - - utils = { - - } - + function heightCompare () { var priHeight = $('.primary').height(); var secHeight = $('.secondary').height(); @@ -322,6 +318,33 @@ var newsBlock = function() { } $(function() { + + if (getCookie("ipv6") == 'true') { + $("#ipv6").text("Now in IPv6"); + } else { + $("#ipv6").text("Now in IPv4"); + } + + function getCookie(c_name) { + var c_value = document.cookie; + var c_start = c_value.indexOf(" " + c_name + "="); + if (c_start == -1) { + c_start = c_value.indexOf(c_name + "="); + } + if (c_start == -1) { + c_value = null; + } else { + c_start = c_value.indexOf("=", c_start) + 1; + var c_end = c_value.indexOf(";", c_start); + if (c_end == -1) { + c_end = c_value.length; + } + c_value = unescape(c_value.substring(c_start, c_end)); + } + return c_value; + } + + var _timer = 0; var menuItem$ = $('.page_menu.level_1').children('li');