Giter Site home page Giter Site logo

all pages in this file and others like this are blurred, by the looks of it, it's page 3, 6, 6, 9, 12 (counting in three's) about stuhack HOT 22 OPEN

nadinelynch2600 avatar nadinelynch2600 commented on August 10, 2024
all pages in this file and others like this are blurred, by the looks of it, it's page 3, 6, 6, 9, 12 (counting in three's)

from stuhack.

Comments (22)

chrisfeldkircher avatar chrisfeldkircher commented on August 10, 2024

This worked for me:

function unblurImages() {
    const blurredImages = document.querySelectorAll('img[alt*="Blurred content"]');

    blurredImages.forEach((image) => {
        if (image.src.includes('/blurred/')) image.src = image.src.replace('/blurred/', '/');

        if (image.hasAttribute('srcset')) image.srcset = image.srcset.split(',').map(src => src.replace('/blurred/', '/')).join(',');

        image.classList.add('bi', 'x0', 'y0', 'w1', 'h1');

        if (image.parentElement.classList.contains('blurred-container')) image.parentElement.classList.remove('blurred-container');
    });
}

function cleanUpPageContent() {
    const pages = document.querySelectorAll('.page-content');

    pages.forEach(page => {
        Array.from(page.parentNode.childNodes).forEach(sibling => {
            if (sibling !== page && sibling.nodeType === Node.ELEMENT_NODE) sibling.remove();
        });
        
        page.classList.add('nofilter');
    });
}

window.addEventListener('load', function() {
    cleanUpPageContent();
    document.getElementById('viewer-wrapper').addEventListener('scroll', unblurImages);
    document.getElementById('document-wrapper').addEventListener('scroll', unblurImages);
});

from stuhack.

Destro9000 avatar Destro9000 commented on August 10, 2024

@chrisfeldkircher So i tried your code into reove blur.js of the extension but it still didnt work
20240117_113843

from stuhack.

chrisfeldkircher avatar chrisfeldkircher commented on August 10, 2024

@Destro9000 Ah, this is an issue I am currently working on. Seems like, in the print view, the new window does not have permission to load the unblurred resources from the server. In the normal scroll view, however, they load just fine. So caching them directly there would solve the problem (I hope). Could you look into the console and tell me if there are any 403 errors?

Screenshot 2024-01-17 at 12 12 38

from stuhack.

Destro9000 avatar Destro9000 commented on August 10, 2024

Ah, this is an issue I am currently working on. Seems like, in the print view, the new window does not have permission to load the unblurred resources from the server. In the normal scroll view, however, they load just fine. Could you look into the console and tell me if there are any 403 errors?

Screenshot 2024-01-17 at 12 12 38

yes there is one 403 error :
"
Failed to load resource: net::ERR_BLOCKED_BY_CLIENT
widget.trustpilot.com/stats/TrustboxImpression?locale=it&styleWidth=100%25&theme=light&url=https%3A%2F%2Fwww.studocu.com%2Fit%2Fdocument%2Funiwersytet-im-adama-mickiewicza-w-poznaniu%2Fprawo-miedzynarodowe-publiczne%2Fskrypt-prawo-miedzynarodowe-publiczne-uam%2F21657310&referrer=https%3A%2F%2Fwww.studocu.com%2Fit%2Fsearch%2Fskrypt%2520prawo%2520miedzynarodowe%2520publiczne%3Forigin%3Dheader&userAgent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F120.0.0.0%20Safari%2F537.36&language=en-US&platform=Win32&nosettings=1&businessUnitId=5c6bbef2ddf81b0001d62aeb&widgetId=5419b6ffb0d04a076446a9af:1

   Failed to load resource: net::ERR_BLOCKED_BY_CLIENT

page3.webp:1

   Failed to load resource: the server responded with a status of 403 ()

page9.webp:1

   Failed to load resource: the server responded with a status of 403 ()

page6.webp:1

   Failed to load resource: the server responded with a status of 403 ()

21657310:1 Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received
"

from stuhack.

chrisfeldkircher avatar chrisfeldkircher commented on August 10, 2024

I see. Does this only happen when you click download or directly when scrolling through on the main site?

from stuhack.

Destro9000 avatar Destro9000 commented on August 10, 2024

@Destro9000 Ah, this is an issue I am currently working on. Seems like, in the print view, the new window does not have permission to load the unblurred resources from the server. In the normal scroll view, however, they load just fine. So caching them directly there would solve the problem (I hope). Could you look into the console and tell me if there are any 403 errors?

Screenshot 2024-01-17 at 12 12 38

btw they dont show up even before clicking on download and going to the print page

from stuhack.

Destro9000 avatar Destro9000 commented on August 10, 2024

I see. Does this only happen when you click download or directly when scrolling through on the main site?

what a timing , i answered just right now above xd

from stuhack.

chrisfeldkircher avatar chrisfeldkircher commented on August 10, 2024

Hmm, this is very confusing. I am trying to understand why it is working for me. The only changes I made were to the remove-blur.js (the code I posted) and one addition to remove-banner.js, as it would not catch all banners and a function in the check_version.js to scroll through all the content to load the pages (otherwise, they would be missing in the download view, as they are loaded when the user scrolls). The remove-banner addition should not influence this, and I intentionally deleted the scroll functionality to see if that would change anything, but it did not.

from stuhack.

chrisfeldkircher avatar chrisfeldkircher commented on August 10, 2024

Anyway, you may want to try my code and see if this works for you. In the check_version.js, I added a loading screen when the script scrolls through the site to load the content and changed the user icon to the anonymous one you see in the image. In case you were wondering.

check_version.js:

window.addEventListener('load', function() {
    initializeExtension();
});

function initializeExtension() {
    try {
        let extensionVersion = chrome.runtime.getManifest().version;
        updateAllLogos();
        replaceUserIcons();
        fetchAllContent();
    } catch (error) {
        console.error('Initialization Error:', error);
    }

    try {
        setupSidebarToggleListener();
    } catch (error) {
        console.error('Sidebar Toggle Error:', error);
    }
}

function updateAllLogos() {
    const studocuLogos = document.querySelectorAll('[aria-label="Studocu Logo"]');
    studocuLogos.forEach(updateLogo);
}

function updateLogo(logoElement) {
    const logoSvg = logoElement.firstChild;
    logoSvg.innerHTML = 
    `<g transform="matrix(0.030577, 0, 0, -0.031212, 0.081575, 28.593828)" fill="#000000" stroke="none" style="">
    <path d="M152 849 c-65 -25 -117 -76 -131 -126 -27 -95 -3 -194 58 -246 18 -15 91 -57 162 -93 143 -73 166 -97 154 -161 -13 -70 -123 -98 -184 -48 -16 14 -35 41 -41 60 l-12 35 -79 0 -79 0 0 -43 c0 -59 41 -138 88 -170 47 -33 107 -46 203 -47 183 0 279 81 279 235 -1 121 -47 174 -236 273 -137 71 -163 96 -150 145 8 35 44 58 95 60 45 1 81 -24 101 -74 12 -29 14 -29 92 -29 l80 0 -4 54 c-6 78 -41 126 -119 165 -55 27 -72 31 -143 30 -56 0 -97 -6 -134 -20z" style="fill: rgb(59, 58, 58);"></path>
    <path d="M1670 435 l0 -415 85 0 85 0 0 175 0 175 125 0 125 0 0 -175 0 -175 80 0 80 0 0 415 0 415 -85 0 -85 0 0 -160 0 -160 -120 0 -120 0 0 160 0 160 -85 0 -85 0 0 -415z" style="fill: rgb(1, 153, 236);"></path>
    <path d="M3540 440 l0 -410 80 0 80 0 0 120 c0 149 3 149 104 -11 l72 -114 87 -3 c53 -2 87 1 87 7 0 10 -105 179 -163 265 -15 21 -27 44 -27 51 0 6 41 68 90 138 50 70 90 130 90 132 0 11 -167 4 -182 -7 -8 -7 -35 -42 -58 -78 -47 -72 -79 -110 -92 -110 -4 0 -8 97 -8 215 l0 215 -80 0 -80 0 0 -410z" style="fill: rgb(1, 153, 236);"></path>
    <path d="M699 723 c-1 -10 -1 -32 0 -50 3 -34 -27 -73 -54 -73 -21 0 -35 -33 -35 -84 l0 -46 45 0 45 0 0 -160 c0 -251 5 -257 258 -294 21 -3 22 0 22 75 0 75 -1 79 -22 79 -13 0 -37 9 -54 19 -37 22 -44 52 -44 189 l0 92 60 0 60 0 0 75 0 75 -60 0 -60 0 0 60 0 60 -80 0 c-69 0 -80 -2 -81 -17z" style="fill: rgb(59, 58, 58);"></path>
    <path d="M2516 629 c-94 -22 -146 -76 -146 -153 l0 -36 66 0 c59 0 70 3 100 30 19 16 45 32 58 36 34 8 79 -16 91 -50 8 -24 6 -31 -13 -46 -12 -10 -46 -21 -74 -25 -207 -25 -258 -62 -258 -187 0 -110 64 -180 177 -194 63 -8 112 7 159 48 34 30 34 30 34 7 0 -42 11 -48 78 -42 l64 6 -4 246 c-3 235 -4 248 -26 282 -44 71 -183 107 -306 78z m174 -374 c0 -46 -23 -101 -48 -114 -80 -43 -178 37 -128 104 9 12 37 23 82 31 98 17 94 18 94 -21z" style="fill: rgb(1, 153, 236);"></path>
    <path d="M3071 619 c-79 -31 -123 -102 -142 -230 -15 -101 7 -234 48 -293 49 -69 80 -81 218 -81 110 0 124 2 165 25 55 31 89 88 92 156 l3 49 -78 3 -77 3 -6 -30 c-17 -85 -125 -108 -178 -38 -18 25 -21 42 -21 137 0 126 14 158 79 175 50 12 85 -7 111 -62 l20 -42 78 -1 c87 0 85 -2 66 80 -15 65 -47 107 -103 135 -44 22 -63 25 -150 24 -56 0 -112 -5 -125 -10z" style="fill: rgb(1, 153, 236);"></path>
     <path d="M1050 388 c0 -205 3 -238 19 -274 37 -81 101 -108 250 -102 119 4 164 24 201 89 24 43 25 50 28 282 l4 237 -81 0 -81 0 0 -194 c0 -111 -5 -206 -11 -224 -13 -37 -55 -57 -104 -48 -62 12 -65 26 -65 258 l0 208 -80 0 -80 0 0 -232z" style="fill: rgb(59, 58, 58);"></path>
    </g>`;
}

