-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnice.js
142 lines (115 loc) · 6.21 KB
/
nice.js
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
javascript: void
function() {
(function() {
var o = document.querySelector("body").getAttribute("class"),
t = /postid-(\d )/,
i = t.exec(o)[1],
n = "/wp-admin/post.php?post="
i "&action=edit", c = window.location.protocol "//"
window.location.host n;
window.open(c)
})()
}();
javascript: void
function() {
(function() {
var o = document.querySelector("meta[name='id']").getAttribute("content");
n = "https://ci-copilot.aws.conde.io/wrd/articles/" + o,
c = window.location.protocol "//"
window.location.host n;
window.open(c)
})()
}();
// actual output
javascript:!function()%7B!function()%7B(function()%7Bvar o%3Ddocument.querySelector("meta%5Bname%3D%27id%27%5D").getAttribute("content"),n%3D"https://copilot.aws.conde.io/wrd/articles/"%2Bo%3Bwindow.open(n)%7D)()%7D()%7D()%3B
//extended editor for all preview links too
/* preview url that iFrames content from wired.com
https://copilot.aws.conde.io/wrd/preview/article/5935bbba31379d0b2f5b9013
If url has HASH - take it and go to https://ci-copilot.aws.conde.io/wrd/articles/ + hash
Else do the normal thing.
var = everythign to the right of /wrd/preview/article/
var pathArray = window.location.pathname.split( '/' );
var secondLevelLocation = pathArray[3];
if secondLevelLocation.length = 24
*/
// First pass at double copilot editor bookmarklet - previews and live urls
javascript:(function () {
var pathArray = window.location.pathname.split( '/' );
var secondLevelLocation = pathArray[2];
if (secondLevelLocation.length === 24) {
var o = secondLevelLocation;
console.log(o);
n = "https://copilot.aws.conde.io/wrd/articles/" + o,
window.open(n);
return;
} else {
var oh = document.querySelector("meta[name='id']").getAttribute("content");
nh = "https://ci-copilot.aws.conde.io/wrd/articles/" + oh,
window.open(nh);
}
})();
// Working Bookmarklet for CP preview URLS
javascript:(function () {
var pathArray = window.location.pathname.split("/");
var secondLevelLocation = pathArray[4];
var o = secondLevelLocation;
n = "https://copilot.aws.conde.io/wrd/articles/" + o,
window.open(n);
})();
// multiple use cases
// combine them together testing July 7th 2017
if preview
then this
else if contributors
then this
else if bundle
then this
else
articles
// can
javascript:(function () {
var pathArray = window.location.pathname.split("/");
var secondLevelLocation = pathArray[4] || '';
var o = secondLevelLocation;
if ((secondLevelLocation.length === 24 )) {
n = "https://copilot.aws.conde.io/wrd/articles/" + o,
} else if {
}
window.open(n);
} else if {
var pathArray = window.location.pathname.split("/");
var secondLevelLocation = pathArray[1] || '';
var o = secondLevelLocation;
var c = document.querySelector("meta[name='id']").getAttribute("content");
if ((secondLevelLocation.length === 6 )) {
n = "https://copilot.aws.conde.io/wrd/contributors/" + c,
window.open(n);
} else if {
var o = document.querySelector("meta[name='id']").getAttribute("content");
n = "https://copilot.aws.conde.io/wrd/articles/" + o,
window.open(n);
}
})();
// add mutiple cases for contributor
javascript:(function () {
var pathArray = window.location.pathname.split("/");
var secondLevelLocation = pathArray[4] || '';
var o = secondLevelLocation;
var c = document.querySelector("meta[name='id']").getAttribute("content");
if ((secondLevelLocation.length === 24 )) {
n = "https://copilot.aws.conde.io/wrd/articles/" + o
} else if {
((secondLevelLocation.length === 6 )) {
n = "https://copilot.aws.conde.io/wrd/contributors/" + c
} else if {
((secondLevelLocation.length === 7 )) {
n = "https://copilot.aws.conde.io/wrd/reviews/" + c
} else {
n = "https://copilot.aws.conde.io/wrd/articles/" + o,
window.open(n);
}
})();
// compressed for bookmarklet
javascript:(function()%7Bvar pathArray %3D window.location.pathname.split("%2F")%3Bvar secondLevelLocation %3D pathArray%5B4%5D %7C%7C ''%3Bvar o %3D secondLevelLocation%3Bif ((secondLevelLocation.length %3D%3D%3D 24 )) %7Bn %3D "https%3A%2F%2Fcopilot.aws.conde.io%2Fwrd%2Farticles%2F" %2B o%2Cwindow.open(n)%3B%7D else %7Bvar o %3D document.querySelector("meta%5Bname%3D'id'%5D").getAttribute("content")%3Bn %3D "https%3A%2F%2Fcopilot.aws.conde.io%2Fwrd%2Farticles%2F" %2B o%2Cwindow.open(n)%3B%7D%7D)()
// V2 working
javascript:(function()%7B%7Bvar pathArray %3D window.location.pathname.split("%2F")%3Bvar secondLevelLocation %3D pathArray%5B4%5D %7C%7C ''%3Bvar pathOne %3D pathArray%5B1%5D %7C%7C ''%3Bvar o %3D secondLevelLocation%3Bvar n %3D "https%3A%2F%2Fcopilot.aws.conde.io%2Fwrd%2Farticles%2F"%3Bif ((secondLevelLocation.length %3D%3D%3D 24 )) %7Bn %3D "https%3A%2F%2Fcopilot.aws.conde.io%2Fwrd%2Farticles%2F" %2B o%3Bconsole.log("preview%3A" %2B n)%3Bwindow.open(n)%3B%7D else if (pathOne.length %3D%3D%3D 6 ) %7Bvar c %3D document.querySelector("meta%5Bname%3D'id'%5D").getAttribute("content")%3Bn %3D "https%3A%2F%2Fcopilot.aws.conde.io%2Fwrd%2Fcontributors%2F" %2B c%3Bconsole.log("contributor%3A" %2B n)%3Bwindow.open(n)%3B%7D else if (pathOne.length %3D%3D%3D 8 ) %7Bvar c %3D document.querySelector("meta%5Bname%3D'id'%5D").getAttribute("content")%3Bn %3D "https%3A%2F%2Fcopilot.aws.conde.io%2Fwrd%2Fbundles%2F" %2B c%3Bconsole.log("bundle%3A" %2B n)%3Bwindow.open(n)%3B%7D else if (pathOne.length %3D%3D%3D 0 ) %7Bvar c %3D document.querySelector("meta%5Bname%3D'id'%5D").getAttribute("content")%3Bn %3D "https%3A%2F%2Fcopilot.aws.conde.io%2Fwrd%2Fbundles%2F" %2B c%3Bconsole.log("homepage%3A" %2B n)%3Bwindow.open(n)%3B%7D else var c %3D document.querySelector("meta%5Bname%3D'id'%5D").getAttribute("content")%3Bn %3D "https%3A%2F%2Fcopilot.aws.conde.io%2Fwrd%2Farticles%2F" %2B c%2Cwindow.open(n)%3Bconsole.log("************************")%3Bconsole.log("meta%3A" %2B c %2B "url%3A" %2B o)%3Bconsole.log(secondLevelLocation)%3Bconsole.log(pathOne)%3Bconsole.log("************************")%3B%7D%7D)()