-
Notifications
You must be signed in to change notification settings - Fork 0
/
iha_ee-vip.user.js
647 lines (567 loc) · 30.3 KB
/
iha_ee-vip.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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
// ==UserScript==
// @name IHA.EE GIF'I EEMALDAJA (TASUTA VIP)
// @version 2.0
// @description IHA.EE GIF'I EEMALDAJA (TASUTA VIP)
// @author Nigol
// @run-at document-idle
// @match https://www.iha.ee/*
// @require https://cdn.jsdelivr.net/npm/js-cookie@rc/dist/js.cookie.min.js
// @grant none
// @namespace https://greasyfork.org/users/578974
// ==/UserScript==
(function() {
'use strict';
// Get the language for the user
function getUserLanguage() {
var langCode = +Cookies.get('Lang'); // Convert to number with unary plus
switch(langCode) {
case 1:
default:
return "estonian";
case 2: return "english";
case 3: return "latvian";
case 4: return "finnish";
case 5: return "russian";
}
}
console.log("Current language:", getUserLanguage());
// Get the page title and change it
var page_title = document.title;
// Split the title and change the part - "Iha.ee - Seksikate inimeste kohtumispaik" to "Iha.ee - Tasuta VIP"
var page_current_location = page_title.split("|")[0];
var page_title_description = page_title.split("|")[1];
page_title = `${page_current_location} | Iha.ee - Tasuta VIP`
document.title = page_title;
// The following code is useful for identifying which page the user is currently in
// so you could apply logic properly (lets say you want to change some divs or other elements, but only in a certain page)
function getCurrentPathSegments() {
var path = window.location.pathname;
if (path === '/') {
return ['root'];
}
var segments = path.split('/').filter(function(segment) {
return segment.trim() !== '';
});
return segments;
}
var currentPathSegments = getCurrentPathSegments();
console.log("Current path segments:", currentPathSegments);
// Based on language, remove content from the website
function deleteDivByLanguageText() {
const language = getUserLanguage();
let regexPatterns;
// Adjust the switch statement to default to Estonian regex patterns
switch (language) {
case "english":
regexPatterns = [/Today's birthdays\s+\(\d+ people\)/, /Currently online \(\d+ people\)/];
break;
case "latvian":
regexPatterns = [/Šodienas dzimšanas dienas\s+\(\d+ personas\)/, /Pašlaik tiešsaitē atrodas \(\d+ personas\)/];
break;
case "finnish":
regexPatterns = [/Tämän päivän syntymäpäiväsankarit\s+\(\d+ henkilöä\)/, /Nykyhetkellä online-käyttäjiä\s+\(\d+ henkilöä\)/];
break;
case "russian":
regexPatterns = [];
// Note - sorry, but learn estonian or english, cause I will not modify this code for you. For certain reasons :)
break;
case "estonian":
default: // Defaulting to Estonian
regexPatterns = [/Tänased sünnipäevalapsed \(\d+ inimest\)/, /Hetkel Online kasutajad \(\d+ inimest\)/];
}
// Find and delete the divs that match the regex patterns
const divs = document.querySelectorAll('.bubble_top');
divs.forEach(div => {
const textContent = div.textContent.trim();
regexPatterns.forEach(pattern => {
if (pattern.test(textContent)) {
div.parentNode.removeChild(div);
}
});
});
};
// Example usage
deleteDivByLanguageText();
// Change the font of the page to League Spartan
function changeFont() {
// Importing League Spartan font from Google Fonts
var link = document.createElement("link");
link.href = "https://fonts.googleapis.com/css2?family=League+Spartan:wght@400;700&display=swap";
link.rel = "stylesheet";
document.head.appendChild(link);
// Creating a <style> element to set the font-family
var style = document.createElement("style");
style.type = "text/css";
style.textContent = "* { font-family: 'League Spartan', sans-serif !important; }";
document.head.appendChild(style);
// Adjusting vertical-align and text-align for .gray1_bg elements
document.querySelectorAll('td.gray1_bg').forEach(function(td) {
td.style.verticalAlign = 'middle';
td.style.textAlign = 'center';
});
};
// Function for resizing text for various elements
function resizeText(selector, newSize) {
const elements = document.querySelectorAll(selector);
elements.forEach(element => {
element.style.fontSize = newSize;
});
};
resizeText('a', '18px');
// Change the wallpaper of the site
function changeWallpaper() {
document.body.style.backgroundImage = 'none';
document.body.style.backgroundColor = 'black';
// document.body.style.backgroundImage = 'url(https://i.ibb.co/hR726CC/iha-background.jpg)';
document.body.style.backgroundSize = 'cover';
}
// Replace the iha.ee logo and slogan
function replaceLogoAndSlogan() {
// Find and replace the logo
const logo = document.querySelector("img[src*='https://www.iha.ee/images/resp_www_iha_ss_1.gif?170120']");
if (logo) {
logo.src = 'https://i.ibb.co/zmv72z3/iha-tasuta-vip-logo.png';
}
// Find and replace the slogan for any language
// Select the first img inside a div with the class "slogan"
const slogan = document.querySelector("div.slogan img");
if (slogan) {
slogan.src = 'https://i.ibb.co/J7GbvMJ/iha-slogan.png';
}
}
// Remove the "Add Comment" section
function removeComments() {
const comments = document.querySelectorAll(".AddCommentForm");
comments.forEach(comment => {
comment.style.display = 'none';
});
}
// Main function to adjust content and apply styles
function adjustContent() {
// Config - does the user want certain part of the page visible or hidden?
// Edit here. Boolean - false to hide, true to show the content.
const show_news = false; // -- default is false. Do you want to see the news feed on the page?
const show_last_top_ten = false; // -- default is false. Do you want to see the last top users that recieved a score of 10 on their images?
const show_users_birthdays = false; // -- default is false. Do you want to see the users with birthday today?
const show_online_users = false; // -- default is false. Show the users currently online
const show_right_side_statistics = false; // default is false. Show the statistics on the right of the page.
const header_stick_to_top = false; // default is false. Makes the header stick to the top.
const right_panel_color = "black"; // default is black. change at your own risk, should work with basic colors.
const header_background_color = "black"; // default is black. change at your own risk, should work with basic colors.
const center_panel_color = "black"; // default is black. change at your own risk, should work with basic colors.
const change_page_text_color = true; // default is true. sets all text to white because the background is black.
var main_div_border_color = "white"; // default is white. sets the border for main div to white.
// Check if the user is logged in or not
function isUserLoggedIn() {
const logoutLink = document.querySelector('a[href$="/logout"]');
return Boolean(logoutLink);
}
if (change_page_text_color) {
// Select all <b> elements and set their text color to white
var bElements = document.querySelectorAll('b');
for (var belement = 0; belement < bElements.length; belement++) {
bElements[belement].style.color = "white";
};
// Select all <a> elements and set their text color to white
var aElements = document.querySelectorAll('a');
for (var aelement = 0; aelement < aElements.length; aelement++) {
aElements[aelement].style.color = "white";
};
var divElements = document.querySelectorAll('div');
for (var divelement = 0; divelement < divElements.length; divelement++) {
divElements[divelement].style.color = "white";
};
};
function addMainBorder() {
// Set the border color
main_div_border_color = "white";
// Find all elements with class 'maindiv'
var elements = document.querySelectorAll('.maindiv');
// Iterate through the elements and set their border style
elements.forEach(function(element) {
element.style.border = `2px solid ${main_div_border_color}`;
});
}
addMainBorder();
// center the main div only when in the root of the page (www.iha.ee)
if (currentPathSegments[0] == "root") {
function centerMainDiv() {
// Assuming .maindiv elements should be directly centered inside the body or a specific container
// This will work well if there's one maindiv or if multiple maindivs are intended to be stacked and centered
// Set the body or container to be a flex container to center the child elements
document.body.style.display = 'flex';
document.body.style.flexDirection = 'column';
document.body.style.justifyContent = 'center';
document.body.style.alignItems = 'center';
document.body.style.height = '100vh'; // Make sure the body takes at least the full viewport height
// Find all elements with class 'maindiv'
var elements = document.querySelectorAll('.maindiv');
elements.forEach(function(element) {
element.style.margin = 'auto'; // Helps center if flexbox doesn't apply, depending on the structure
// Optional: set a max-width or width for better control over the layout
element.style.maxWidth = '90%'; // Example, adjust as needed
element.style.boxSizing = 'border-box'; // Include padding and borders in the element's total width and height
});
}
centerMainDiv();
}
function resizeLangIcon() {
var langicon = document.querySelector('.langicon img');
if (langicon) {
langicon.style.width = '40px';
}
}
resizeLangIcon();
function setLangSelectionBoxBackgroundColor() {
var langSelectionBox = document.getElementById('langselectionbox');
if (langSelectionBox) {
langSelectionBox.style.backgroundColor = "black";
langSelectionBox.style.border = "2px solid white";
}
}
// Call the function
setLangSelectionBoxBackgroundColor();
// Remove left menu links that can not be accessed when not logged
function removeMenuItemsIfNotLoggedIn() {
if (!isUserLoggedIn()) {
// Define menu items for each language
const menuItemsByLanguage = {
english: [
"VIP account", // Assumed English translation
"Mailbox", // Assumed English translation
"My pictures",
"My videos",
"My contacts",
"My profile",
"Account settings",
"Viewed/rated", // Assumed English translation
"Sexy stories" // Assumed English translation
],
estonian: [
"VIP konto",
"Postkast",
"Minu pildid",
"Minu videod",
"Minu kontaktid",
"Minu ankeet",
"Konto seaded",
"Vaadatud/hinnatud",
"Seksikad jutud"
],
latvian: [
"VIP konts",
"Pastkaste",
"Mani attēli",
"Manas videofilmas",
"Mani kontakti",
"Mans profils",
"Konta iestatījumi",
"Skatīti/vērtēti",
"Seksīgi stāsti"
],
finnish: [
"VIP-tili",
"Postilaatikko",
"Minun kuvat",
"Minun videot",
"Minun yhteystiedot",
"Profiilini",
"Tilin asetukset",
"Katsottu/arvioitu",
"Seksikkäät tarinat"
]
};
// Use the getUserLanguage function to determine the current language
const currentLanguage = getUserLanguage(); // Assume this function is defined elsewhere
// Select the appropriate list of items to remove based on the current language
// Default to English if the current language's items aren't defined
const itemsToRemove = menuItemsByLanguage[currentLanguage] || menuItemsByLanguage.english;
// Proceed with the removal process
itemsToRemove.forEach(item => {
// Find the menu item by its text content and remove it
const menuItem = Array.from(document.querySelectorAll('#leftMenu a')).find(a => a.textContent.trim() === item);
if (menuItem) {
// If a separator is directly before the item, consider removing it as well
const previousSibling = menuItem.previousElementSibling;
if (previousSibling && previousSibling.classList.contains('left_menu_item_separator')) {
previousSibling.remove();
};
menuItem.remove();
};
});
};
};
removeMenuItemsIfNotLoggedIn();
// Only execute the code when viewing nude pictures.
if (currentPathSegments[0] == "picture") {
function getImageURL() {
// Select the element that has the background-image.
const imgWrapper = document.querySelector('.imgwrapper_big');
// Extract the background-image style property.
const style = imgWrapper ? window.getComputedStyle(imgWrapper) : null;
const backgroundImage = style ? style.backgroundImage : null;
// The backgroundImage will be in the format: url("http://example.com/image.jpg")
// Extract the URL part using a RegExp.
if (backgroundImage) {
const match = backgroundImage.match(/url\("?(.+?)"?\)/);
if (match) {
return match[1]; // This is the URL of the background image.
}
}
// Return null or an appropriate default value if the image URL couldn't be retrieved.
return null;
}
// Example usage:
console.log(getImageURL()); // Logs the URL of the background image, or null if not found.
// Removes the href attribute from the anchor tag around the image.
function removeImageHref() {
// Select all anchor tags in the document
const anchors = document.querySelectorAll('a');
// Iterate through all anchor tags to find matching pattern
anchors.forEach(anchor => {
// Check if the href matches the desired pattern using RegExp
if (/www\.iha\.ee\/users\/.+/.test(anchor.getAttribute('href'))) {
// Remove the href attribute if a match is found
anchor.removeAttribute('href');
}
});
}
removeImageHref();
function setImageResolution() {
const imgWrapper = document.querySelector('.imgwrapper_big');
if (imgWrapper) {
const imageURL = imgWrapper.style.backgroundImage.slice(5, -2); // Extract URL from background-image
const img = new Image();
img.onload = function() {
const width = img.naturalWidth;
const height = img.naturalHeight;
// Optionally, you can check if the image dimensions are larger than a specific size
// and only then update the wrapper size. For demonstration, I'll update it directly.
imgWrapper.style.maxWidth = `${width}px`;
imgWrapper.style.maxHeight = `${height}px`;
// If you also want to update the src of an <img> element within imgWrapper:
const imgElement = imgWrapper.querySelector('img');
if (imgElement) {
imgElement.src = imageURL;
// Adjust the <img> element to not exceed the background dimensions (optional)
imgElement.style.maxWidth = '100%';
imgElement.style.maxHeight = '100%';
}
};
img.src = imageURL;
}
}
setImageResolution();
// Displays the background-image URL on top of the picture div and copies it on click.
function showImageURLOnTop() {
const imgWrapper = document.querySelector('.imgwrapper_big');
if (imgWrapper) {
const imageURL = getImageURL();
const overlay = document.createElement('div');
overlay.innerHTML = `${imageURL} <b>Vajuta lingile, et see kopeerida.</b>`;
overlay.style.position = 'absolute';
overlay.style.top = '0';
overlay.style.left = '0';
overlay.style.color = 'white';
overlay.style.backgroundColor = 'rgba(0,0,0,0.5)';
overlay.style.cursor = 'pointer';
overlay.addEventListener('click', function() {
navigator.clipboard.writeText(imageURL).then(() => {
alert('URL copied to clipboard!');
});
});
imgWrapper.style.position = 'relative';
imgWrapper.appendChild(overlay);
}
}
}
// Change the header icons
function replaceIconsWithSVG() {
const messageSVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path fill="#feffff" d="M160 368c26.5 0 48 21.5 48 48v16l72.5-54.4c8.3-6.2 18.4-9.6 28.8-9.6H448c8.8 0 16-7.2 16-16V64c0-8.8-7.2-16-16-16H64c-8.8 0-16 7.2-16 16V352c0 8.8 7.2 16 16 16h96zm48 124l-.2 .2-5.1 3.8-17.1 12.8c-4.8 3.6-11.3 4.2-16.8 1.5s-8.8-8.2-8.8-14.3V474.7v-6.4V468v-4V416H112 64c-35.3 0-64-28.7-64-64V64C0 28.7 28.7 0 64 0H448c35.3 0 64 28.7 64 64V352c0 35.3-28.7 64-64 64H309.3L208 492z"/></svg>`;
const searchSVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path fill="#feffff" d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"/></svg>`
const loginSVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path fill="#feffff" d="M217.9 105.9L340.7 228.7c7.2 7.2 11.3 17.1 11.3 27.3s-4.1 20.1-11.3 27.3L217.9 406.1c-6.4 6.4-15 9.9-24 9.9c-18.7 0-33.9-15.2-33.9-33.9l0-62.1L32 320c-17.7 0-32-14.3-32-32l0-64c0-17.7 14.3-32 32-32l128 0 0-62.1c0-18.7 15.2-33.9 33.9-33.9c9 0 17.6 3.6 24 9.9zM352 416l64 0c17.7 0 32-14.3 32-32l0-256c0-17.7-14.3-32-32-32l-64 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l64 0c53 0 96 43 96 96l0 256c0 53-43 96-96 96l-64 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"/></svg>`
// Select the envelope icon's image element
const envelopeIconImg = document.querySelector('.envelopeicon img');
const searchIconImg = document.querySelector('.searchicon img');
const loginIconImg = document.querySelector('.loginicon img');
// Check if the envelope icon exists
if (envelopeIconImg) {
// Create a div to wrap the SVG, this ensures the notification div remains positioned correctly
const svgWrapper = document.createElement('div');
svgWrapper.innerHTML = messageSVG;
svgWrapper.style.width = '32px'; // Set the SVG width
svgWrapper.style.height = '32px'; // Set the SVG height
svgWrapper.style.position = 'relative'; // Needed to keep the notification positioned correctly
// Replace the <img> tag with the new SVG wrapper
envelopeIconImg.parentNode.insertBefore(svgWrapper, envelopeIconImg);
envelopeIconImg.remove(); // Remove the original <img> tag
};
// Check if the search icon exists
if (searchIconImg) {
const svgWrapper = document.createElement('div');
svgWrapper.innerHTML = searchSVG;
svgWrapper.style.width = '32px'; // Set the SVG width
svgWrapper.style.height = '32px'; // Set the SVG height
svgWrapper.style.position = 'relative'; // Needed to keep the notification positioned correctly
// Replace the <img> tag with the new SVG wrapper
searchIconImg.parentNode.insertBefore(svgWrapper, searchIconImg);
searchIconImg.remove(); // Remove the original <img> tag
};
// Check if the envelope icon exists
if (loginIconImg) {
// Create a div to wrap the SVG, this ensures the notification div remains positioned correctly
const svgWrapper = document.createElement('div');
svgWrapper.innerHTML = loginSVG;
svgWrapper.style.width = '32px'; // Set the SVG width
svgWrapper.style.height = '32px'; // Set the SVG height
svgWrapper.style.position = 'relative'; // Needed to keep the notification positioned correctly
// Replace the <img> tag with the new SVG wrapper
loginIconImg.parentNode.insertBefore(svgWrapper, loginIconImg);
loginIconImg.remove(); // Remove the original <img> tag
};
};
replaceIconsWithSVG();
// Make the header stick to the top
if (!header_stick_to_top) {
var header = document.getElementById('header');
if (header) {
// Remove the 'position: fixed;' style to make it stay at the top without moving on scroll
header.style.position = 'static'; // Or 'relative' depending on how you want it to behave in the flow
// Change header background color to black
header.style.backgroundColor = header_background_color;
};
var toppadding = document.querySelector('.toppadding');
if (toppadding) {
toppadding.remove();
};
};
// Remove the right side statistics.
if (!show_right_side_statistics) {
var right_side_statistics = document.querySelector('#rightstatistics');
if (right_side_statistics) {
right_side_statistics.remove();
};
};
// Remove the news selection, because honestly - who the fuck cares? Set this to 'true' to still see the news.
if (!show_news) {
var main_news_div = document.querySelector('.main_news_div');
if (main_news_div) {
main_news_div.remove();
};
};
// Remove the birthdays shit, because once again, no one gives a flying fuck. Set to 'true' if you want to see this shit.
if (!show_users_birthdays) {
var birthday_list = document.querySelector('.birthday_list');
if (birthday_list) {
birthday_list.remove();
};
var birthday_list_more = document.querySelector('.birthday_list_more');
if (birthday_list_more) {
birthday_list_more.remove();
};
};
// Remove the online users div. Bullshit once again. Set to 'true' if you want to see it.
if (!show_online_users) {
var online_list = document.querySelector('.online_list');
if (online_list) {
online_list.remove();
};
var online_list_more = document.querySelector('.online_list_more');
if (online_list_more) {
online_list_more.remove();
};
};
// Remove the view where it shows you the last people who got the rating 10. Set to 'true' if you want to see it.
if (!show_last_top_ten) {
var last_top_ten = document.querySelector('.news_ten_wrapper')
if (last_top_ten) {
last_top_ten.remove();
};
};
// Get the page title and change it
var page_title = document.title;
// Split the title and change the part - "Iha.ee - Seksikate inimeste kohtumispaik" to "Iha.ee - Tasuta VIP"
var page_current_location = page_title.split("|")[0];
var page_title_description = page_title.split("|")[1];
page_title = `${page_current_location} | Iha.ee - Tasuta VIP`
document.title = page_title;
// Remove the top advertisement
var headbanner = document.querySelector('.headbanner');
if (headbanner) {
headbanner.remove();
};
// Remove the bottom footer_banner with the another sex advertisement
var footer_banner = document.querySelector('.footer_banner');
if (footer_banner) {
footer_banner.remove();
};
// Remove the bottom footer wrapper.
var footer_wrapper = document.querySelector('.footer_wrapper');
if (footer_wrapper) {
footer_wrapper.remove();
};
// Remove the ticker bullshit (banner that shows info about how to advertise yourself)
var ticker = document.querySelector('#ticker');
if (ticker) {
ticker.remove();
};
// Adjust opacity for .gif images within specified divs
const imgWrappers = document.querySelectorAll('div.imgwrapper[style*="background-image"], div.imgwrapper_big[style*="background-image"]');
imgWrappers.forEach(wrapper => {
const img = wrapper.querySelector('img');
if (img && img.src.endsWith('.gif')) {
img.style.opacity = '0';
}
});
// Remove <a> tags with specific text
const links = document.querySelectorAll('a');
links.forEach(link => {
if (link.textContent === 'Selle pildi nägemiseks pead olema sisse logitud!') {
// Assuming the parent div is to be removed, not just the <a> tag
if (link.parentNode) {
link.parentNode.style.display = 'none'; // Hides the entire div containing the link
}
}
});
// Change the right panel background color to the color specified in the configuration
var rightPanel = document.querySelector('.rightpanel');
if (rightPanel) {
rightPanel.style.backgroundColor = right_panel_color;
}
// Change the center panel background color to the color specified in the configuration
var centerPanel = document.querySelector('.centerpanel');
if (centerPanel) {
centerPanel.style.backgroundColor = center_panel_color;
};
// New functionalities
changeFont();
changeWallpaper();
replaceLogoAndSlogan();
removeComments();
// Print to console whether the user is logged in or not
console.log("User logged in:", isUserLoggedIn())
function removeRatingMenu() {
if (!isUserLoggedIn()) {
// Assuming the entire section you want to remove is uniquely identified by its style or content.
// Since there's no unique ID or class strictly for the rating section, we need to target a broader container or a specific identifiable element within it.
// This example will remove the whole container div that includes the rating and login prompt.
// You might need to adjust the selector based on the actual structure and how you can best identify the section to remove.
const container = document.querySelector('div[style*="margin: 0px auto;"][style*="max-width: 615px;"]'); // Adjust the selector as needed.
if (container) {
container.parentNode.removeChild(container);
}
}
}
removeRatingMenu();
}
// Initial run and observe for dynamic changes
adjustContent();
const observer = new MutationObserver(mutations => {
mutations.forEach(mutation => {
if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
adjustContent();
}
});
});
observer.observe(document.body, { childList: true, subtree: true });
})();