function replaceUserIcons() {
    const userIcons = document.querySelectorAll('.svg-inline--fa.fa-user.fa-fw._db78be352894._6d88284663af');
    if (userIcons.length === 0) {
        console.log('No user icons found.');
        return;
    }

    userIcons.forEach(replaceIconWithSvg);
}

function replaceIconWithSvg(iconElement) {
    const svgContainer = document.createElement('div');
    svgContainer.innerHTML = 
    `<svg xmlns="http://www.w3.org/2000/svg" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" width="556" height="769" viewBox="31.5 82.5 556 769">
            <rect fill="#14213d" width="556" height="769" x="31.5" y="82.5"/>
            <path transform="translate(-79.857144,-56.433611)" fill="#fca311" d="M 419.05551,874.84246 c 10.2812,-3.209 18.6107,-7.75769 28.0384,-15.31151 21.1336,-16.93304 35.7755,-36.70036 90.4391,-122.09734 41.0968,-64.20239 56.5193,-92.89811 67.9874,-126.5 5.2804,-15.47191 11.3362,-42.0865 11.3366,-49.82332 1e-4,-3.10151 -0.3303,-3.76046 -1.7499,-3.49032 -2.5369,0.48275 -7.8503,8.92686 -9.7679,15.52336 -2.0554,7.0702 -9.6654,26.2121 -17.0999,43.01244 -9.5612,21.6063 -26.2848,49.91776 -51.8504,87.77784 -48.7477,72.19049 -47.3014,70.18612 -49.9192,69.18158 -1.3841,-0.53115 -1.3958,-1.04457 -0.1067,-4.69824 1.7841,-5.05673 9.7203,-18.61617 20.1828,-34.48334 4.3518,-6.6 10.7611,-17.36382 14.2428,-23.91959 3.4817,-6.55578 8.5214,-15.27602 11.1994,-19.37831 3.388,-5.18983 4.8691,-8.48436 4.8691,-10.83041 0,-1.85443 -0.4899,-3.37169 -1.0886,-3.37169 -0.5988,0 -3.4036,2.025 -6.2328,4.5 -4.6608,4.07713 -8.7622,6.06231 -7.1562,3.4638 0.3522,-0.56991 7.8676,-9.23241 16.7007,-19.25 25.2356,-28.6193 33.4111,-40.59765 38.3671,-56.2138 2.8231,-8.89524 4.4619,-24.5 2.573,-24.5 -2.3234,0 -10.0492,11.56409 -23.1529,34.6554 -7.4193,13.07435 -15.1076,25.81298 -17.085,28.30807 -20.1618,25.44015 -57.7915,43.13276 -98.9253,46.51242 -4.125,0.33892 -13.5409,1.7664 -20.9241,3.17218 -13.1742,2.50836 -13.7702,2.5341 -32,1.38248 -21.3367,-1.34788 -31.4673,-3.11017 -34.5552,-6.01113 -1.8305,-1.71963 -3.4968,-2.01942 -11.2247,-2.01942 -11.0647,0 -21.4634,-1.89195 -36.4376,-6.62955 -25.9777,-8.21896 -47.266,-19.11094 -63.2641,-32.36856 -12.2852,-10.18082 -16.6927,-16.50052 -31.0041,-44.45524 -9.6417,-18.83349 -14.9082,-27.54665 -16.65,-27.54665 -2.8273,0 3.9594,22.32503 10.5711,34.77434 10.3659,19.51776 20.6328,32.26524 46.7284,58.01811 37.2419,36.75277 44.8774,42.20863 71.4824,51.07674 22.4366,7.47873 34.659,9.12865 67.6336,9.12997 20.8422,8.4e-4 20.8575,0.002 23.8567,2.52612 2.4201,2.03635 3.6581,2.40204 6.3944,1.88871 2.1955,-0.41188 3.3932,-0.2463 3.3932,0.46911 0,0.60813 -2.7661,4.82071 -6.1469,9.3613 -8.5155,11.4367 -10.307,15.67034 -10.2637,24.2556 0.029,5.73642 0.7461,8.80511 3.973,17 3.9263,9.97113 3.9373,10.03898 3.8337,23.5 -0.097,12.64282 -0.3945,14.61116 -4.6788,31 -6.5274,24.96939 -7.3154,35 -2.7498,35 1.0611,0 5.665,-1.16602 10.2309,-2.59115 z m -54.9142,-6.40885 c -0.1187,-3.575 -2.0622,-13.925 -4.3189,-23 -6.6985,-26.93611 -8.1038,-38.34882 -5.8996,-47.91121 0.5593,-2.42617 3.2483,-9.2131 5.9756,-15.08207 4.4705,-9.6202 4.9546,-11.35198 4.9171,-17.58878 -0.048,-7.95437 -2.0902,-14.39763 -6.5567,-20.68482 -3.6905,-5.19476 -7.0379,-6.91603 -19.999,-10.28361 -5.3732,-1.39607 -14.9744,-4.73803 -21.3361,-7.42657 -6.3616,-2.68855 -14.8518,-5.91445 -18.867,-7.16868 -8.7829,-2.74348 -10.9717,-2.04072 -10.2347,3.28599 0.4952,3.57849 0.4735,12.33109 -0.063,25.35975 -0.2812,6.83172 0.14,9.45455 2.8843,17.96024 3.2407,10.04424 3.8946,14.91707 2.3324,17.38193 -2.3188,3.65854 -8.0662,-4.35362 -14.592,-20.34217 -4.9398,-12.1025 -20.1029,-41.42379 -31.5541,-61.01688 -9.0516,-15.4874 -25.3321,-41.43133 -47.3677,-75.48312 -12.41166,-19.1799 -19.7901,-33.16346 -26.21662,-49.68554 -7.86073,-20.2093 -15.90421,-33.31446 -20.44722,-33.31446 -3.6032,0 -3.24903,4.18127 1.61762,19.09752 16.28268,49.90635 40.63992,98.11942 90.38162,178.90248 19.7033,31.99905 26.2263,41.64641 34.2401,50.64047 3.3616,3.77274 13.1102,17.43453 21.6635,30.35953 12.6987,19.18908 17.3038,25.26212 25.1038,33.10579 5.2537,5.28318 11.6927,10.8402 14.3089,12.34894 6.5961,3.80395 17.6471,7.60029 21.2433,7.2977 l 3,-0.25243 -0.2158,-6.5 z m 27.1335,-58.72632 c -0.089,-4.50338 -2.0953,-7.99601 -3.682,-6.40939 -0.5438,0.54383 -0.6468,3.14679 -0.2411,6.09621 0.556,4.04281 1.0617,5.07534 2.3567,4.81245 1.2312,-0.24994 1.6279,-1.38937 1.5664,-4.49927 z m 23.5757,-120.52368 c 0,-0.6875 -0.894,-2.6 -1.9786,-4.25 -2.6837,-4.08243 -20.7025,-23.45356 -24.9324,-26.80361 -3.2733,-2.59236 -3.5268,-2.63784 -6,-1.07654 -2.9912,1.88826 -2.5678,1.41474 -15.4765,17.30928 -6.7629,8.32726 -9.5694,12.50737 -8.8681,13.20864 1.0237,1.02374 24.7043,2.41777 46.0122,2.70865 8.4183,0.11492 11.2484,-0.16106 11.2434,-1.09642 z m 57.5455,-38.18474 c 28.5871,-6.92592 43.8075,-16.34146 60.0581,-37.15269 7.6105,-9.74633 15.403,-22.16368 15.403,-24.54463 0,-1.88067 -1.0118,-2.06358 -21.4947,-3.88558 -20.6227,-1.83443 -30.0053,-4.96585 -30.0053,-10.01418 0,-2.41879 0.1401,-2.46196 7,-2.15724 3.85,0.17102 12.4734,0.95852 19.1632,1.75 16.1262,1.90794 22.2504,1.8198 40.2291,-0.57896 16.2054,-2.16214 22.4327,-4.09438 30.5019,-9.46426 7.6345,-5.08063 24.6061,-20.52887 29.2698,-26.64256 5.1892,-6.80274 6.5711,-9.59582 9.3383,-18.87516 2.0048,-6.72269 2.2877,-10.3153 2.7304,-34.66389 l 0.4939,-27.16389 -5.8633,-0.6514 c -3.2248,-0.35827 -11.2072,-1.52202 -17.7386,-2.58611 -14.4327,-2.35135 -17.6908,-2.38668 -24.1247,-0.26157 -4.2189,1.39349 -12.4986,1.77054 -53,2.41356 -26.4,0.41914 -51.825,1.07327 -56.5,1.45362 -11.794,0.95954 -15.8696,-0.32055 -23.1597,-7.2741 -3.2122,-3.06386 -5.8403,-6.10001 -5.8403,-6.747 0,-2.61342 6.1985,-10.20719 10.7036,-13.11283 12.0148,-7.74934 29.4167,-17.64593 34.363,-19.54254 13.43,-5.14965 37.0067,-6.3908 53.9334,-2.83922 17.0438,3.57613 32.8738,12.66492 40.4997,23.25289 4.9137,6.8223 5.8079,7.39397 14.388,9.19886 3.7742,0.79392 8.381,2.32255 10.2373,3.39695 4.0209,2.32725 16.1015,6.12667 19.4804,6.12667 2.3747,0 2.3946,-0.0877 2.3946,-10.53868 0,-11.98633 -1.5125,-51.0181 -3.0404,-78.46132 -3.1077,-55.81685 -11.5671,-98.55783 -24.5954,-124.26798 -13.5518,-26.74328 -43.3262,-42.58301 -101.8642,-54.19091 -43.9406,-8.7133 -87.5987,-12.339 -127.5,-10.58856 -95.5719,4.19266 -157.52,18.61114 -186.8548,43.49064 -15.61968,13.2474 -24.90804,32.96649 -32.5281,69.05681 -9.9497,47.12409 -13.46707,84.86293 -14.30664,153.5 l -0.58101,47.5 3.23662,9.5 c 7.95205,23.34048 22.05186,47.35088 34.65556,59.01456 6.94217,6.4244 17.98477,12.77291 24.30057,13.97068 7.7698,1.47351 31.4127,1.20674 47.5778,-0.53684 7.7,-0.83052 18.6125,-1.7858 24.25,-2.12284 9.9703,-0.59606 10.25,-0.55491 10.25,1.50777 0,3.06243 -3.2597,4.69687 -14,7.01969 -21.8041,4.71561 -26.4955,5.35179 -38.7132,5.24965 -14.6582,-0.12254 -15.01,0.17384 -10.2496,8.63517 8.2005,14.57599 18.7824,26.66966 30.0031,34.28948 12.8421,8.72094 43.3835,21.76894 56.1639,23.99454 8.4399,1.46975 15.1923,-0.29877 21.9778,-5.75621 6.833,-5.49562 9.223,-8.95262 9.1051,-13.16978 -0.083,-2.97953 -0.9658,-4.39183 -5.1482,-8.23972 -2.7761,-2.55411 -5.3134,-5.70411 -5.6383,-7 -0.325,-1.29588 0.1026,-6.63115 0.9503,-11.85615 2.6289,-16.20573 1.4678,-27.43417 -2.7711,-26.79696 -1.0865,0.16333 -2.4715,1.19696 -3.0776,2.29696 -0.6062,1.1 -2.5493,4.06437 -4.3181,6.5875 -5.0339,7.18101 -7.2841,13.35197 -7.2841,19.97635 0,5.47544 -0.1812,5.94353 -2.5292,6.53284 -1.8421,0.46233 -3.6156,-0.11802 -6.5275,-2.13603 -8.045,-5.57516 -12.9493,-15.39005 -12.9377,-25.89216 0.012,-11.20982 4.2953,-17.65549 15.9919,-24.06711 8.4019,-4.60561 14.1637,-10.64944 16.4992,-17.30686 2.0216,-5.76243 7.095,-34.27467 9.1094,-51.19453 0.9232,-7.75383 1.5413,-22.76461 1.628,-39.53394 l 0.1398,-27.03394 -7.9369,-15.35226 c -7.1061,-13.7451 -8.6072,-15.93995 -14.3394,-20.96606 -3.5213,-3.08759 -11.6213,-10.26394 -18,-15.94745 -19.8689,-17.70357 -28.8521,-23.13289 -43.4429,-26.25647 -14.1213,-3.02307 -20.6547,-6.19538 -20.6547,-10.029 0,-3.68669 6.0759,-5.2182 18,-4.53717 23.7661,1.35736 37.9651,8.9254 71.2477,37.97499 23.9499,20.90383 29.4533,27.64798 36.4615,44.6813 1.6972,4.125 4.01,11.325 5.1397,16 4.0166,16.62255 4.3336,24.58089 3.2011,80.36346 -0.5864,28.88329 -1.2694,53.10491 -1.5179,53.82581 -1.8176,5.27305 -7.567,48.13486 -7.6176,56.78945 -0.057,9.79567 0.061,10.38603 2.6114,13.0483 6.5803,6.86838 22.8957,10.99253 35.6553,9.01282 7.8852,-1.22344 11.4681,-2.79034 17.4437,-7.62881 2.2687,-1.83695 5.3566,-3.90112 6.8621,-4.58704 3.0567,-1.39272 1.366,-2.82857 15.6873,13.32324 10.6803,12.04551 18.4432,14.00219 37.3646,9.41803 z m -11.4424,-59.31526 c -1.5024,-7.07039 -6.1821,-17.04236 -9.4294,-20.09301 -1.3304,-1.24992 -4.7502,-2.88754 -7.5994,-3.63915 -2.8493,-0.75162 -5.8301,-1.90571 -6.6241,-2.56465 -3.6043,-2.99131 0.1744,-10.76785 4.6824,-9.63641 4.1206,1.0342 14.2711,8.13413 17.5523,12.27727 7.8785,9.94783 10.5796,21.29247 6.3468,26.65595 -1.1936,1.5125 -2.516,2.75 -2.9385,2.75 -0.4226,0 -1.3181,-2.5875 -1.9901,-5.75 z M 168.85714,472.85417 c 0,-1.4187 1.19024,-5.55457 2.64497,-9.19084 2.6349,-6.5862 2.63821,-6.62876 0.86825,-11.17055 -0.97721,-2.50754 -1.98913,-5.76675 -2.24872,-7.24269 -0.50924,-2.89535 -1.3956,-2.45712 11.97037,-5.91827 2.49333,-0.64565 4.65406,-2.2017 6.5,-4.68096 4.83255,-6.49053 12.6122,-13.69689 18.299,-16.95055 14.202,-8.12556 34.5107,-11.82919 55.9661,-10.20637 12.6744,0.95865 20.2923,3.23224 33.5,9.99818 22.4751,11.51333 31.7464,18.16421 33.1732,23.79701 1.3833,5.46121 -5.4349,13.06468 -14.0367,15.65345 -6.6929,2.01426 -23.1882,3.30599 -64.4446,5.0466 -20.5194,0.86571 -40.7694,2.16595 -45,2.88941 -15.20966,2.60101 -30.67386,6.67122 -32.75632,8.62155 -2.83511,2.65524 -4.43555,2.42216 -4.43555,-0.64597 z m 257.66667,-55.08723 c -1.3226,-1.32258 -0.6419,-11.48073 0.9805,-14.63299 6.9436,-13.49101 20.1831,-28.02453 41.8528,-45.94367 25.0509,-20.71509 43.0707,-28.75667 64.4388,-28.75667 8.886,0 13.0612,1.44801 13.0612,4.52973 0,4.11732 -6.2547,7.30363 -23.5681,12.00616 -12.3073,3.34281 -15.2048,4.80192 -25.0703,12.62474 -21.2078,16.81662 -54.6246,47.64765 -63.6116,58.68928 -1.6802,2.06432 -6.5996,2.96712 -8.0833,1.48342 z m -89.5356,-43.5972 c -2.4029,-1.22987 -9.8206,-7.35327 -16.4837,-13.60756 -14.4287,-13.54343 -20.3355,-17.70014 -35.0557,-24.66954 -21.0188,-9.95152 -34.2684,-12.97696 -53.4847,-12.21287 -19.9989,0.7952 -29.5296,5.1125 -45.08685,20.42381 -5.21393,5.13152 -9.82643,9.33003 -10.25,9.33003 -2.78253,0 2.79639,-11.02836 10.38045,-20.51997 10.2876,-12.87522 27.1804,-24.0405 42.3494,-27.99082 11.2299,-2.9245 26.3904,-3.97349 38.7728,-2.68277 29.2887,3.05299 53.8167,14.04509 74.025,33.17388 12.379,11.71775 16.4366,20.86481 13.7242,30.93804 -2.5529,9.48063 -9.7902,12.47572 -18.8909,7.81777 z m 91.9832,0.63137 c -5.8349,-4.08693 -7.8784,-16.63631 -4.039,-24.80425 2.6047,-5.54125 17.9154,-20.45382 27.5487,-26.83227 32.1866,-21.31167 65.9695,-28.28349 95.7641,-19.76297 16.8713,4.82473 35.0982,17.59234 46.2018,32.36343 5.0377,6.70152 9.7153,15.25299 9.1959,16.81135 -0.1805,0.54148 -5.0118,-3.30575 -10.7361,-8.5494 -17.9897,-16.47897 -30.5119,-21.18049 -54.0497,-20.29311 -28.025,1.05655 -47.4019,10.07505 -82,38.16491 -18.563,15.07113 -22.3125,16.80595 -27.8857,12.90231 z"/>
            </svg>`;
    iconElement.parentNode.replaceChild(svgContainer.firstChild, iconElement);
}

