- 积分
- 185527
- 最后登录
- 2024-4-22
- 精华
- 0
- 阅读权限
- 255
- 主题
- 250
- UID
- 1004992
- 帖子
- 156603
- PB币
- 213424
- 威望
- 20481
- 贡献
- 3
- 技术
- 142
- 活跃
- 2666
幻想乡中享幸福
- UID
- 1004992
- 帖子
- 156603
- PB币
- 213424
- 贡献
- 3
- 技术
- 142
- 活跃
- 2666
|
18F
发表于 2013-8-14 23:19:57
IP属地未知
|只看该作者
本帖最后由 aa65535 于 2013-8-15 02:17 编辑
- function applySections(style, sections) {
- var rid = randomString();
- var styleContent = document.createElement("div");
- styleContent.setAttribute("id", rid);
- if (document.body) {
- document.body.appendChild(styleContent);
- } else {
- document.documentElement.appendChild(styleContent);
- }
- var styleElement = document.createElement("style");
- styleElement.setAttribute("id", "stylish-" + style.id);
- styleElement.setAttribute("class", "stylish");
- styleElement.setAttribute("type", "text/css");
- styleElement.appendChild(document.createTextNode(sections.map(function(section) {
- return section.code;
- }).join("\n")));
- document.getElementById(rid).appendChild(styleElement);
- }
- function randomString(len) {
- len = len || 32;
- var chars = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ',
- maxPos = chars.length,
- str = '';
- for (i = 0; i < len; i++) {
- str += chars.charAt(Math.floor(Math.random() * maxPos));
- }
- return str;
- }
复制代码 把stylish函数改了一下,GGK怎么办? |
|