Skip to content

Commit

Permalink
Merge pull request #4 from zpbx/dev
Browse files Browse the repository at this point in the history
Update.
  • Loading branch information
cssmagic committed Nov 5, 2014
2 parents 1ea824e + 6e5e131 commit 82b8e38
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 39 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "weibo-keep-v5",
"version": "0.1.0",
"version": "0.1.2",
"homepage": "https://github.com/UserScript/Weibo-Keep-V5",
"authors": [
"cssmagic"
Expand Down
29 changes: 10 additions & 19 deletions dist/weibo-keep-v5.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// ==UserScript==
// @name Weibo-Keep-V5
// @version 0.1.0
// @version 0.1.2
// @author cssmagic
// @namespace https://github.com/UserScript
// @homepage https://github.com/UserScript/Weibo-Keep-V5
// @description To keep Sina Weibo at V5.
// @description:zh 让新浪微博保持在 V5 界面。
// @downloadURL https://rawgit.com/UserScript/Weibo-Keep-V5/master/dist/weibo-keep-v5.user.js
Expand Down Expand Up @@ -152,20 +154,10 @@ void function (root) {
void function () {
'use strict'

//url
var host = location.host
var path = location.pathname
var query = location.search
var req = path + query
var paramV6 = 'wvr=6'
var paramV5 = 'wvr=5'

//cookie
var cookieKey = 'wvr'
var cookieKeyV6 = 'wvr6'
var cookieDomain = '.weibo.com'

//util
function _setCookie(key, value, path, days, domain) {
var str = key + '=' + encodeURIComponent(value) + ';'
if (path) str += 'path=' + path + ';'
Expand All @@ -175,6 +167,11 @@ void function () {
}

//url
var path = location.pathname
var query = location.search
var req = path + query
var paramV6 = 'wvr=6'
var paramV5 = 'wvr=5'
function _isV6URL(url) {
url = url || req
return $.str.include(url, paramV6)
Expand Down Expand Up @@ -233,17 +230,11 @@ void function () {

//weibo config
function _getWeiboConfig() {
return (unsafeWindow || window).$CONFIG
return unsafeWindow.$CONFIG || {}
}
function _isDebugMode() {
var config = _getWeiboConfig()
var result = false
if (config.uid === '1645021302') {
result = true
} else if (config.domain === 'cssmagic') {
result = true
}
return result
return config.uid === '1645021302' || config.domain === 'cssmagic'
}
function _isV6Page() {
var config = _getWeiboConfig()
Expand Down
25 changes: 7 additions & 18 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
void function () {
'use strict'

//url
var host = location.host
var path = location.pathname
var query = location.search
var req = path + query
var paramV6 = 'wvr=6'
var paramV5 = 'wvr=5'

//cookie
var cookieKey = 'wvr'
var cookieKeyV6 = 'wvr6'
var cookieDomain = '.weibo.com'

//util
function _setCookie(key, value, path, days, domain) {
var str = key + '=' + encodeURIComponent(value) + ';'
if (path) str += 'path=' + path + ';'
Expand All @@ -24,6 +14,11 @@ void function () {
}

//url
var path = location.pathname
var query = location.search
var req = path + query
var paramV6 = 'wvr=6'
var paramV5 = 'wvr=5'
function _isV6URL(url) {
url = url || req
return $.str.include(url, paramV6)
Expand Down Expand Up @@ -82,17 +77,11 @@ void function () {

//weibo config
function _getWeiboConfig() {
return (unsafeWindow || window).$CONFIG
return unsafeWindow.$CONFIG || {}
}
function _isDebugMode() {
var config = _getWeiboConfig()
var result = false
if (config.uid === '1645021302') {
result = true
} else if (config.domain === 'cssmagic') {
result = true
}
return result
return config.uid === '1645021302' || config.domain === 'cssmagic'
}
function _isV6Page() {
var config = _getWeiboConfig()
Expand Down
4 changes: 3 additions & 1 deletion src/meta.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// ==UserScript==
// @name Weibo-Keep-V5
// @version 0.1.0
// @version 0.1.2
// @author cssmagic
// @namespace https://github.com/UserScript
// @homepage https://github.com/UserScript/Weibo-Keep-V5
// @description To keep Sina Weibo at V5.
// @description:zh 让新浪微博保持在 V5 界面。
// @downloadURL https://rawgit.com/UserScript/Weibo-Keep-V5/master/dist/weibo-keep-v5.user.js
Expand Down

0 comments on commit 82b8e38

Please sign in to comment.