function setupSidebarToggleListener() {
    const sidebarToggleButton = document.querySelector('[data-test-selector="content-sidebar-toggle"]');
    sidebarToggleButton.addEventListener('click', () => {
        setTimeout(updateAllLogos, 200);
    });
}

function addStyleToNewWindow(newWin, cssRule) 
{
    var style = newWin.document.createElement('style');
    style.type = 'text/css';
    style.appendChild(newWin.document.createTextNode(cssRule));
    newWin.document.head.appendChild(style);
}

function fetchAllContent() 
{
    var wrapper = document.getElementById('document-wrapper');
    var height = wrapper.scrollHeight;
    var currentPosition = 0;
    var step = 10000; // step size to controll how much it should scroll down at a time 
	var overlay = createOverlay();

    function createOverlay() 
	{
        var overlayDiv = document.createElement('div');
        overlayDiv.style.position = 'fixed';
        overlayDiv.style.top = '0';
        overlayDiv.style.left = '0';
        overlayDiv.style.width = '100%';
        overlayDiv.style.height = '100%';
        overlayDiv.style.backgroundColor = 'white';
        overlayDiv.style.display = 'flex';
        overlayDiv.style.justifyContent = 'center';
        overlayDiv.style.alignItems = 'center';
        overlayDiv.style.borderRadius = '15px';
        overlayDiv.style.zIndex = '1000';
        overlayDiv.innerText = 'Please wait! The content is being loaded.';
		overlayDiv.style.fontSize = '30px';
        document.body.appendChild(overlayDiv);
        return overlayDiv;
    }

    function hideOverlay() 
	{
        overlay.style.display = 'none';
    }

    function scrollStep() 
	{
        if (currentPosition < height) 
		{
            wrapper.scrollTo(0, currentPosition);
            currentPosition += step;
            setTimeout(scrollStep, 50); // time needed to scroll through the step size
        } 
		else 
		{
            hideOverlay();

			// wait at the bottom to ensure everything has been loaded
            setTimeout(() => wrapper.scrollTo(0, 0), 50);
        }

        // Cache images as they are loaded
        document.querySelectorAll('img').forEach(img => {
            const src = img.src;
            if (src) 
            {
                // Send the src to the background worker to cache
                chrome.runtime.sendMessage({ action: 'cache', url: src });
            }
        });
    }


    scrollStep();
}

