-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy patheyny_OrderByDate.user.js
More file actions
72 lines (59 loc) · 2.03 KB
/
eyny_OrderByDate.user.js
File metadata and controls
72 lines (59 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// IMPORTANT! This file has been depreciated! It's function has merge into eyny.js!
// ==UserScript==
// @name Eyny_OrderByDate
// @namespace Yr
// @version 0.1
// @description try to take over the world!
// @author yanagiragi
// @match http://*.eyny.com/forum-*.html
// @match http://*.eyny.com/forum.php*
// @grant none
// ==/UserScript==
// Purpose : with entering "eyny.com", you will grant
// 1. new url with www****.eyny.com, to avoid imgur.com blocking www**.eyny.com
// 2. Already agreeed you are over 18 years old :)
// 3. No longer access homepage twice if you're trying to access some forums
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) == variable) {
return decodeURIComponent(pair[1]);
}
}
console.log('Query variable %s not found', variable);
return null;
}
function sortByDate_php() {
var id = getQueryVariable('fid');
console.log(id);
let skip = getQueryVariable('orderby');
let view = getQueryVariable('view');
let mod = getQueryVariable('mod');
if (skip != null || view == 'all' || mod == 'viewthread')
return;
if (exclude.indexOf(id) < 0) {
var postfix = location + '&filter=author&orderby=dateline';
location.replace(postfix);
}
}
function sortByDate_html() {
var loc = location.hostname.toString(); // domain
var path = location.pathname;
var id = path.substr(7, path.length);
id = id.substr(0, id.indexOf('-'));
if (exclude.indexOf(id) < 0) {
console.log('ready to sort');
var postfix = 'forum.php?mod=forumdisplay&fid=' + id + '&filter=author&orderby=dateline';
location.replace(postfix);
}
}
var exclude = ['22'];
(function () {
'use strict';
if (location.pathname == "/forum.php")
sortByDate_php();
else
sortByDate_html();
})();