2008-12-18 92 views
1

我的任務是重寫當前支持我的客戶內部網站的Javascript引擎。在審查的代碼中,我遇到過這個功能flvFPW1我不承認,我也不能破譯代碼(我的JavaScript知識是謙虛充其量)。 Google搜索爲我提供了一些點擊量,但大部分(如果不是全部)頁面點擊來自該特定頁面上使用的Javascript,換句話說,即使明顯地被其他人使用,我也找不到這個函數的描述。flvFPW1() - 它有什麼作用?

這裏有人能告訴我嗎?

感謝/弗雷德裏克

回答

4

我自己的研究同意,這是一個Dreamweaver擴展:我發現(向下滾動一些關於這個頁)而不是1.3:

function flvFPW1(){//v1.44 
var v1=arguments,v2=v1[2].split(","),v3=(v1.length>3)?v1[3]:false,v4=(v1.length>4)?parseInt(v1[4]):0, 
v5=(v1.length>5)?parseInt(v1[5]):0,v6,v7=0,v8,v9,v10,v11,v12,v13,v14,v15,v16;v11= 
new Array("width,left,"+v4,"height,top,"+v5);for (i=0;i<v11.length;i++){v12=v11[i].split(",");l_iTarget=parseInt(v12[2]); 
if (l_iTarget>1||v1[2].indexOf("%")>-1){v13=eval("screen."+v12[0]); 
for (v6=0;v6<v2.length;v6++){v10=v2[v6].split("="); 
if (v10[0]==v12[0]){v14=parseInt(v10[1]);if (v10[1].indexOf("%")>-1){v14=(v14/100)*v13;v2[v6]=v12[0]+"="+v14;}} 
if (v10[0]==v12[1]){v16=parseInt(v10[1]);v15=v6;}} 
if (l_iTarget==2){v7=(v13-v14)/2;v15=v2.length;} 
else if (l_iTarget==3){v7=v13-v14-v16;}v2[v15]=v12[1]+"="+v7;}}v8=v2.join(",");v9=window.open(v1[0],v1[1],v8); 
if (v3){v9.focus();}document.MM_returnValue=false;return v9;} 

當然,這是通過壓縮器來節省帶寬,這使得它很難閱讀。在我意識到通過向我的搜索字符串中添加「dreamweaver」可以獲得更好的結果之前,我花了一些時間不加混淆。這樣做,我能找到一些更有趣的文檔:

http://www.flevooware.nl/dreamweaver/extdetails.asp?extID=8(簡短描述) http://satsuki.altervista.org/basibloggers/source40.txt(全腳本代碼,在意大利)

簡而言之:它基本上只是window.open的包裝。這裏是我翻譯代碼的進展:

function flvFPW1() 
{//v1.44 
    var v1=arguments; // pass v1[0] and v1[1] directly to window.open 
    var arg3=v1[2].split(","); 
    var focusNewWindow=(v1.length>3)?v1[3]:false; 
    var newWindowWidth=(v1.length>4)?parseInt(v1[4]):0; 
    var newWindowHeight=(v1.length>5)?parseInt(v1[5]):0; 

    var adjustedWindowPosition=0,result,keyValuePair,AxisProperty; 
    var windowSize,sizeValue,arg3Index,anchorValue; 

    var hwArray= new Array("width,left,"+newWindowWidth,"height,top,"+newWindowHeight); 
    for (i=0;i<hwArray.length;i++) // x-axis, then y-axis 
    { 
     AxisProperty=hwArray[i].split(","); // {"width", "left", 0} or {"height", "top", 0} 
     l_iTarget=parseInt(AxisProperty[2]); // l_iTarget defined where? 

     if (l_iTarget>1||v1[2].indexOf("%")>-1) 
     { 
      screenSize=eval("screen."+AxisProperty[0]); // x or y size of the window 
      for (var i=0;i<arg3.length;i++) 
      { 
       keyValuePair=arg3[i].split("="); 
       if (keyValuePair[0]==AxisProperty[0]) // if the key is (width|height) 
       { 
        sizeValue=parseInt(keyValuePair[1]); 
        if (keyValuePair[1].indexOf("%")>-1) 
        { 
         sizeValue=(sizeValue/100)* screenSize; 
         arg3[i]=AxisProperty[0]+"="+sizeValue; 
        } 
       } 

       if (keyValuePair[0]==AxisProperty[1]) // if the key is (left|top) 
       { 
        anchorValue=parseInt(keyValuePair[1]); 
        arg3Index=i; 
       } 
      } 
      if (l_iTarget==2) 
      { 
       adjustedWindowPosition=(screenSize-sizeValue)/2; // will center the window on this axix 
       arg3Index=arg3.length; 
      } 
      else if (l_iTarget==3) 
      { 
       adjustedWindowPosition= screenSize-sizeValue-anchorValue; 
      } 
      arg3[arg3Index]=AxisProperty[1]+"="+adjustedWindowPosition; // (left|top) = value 
     } 
    } 
    var newArg3=arg3.join(","); 
    result=window.open(v1[0],v1[1],newArg3); 
    if (focusNewWindow) 
    { 
     result.focus(); 
    } 

    document.MM_returnValue=false; 
    return result; 
} 
+0

