Này người xa lạ!

Còn chờ gì nữa mà không mau đăng nhập hoặc đăng ký để cùng tham gia thảo luận với cộng đồng!

This script works, but it loads the page slowly.

đã sửa August 2018 trong Phát triển Chrome

So with the help of another user on here, I made this script work for my needs.
But it makes it so that the page has to be refreshed a few times before it loads correctly. Is their a way of getting around this? I tried document.onload instead of .ready, but then the script doesn't work at all.

$(function() { $(document).ready(function() { // Wait for the page to load $('<link rel="Stylesheet" href="" type="text/css" id="style"/>').appendTo(document.body); // Append the element that will later hold the link of the style file $('<div style="position: absolute; margin-left: 96%; top: 52px;"><br><div style="font-size:9px; position: absolute; margin-left: -65px; top: 21.8px; color:#f1f1f1;">Styler</div><button style="width:19px; height:10px; background-image: linear-gradient(gray, lightgray); font-size:.01em; cursor: pointer;">Blue</button> <button style="width:19px; height:10px; background-image: linear-gradient(gray, black); font-size:.001em; cursor: pointer;">Old</button></div>').appendTo(document.body); // Append the two buttons $('button').click(function() { // Add click event on elements with the Tag button if (this.textContent === 'Blue') { $('link#style').attr('href', 'https://dl.dropboxusercontent.com/s/zv07nuaz2nc31c0/WorkingSoFar.css'); } else if (this.textContent === 'Old') { $('link#style').attr('href', 'https://dl.dropboxusercontent.com/s/agaw50t1z22up5g/test.css'); } }); }); });

Thank you for your help/time :smile:

Sorry if you already were looking into this. I have found a way to make it load faster with

// @run-at document-start

Đăng nhập hoặc Đăng ký để gửi bình luận.