• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Enable Web Inspector in WebDialog on Mac

Scheduled Pinned Locked Moved Developers' Forum
9 Posts 3 Posters 2.1k 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.
  • D Offline
    driven
    last edited by 15 May 2011, 10:06

    I've been trying to do this for ages, and it's so simple... just like me

    so, incase any other Mac users want the full native web inspector in SU, here's my 'how to'

    To enable the Web Inspector panel in WebDialog on Mac OSX...

    1. Go to ~/Library/Preferences/com.google.sketchupfree[n].plist

    2. Open the file with the Property List Editor.app(default) or other

    3. Click on the add [+] icon

    4. new item name "WebKitDeveloperExtras", then tab

    5. set type to boolean, then tab

    6. check box, sets this value to true

    7. open Sketchup, open a WebDialog, right click in a void and select "Inspect element" to open Inspector

          and it even splits off into separate window....
      
                 finally
      
                      john
      

    I haven't done extensive testing yet, but it's there...

    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 15 May 2011, 14:29

      Sounds like a good candidate for a new chapter of the "WebDialog: Lost Manual" edition 2.

      ThomThom ?

      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • D Offline
        Dan Rathbun
        last edited by 15 May 2011, 15:22

        Would it be possible to set that from Ruby (and give Mac developers a toggle ?)

        if RUBY_PLATFORM =~ /(darwin)/
        
          require('sketchup.rb')
        
          module Dev
            MENU = UI.menu('Plugins').add_submenu('Development')
        
            module Safari
              MENU = Dev;;MENU.add_submenu('Safari')
              MENUITEMS = {}
        
              @@webinspector_enabled = false
        
              self.webinspector=(bool)
                val =( bool ? "true" ; "false" )
                @@webinspector_enabled =( bool ? true ; false )
                Sketchup.write_default( "", "WebKitDeveloperExtras", val )
              end
        
              self.webinspector?
                val = Sketchup.read_default( "", "WebKitDeveloperExtras" )
                return @@webinspector_enabled =( val == "true" ? true ; false )
              end
        
              unless file_loaded?(__FILE__)
                # init the var @@webinspector_enabled
                self.webinspector?
                puts("Safari Dev; Web Inspector enabled = #{@@webinspector_enabled}") unless $VERBOSE.nil?
                MENUITEMS['Web Inspector']= MENU.add_item('Web Inspector') {
                  # toggle Web Inspector
                  self.webinspector=( !@@webinspector_enabled )
                }
                MENU.set_validation_proc(MENUITEMS['Web Inspector']) {
                  @@webinspector_enabled ? MF_CHECKED ; MF_UNCHECKED
                }
              end
        
            end # module Safari
        
          end # module Dev
        
        end # if Mac only
        
        file_loaded(__FILE__)
        

        You'll perhaps need to adjust the actual values written to the plist..
        if they are 0 || 1 for false and true, then change the val lines (15 and 22,) to:
        val =( bool ? 1 : 0 )
        and
        return @@webinspector_enabled =( val == 1 ? true : false )
        .. or similar. (you get the idea?)

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • D Offline
          driven
          last edited by 15 May 2011, 15:55

          Hi Dan,

          been at a fete since i posted,

          what you don't get (which would be very useful) is the 'Develop' menu and it's down list.

          Can code add a new 'Main Menu' item for webkit to populate? or would I need to do that in the nib file?

          javascript debug and the console seem to work.

          I'll try and have a play later.

          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 15 May 2011, 17:59

            @driven said:

            what you don't get (which would be very useful) is the 'Develop' menu and it's down list.

            The code sample is a Ruby script that adds a submenu to the Sketchup "Plugins" menu (not to any Safari menu.)

            It may need to run at Sketchup startup in order to add menu items (at least on Windows submenus can be added after startup, but not menu items.)

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • D Offline
              driven
              last edited by 15 May 2011, 19:11

              hi Dan,

              btw, cheers for your mac interest

              I can see what your code does for loading Web Inspector via ruby, but I don't think it needs a Plugins menu item or toggle. It's quite easy to do and undo manually.

              Anyone wanting to use WI in or out of SU needs Apple Developer Tools and if they can instal that, than this is a simple extra step.

              It's adding the other features associated with the Develop menu that's of interest to me. http://wn.com/Safari_debug_menu

              I'll see if I can set context menu items or shortcut keys to work with it, that may be easier than Menu Items.

              john
              added a link so you can see what I mean.

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

              1 Reply Last reply Reply Quote 0
              • TommyKT Offline
                TommyK
                last edited by 9 Dec 2015, 22:55

                I am sure I am doing something stupid, but this isn't working for me.

                I have found ~/Library/Preferences/com.sketchup.SketchUp.2016.plist . Opened it with Xcode, made the additional property to the root, saved it. Then nothing. I try to go back to open the .plist file again, and it doesn't let me.... Strange? Any ideas?

                1 Reply Last reply Reply Quote 0
                • D Offline
                  driven
                  last edited by 9 Dec 2015, 23:14

                  Tommy, just set it as a global preference and it works for SU and Safari...

                  defaults write NSGlobalDomain WebKitDeveloperExtras -bool true

                  paste into Terminal or wrap in %x() from Ruby Console...

                  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
                  • TommyKT Offline
                    TommyK
                    last edited by 10 Dec 2015, 12:16

                    @driven said:

                    Tommy, just set it as a global preference and it works for SU and Safari...

                    defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
                    

                    paste into Terminal or wrap in %x() from Ruby Console...

                    john

                    YES! IT WORKS! SO SIMPLE! THANK YOU!

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

                    Advertisement