remove_banner.js:

window.addEventListener('load', function(){
    // Remove the primary banner
    var primaryBanner = document.querySelectorAll('._95f5f1767857')[0];
    if (primaryBanner) {
        primaryBanner.remove();
    }

    // Remove banners for smaller screens
    if (window.innerWidth <= 990){
        var pages = document.getElementById('page-container').childNodes;
        if(pages != null){
            for(i = 0; i < pages.length; i++) {
                if(pages[i].id === ''){
                    pages[i].parentNode.removeChild(pages[i]);
                }
            }
        }
    }

    // Function to remove banner-wrapper elements
    function removeBannerWrapper() {
        var bannerWrappers = document.querySelectorAll('.banner-wrapper');
        bannerWrappers.forEach(function(banner) {
            banner.remove();
        });
    }

    // Call the function to remove banner-wrapper elements
    removeBannerWrapper();

    // Optional: Observe for dynamic changes and remove new banner-wrapper elements
    var observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if (mutation.addedNodes.length) {
                removeBannerWrapper();
            }
        });
    });

    var config = { childList: true, subtree: true };
    observer.observe(document.body, config);
});

remove_blur.js:

function unblurImages() {
    const blurredImages = document.querySelectorAll('img[alt*="Blurred content"]');

    blurredImages.forEach((image) => {
        if (image.src.includes('/blurred/')) image.src = image.src.replace('/blurred/', '/');

        if (image.hasAttribute('srcset')) image.srcset = image.srcset.split(',').map(src => src.replace('/blurred/', '/')).join(',');

        image.classList.add('bi', 'x0', 'y0', 'w1', 'h1');

        if (image.parentElement.classList.contains('blurred-container')) image.parentElement.classList.remove('blurred-container');
    });
}

function cleanUpPageContent() {
    const pages = document.querySelectorAll('.page-content');

    pages.forEach(page => {
        Array.from(page.parentNode.childNodes).forEach(sibling => {
            if (sibling !== page && sibling.nodeType === Node.ELEMENT_NODE) sibling.remove();
        });

        page.classList.add('nofilter');
    });
}

window.addEventListener('load', function() {
    cleanUpPageContent();
    document.getElementById('viewer-wrapper').addEventListener('scroll', unblurImages);
    document.getElementById('document-wrapper').addEventListener('scroll', unblurImages);
});

from stuhack.

Destro9000 avatar Destro9000 commented on August 10, 2024

Anyway, you may want to try my code and see if this works for you. In the check_version.js, I added a loading screen when the script scrolls through the site to load the content and changed the user icon to the anonymous one you see in the image. In case you were wondering.

check_version.js:

window.addEventListener('load', function() {
    initializeExtension();
});

function initializeExtension() {
    try {
        let extensionVersion = chrome.runtime.getManifest().version;
        updateAllLogos();
        replaceUserIcons();
        fetchAllContent();
    } catch (error) {
        console.error('Initialization Error:', error);
    }

    try {
        setupSidebarToggleListener();
    } catch (error) {
        console.error('Sidebar Toggle Error:', error);
    }
}

function updateAllLogos() {
    const studocuLogos = document.querySelectorAll('[aria-label="Studocu Logo"]');
    studocuLogos.forEach(updateLogo);
}

