-
Notifications
You must be signed in to change notification settings - Fork 0
/
eksi-kumanda.user.js
71 lines (62 loc) · 2.06 KB
/
eksi-kumanda.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
// ==UserScript==
// @name eksi kumanda
// @namespace http://github.com/mehmettaskiner/
// @author mehmettaskiner
// @description navigation'a kanal eklemeye yarar.
// @include https://eksisozluk.com/*
// @match https://eksisozluk.com/*
// @require https://code.jquery.com/jquery-1.10.2.min.js
// @version 0.1
// @run-at document-end
// ==/UserScript==
var SINEMA = "#sinema";
var MUZIK = "#müzik";
var SIYASET = "#siyaset";
var BILIM = "#bilim";
var EDEBIYAT = "#edebiyat";
var SPOR = "#spor";
var ILISKILER = "#ilişkiler";
var TARIH = "#tarih";
var TEKNOLOJI = "#teknoloji";
var SANAT = "#sanat";
var TV = "#tv";
var OYUN = "#oyun";
var ANKET = "#anket";
var PROGRAMLAMA = "#programlama";
var META = "#meta";
var SAGLIK = "#sağlık";
function savePreference(elem) {
var exist = GM_getValue(elem);
if (exist) {
GM_deleteValue(elem);
} else {
GM_setValue(elem, elem);
}
populateNavBar();
}
function populateNavBar() {
var channels = [SINEMA, MUZIK, SIYASET, BILIM, EDEBIYAT, SPOR, ILISKILER, TARIH, TEKNOLOJI, SANAT, TV, OYUN, ANKET, PROGRAMLAMA, META, SAGLIK];
for (channelName in channels) {
var exist = GM_getValue(channels[channelName]);
if (typeof exist == "string") {
html = "<li name=" + channels[channelName] + "><a class=\"index-link\" href=\"/basliklar/kanal/" + channels[channelName].replace("#", "") + "\">" + channels[channelName] + "</a></li>";
var item = $("[name=" + channels[channelName] + "]").length;
if (item == 0){
$("#quick-index-nav").append(html);
}
} else {
$("[name=" + channels[channelName] + "]").remove();
}
}
}
function settings() {
var button = $('<input type="button" class="channel-button primary" value="kısayol"/>');
$("#channel-follow-list li h3").append(button).click(function() {
a = $(this).find(".index-link").text();
savePreference(a);
});
}
$(document).ready(function() {
populateNavBar();
settings();
});