* mvFirefogg refactoring for better reuse
authorMichael Dale <dale@users.mediawiki.org>
Thu, 30 Jul 2009 17:20:34 +0000 (17:20 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Thu, 30 Jul 2009 17:20:34 +0000 (17:20 +0000)
js2/mwEmbed/libAddMedia/mvFirefogg.js

index eefa41e..5da6094 100644 (file)
@@ -211,26 +211,32 @@ mvFirefogg.prototype = { //extends mvBaseUploadInterface
                                        $j( _this.target_use_latest_fox ).show();
                                }
                                return ;
-                       }
-                       //they have the right version of mozilla provide install link: 
-                       var os_link = false;
-                       if(navigator.oscpu){
-                               if(navigator.oscpu.search('Linux') >= 0)
-                                       os_link = firefogg_install_links['linux'];
-                               else if(navigator.oscpu.search('Mac') >= 0)
-                                         os_link = firefogg_install_links['macosx'];
-                               else if(navigator.oscpu.search('Win') >= 0)
-                                         os_link = firefogg_install_links['win32'];
-                       }                                                                                       
+                       }               
+                                                                                                       
                        //if rewriting form use upload msg text
                        var upMsg = (_this.form_rewrite) ? gM('fogg-for_improved_uplods') : '';                 
-                       $j(_this.target_please_install).html( upMsg + gM('fogg-please_install',os_link )).css('padding', '10px').show();                        
+                       $j( _this.target_please_install ).html( upMsg + gM('fogg-please_install', _this.getOSlink() )).css('padding', '10px').show();                   
                }
                //setup the target save local file bindins: 
                $j( _this.target_btn_save_local_file ).unbind().click(function(){
                        _this.saveLocalFogg();
                });
        },
+       /*
+        * returns the firefogg link for your os: 
+        */
+       getOSlink:function(){
+               var os_link = false;
+               if(navigator.oscpu){
+                       if(navigator.oscpu.search('Linux') >= 0)
+                               os_link = firefogg_install_links['linux'];
+                       else if(navigator.oscpu.search('Mac') >= 0)
+                                 os_link = firefogg_install_links['macosx'];
+                       else if(navigator.oscpu.search('Win') >= 0)
+                                 os_link = firefogg_install_links['win32'];
+               }       
+               return os_link
+       },
        firefoggCheck:function(){                                  
                if(typeof(Firefogg) != 'undefined' && Firefogg().version >= this.min_firefogg_version){                                         
                        this.fogg = new Firefogg();