Experimenting with HtmlDialog session history


#1

I’ve been experimenting with capturing the history in a tutorial viewer…

the idea being you can close the dialog then easily go back to the one you were following…

not all sites work, but this does on a mac…

can anyone try it on a PC?

first run is copy/paste or load from Ruby Console, the after closing use the last line only to reopen the last visited clip…

#
module JcB
  #
  module TrackUrl
    module_function

    @mac = Sketchup.platform == :platform_osx
    @dialog_properties =
      {
        dialog_title: 'Tutorial Viewer',
        preferences_key: 'track_url',
        scrollable: true,
        resizable: true,
        width: 600,
        height: 400,
        left: 100,
        top: 100,
        min_width: 50,
        min_height: 50,
        # max_width: 1000,
        # max_height: 1000,
        style: UI::HtmlDialog::STYLE_DIALOG,
        url: 'https://www.youtube.com/user/SketchUpVideo'
      }

    @url = @dialog_properties[:url]

    @tracker = %[
            var url = window.location.href
            sketchup.tracking(url);
            //window.location = 'skp:tracking@' + url;
      ]
    # on a mac sound keeps playing after closing WebDialogs
    def reset_sound
      @dialog.set_url(@url) unless @mac && @dialog.class == UI::WebDialog
    end

    def our_dialog
      dialog = UI::HtmlDialog.new(@dialog_properties)
#      dialog = UI::WebDialog.new(@dialog_properties)
      dialog.set_url(@url)
      dialog.show
      dialog.show_modal if @mac && dialog.class == UI::WebDialog

      dialog.add_action_callback('tracking') do |_action_context, url|
        unless url == @url
          @url = url
          p url
        end
      end

      @dialog = dialog
    end

    def run_tracker
      our_dialog
      p "tracking url changes from #{@url}"
      check4change = UI.start_timer(1.0, true) do
        if @dialog.visible?
          @dialog.execute_script(@tracker)
        else
          reset_sound
          UI.stop_timer(check4change)
          puts "current url = #{@url}"
        end # if nil
      end # wait
    end
  end
end

# to run
JcB::TrackUrl.run_tracker

track_url.rb (1.7 KB)

john


#2

John,

Tested with Win7 & SU2017, both standard and super-charged. Both work.

If you get a chance, I’m wondering what OS X shows for the following in the console:

require 'openssl'
OpenSSL::SSL::SSLContext::METHODS.each_slice(3) { |a,b,c|
  puts "#{a.to_s.ljust(17)} #{b.to_s.ljust(17)} #{c.to_s.ljust(17)}"
}

#3

cheers for test the HtmlDialog…

your results:

TLSv1             TLSv1_server      TLSv1_client     
TLSv1_2           TLSv1_2_server    TLSv1_2_client   
TLSv1_1           TLSv1_1_server    TLSv1_1_client   
SSLv3             SSLv3_server      SSLv3_client     
SSLv23            SSLv23_server     SSLv23_client    

#4

And, thank you.

Personal opinion - nothing called v ‘2017’ should have SSLv3 available.


#5

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.