Epey.com Favorilerim

Epey.com daki favori ürünlerinizi kategorize eder.

目前為 2021-01-02 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Epey.com Favorilerim
// @namespace    https://github.com/ilyasbilgihan
// @version      0.5
// @description  Epey.com daki favori ürünlerinizi kategorize eder.
// @author       @ilyasbilgihan
// @match        https://www.epey.com/uye/favorilerim/*
// @match        http://www.epey.com/uye/favorilerim/*
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    var counts = {};
    var indirimde = 0;
    var items = document.querySelectorAll('#favorilerim li');
    var fbaslik = document.querySelector('#fbaslik h1');
    fbaslik.innerText = "Fiyatı Düşenler | "
    items.forEach((item)=>{
        var category = item.querySelector('a').getAttribute('href').split('/')[3];
        var degisim = item.querySelector('.degisim');
        if(!degisim.classList.contains('dusus')){ // Bu kontrol yapılmazsa tüm favori ürünler kategorilere ayrılır.
            counts[category] = counts[category] || document.createElement('ul');
            counts[category].append(item);
        }else { indirimde++; }

    });

    fbaslik.setAttribute('data-count','('+indirimde+' ürün)');

    var cerceve = document.querySelector('.cerceve.cerceve');


    for (const [key, value] of Object.entries(counts)) {
        var h2 = document.createElement('div');
        h2.classList.add('cat-name');
        h2.innerHTML = '<h2>'+ key.split('-').join(' ') +' | </h2> <span data-target="'+key+'" class="btn-open">Göster / Gizle</span>';
        
        value.classList.add('cat');
        value.classList.add('closed');
        value.classList.add(key);

        cerceve.append(h2);
        cerceve.append(value);
        value.style.maxHeight = value.offsetHeight + "px";
    }

    var buttons = document.querySelectorAll('.btn-open');
    buttons.forEach((button)=>{
        button.addEventListener('click', (e)=>{
            var target = e.target.getAttribute('data-target');
            var targetElement = document.querySelector('.cat.'+target);
            targetElement.classList.toggle('closed');

        });
    });

    GM_addStyle(`
        #fbaslik h1{font-size: 25px;}
        .cerceve.cerceve{ width: auto; }
        #fbaslik h1:after{content:attr(data-count); font-size: 16px; color: #2f9a30;}
        .btn-open { position: absolute; top: 0; right: 20px; cursor: pointer; user-select: none; }
        #favorilerim { min-height: 0; }
        .cat-name {
            margin: 20px 0 20px 10px;
            text-transform: Capitalize;
            min-width: 100%;
            float: left;
            position: relative;
        }
        .cat-name h2:after { content: "(Fiyat düşüşü yok)"; font-size: 14px; color: red; }
        .cat{ transition: .4s all; opacity: 1; overflow: hidden; float:left;min-height:0;}.cat li{float:left;width:467px;height:125px;border:1px solid #e8dca8;margin:0 3px 4px;padding:5px;position:relative}.cat li span{margin:5px 0}.cat li .resim{float:left;text-align:center;text-align:center;width:120px;margin-right:15px}.cat li .adi{display:block;width:425px;font-size:13px}.cat li .adi a{font-size:15px;font-weight:700}.cat li .varyant{font-size:13px;font-weight:400}.cat li .fiyat{display:block}.cat li .fiyat span{float:left;width:140px;height:50px}.cat li .fiyat span strong{display:block;font-size:15px}.cat li .fiyat .arrow{width:50px;background:url(https://resim.epey.com/tema/arrow.png?v=2) no-repeat}.cat li .tarih{display:block;font-size:13px}.cat li .degisim{position:absolute;top:0;right:3px;width:24px;text-align:center}.cat li .artis{background:url(https://resim.epey.com/tema/artis.png?v=2) no-repeat top;padding:20px 0 0 0}.cat li .dusus{background:url(https://resim.epey.com/tema/dusus.png?v=2) no-repeat bottom;padding:0 0 20px 0}.cat li .sil{position:absolute;bottom:0;right:3px;width:24px;height:24px;text-align:center;background:url(https://resim.epey.com/tema/delete.png?v=1) no-repeat bottom;cursor:pointer}
        .cat.closed { max-height: 0px!important; opacity: 0; transition: .4s all; }
    `);



})();