function updateLogo(logoElement) {
    const logoSvg = logoElement.firstChild;
    logoSvg.innerHTML = 
    `<g transform="matrix(0.030577, 0, 0, -0.031212, 0.081575, 28.593828)" fill="#000000" stroke="none" style="">
    <path d="M152 849 c-65 -25 -117 -76 -131 -126 -27 -95 -3 -194 58 -246 18 -15 91 -57 162 -93 143 -73 166 -97 154 -161 -13 -70 -123 -98 -184 -48 -16 14 -35 41 -41 60 l-12 35 -79 0 -79 0 0 -43 c0 -59 41 -138 88 -170 47 -33 107 -46 203 -47 183 0 279 81 279 235 -1 121 -47 174 -236 273 -137 71 -163 96 -150 145 8 35 44 58 95 60 45 1 81 -24 101 -74 12 -29 14 -29 92 -29 l80 0 -4 54 c-6 78 -41 126 -119 165 -55 27 -72 31 -143 30 -56 0 -97 -6 -134 -20z" style="fill: rgb(59, 58, 58);"></path>
    <path d="M1670 435 l0 -415 85 0 85 0 0 175 0 175 125 0 125 0 0 -175 0 -175 80 0 80 0 0 415 0 415 -85 0 -85 0 0 -160 0 -160 -120 0 -120 0 0 160 0 160 -85 0 -85 0 0 -415z" style="fill: rgb(1, 153, 236);"></path>
    <path d="M3540 440 l0 -410 80 0 80 0 0 120 c0 149 3 149 104 -11 l72 -114 87 -3 c53 -2 87 1 87 7 0 10 -105 179 -163 265 -15 21 -27 44 -27 51 0 6 41 68 90 138 50 70 90 130 90 132 0 11 -167 4 -182 -7 -8 -7 -35 -42 -58 -78 -47 -72 -79 -110 -92 -110 -4 0 -8 97 -8 215 l0 215 -80 0 -80 0 0 -410z" style="fill: rgb(1, 153, 236);"></path>
    <path d="M699 723 c-1 -10 -1 -32 0 -50 3 -34 -27 -73 -54 -73 -21 0 -35 -33 -35 -84 l0 -46 45 0 45 0 0 -160 c0 -251 5 -257 258 -294 21 -3 22 0 22 75 0 75 -1 79 -22 79 -13 0 -37 9 -54 19 -37 22 -44 52 -44 189 l0 92 60 0 60 0 0 75 0 75 -60 0 -60 0 0 60 0 60 -80 0 c-69 0 -80 -2 -81 -17z" style="fill: rgb(59, 58, 58);"></path>
    <path d="M2516 629 c-94 -22 -146 -76 -146 -153 l0 -36 66 0 c59 0 70 3 100 30 19 16 45 32 58 36 34 8 79 -16 91 -50 8 -24 6 -31 -13 -46 -12 -10 -46 -21 -74 -25 -207 -25 -258 -62 -258 -187 0 -110 64 -180 177 -194 63 -8 112 7 159 48 34 30 34 30 34 7 0 -42 11 -48 78 -42 l64 6 -4 246 c-3 235 -4 248 -26 282 -44 71 -183 107 -306 78z m174 -374 c0 -46 -23 -101 -48 -114 -80 -43 -178 37 -128 104 9 12 37 23 82 31 98 17 94 18 94 -21z" style="fill: rgb(1, 153, 236);"></path>
    <path d="M3071 619 c-79 -31 -123 -102 -142 -230 -15 -101 7 -234 48 -293 49 -69 80 -81 218 -81 110 0 124 2 165 25 55 31 89 88 92 156 l3 49 -78 3 -77 3 -6 -30 c-17 -85 -125 -108 -178 -38 -18 25 -21 42 -21 137 0 126 14 158 79 175 50 12 85 -7 111 -62 l20 -42 78 -1 c87 0 85 -2 66 80 -15 65 -47 107 -103 135 -44 22 -63 25 -150 24 -56 0 -112 -5 -125 -10z" style="fill: rgb(1, 153, 236);"></path>
     <path d="M1050 388 c0 -205 3 -238 19 -274 37 -81 101 -108 250 -102 119 4 164 24 201 89 24 43 25 50 28 282 l4 237 -81 0 -81 0 0 -194 c0 -111 -5 -206 -11 -224 -13 -37 -55 -57 -104 -48 -62 12 -65 26 -65 258 l0 208 -80 0 -80 0 0 -232z" style="fill: rgb(59, 58, 58);"></path>
    </g>`;
}

function replaceUserIcons() {
    const userIcons = document.querySelectorAll('.svg-inline--fa.fa-user.fa-fw._db78be352894._6d88284663af');
    if (userIcons.length === 0) {
        console.log('No user icons found.');
        return;
    }

    userIcons.forEach(replaceIconWithSvg);
}

