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!

CSS to Script Converter

đã sửa April 2017 trong Phát triển Chrome
Hey guys. So recently I have developed a small utility to convert CSS to Userscripts since I can't seem to find one that already exists.

- Convert CSS to Userscripts
- GreaseMonkey and TamperMonkey support.
- Simple user interface.

I hope you guys will find this tool helpful!

Repo: https://github.com/Spiderpig86/CSStoUserScriptConverter

Requirements: Windows XP SP3 or above.
(Sorry OSX/Linux users) :(

Bình luận

  • Woo download link has been added.
  • awesome work, thank you, this will be useful!
  • Seems Ok, if "Chrome" Checked.

    But don't work if "Firefox" checked:
    It copy just the CSS in the generated script place...

    Can you give us what this version provide new.
    I observe "just" a new design and the browser option.

    .... I know i ask you that previously :
    And option to directly convert an Userstyles ???

  • đã sửa September 2015 Chrome
    I'll look more into this issue. Thanks for the report. So far I have not found the time to implement reversing Userscripts into plain CSS. I will also try to implement that in the future.

    PS: @decembre Those are pretty much the only changes in 1.0.1. I will attach a changelog in the future.
  • I'm really confused as to what the issue is. I've tested the converter to target Firefox with Stylish and everything works.
  • I have retested:
    I don't know, but , for my , if i use the firefox option, that's give only the CSS i provide...

    i am on win7 64bits
  • Can you give me a sample of what a userstyle should look like on Firefox?
  • đã sửa September 2015 Firefox
    by example (for your username in this forum):

    .Username[href$="/forum/profile/5720/Stanley%20Lim"] { border-radius: 5px !important; padding: 5px !important; background: red !important; }

    give (with "Chrome" option) :

    // ==UserScript== // @name STY - TEST - For CSS to Script Converter // @description STY - TEST - For CSS to Script Converter // @author decembre // @homepage greasyfork.org // @include greasyfork.org // @version v.1 // ==/UserScript== (function() {var css = [".Username[href$='/forum/profile/5720/Stanley%20Lim'] {", "border-radius: 5px !important;", "padding: 5px !important;", "background: red !important;", "}" ].join("\n"); if (typeof GM_addStyle != 'undefined') { GM_addStyle(css); } else if (typeof PRO_addStyle != 'undefined') { PRO_addStyle(css); } else if (typeof addStyle != 'undefined') { addStyle(css); } else { var node = document.createElement('style'); node.type = 'text/css'; node.appendChild(document.createTextNode(css)); var heads = document.getElementsByTagName('head'); if (heads.length > 0) { heads[0].appendChild(node); } else { // no head yet, stick it whereever document.documentElement.appendChild(node); } }})();

    With firefox option:
    that's just the original CSS without any change....
  • But there is a change when you use the Firefox option. It specifies that it is meant to be rendered for Firefox. I've tested conversions from CSS to Userscripts for Firefox and tried it out in GeaseMonkey and Stylish and both worked.
  • strange...
  • Now it work for Chrome ...
    I don't know why but work !
    A question:
    How to use your tool for a style which have some different CSS for different domain or pref url ?
  • Hey does anyone still have a copy of this they could send me or post an updated link since his original dropbox link is dead?
  • Hey does anyone still have a copy of this they could send me or post an updated link since his original dropbox link is dead?

    Sorry for the inactivity and thanks for reporting the broken link. An update rolled out and this time I put the application on Github. If there are any issues, please report it there.
  • Waterfox
    How to install it ?
  • decembre nói:

    How to install it ?

    You can download the project at https://github.com/Spiderpig86/CSStoUserScriptConverter/releases . The .exe is portable so you can run it anywhere after you extract it. It should be in ./CSStoUserScript/bin/Release/CSStoUserScript.exe
  • Waterfox
    Thanks !
  • đã sửa May 2017 Waterfox
    decembre nói:

    A question:
    How to use your tool for an userststyle which have some different CSS for different domain or pref url ?

    by example my userstyle:
    Userstyles TableView+Enhancer - Dark-Grey
    Use these:

    @-moz-document domain("userstyles.org")
    , domain("greasyfork.org")
    , domain("sleazyfork.org")
    , url-prefix("https://greasyfork.org/forum/") ,

    @-moz-document url-prefix("https://userstyles.org/")
    @-moz-document url-prefix("https://forum.userstyles.org")
    @-moz-document url-prefix("https://userstyles.org/help")
    @-moz-document domain("sleazyfork.org")
    @-moz-document url-prefix("https://greasyfork.org/fr/scripts/19838-diep-io-by-terjanq")

    For firefox, what i need to use as @include?
    If i use all al them i can have some problem because by example i don't want use the same
    CSS for usertyle.or or greasyfor.org.

    Chrome need a separate block for each domain or url-prefix
  • Any news ?

  • Wow it's been a while. Anyway, I noticed that there was some renewed interest in this tool recently. I can see if I have time to update the tool and create a cross-platform version (using Electron for example). Please let me know of any issues and missing features.

  • I test your tool when you have a new version :smile:

  • I think, you can do like this:

    // ==UserScript==
    // @name         InsertUserCSS
    // @include      *://example.com/*
    // ==/UserScript==
    'use strict'
    document.body.insertAdjacentHTML('beforeend', `<style>
    body {
      background: #000;
  • @kkocdko a dit :
    I think, you can do like this...

    Thanks, but it seems not working with "complexe" usertyles (pref-url, etc)
    In chrome, I test it with my userstyle:
    Userstyles / Greasy Fork Enhancer Dark-Grey
    I inserted its code between balises.
    Maybe i do something wrong?
    Can you drop an eye ?

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