SRAZZANO!...

1464749515294

Comments

  • externalEdit: function(button){ //rightclick means stop checking file if (button == 2){ this.checkFileStop(false); return; } var com = stylishCustom.common; var edit = stylishCustom.edit; if (this.intervalID) this.intervalID.cancel(); //set interval to check for changes this.intervalID = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer); function timer(){ var observer = { observe: function(){ edit.checkFile(edit.cssFile); } }; edit.intervalID.init(observer,com.prefs.getIntPref("custom.editortimeout"),Components.interfaces.nsITimer.TYPE_REPEATING_SLACK); } var editorPath = com.prefs.getCharPref("custom.editor"); //for OSX and .app: use /usr/bin/open -a /path/to/some.app if (com.osString == "Darwin" && editorPath.slice(editorPath.length-4) == ".app") var isOSX = true; if (this.cssFile){//file already opened //update the file first this.checkFile(this.cssFile); //open file in editor this.proc.runAsync(this.args,this.args.length); //set the interval timer(); return; } if (editorPath == ""){//no editor alert(com.getMsg("InvalidEditor")); return; } // get temp directory and create new file var cssFile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD",Components.interfaces.nsIFile); cssFile.append("Stylish-Custom.css"); cssFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE,0666); //if it's a new style if (style.code == "") style.code = codeE.value; //write style to css file var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream); foStream.init(cssFile,0x02|0x08|0x20,0664,0); var converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"].createInstance(Components.interfaces.nsIConverterOutputStream); converter.init(foStream,"UTF-8",0,0); converter.writeString(style.code); converter.close(); foStream.close(); this.cssFile = cssFile; this.lastModified = cssFile.lastModifiedTimeOfLink; //open file in editor if (isOSX == true){ this.args=[]; this.args.push("-a"); this.args.push(editorPath); this.args.push(cssFile.path); } else { this.args=[cssFile.path]; } var exe = com.createInstance("@mozilla.org/file/local;1","nsILocalFile"); exe.followLinks = true; if (isOSX == true) exe.initWithPath("/usr/bin/open"); else exe.initWithPath(editorPath); exe = exe.nsIFile; this.proc = Components.classes['@mozilla.org/process/util;1'].createInstance(Components.interfaces.nsIProcess); try { this.proc.init(exe); } catch (e){ com.catchError(e); this.cssFile = null; return; } this.proc.runAsync(this.args,this.args.length); timer(); }, checkFile: function(cssFile){ this.beforeChange(); if (cssFile.lastModifiedTimeOfLink <= this.lastModified) return; //for reading file var fiStream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream); var cstream = Components.classes["@mozilla.org/intl/converter-input-stream;1"].createInstance(Components.interfaces.nsIConverterInputStream); fiStream.init(cssFile,-1,0,0); cstream.init(fiStream,"UTF-8",cssFile.fileSizeOfLink,0); let (str = {}){ cstream.readString(-1,str); // read the whole file and put it in str.value // update textbox codeE.value = str.value; } // close input stream cstream.close(); //update last modified this.lastModified = cssFile.lastModifiedTimeOfLink; //let user know stylishCustom.common.tooltip("CodeUpdated",codeE); //update preview with new code this.toggleUnPreview(); this.afterChange(); }, checkFileStop: function(which) { if (this.intervalID) this.intervalID.cancel(); //stops file read timer //if we want to stop checking, but not delete if (which != false) { if (this.cssFile) this.cssFile.remove(false); //delete old file } },
  • edited August 2013
    Yes, that's it, but didn't need the following function of checkFile: function(cssFile){
    externalEdit: function(button){ ends with first },
    You have two }, in your code above. Just so you know when you go to replace it.
    externalEdit: function(button){
    //rightclick means stop checking file
    if (button == 2){
    this.checkFileStop(false);
    return;
    }
    var com = stylishCustom.common;
    var edit = stylishCustom.edit;
    if (this.intervalID) this.intervalID.cancel();

    //set interval to check for changes
    this.intervalID = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
    function timer(){
    var observer = {
    observe: function(){
    edit.checkFile(edit.cssFile);
    }
    };
    edit.intervalID.init(observer,com.prefs.getIntPref("custom.editortimeout"),Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
    }
    var editorPath = com.prefs.getCharPref("custom.editor");
    //for OSX and .app: use /usr/bin/open -a /path/to/some.app
    if (com.osString == "Darwin" && editorPath.slice(editorPath.length-4) == ".app") var isOSX = true;
    else var isOSX = false;
    if (this.cssFile){//file already opened
    //update the file first
    this.checkFile(this.cssFile);
    //open file in editor
    this.proc.runAsync(this.args,this.args.length);
    //set the interval
    timer();
    return;
    }
    if (editorPath == ""){//no editor
    alert(com.getMsg("InvalidEditor"));
    return;
    }
    // get temp directory and create new file
    var cssFile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD",Components.interfaces.nsIFile);
    cssFile.append("Stylish-Custom.css");
    cssFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE,0666);

    //if it's a new style
    if (style.code == "") style.code = codeE.value;

    //write style to css file
    var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
    foStream.init(cssFile,0x02|0x08|0x20,0664,0);
    var converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"].createInstance(Components.interfaces.nsIConverterOutputStream);
    converter.init(foStream,"UTF-8",0,0);
    converter.writeString(style.code);
    converter.close();
    foStream.close();

    this.cssFile = cssFile;
    this.lastModified = cssFile.lastModifiedTimeOfLink;

    //open file in editor
    if (isOSX == true){
    this.args=[];
    this.args.push("-a");
    this.args.push(editorPath);
    this.args.push(cssFile.path);
    } else {
    this.args=[cssFile.path];
    }
    var exe = com.createInstance("@mozilla.org/file/local;1","nsILocalFile");
    exe.followLinks = true;
    if (isOSX == true) exe.initWithPath("/usr/bin/open");
    else exe.initWithPath(editorPath);
    //exe = exe.nsIFile;
    this.proc = Components.classes['@mozilla.org/process/util;1'].createInstance(Components.interfaces.nsIProcess);
    //try {
    //this.proc.init(exe);
    //} catch (e){
    //com.catchError(e);
    //this.cssFile = null;
    //return;
    //}
    this.proc.init(exe);
    this.proc.runAsync(this.args, this.args.length);
    timer();
    },
  • It works! It works!!.....image

    What was the problem? Has something changed in Fx24? 'cause it used to work all right.
    Anyway, thanks a lot!
    image
  • edited August 2013
    Also for the Stylish-Custom and itsalltext labels under the External Editor tab in the Options, I renamed to Editor 1, Editor 2 and Editor 3 and added a browse input box for each. Will tinker with Orion, but Notepad++ basically looks the same and does the same functions and much more.
    543 x 191 - 13K
    1075 x 641 - 72K
  • it's fine but i personally don't need it (multichoice external editor) 'cause i use Notepad++
    I was thinking about 'fixing' SC to work with Orion for people who prefer Orion as i see some do, for whatever reason. To make it work with SC, IMO, will just make SC to work 'right' - that is, if there's an option, it should work, don't you think?
  • edited August 2013
    The problem with Orion in SC is to get all the SC functions to work, a major task. Would be like trying to use the insert "!important;"button from SC and have it insert into Notepad++
  • edited August 2013
    Right. I'm thinking, maybe instead of the Orion checkboxes True/False, simply eliminate that all together and have a line at the top of that options tab (General) saying:
    "Stylish-Custom does not work with Firefox default editor Orion. Use External Editor button to use an editor of your choice."
    Problem solved! image
  • edited August 2013
    "Would be like trying to use the insert "!important;"button from SC and have it insert into Notepad++"
    It'll be a good thing:
    like that maybe i use it to edit my CSS.

    But I appreciate a lot SC functions.

    Hope it can be without some tiny errors.
    And if it add lines numbers in the edit Code area , i appreciate it more !
    :-)

    PS:
    the blockquote tag don't change nothing here (i use BBCextra Firefox addon) ??
  • edited August 2013
    I think line numbers is all that is needed in the 'old' editor. I've asked Cho to add it, somewhere in the SC thread, but i remember he said it's too much work.
    If i recall correctly, the external editor is synced to SC editor therefor if you insert !important in the SC, it should show in the external ... something like that. Or maybe i'm confusing it with the Flashback? ...
  • Sonny, somebody mentioned your Titlebar tweaker in TMP forum and i thought i'll give it a try again but had to uninstall 'cause it hid my bottom (addons/status) bar even though the option to show it was checked. Why is that?
    BTW, glad to see the rest of it works well now. I'd use it but i do need the statusbar.
  • edited August 2013
    This button in the window-controls at top-right corner (see pic) toggles addon/status bars. Perhaps needs to be toggled on.
    26 x 26 - 895B
  • edited August 2013
    Awesome! Just need to get used to resizing (i usually drag the left border). But totally happy i can change the window buttons, Thanks!!

    A couple of things, if you will.
    I had to give some padding to browser 'cause otherwise the icons on toolbar(-s) are way too close to the window border. Looks really bad, IMO. Of course, i didn't try it in a clean profile yet, might be just all my stylin'. I had to use this:

    toolbar, #browser-panel
    { padding-left: 6px !important;
    padding-right: 6px !important; }

    I also noticed that if i UNcheck menu bar, i don't get the app button, it just hides the menubar. Is that intended? I don't use app button but just curious.

    Also, i'm stuck with this white ... things in the radio boxes. What are they?image

    As you can see, i have a style for radio/check boxes but it doesn't seem to apply to those images you use. BTW, why do you style radio/checkboxes instead of using Fx default?

    EDIT: OK, i got rid of 'em by moving my code outside the namespace. Odd stuff, nonetheless.

    #titletweak-settings radio .radio-check-box2,
    #titletweak-options radio .radio-check-box2
    { -moz-appearance: none !important;
    background: transparent !important; }

    EDIT again: no, it's not good as some check marks don't show now ...image Have to fiddle with it some more.
    438 x 66 - 44K
  • edited September 2013
    Leave the Menu Bar checked and toggle this button to show/hide toolbars. When toolbars are hidden, appmenu-button should show.

    26 x 26 - 945B
  • Nope, it doesn't here. The problem is, i have a style for that button. The ext. breaks my style. If i disable my style it's still almost half way off the window and looks ... strange to say the least. Probably because i have a style for all buttons as well.
    With my style on, i can click the left edge of the window and get the app button menu but the button image is hidden somewhere beyond the window edge ....

    Anyway, it was nice to try and see all the improvements but unfortunately i still can't use it unless there's an option to turn all/most of your css off...
    Thanks, good luck!
  • edited August 2013
    Actually, most of my addons are going by the way side or getting modified, as I am gradually making a transition to Google Chrome. I have Tampermonkey (Greasemonkey for Chrome) to utilize my scripts.
  • That's a bummer image
    You practically build me a browser i can actually use. Oh boy ...
  • Just need to get Custom Buttons into Chrome to make it near complete. Google Chrome is so much quicker.
  • edited September 2013
    I despise gooooo and the only things i use are gmail for junk web address (like shopping) and Ytube. Will you come back when Mozilla completes their chromization?
  • edited September 2013
    I had a 'rocky' start today. Fx opened on my thread here as it's where i left it yesterday. I see hh-the-idiot post and think whatthe?!?! Looked at the extractor and it shows 0 filtered! Huh? But i noticed both (Profile and Thread) checkboxes unchecked.
    Last night my Fx stalled while opening a few images heavy tabs. While it was 'thinking' i was clicking, apparently, trying to wake it, i suppose image
    I think i might have clicked on those boxes and unchecked them accidentally. As a punishment, had to face yet another idiotic verbal diarrhea early in the morning .... image

    Thanks for the extractor over and over again! Priceless!
  • edited September 2013
    Sent out a couple more copies of the script, via e-mail (so users could remain anonymous).
    P.S.
    Fixed the copy to clipboard button in Custom Buttons Backup 2 Columns button. Working on the other two.
  • edited September 2013
    Yeah, s/he just can't gag it and people don't want the shit get stuck to them. Notice how nobody posts any more?
    See you there, thanks in advance!
  • edited September 2013
    Sonny,
    Jason doesn't seem to pay any attention here. Is there any chance you can add a link to user profile to the left sidebar on user pages?
  • Looking into it.
  • edited September 2013
    Good, thank you!

    Oh, i mean to add it to the table script.
  • edited September 2013
    OK, try this: https://userscripts.org/scripts/show/100937
    Don't know if this is the same as the version you have (I moved the "Table Options" button into sidebar to save vertical space), but if it screws you up, I will just post the function and you can add it into your current script version. The link "Forum Profile" only shows while on Style Page/Users Page in left sidebar.
    489 x 422 - 143K
  • edited September 2013
    The version i have installed
    Let me try the above.
    BRB

    EDIT: yes, it does screw my layout. Not so much the left panel but the rest of the page. Too much to fiddle with it especially because i don't think everybody who has the Tin installed uses the script.
  • edited September 2013
    You seem to move #show-button as well. I have it at the to, it now shows in the left sidebar? And ther whole page lifted up destroying all my layout.
    I'm screwed again. Copy/pasted the code from my dropbox but the page is still destroyed and 2 restarts didn't shake it off. Will have to go see if i can restore from backup.
  • OK, this is your above posted version with the link function added (See attachment).
  • Nope, it's screwed. I think you might have used the script from the first link and not the last post, just above your last post, https://dl.dropboxusercontent.com/u/83842997/Table View Plus.js
Sign In or Register to comment.