function replaceIconWithSvg(iconElement) {
    const svgContainer = document.createElement('div');
    svgContainer.innerHTML = 
    `<svg xmlns="http://www.w3.org/2000/svg" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" width="556" height="769" viewBox="31.5 82.5 556 769">
            <rect fill="#14213d" width="556" height="769" x="31.5" y="82.5"/>
            <path transform="translate(-79.857144,-56.433611)" fill="#fca311" d="M 419.05551,874.84246 c 10.2812,-3.209 18.6107,-7.75769 28.0384,-15.31151 21.1336,-16.93304 35.7755,-36.70036 90.4391,-122.09734 41.0968,-64.20239 56.5193,-92.89811 67.9874,-126.5 5.2804,-15.47191 11.3362,-42.0865 11.3366,-49.82332 1e-4,-3.10151 -0.3303,-3.76046 -1.7499,-3.49032 -2.5369,0.48275 -7.8503,8.92686 -9.7679,15.52336 -2.0554,7.0702 -9.6654,26.2121 -17.0999,43.01244 -9.5612,21.6063 -26.2848,49.91776 -51.8504,87.77784 -48.7477,72.19049 -47.3014,70.18612 -49.9192,69.18158 -1.3841,-0.53115 -1.3958,-1.04457 -0.1067,-4.69824 1.7841,-5.05673 9.7203,-18.61617 20.1828,-34.48334 4.3518,-6.6 10.7611,-17.36382 14.2428,-23.91959 3.4817,-6.55578 8.5214,-15.27602 11.1994,-19.37831 3.388,-5.18983 4.8691,-8.48436 4.8691,-10.83041 0,-1.85443 -0.4899,-3.37169 -1.0886,-3.37169 -0.5988,0 -3.4036,2.025 -6.2328,4.5 -4.6608,4.07713 -8.7622,6.06231 -7.1562,3.4638 0.3522,-0.56991 7.8676,-9.23241 16.7007,-19.25 25.2356,-28.6193 33.4111,-40.59765 38.3671,-56.2138 2.8231,-8.89524 4.4619,-24.5 2.573,-24.5 -2.3234,0 -10.0492,11.56409 -23.1529,34.6554 -7.4193,13.07435 -15.1076,25.81298 -17.085,28.30807 -20.1618,25.44015 -57.7915,43.13276 -98.9253,46.51242 -4.125,0.33892 -13.5409,1.7664 -20.9241,3.17218 -13.1742,2.50836 -13.7702,2.5341 -32,1.38248 -21.3367,-1.34788 -31.4673,-3.11017 -34.5552,-6.01113 -1.8305,-1.71963 -3.4968,-2.01942 -11.2247,-2.01942 -11.0647,0 -21.4634,-1.89195 -36.4376,-6.62955 -25.9777,-8.21896 -47.266,-19.11094 -63.2641,-32.36856 -12.2852,-10.18082 -16.6927,-16.50052 -31.0041,-44.45524 -9.6417,-18.83349 -14.9082,-27.54665 -16.65,-27.54665 -2.8273,0 3.9594,22.32503 10.5711,34.77434 10.3659,19.51776 20.6328,32.26524 46.7284,58.01811 37.2419,36.75277 44.8774,42.20863 71.4824,51.07674 22.4366,7.47873 34.659,9.12865 67.6336,9.12997 20.8422,8.4e-4 20.8575,0.002 23.8567,2.52612 2.4201,2.03635 3.6581,2.40204 6.3944,1.88871 2.1955,-0.41188 3.3932,-0.2463 3.3932,0.46911 0,0.60813 -2.7661,4.82071 -6.1469,9.3613 -8.5155,11.4367 -10.307,15.67034 -10.2637,24.2556 0.029,5.73642 0.7461,8.80511 3.973,17 3.9263,9.97113 3.9373,10.03898 3.8337,23.5 -0.097,12.64282 -0.3945,14.61116 -4.6788,31 -6.5274,24.96939 -7.3154,35 -2.7498,35 1.0611,0 5.665,-1.16602 10.2309,-2.59115 z m -54.9142,-6.40885 c -0.1187,-3.575 -2.0622,-13.925 -4.3189,-23 -6.6985,-26.93611 -8.1038,-38.34882 -5.8996,-47.91121 0.5593,-2.42617 3.2483,-9.2131 5.9756,-15.08207 4.4705,-9.6202 4.9546,-11.35198 4.9171,-17.58878 -0.048,-7.95437 -2.0902,-14.39763 -6.5567,-20.68482 -3.6905,-5.19476 -7.0379,-6.91603 -19.999,-10.28361 -5.3732,-1.39607 -14.9744,-4.73803 -21.3361,-7.42657 -6.3616,-2.68855 -14.8518,-5.91445 -18.867,-7.16868 -8.7829,-2.74348 -10.9717,-2.04072 -10.2347,3.28599 0.4952,3.57849 0.4735,12.33109 -0.063,25.35975 -0.2812,6.83172 0.14,9.45455 2.8843,17.96024 3.2407,10.04424 3.8946,14.91707 2.3324,17.38193 -2.3188,3.65854 -8.0662,-4.35362 -14.592,-20.34217 -4.9398,-12.1025 -20.1029,-41.42379 -31.5541,-61.01688 -9.0516,-15.4874 -25.3321,-41.43133 -47.3677,-75.48312 -12.41166,-19.1799 -19.7901,-33.16346 -26.21662,-49.68554 -7.86073,-20.2093 -15.90421,-33.31446 -20.44722,-33.31446 -3.6032,0 -3.24903,4.18127 1.61762,19.09752 16.28268,49.90635 40.63992,98.11942 90.38162,178.90248 19.7033,31.99905 26.2263,41.64641 34.2401,50.64047 3.3616,3.77274 13.1102,17.43453 21.6635,30.35953 12.6987,19.18908 17.3038,25.26212 25.1038,33.10579 5.2537,5.28318 11.6927,10.8402 14.3089,12.34894 6.5961,3.80395 17.6471,7.60029 21.2433,7.2977 l 3,-0.25243 -0.2158,-6.5 z m 27.1335,-58.72632 c -0.089,-4.50338 -2.0953,-7.99601 -3.682,-6.40939 -0.5438,0.54383 -0.6468,3.14679 -0.2411,6.09621 0.556,4.04281 1.0617,5.07534 2.3567,4.81245 1.2312,-0.24994 1.6279,-1.38937 1.5664,-4.49927 z m 23.5757,-120.52368 c 0,-0.6875 -0.894,-2.6 -1.9786,-4.25 -2.6837,-4.08243 -20.7025,-23.45356 -24.9324,-26.80361 -3.2733,-2.59236 -3.5268,-2.63784 -6,-1.07654 -2.9912,1.88826 -2.5678,1.41474 -15.4765,17.30928 -6.7629,8.32726 -9.5694,12.50737 -8.8681,13.20864 1.0237,1.02374 24.7043,2.41777 46.0122,2.70865 8.4183,0.11492 11.2484,-0.16106 11.2434,-1.09642 z m 57.5455,-38.18474 c 28.5871,-6.92592 43.8075,-16.34146 60.0581,-37.15269 7.6105,-9.74633 15.403,-22.16368 15.403,-24.54463 0,-1.88067 -1.0118,-2.06358 -21.4947,-3.88558 -20.6227,-1.83443 -30.0053,-4.96585 -30.0053,-10.01418 0,-2.41879 0.1401,-2.46196 7,-2.15724 3.85,0.17102 12.4734,0.95852 19.1632,1.75 16.1262,1.90794 22.2504,1.8198 40.2291,-0.57896 16.2054,-2.16214 22.4327,-4.09438 30.5019,-9.46426 7.6345,-5.08063 24.6061,-20.52887 29.2698,-26.64256 5.1892,-6.80274 6.5711,-9.59582 9.3383,-18.87516 2.0048,-6.72269 2.2877,-10.3153 2.7304,-34.66389 l 0.4939,-27.16389 -5.8633,-0.6514 c -3.2248,-0.35827 -11.2072,-1.52202 -17.7386,-2.58611 -14.4327,-2.35135 -17.6908,-2.38668 -24.1247,-0.26157 -4.2189,1.39349 -12.4986,1.77054 -53,2.41356 -26.4,0.41914 -51.825,1.07327 -56.5,1.45362 -11.794,0.95954 -15.8696,-0.32055 -23.1597,-7.2741 -3.2122,-3.06386 -5.8403,-6.10001 -5.8403,-6.747 0,-2.61342 6.1985,-10.20719 10.7036,-13.11283 12.0148,-7.74934 29.4167,-17.64593 34.363,-19.54254 13.43,-5.14965 37.0067,-6.3908 53.9334,-2.83922 17.0438,3.57613 32.8738,12.66492 40.4997,23.25289 4.9137,6.8223 5.8079,7.39397 14.388,9.19886 3.7742,0.79392 8.381,2.32255 10.2373,3.39695 4.0209,2.32725 16.1015,6.12667 19.4804,6.12667 2.3747,0 2.3946,-0.0877 2.3946,-10.53868 0,-11.98633 -1.5125,-51.0181 -3.0404,-78.46132 -3.1077,-55.81685 -11.5671,-98.55783 -24.5954,-124.26798 -13.5518,-26.74328 -43.3262,-42.58301 -101.8642,-54.19091 -43.9406,-8.7133 -87.5987,-12.339 -127.5,-10.58856 -95.5719,4.19266 -157.52,18.61114 -186.8548,43.49064 -15.61968,13.2474 -24.90804,32.96649 -32.5281,69.05681 -9.9497,47.12409 -13.46707,84.86293 -14.30664,153.5 l -0.58101,47.5 3.23662,9.5 c 7.95205,23.34048 22.05186,47.35088 34.65556,59.01456 6.94217,6.4244 17.98477,12.77291 24.30057,13.97068 7.7698,1.47351 31.4127,1.20674 47.5778,-0.53684 7.7,-0.83052 18.6125,-1.7858 24.25,-2.12284 9.9703,-0.59606 10.25,-0.55491 10.25,1.50777 0,3.06243 -3.2597,4.69687 -14,7.01969 -21.8041,4.71561 -26.4955,5.35179 -38.7132,5.24965 -14.6582,-0.12254 -15.01,0.17384 -10.2496,8.63517 8.2005,14.57599 18.7824,26.66966 30.0031,34.28948 12.8421,8.72094 43.3835,21.76894 56.1639,23.99454 8.4399,1.46975 15.1923,-0.29877 21.9778,-5.75621 6.833,-5.49562 9.223,-8.95262 9.1051,-13.16978 -0.083,-2.97953 -0.9658,-4.39183 -5.1482,-8.23972 -2.7761,-2.55411 -5.3134,-5.70411 -5.6383,-7 -0.325,-1.29588 0.1026,-6.63115 0.9503,-11.85615 2.6289,-16.20573 1.4678,-27.43417 -2.7711,-26.79696 -1.0865,0.16333 -2.4715,1.19696 -3.0776,2.29696 -0.6062,1.1 -2.5493,4.06437 -4.3181,6.5875 -5.0339,7.18101 -7.2841,13.35197 -7.2841,19.97635 0,5.47544 -0.1812,5.94353 -2.5292,6.53284 -1.8421,0.46233 -3.6156,-0.11802 -6.5275,-2.13603 -8.045,-5.57516 -12.9493,-15.39005 -12.9377,-25.89216 0.012,-11.20982 4.2953,-17.65549 15.9919,-24.06711 8.4019,-4.60561 14.1637,-10.64944 16.4992,-17.30686 2.0216,-5.76243 7.095,-34.27467 9.1094,-51.19453 0.9232,-7.75383 1.5413,-22.76461 1.628,-39.53394 l 0.1398,-27.03394 -7.9369,-15.35226 c -7.1061,-13.7451 -8.6072,-15.93995 -14.3394,-20.96606 -3.5213,-3.08759 -11.6213,-10.26394 -18,-15.94745 -19.8689,-17.70357 -28.8521,-23.13289 -43.4429,-26.25647 -14.1213,-3.02307 -20.6547,-6.19538 -20.6547,-10.029 0,-3.68669 6.0759,-5.2182 18,-4.53717 23.7661,1.35736 37.9651,8.9254 71.2477,37.97499 23.9499,20.90383 29.4533,27.64798 36.4615,44.6813 1.6972,4.125 4.01,11.325 5.1397,16 4.0166,16.62255 4.3336,24.58089 3.2011,80.36346 -0.5864,28.88329 -1.2694,53.10491 -1.5179,53.82581 -1.8176,5.27305 -7.567,48.13486 -7.6176,56.78945 -0.057,9.79567 0.061,10.38603 2.6114,13.0483 6.5803,6.86838 22.8957,10.99253 35.6553,9.01282 7.8852,-1.22344 11.4681,-2.79034 17.4437,-7.62881 2.2687,-1.83695 5.3566,-3.90112 6.8621,-4.58704 3.0567,-1.39272 1.366,-2.82857 15.6873,13.32324 10.6803,12.04551 18.4432,14.00219 37.3646,9.41803 z m -11.4424,-59.31526 c -1.5024,-7.07039 -6.1821,-17.04236 -9.4294,-20.09301 -1.3304,-1.24992 -4.7502,-2.88754 -7.5994,-3.63915 -2.8493,-0.75162 -5.8301,-1.90571 -6.6241,-2.56465 -3.6043,-2.99131 0.1744,-10.76785 4.6824,-9.63641 4.1206,1.0342 14.2711,8.13413 17.5523,12.27727 7.8785,9.94783 10.5796,21.29247 6.3468,26.65595 -1.1936,1.5125 -2.516,2.75 -2.9385,2.75 -0.4226,0 -1.3181,-2.5875 -1.9901,-5.75 z M 168.85714,472.85417 c 0,-1.4187 1.19024,-5.55457 2.64497,-9.19084 2.6349,-6.5862 2.63821,-6.62876 0.86825,-11.17055 -0.97721,-2.50754 -1.98913,-5.76675 -2.24872,-7.24269 -0.50924,-2.89535 -1.3956,-2.45712 11.97037,-5.91827 2.49333,-0.64565 4.65406,-2.2017 6.5,-4.68096 4.83255,-6.49053 12.6122,-13.69689 18.299,-16.95055 14.202,-8.12556 34.5107,-11.82919 55.9661,-10.20637 12.6744,0.95865 20.2923,3.23224 33.5,9.99818 22.4751,11.51333 31.7464,18.16421 33.1732,23.79701 1.3833,5.46121 -5.4349,13.06468 -14.0367,15.65345 -6.6929,2.01426 -23.1882,3.30599 -64.4446,5.0466 -20.5194,0.86571 -40.7694,2.16595 -45,2.88941 -15.20966,2.60101 -30.67386,6.67122 -32.75632,8.62155 -2.83511,2.65524 -4.43555,2.42216 -4.43555,-0.64597 z m 257.66667,-55.08723 c -1.3226,-1.32258 -0.6419,-11.48073 0.9805,-14.63299 6.9436,-13.49101 20.1831,-28.02453 41.8528,-45.94367 25.0509,-20.71509 43.0707,-28.75667 64.4388,-28.75667 8.886,0 13.0612,1.44801 13.0612,4.52973 0,4.11732 -6.2547,7.30363 -23.5681,12.00616 -12.3073,3.34281 -15.2048,4.80192 -25.0703,12.62474 -21.2078,16.81662 -54.6246,47.64765 -63.6116,58.68928 -1.6802,2.06432 -6.5996,2.96712 -8.0833,1.48342 z m -89.5356,-43.5972 c -2.4029,-1.22987 -9.8206,-7.35327 -16.4837,-13.60756 -14.4287,-13.54343 -20.3355,-17.70014 -35.0557,-24.66954 -21.0188,-9.95152 -34.2684,-12.97696 -53.4847,-12.21287 -19.9989,0.7952 -29.5296,5.1125 -45.08685,20.42381 -5.21393,5.13152 -9.82643,9.33003 -10.25,9.33003 -2.78253,0 2.79639,-11.02836 10.38045,-20.51997 10.2876,-12.87522 27.1804,-24.0405 42.3494,-27.99082 11.2299,-2.9245 26.3904,-3.97349 38.7728,-2.68277 29.2887,3.05299 53.8167,14.04509 74.025,33.17388 12.379,11.71775 16.4366,20.86481 13.7242,30.93804 -2.5529,9.48063 -9.7902,12.47572 -18.8909,7.81777 z m 91.9832,0.63137 c -5.8349,-4.08693 -7.8784,-16.63631 -4.039,-24.80425 2.6047,-5.54125 17.9154,-20.45382 27.5487,-26.83227 32.1866,-21.31167 65.9695,-28.28349 95.7641,-19.76297 16.8713,4.82473 35.0982,17.59234 46.2018,32.36343 5.0377,6.70152 9.7153,15.25299 9.1959,16.81135 -0.1805,0.54148 -5.0118,-3.30575 -10.7361,-8.5494 -17.9897,-16.47897 -30.5119,-21.18049 -54.0497,-20.29311 -28.025,1.05655 -47.4019,10.07505 -82,38.16491 -18.563,15.07113 -22.3125,16.80595 -27.8857,12.90231 z"/>
            </svg>`;
    iconElement.parentNode.replaceChild(svgContainer.firstChild, iconElement);
}

