• Login
sketchucation logo sketchucation
  • Login
๐Ÿค‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Webdialogs: inputbox shows black background (sketchup webkit

Scheduled Pinned Locked Moved SketchUp Bug Reporting
sketchup
50 Posts 22 Posters 35.3k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    RichMorin
    last edited by 3 Jul 2012, 00:52

    I grabbed a copy of Pacifist, but I can't find a copy of Safari 5.1.5 to install.

    For example, the page http://support.apple.com/kb/DL1070
    has a Download button that leads to http://www.apple.com/safari/download/.

    However, this page only supports downloading of Safari 5.1.7.

    Help?

    1 Reply Last reply Reply Quote 0
    • T Offline
      troypiggo
      last edited by 3 Jul 2012, 01:03

      I found it here:

      http://mac.oldapps.com/safari.php?old_safari=813

      This is not my signature. I type it at the end of every message for quality control.

      1 Reply Last reply Reply Quote 0
      • D Offline
        driven
        last edited by 3 Jul 2012, 02:02

        Hi,
        update to my investigation.

        WebView uses a different version of Webkit than Safari (and not just in SU) and I can't find a way to change the userAgent from within SU, so been trying another approach.

        dlg.execute_script %(function addGlobalStyle(css) { 
           var head, style; 
           head = document.getElementsByTagName('head')[0]; 
           if (!head) { return; } 
           style = document.createElement('style'); 
           style.type = 'text/css'; 
           style.innerHTML = css; 
           head.appendChild(style); 
        
        } 
        
        addGlobalStyle('input {border; 1px solid gray;}')) 
        
        

        This works if you know the name of the dialog, but how can I get that with ruby to apply a global patch. Is it possible to get a new dialog name in ruby.
        Using WebInspector to add the JS I can also exclude type with

        addGlobalStyle('input, input;not[type="submit"];not[type="button"];not[type="file"];not[type="search"]{border; 1px solid gray;}')) 
        

        , but that returns true and fails in RubyConsole
        john

        learn from the mistakes of others, you may not live long enough to make them all yourself...

        1 Reply Last reply Reply Quote 0
        • T Offline
          thomthom
          last edited by 3 Jul 2012, 22:06

          @aerilius said:

          UI::WebDialog.open

          You mean UI::WebDialog.show ?

          Thomas Thomassen โ€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • A Offline
            Aerilius
            last edited by 3 Jul 2012, 23:47

            fixed it.

            1 Reply Last reply Reply Quote 0
            • D Offline
              driven
              last edited by 4 Jul 2012, 00:09

              @aerilius said:

              fixed it.

              hi, I'm getting
              Error: #<SyntaxError: (eval):24: compile error (eval):15: parse error, unexpected '(' alias(:show_orig, :show) ^ (eval):20: both block arg and actual block given> (eval):24

              I'd much rather use a small amount of ruby to 'fix' the input problem

              cheers for your efforts
              john

              learn from the mistakes of others, you may not live long enough to make them all yourself...

              1 Reply Last reply Reply Quote 0
              • D Offline
                Dan Rathbun
                last edited by 5 Jul 2012, 21:45

                @Aerilius

                It's much more complicated than that.

                I have a patch that does similar.. (and more,) but we can't release such a thing without Boulder's blessing.

                We have realized, that it's best not to show how to modify the API modules and classes. Some newbie's just run with it and start hacking away, and worse. (Yes we've all been guilty of openly discussing such things in the past. I'm sure I have. Sometimes we forget the "kids" come along and read what we've written later.)

                Anyway... you don't need the literal block when you pass to the orig method, as the wrapper method has already converted any block argument to a Proc object.
                So instead you do:
                block_given? ? show_orig(&proc) : show_orig()

                But it will not work like that, for the same reasons that the current API show(), show_modal() and set_on_close() block form methods do not work on Mac. (The webpage is never ready when Ruby executes the block.)

                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • D Offline
                  driven
                  last edited by 5 Jul 2012, 22:49

                  Improved my 'GreaseKit' UserScript using a file from Dan (cheers)
                  with safari Css style on input borders

                  // ==UserScript==
                  // @name           inputPatch
                  // @author	       driven
                  // @namespace      http://drivenupthewall
                  // @description    fixes webkit input boxes in SketchUp.
                  // @include        *
                  // ==/UserScript==
                  
                  (function() {	
                  	function main() {
                  // ====== DO NOT TOUCH ANYTHING ABOVE =====
                  // ===== PLACE CUSTOM CODE UNDER THIS LINE =====
                  		function patchStyle(css) { 
                     var head, style; 
                     head = document.getElementsByTagName('head')[0]; 
                     if (!head) { return; } 
                     style = document.createElement('style'); 
                     style.type = 'text/css'; 
                     style.innerHTML = css; 
                     head.appendChild(style); 
                  
                  } 
                  
                  patchStyle('input;not([type=button]);not([type=file]);not([type=checkbox]);not([type=image]);not([type=radio]);not([type=reset]);not([type=search]);not([type=submit]){background-color; rgb(255, 255, 255); border-bottom-color; rgb(238, 238, 238); border-bottom-style; inset; border-bottom-width; 1px; border-collapse; separate; border-left-color; rgb(238, 238, 238); border-left-style; inset; border-left-width; 1px; border-right-color; rgb(238, 238, 238); border-right-style; inset; border-right-width; 1px; border-top-color; rgb(238, 238, 238); border-top-style; inset; border-top-width; 1px;}');
                  // ===== KEEP CUSTOM CODE ABOVE THIS LINE =====		
                  // ===== DO NOT TOUCH ANYTHING BELOW =====
                  	};
                  	var script = document.createElement('script');
                  	script.appendChild(document.createTextNode('('+ main + ') ();'));
                  	(document.body || document.head || document.documentElement).appendChild(script);
                  })();
                  
                  
                  
                  

                  john

                  learn from the mistakes of others, you may not live long enough to make them all yourself...

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    driven
                    last edited by 5 Jul 2012, 22:54

                    working with Safari 6[dev] as main browser
                    I added GreaseKit to SketchUp Menu and wrote a userScript to intercept ALL WebDialogs to add the patch.

                    It only affects input[type=text] even when it's not been declared. (e.g. at 3D Warehouse site)

                    Here are some instructions and my userScript if anyones interested.

                    You need to instal SIMBL and GreaseKit in these locations
                    /Library/Application\ Support/SIMBL
                    %(#4040BF)[/Library/Application\ Support/SIMBL/Plugins/GreaseKit.bundle
                    ~/Library/Application Support/GreaseKit/apps.plist
                    ~/Library/Application Support/GreaseKit/config.xml]
                    ~/Library/Application\ Support/GreaseKit/inputPatch.user.js

                    Edit:SCRIPT REMOVED -better version below

                    add SketchUp to greaseKit from Safari Menu, then in SU Reload All UserScripts and Select 'InputPatch'
                    that's it
                    john

                    learn from the mistakes of others, you may not live long enough to make them all yourself...

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      Aerilius
                      last edited by 8 Jul 2012, 09:05

                      You could carefully "alias" the WebDialog class in SketchUp, that means you add a script that is loaded first where you redefine the UI::WebDialog.open method so that it injects your JavaScript after the WebDialog has opened. Maybe like (untested):

                      class UI;;WebDialog
                      
                        # this gives a new name to the method "show"
                        alias ;show_orig ;show
                        private ;show_orig
                      
                        def show(&proc)
                          # this calls the original "show" method
                          show_orig(&proc){ proc.call }
                          execute_script(" /*your script*/ ")
                        end
                      
                      end
                      

                      However re-defining base classes is something that no published plugin should do.

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        troyhome
                        last edited by 17 Jul 2012, 16:05

                        @petersaal said:

                        I found the same problem last week. The source of the problem is the Safari update that Apple pushed out last week (5.1.7). Here's a work-around for dynamic components: make the following edits in red to the manager.css and configurator.css files. (located in Library/Application Support/Google SketchUp 8/SketchUp/Tools/Dynamic Components/css)

                        In Manager.css:

                        .edit-field {
                        position: absolute;
                        border-top: 2px solid #3063C9;
                        border-left: 2px solid #3063C9;
                        border-right: 2px solid #A5C4FF;
                        border-bottom: 2px solid #A5C4FF;
                        background-color: white; font-size: 12px;
                        font-family: sans-serif;
                        width: 100%;
                        height: 100%;
                        overflow: hidden;
                        padding-left: 2px;
                        padding-top: 1px;
                        border: 1px solid #000000;
                        }

                        In Configurator.css:

                        .config-field {
                        width: 100%;
                        font-size: 11px;
                        font-family: tahoma, sans-serif;
                        height: 22px;
                        background-color: white;
                        border: 1px solid #000000;
                        }

                        .config-field-readonly {
                        width: 100%;
                        font-size: 11px;
                        font-family: tahoma, sans-serif;
                        height: 22px;
                        background-color: threedface;
                        border: 1px solid #000000;
                        }

                        Thank you!! this worked for me!!!

                        IOviz.com
                        SU Pro 2024 PC

                        1 Reply Last reply Reply Quote 0
                        • T Offline
                          troyhome
                          last edited by 17 Jul 2012, 16:56

                          @unknownuser said:

                          Thanks guys!
                          I managed to get all the dialog boxes of 1001bit fixed following the suggestions on the css;

                          [attachment=0:1pgsvrh4]<!-- ia0 -->black_textbox_patch.jpg<!-- ia0 -->[/attachment:1pgsvrh4]

                          It's a lot of work to edit all the html files, but at least the problem is solved. ๐Ÿ˜„
                          Cheers!

                          what files exactly did you modify?

                          IOviz.com
                          SU Pro 2024 PC

                          1 Reply Last reply Reply Quote 0
                          • P Offline
                            phaseOne
                            last edited by 22 Jul 2012, 16:11

                            To avoid any confusion over installation of the script, I created this guide:

                            1. Download SIMBL

                            2. Unzip the file

                            3. Launch the SIMBL-..*.pkg installer

                            4. Download GreaseKit

                            5. Mount the GreaseKit-..dmg image

                            6. Copy GreaseKit.bundle to /Library/Application Support/SIMBL/Plugins/

                            7. Launch Safari

                            8. Select the GreaseKit item in the menubar
                              http://grab.bovie.me/eUVw

                            9. Select Manage Applications...
                              http://grab.bovie.me/eUVy

                            10. Add Sketchup to the application list
                              http://grab.bovie.me/eUVI

                            11. Quit Safari

                            12. Download inputPatch.user.js created by driven (his original post)

                            13. Copy inputPatch.user.js to **~/**Library/Application Support/GreaseKit/

                            14. Launch SketchUp

                            15. Select inputPatch from the GreaseKit menu
                              http://grab.bovie.me/eUW4

                            Your text boxes are now white!

                            1 Reply Last reply Reply Quote 0
                            • D Offline
                              driven
                              last edited by 25 Jul 2012, 01:23

                              hi Phaseone,
                              Welcome to SCF and thanks for the guide on how to instal my GreaseKit solution.

                              It made me revisit the issue and I realise now that there is an even easier way to do this. [i.e. without SIMBL, GreaseKit or js injection]

                              In an earlier post from Aerilius
                              @unknownuser said:

                              Another idea, would a WebView also accept a user stylesheet (that would override the default background in all websites+webdialogs in SketchUp)?

                              Yes, Safari does it from the preference menu and I now have it working in SU, but what's the simplest way to share the 'how to'.

                              First you need a css file containing the patch code, in a place SU can find. So copy paste this into Ruby Console and hit return.

                              directory='/Library/Application Support/Google SketchUp 8/SketchUp/plugins/__InputPatch/'
                              Dir;;mkdir(directory) unless File.exists?(directory)
                              filename='inputPatch.css'
                              File.open(directory + filename, 'w') do |iP|
                              iP.puts <<PATCH
                              input;not([type=button]);not([type=file]);not([type=checkbox]);not([type=image]);not([type=radio]);not([type=reset]);not([type=search]);not([type=submit]){background-color; rgb(255, 255, 255); border-bottom-color; rgb(238, 238, 238); border-bottom-style; inset; border-bottom-width; 1px; border-collapse; separate; border-left-color; rgb(238, 238, 238); border-left-style; inset; border-left-width; 1px; border-right-color; rgb(238, 238, 238); border-right-style; inset; border-right-width; 1px; border-top-color; rgb(238, 238, 238); border-top-style; inset; border-top-width; 1px;}
                              PATCH
                              end
                              

                              it makes a folder + file in /Library/Application Support/Google SketchUp 8/SketchUp/plugins/

                              Then if you have Pro8 copy/paste and return this.

                              `defaults write ~/Library/Preferences/com.google.sketchuppro8.plist WebKitUserStyleSheetEnabledPreferenceKey -bool True`
                              `defaults write ~/Library/Preferences/com.google.sketchuppro8.plist WebKitUserStyleSheetLocationPreferenceKey '/Library/Application Support/Google SketchUp 8/SketchUp/plugins/__InputPatch/inputPatch.css'`
                              
                              

                              or for free try

                              `defaults write ~/Library/Preferences/com.google.sketchupfree8.plist WebKitUserStyleSheetEnabledPreferenceKey -bool True`
                              `defaults write ~/Library/Preferences/com.google.sketchupfree8.plist WebKitUserStyleSheetLocationPreferenceKey '/Library/Application Support/Google SketchUp 8/SketchUp/plugins/__InputPatch/inputPatch.css'`
                              
                              

                              Restart SU
                              You only need to do this once, and all your input boxes in SU will work correctly [without editing any files]
                              If the problem is resolved in the future you can just bin the __inputPatch Folder

                              john

                              learn from the mistakes of others, you may not live long enough to make them all yourself...

                              1 Reply Last reply Reply Quote 0
                              • M Offline
                                mwm5053
                                last edited by 29 Jul 2012, 13:52

                                thanks John for this fix. Works great
                                Walt

                                2011 iMac
                                SU 2015 Pro, 2017 Make
                                V2 Twilight
                                macOS Sierra 10.12.5

                                1 Reply Last reply Reply Quote 0
                                • nickN Offline
                                  nick
                                  last edited by 29 Jul 2012, 22:54

                                  Thanks John

                                  That's magic; a very elegant solution.

                                  Nick

                                  1 Reply Last reply Reply Quote 0
                                  • mariochaM Offline
                                    mariocha
                                    last edited by 3 Aug 2012, 13:36

                                    YEaH !!! ๐Ÿ˜„ John !
                                    Corrected !
                                    I had to do it twice.
                                    (The cursor jumps at the end of the pasted text, so one does not see at once what has just been pasted in the Ruby console input field.)

                                    %(#008000)[Mario C.
                                    Every rule has exceptions, but some.]

                                    1 Reply Last reply Reply Quote 0
                                    • solid-woodS Offline
                                      solid-wood
                                      last edited by 31 Aug 2012, 10:11

                                      @driven said:

                                      hi Phaseone,
                                      Welcome to SCF and thanks for the guide on how to instal my GreaseKit solution.

                                      It made me revisit the issue and I realise now that there is an even easier way to do this. [i.e. without SIMBL, GreaseKit or js injection]

                                      In an earlier post from Aerilius
                                      @unknownuser said:

                                      Another idea, would a WebView also accept a user stylesheet (that would override the default background in all websites+webdialogs in SketchUp)?

                                      Yes, Safari does it from the preference menu and I now have it working in SU, but what's the simplest way to share the 'how to'.

                                      First you need a css file containing the patch code, in a place SU can find. So copy paste this into Ruby Console and hit return.

                                      Restart SU
                                      You only need to do this once, and all your input boxes in SU will work correctly [without editing any files]
                                      If the problem is resolved in the future you can just bin the __inputPatch Folder

                                      john

                                      Hi,

                                      I have the same problem as a lot of others, I guess. Mac OS 10.6.8 + SU Pro 8.0.15157.
                                      Tried your solution, and it works on DC's, but not on everything...or at least not with Fredo6 Tools, SU Clock etc etc.
                                      I had the problem with 1001Bit plug but with the upgrade it was fixed.
                                      Is it that the maker of the plugin does something wrong when writing the code (miss something)?
                                      After your fix I seem to have no problem with DC's. That helps a lot - THANKS!
                                      Is there something else to do? Tried your fix many times to make sure I did it right. Think I did.
                                      Look at the result (pic). Is that "nil" OK?? ...or am I doing something when pasting?

                                      Do you know if a full upgrade to Mountain Lion helps? Does anyone know?
                                      Thankful for some help.
                                      Cheers


                                      11.jpg

                                      1 Reply Last reply Reply Quote 0
                                      • D Offline
                                        driven
                                        last edited by 4 Sept 2012, 10:32

                                        Mountain Lion and SU8 Maintenance release 'M4' appears to have fixed the blackouts here.

                                        I renamed my 'fix' folder to disable it and all I have checked works.

                                        ML is much better IMHO.

                                        john

                                        learn from the mistakes of others, you may not live long enough to make them all yourself...

                                        1 Reply Last reply Reply Quote 0
                                        • solid-woodS Offline
                                          solid-wood
                                          last edited by 4 Sept 2012, 14:13

                                          @driven said:

                                          Mountain Lion and SU8 Maintenance release 'M4' appears to have fixed the blackouts here.

                                          I renamed my 'fix' folder to disable it and all I have checked works.

                                          ML is much better IMHO.

                                          john

                                          Hi John,

                                          Thanks! Can You tell me where to find "M4"? When I download from Trimble, it's only the "M3"...?????
                                          When did they release M4, I downloaded today, 20120904, and it is still the same.

                                          Cheers
                                          Jan

                                          1 Reply Last reply Reply Quote 0
                                          • 1
                                          • 2
                                          • 3
                                          • 2 / 3
                                          • First post
                                            Last post
                                          Buy SketchPlus
                                          Buy SUbD
                                          Buy WrapR
                                          Buy eBook
                                          Buy Modelur
                                          Buy Vertex Tools
                                          Buy SketchCuisine
                                          Buy FormFonts

                                          Advertisement