-
Notifications
You must be signed in to change notification settings - Fork 0
/
flickrPhotoShowPublicOrPrivate.user.js
252 lines (199 loc) · 7.77 KB
/
flickrPhotoShowPublicOrPrivate.user.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
// ==UserScript==
// @name flickrPhotoShowPublicOrPrivate
// @namespace http://tampermonkey.net/
// @version 20220821
// @description On Flickr show whether a photo is public or private by drawing a colored box around it.
// @author nindogo
// @match https://www.flickr.com/groups/*
// @match https://www.flickr.com/groups/*/pool/*/
// @match https://www.flickr.com/photos/*/
// @match https://www.flickr.com/photos/*
// @match https://www.flickr.com/people/*/
// @match https://www.flickr.com/people/*
// @match https://www.flickr.com/photos/*/*
// @match https://www.flickr.com/photos/*/*/
// @match https://www.flickr.com/*
// @match https://flickr.com/groups/*/pool/*
// @match https://flickr.com/groups/*/pool/*/
// @match https://flickr.com/photos/*/
// @match https://flickr.com/photos/*
// @match https://flickr.com/people/*/
// @match https://flickr.com/people/*
// @match https://flickr.com/photos/*/*
// @match https://flickr.com/photos/*/*/
// @match https://flickr.com/*
// @grant GM_xmlhttpRequest
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// Selectors and the following script require jQuery.
// @require https://gist.githubusercontent.com/raw/2625891/waitForKeyElements.js
// The previous require is from a script of Brock Adams (Thanks to him!)
// @icon https://combo.staticflickr.com/pw/images/favicons/favicon-180.png
//@downloadURL https://github.com/nindogo/test_repo/raw/master/flickrPhotoShowPublicOrPrivate.user.js
// ==/UserScript==
//waitForKeyElements(".view.photo-list-photo-view.awake", showHiddenOrOpen, bWaitOnce=false);
waitForKeyElements("div.photo-list-photo-container", showHiddenOrOpen, bWaitOnce=false);
waitForKeyElements(".pool-photo.photo-display-item", showHiddenOrOpen_2);
waitForKeyElements(".activity-card-photo ", showHiddenOrOpen_2);
waitForKeyElements(".preview-img-link", showHiddenOrOpen_3);
waitForKeyElements(".preview-video-link", showHiddenOrOpen_4);
waitForKeyElements(".photo-link", showHiddenOrOpen_5 );
//waitForKeyElements("a.overlay", showHiddenOrOpen_6 );
// waitForKeyElements("div.videoplayer", showHiddenOrOpen_4);
function showHiddenOrOpen(jNode){
//console.log(jNode[0].childNodes)
//console.log(jNode[0].childNodes[1].childNodes)
//console.log(jNode[0].childNodes[1].src.split("/")[4].split("_")[0])
//var photo_id = ((((jNode[0].style.backgroundImage).split("/"))[4]).split("_"))[0];
var photo_id = jNode[0].childNodes[1].src.split("/")[4].split("_")[0];
var protocol = window.location.protocol;
var api_key = "9f7fba1e66c150084f948ab8df0ce3a9"
var url = protocol+'//api.flickr.com/services/rest/'
+'?method=flickr.photos.getFavorites'
+'&api_key=' + api_key
+'&format=json&nojsoncallback=1'
+'&photo_id=' + photo_id;
GM_xmlhttpRequest({
method: 'GET',
url: url,
context: jNode,
onload: function(response){
var a = (JSON.parse(response.responseText)).stat;
var b = response.context[0].parentNode;
if (a == 'ok') {
b.style.border = "2.5px solid #39ff14";
}
else if (a == 'fail'){
b.style.border = "2.5px solid #F71F12";
}
}
})
}
function showHiddenOrOpen_2(jNode){
// var photo_id = ((((jNode[0].style.backgroundImage).split("/"))[5]).split("_"))[0];
var photo_id = jNode[0]["dataset"]["photoId"];
var protocol = window.location.protocol;
var api_key = "9f7fba1e66c150084f948ab8df0ce3a9"
var url = protocol+'//api.flickr.com/services/rest/'
+'?method=flickr.photos.getFavorites'
+'&api_key=' + api_key
+'&format=json&nojsoncallback=1'
+'&photo_id=' + photo_id;
GM_xmlhttpRequest({
method: 'GET',
url: url,
context: jNode,
onload: function(response){
var a = (JSON.parse(response.responseText)).stat;
var b = response.context[0];
if (a == 'ok') {
b.style.border = "5px solid #39ff14";
}
else if (a == 'fail'){
b.style.border = "5px solid #F71F12";
}
}
})
}
function showHiddenOrOpen_3(jNode){
var photo_id = jNode[0].href.split("/")[5];
var protocol = window.location.protocol;
var api_key = "9f7fba1e66c150084f948ab8df0ce3a9"
var url = protocol+'//api.flickr.com/services/rest/'
+'?method=flickr.photos.getFavorites'
+'&api_key=' + api_key
+'&format=json&nojsoncallback=1'
+'&photo_id=' + photo_id;
GM_xmlhttpRequest({
method: 'GET',
url: url,
context: jNode,
onload: function(response){
var a = (JSON.parse(response.responseText)).stat;
var b = response.context[0].childNodes[5];
if (a == 'ok') {
b.style.border = "5px solid #39ff14";
}
else if (a == 'fail'){
b.style.border = "5px solid #F71F12";
}
}
})
}
function showHiddenOrOpen_4(jNode){
var photo_id = jNode[0].href.split("/")[5];
var protocol = window.location.protocol;
var api_key = "9f7fba1e66c150084f948ab8df0ce3a9"
// console.log(photo_id);
var url = protocol+'//api.flickr.com/services/rest/'
+'?method=flickr.photos.getFavorites'
+'&api_key=' + api_key
+'&format=json&nojsoncallback=1'
+'&photo_id=' + photo_id;
GM_xmlhttpRequest({
method: 'GET',
url: url,
context: jNode,
onload: function(response){
var a = (JSON.parse(response.responseText)).stat;
var b = response.context[0].childNodes[1];
if (a == 'ok') {
b.style.border = "5px solid #39ff14";
}
else if (a == 'fail'){
b.style.border = "5px solid #F71F12";
}
}
})
}
// New home page. Work on link and go up to div.
function showHiddenOrOpen_5(jNode){
var photo_id = jNode[0].href.split("/")[5];
var protocol = window.location.protocol;
var api_key = "9f7fba1e66c150084f948ab8df0ce3a9"
var url = protocol+'//api.flickr.com/services/rest/'
+'?method=flickr.photos.getFavorites'
+'&api_key=' + api_key
+'&format=json&nojsoncallback=1'
+'&photo_id=' + photo_id;
GM_xmlhttpRequest({
method: 'GET',
url: url,
context: jNode,
onload: function(response){
var a = (JSON.parse(response.responseText)).stat;
var b = response.context[0].parentNode.parentNode;
if (a == 'ok') {
b.style.border = "5px solid #39ff14";
}
else if (a == 'fail'){
b.style.border = "5px solid #F71F12";
}
}
})
}
function showHiddenOrOpen_6(jNode){
console.log(jNode)
var photo_id = jNode[0].href.split("/")[5];
var protocol = window.location.protocol;
var api_key = "9f7fba1e66c150084f948ab8df0ce3a9"
var url = protocol+'//api.flickr.com/services/rest/'
+'?method=flickr.photos.getFavorites'
+'&api_key=' + api_key
+'&format=json&nojsoncallback=1'
+'&photo_id=' + photo_id;
GM_xmlhttpRequest({
method: 'GET',
url: url,
context: jNode,
onload: function(response){
var a = (JSON.parse(response.responseText)).stat;
var b = response.context[0].parentNode.parentNode;
if (a == 'ok') {
b.style.border = "5px solid #39ff14";
}
else if (a == 'fail'){
b.style.border = "5px solid #F71F12";
}
}
})
}