function setupSidebarToggleListener() {
    const sidebarToggleButton = document.querySelector('[data-test-selector="content-sidebar-toggle"]');
    sidebarToggleButton.addEventListener('click', () => {
        setTimeout(updateAllLogos, 200);
    });
}

function addStyleToNewWindow(newWin, cssRule) 
{
    var style = newWin.document.createElement('style');
    style.type = 'text/css';
    style.appendChild(newWin.document.createTextNode(cssRule));
    newWin.document.head.appendChild(style);
}

function fetchAllContent() 
{
    var wrapper = document.getElementById('document-wrapper');
    var height = wrapper.scrollHeight;
    var currentPosition = 0;
    var step = 10000; // step size to controll how much it should scroll down at a time 
	var overlay = createOverlay();

    function createOverlay() 
	{
        var overlayDiv = document.createElement('div');
        overlayDiv.style.position = 'fixed';
        overlayDiv.style.top = '0';
        overlayDiv.style.left = '0';
        overlayDiv.style.width = '100%';
        overlayDiv.style.height = '100%';
        overlayDiv.style.backgroundColor = 'white';
        overlayDiv.style.display = 'flex';
        overlayDiv.style.justifyContent = 'center';
        overlayDiv.style.alignItems = 'center';
        overlayDiv.style.borderRadius = '15px';
        overlayDiv.style.zIndex = '1000';
        overlayDiv.innerText = 'Please wait! The content is being loaded.';
		overlayDiv.style.fontSize = '30px';
        document.body.appendChild(overlayDiv);
        return overlayDiv;
    }

    function hideOverlay() 
	{
        overlay.style.display = 'none';
    }

    function scrollStep() 
	{
        if (currentPosition < height) 
		{
            wrapper.scrollTo(0, currentPosition);
            currentPosition += step;
            setTimeout(scrollStep, 50); // time needed to scroll through the step size
        } 
		else 
		{
            hideOverlay();

			// wait at the bottom to ensure everything has been loaded
            setTimeout(() => wrapper.scrollTo(0, 0), 50);
        }

        // Cache images as they are loaded
        document.querySelectorAll('img').forEach(img => {
            const src = img.src;
            if (src) 
            {
                // Send the src to the background worker to cache
                chrome.runtime.sendMessage({ action: 'cache', url: src });
            }
        });
    }


    scrollStep();
}

remove_banner.js:

window.addEventListener('load', function(){
    // Remove the primary banner
    var primaryBanner = document.querySelectorAll('._95f5f1767857')[0];
    if (primaryBanner) {
        primaryBanner.remove();
    }

    // Remove banners for smaller screens
    if (window.innerWidth <= 990){
        var pages = document.getElementById('page-container').childNodes;
        if(pages != null){
            for(i = 0; i < pages.length; i++) {
                if(pages[i].id === ''){
                    pages[i].parentNode.removeChild(pages[i]);
                }
            }
        }
    }

    // Function to remove banner-wrapper elements
    function removeBannerWrapper() {
        var bannerWrappers = document.querySelectorAll('.banner-wrapper');
        bannerWrappers.forEach(function(banner) {
            banner.remove();
        });
    }

    // Call the function to remove banner-wrapper elements
    removeBannerWrapper();

    // Optional: Observe for dynamic changes and remove new banner-wrapper elements
    var observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if (mutation.addedNodes.length) {
                removeBannerWrapper();
            }
        });
    });

    var config = { childList: true, subtree: true };
    observer.observe(document.body, config);
});

remove_blur.js:

function unblurImages() {
    const blurredImages = document.querySelectorAll('img[alt*="Blurred content"]');

    blurredImages.forEach((image) => {
        if (image.src.includes('/blurred/')) image.src = image.src.replace('/blurred/', '/');

        if (image.hasAttribute('srcset')) image.srcset = image.srcset.split(',').map(src => src.replace('/blurred/', '/')).join(',');

        image.classList.add('bi', 'x0', 'y0', 'w1', 'h1');

        if (image.parentElement.classList.contains('blurred-container')) image.parentElement.classList.remove('blurred-container');
    });
}

function cleanUpPageContent() {
    const pages = document.querySelectorAll('.page-content');

    pages.forEach(page => {
        Array.from(page.parentNode.childNodes).forEach(sibling => {
            if (sibling !== page && sibling.nodeType === Node.ELEMENT_NODE) sibling.remove();
        });

        page.classList.add('nofilter');
    });
}