營救:http://www.howtocreate.co.uk/tutorials/jsexamples/JSTidy.html – 2008-12-18 16:01:14

0

我不認爲這是一個內置的功能,所以它只是一些功能,你的團隊的一書中寫道。

這可能是Dreamweaver將打開一個網頁,做一些事情,雖然功能...

1

您的網站上,輸入該位置欄中:

javascript:alert(flvFPW1); 

它將報告功能代碼

+0

正是我想到的。 – some 2008-12-18 15:30:31

0

安裝Firefox(http://www.mozilla.com/en-US/firefox/)和螢火蟲延伸(https://addons.mozilla.org/en-US/firefox/addon/1843)。使用FireBug的DOM選項卡找到該功能並在右欄中點擊它。它會帶您到該函數定義的文件/行。

或打開你最喜歡的功能強大的文本編輯器(如TextPad或TextMate的)的HTML頁面,並做了搜索/查找功能名稱。

如果你說你已經找到了功能,但不能真正瞭解它,那麼你或許應該粘貼在你的問題中的代碼。

0

谷歌收益率:

function flvFPW1() { // v1.3 
    // Copyright 2002, Marja Ribbers-de Vroed, FlevOOware (www.flevooware.nl/dreamweaver/) 
    var v1 = arguments, v2 = v1[2].split(","), v3 = (v1.length > 3) ? v1[3] : false, v4 = (v1.length > 4) ? parseInt(v1[4]) : 0, v5 = (v1.length > 5) ? parseInt(v1[5]) : 0, v6, v7 = 0, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18; 
    if (v4 > 1) { 
     v10 = screen.width; 
     for (v6 = 0; v6 < v2.length; v6++) { 
      v18 = v2[v6].split("="); 
      if (v18[0] == "width") { 
       v8 = parseInt(v18[1]); 
      } 
      if (v18[0] == "left") { 
       v9 = parseInt(v18[1]); 
       v11 = v6; 
      } 
     } 
     if (v4 == 2) { 
      v7 = (v10 - v8)/2; 
      v11 = v2.length; 
     } else if (v4 == 3) { 
      v7 = v10 - v8 - v9; 
     } 
     v2[v11] = "left=" + v7; 
    } 
    if (v5 > 1) { 
     v14 = screen.height; 
     for (v6 = 0; v6 < v2.length; v6++) { 
      v18 = v2[v6].split("="); 
      if (v18[0] == "height") { 
       v12 = parseInt(v18[1]); 
      } 
      if (v18[0] == "top") { 
       v13 = parseInt(v18[1]); 
       v15 = v6; 
      } 
     } 
     if (v5 == 2) { 
      v7 = (v14 - v12)/2; 
      v15 = v2.length; 
     } else if (v5 == 3) { 
      v7 = v14 - v12 - v13; 
     } 
     v2[v15] = "top=" + v7; 
    } 
    v16 = v2.join(","); 
    v17 = window.open(v1[0], v1[1], v16); 
    if (v3) { 
     v17.focus(); 
    } 
    document.MM_returnValue = false; 
} 

在註釋中的網址指向:

FlevOOware - Dreamweaver Extensions - Popup Link

0

感謝您幫助大家! spilth:是的,我找到了js文件中的函數,但無法理解代碼。由於我在與我的客戶頁面無關的其他幾個頁面上找到了相同的功能,因此我認爲其用途已被其他人知曉。所以我不打擾發佈代碼。但我會在下一次。

最好的問候

相關問題