TabbedBrowser.js
[app.wkmirror] / BrowserToolbar.js
index ec23a1f..0038acc 100644 (file)
@@ -2,6 +2,9 @@ Gtk = imports.gi.Gtk;
 
 BrowserSettings = imports.BrowserSettings;
 TabbedBrowser = imports.TabbedBrowser;
+File = imports.File.File;
+
+
 
 BrowserToolbar = new GType({
     parent: Gtk.HBox.type,
@@ -14,8 +17,10 @@ BrowserToolbar = new GType({
         var back_button = new Gtk.ToolButton({stock_id:"gtk-go-back"});
         var forward_button = new Gtk.ToolButton({stock_id:"gtk-go-forward"});
         var refresh_button = new Gtk.ToolButton({stock_id:"gtk-refresh"});
-        var grab_button = new Gtk.ToolButton({label:"grab"});
-
+        var grab_button = new Gtk.ToolButton({label:"mirror"});
+        var nsgrab_button = new Gtk.ToolButton({label:"netsuite grab"});
+        
+        
         var back = function ()
         {
             TabbedBrowser.browser.current_tab().get_web_view().go_back();
@@ -28,7 +33,20 @@ BrowserToolbar = new GType({
 
         var refresh = function ()
         {
+            
+            
             TabbedBrowser.browser.current_tab().get_web_view().reload();
+            
+            /*TabbedBrowser.browser.current_tab().get_web_view().signals.onload_event(function() {
+           
+                print("Sending gather links");
+                TabbedBrowser.browser.current_tab().get_web_view().execute_script(
+                    "gatherlinks();"
+                    
+                );
+             });
+            */
+
         };
 
         var browse = function (url)
@@ -36,11 +54,26 @@ BrowserToolbar = new GType({
             TabbedBrowser.browser.current_tab().get_web_view().browse(url.text);
         };
 
-       var grab = function(){
-               //TabbedBrowser.browser.current_tab().get_web_view().reload();
-               print('test');
-       };
-
+       var grab = function(){
+            print("sedning gather links (Start)");
+            TabbedBrowser.browser.current_tab().get_web_view().add_inject();
+            TabbedBrowser.browser.current_tab().get_web_view().execute_script(
+                "BrowserMirror.gatherlinks();"
+            );
+    
+           // print('test');
+       };
+        var nsgrab = function(){
+            print("sedning ns gather links (Start)");
+            TabbedBrowser.browser.current_tab().get_web_view().add_nsinject();
+            TabbedBrowser.browser.current_tab().get_web_view().nsdownloadNext();
+    
+           // print('test');
+       };
+        
+        
+        
+         
         // Public
         this.set_url = function (url)
         {
@@ -69,11 +102,15 @@ BrowserToolbar = new GType({
         refresh_button.signal.clicked.connect(refresh);
         url_bar.signal.activate.connect(browse);
         grab_button.signal.clicked.connect(grab);
+        nsgrab_button.signal.clicked.connect(nsgrab);
 
         this.pack_start(back_button);
         this.pack_start(forward_button);
-       this.pack_start(grab_button);
-        //this.pack_start(refresh_button);
+        
+        
+        this.pack_start(refresh_button);
+        this.pack_start(grab_button);
+        this.pack_start(nsgrab_button);
         this.pack_start(url_bar, true, true);