window.addEventListener('load', function() {
    cleanUpPageContent();
    document.getElementById('viewer-wrapper').addEventListener('scroll', unblurImages);
    document.getElementById('document-wrapper').addEventListener('scroll', unblurImages);
});

I will try it in a bit and get back to you if it doesnt or of it does

from stuhack.

Destro9000 avatar Destro9000 commented on August 10, 2024

@chrisfeldkircher seems that it doesnt work
can you try with this
https://www.studocu.com/it/document/uniwersytet-im-adama-mickiewicza-w-poznaniu/prawo-miedzynarodowe-publiczne/skrypt-prawo-miedzynarodowe-publiczne-uam/21657310

ps. if u have discord i think its better to move there for this issue

from stuhack.

chrisfeldkircher avatar chrisfeldkircher commented on August 10, 2024

@Destro9000 Hmm, I see. I get the same error. Weirdly, it works with some documents rather than with others. I'll need to investigate this a little further. It looks like it's a different CDN. The document you sent uses CloudFront, whereas the ones it worked with used https://pieces.studocu.com. I do not know why they would distribute their resources like this, but it could be location-based or due to other factors. Yes, discord sounds good.

from stuhack.

Destro9000 avatar Destro9000 commented on August 10, 2024

@Destro9000 Hmm, I see. I get the same error. Weirdly, it works with some documents rather than with others. I'll need to investigate this a little further. It looks like it's a different CDN. The document you sent uses CloudFront, whereas the ones it worked with used https://pieces.studocu.com. I do not know why they would distribute their resources like this, but it could be location-based or due to other factors. Yes, discord sounds good.

You can send the request

from stuhack.

jacobcarrot avatar jacobcarrot commented on August 10, 2024

Hey, have you solved this issue?

from stuhack.

chrisfeldkircher avatar chrisfeldkircher commented on August 10, 2024

@jacobcarrot No, I am still working on it. Unfortunately, it does not seem to be that easy. Two different CDNs are used. One is hosted on their own server (https://pieces.studocu.com/), and the other is hosted by Amazon (https://d3tvd1u91rr79.cloudfront.net/). For some reason (it may be geographical nature to load resources more efficiently; Spotify and Co. use the same strategy to ensure global efficient distribution), they employ their own CDN for some documents, where the plugin works just fine, and for others, they use the Amazon one. When we try to replace the /blurred part in the image src, it gives a 403 (unauthorized access error). When a document is uploaded, it gets processed, where the text of the pdf is extracted, and only the parts (like graphics, images, and so on) are stored as images. When you now try to access the uploaded document, the image is loaded as background, and the text is laid over it. As you might have realized, no text is overlayed when the image is blurred. It is hard to circumvent this, as getting the unblurred images is only part of the problem. I am currently trying to understand how the text is loaded. However, the js code is quite messy as it uses extensive libraries (react, PerimeterX (against web-scrapping), and so on), which are loaded in chunks. They use signed URLs to access Amazon content; therefore, injecting the images into a freely accessible document does not work as the policy and Signature parameters encode the path. The signature is encrypted ( I don't think it is feasible to try to crack it as Amazon most likely securely implemented it). Another idea I had was to use a denoising auto-encoder, but as I already said, the images are merely used as background, so this would not yield any text.

Policy:
{"Statement":[{"Resource":"https:\/\/d3tvd1u91rr79.cloudfront.net\/bca7e0456f3b371544daa0811da7fb49\/html\/pages\/blurred\/*","Condition":{"DateLessThan":{"AWS:EpochTime":1705573309}}}]}

from stuhack.

nadinelynch2600 avatar nadinelynch2600 commented on August 10, 2024

image
after doing all the adjustments I am still getting this blurred page content issue

from stuhack.

KXTOD avatar KXTOD commented on August 10, 2024

@jacobcarrot No, I am still working on it. Unfortunately, it does not seem to be that easy. Two different CDNs are used. One is hosted on their own server (https://pieces.studocu.com/), and the other is hosted by Amazon (https://d3tvd1u91rr79.cloudfront.net/). For some reason (it may be geographical nature to load resources more efficiently; Spotify and Co. use the same strategy to ensure global efficient distribution), they employ their own CDN for some documents, where the plugin works just fine, and for others, they use the Amazon one. When we try to replace the /blurred part in the image src, it gives a 403 (unauthorized access error). When a document is uploaded, it gets processed, where the text of the pdf is extracted, and only the parts (like graphics, images, and so on) are stored as images. When you now try to access the uploaded document, the image is loaded as background, and the text is laid over it. As you might have realized, no text is overlayed when the image is blurred. It is hard to circumvent this, as getting the unblurred images is only part of the problem. I am currently trying to understand how the text is loaded. However, the js code is quite messy as it uses extensive libraries (react, PerimeterX (against web-scrapping), and so on), which are loaded in chunks. They use signed URLs to access Amazon content; therefore, injecting the images into a freely accessible document does not work as the policy and Signature parameters encode the path. The signature is encrypted ( I don't think it is feasible to try to crack it as Amazon most likely securely implemented it). Another idea I had was to use a denoising auto-encoder, but as I already said, the images are merely used as background, so this would not yield any text.

Policy:

{"Statement":[{"Resource":"https:\/\/d3tvd1u91rr79.cloudfront.net\/bca7e0456f3b371544daa0811da7fb49\/html\/pages\/blurred\/*","Condition":{"DateLessThan":{"AWS:EpochTime":1705573309}}}]}

Spoiler: they are not doing it for faster loading times but because you posted the solution about removing the /blurred/ in the URL. Studocu developers are watching this repository and they fix anything that gets posted on here. I made the same solution as you and it worked fine for me for like 4 weeks, but since you posted your solution they have patched it for a lot of documents. I currently believe there are no new bypasses.

from stuhack.

chrisfeldkircher avatar chrisfeldkircher commented on August 10, 2024

@KXTOD I've noticed the same. Since they will change it soon anyway, you can still get some images by reconstructing the pieces.studocu CDN url for them by taking the cloudfront.net identifier and using it in the pieces.studocu one. Of course, this will be an easy patch for them, and as I've noticed, they have already initiated to move on to Cloudfront, which will eventually result in the content not being available on pieces.studocu anymore. I have not tested it in the last two weeks; however, it worked for me before that. The replacement timing is essential, as the content is loaded when the users scroll, so loading all the content before replacing the URLs would be advisable.
Further, sometimes, it results in a 404 when the content is unavailable on pieces.studocu anymore, which would cause the image only to be displayed by its alt-text. This may help.

https://pieces.studocu.com//html/bg<page_number>.png?class=docbgsm 360w, https://pieces.studocu.com//html/bg<page_number>.png?class=docbgmd 700w, https://pieces.studocu.com//html/bg<page_number>.png?class=docbglg 1000w, https://pieces.studocu.com//html/bg<page_number>.png?class=docbgxl 1400w

Replace with the identifier found in the cloudfront.net source.
Replace <page_number> with the page number, i.e., the document's page number the image is used in.

from stuhack.

KXTOD avatar KXTOD commented on August 10, 2024

@KXTOD I've noticed the same. Since they will change it soon anyway, you can still get some images by reconstructing the pieces.studocu CDN url for them by taking the cloudfront.net identifier and using it in the pieces.studocu one. Of course, this will be an easy patch for them, and as I've noticed, they have already initiated to move on to Cloudfront, which will eventually result in the content not being available on pieces.studocu anymore. I have not tested it in the last two weeks; however, it worked for me before that. The replacement timing is essential, as the content is loaded when the users scroll, so loading all the content before replacing the URLs would be advisable. Further, sometimes, it results in a 404 when the content is unavailable on pieces.studocu anymore, which would cause the image only to be displayed by its alt-text. This may help.

https://pieces.studocu.com//html/bg<page_number>.png?class=docbgsm 360w, https://pieces.studocu.com//html/bg<page_number>.png?class=docbgmd 700w, https://pieces.studocu.com//html/bg<page_number>.png?class=docbglg 1000w, https://pieces.studocu.com//html/bg<page_number>.png?class=docbgxl 1400w

Replace with the identifier found in the cloudfront.net source. Replace <page_number> with the page number, i.e., the document's page number the image is used in.

https://pieces.studocu.com also returns 403 now. Seems like they have finally patched all possible ways :/ If you have discord and want to continue investigating with me, please drop your tag below :D

from stuhack.

danieltyukov avatar danieltyukov commented on August 10, 2024

https://github.com/danieltyukov/studocuhack
checkout the most latest version of a better extension to solve this problem.

from stuhack.

lmBored avatar lmBored commented on August 10, 2024

https://github.com/danieltyukov/studocuhack checkout the most latest version of a better extension to solve this problem.

Thank you Daniel, but have you done that connector?

from stuhack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.