FlvFPW1 () - What does it do?

I have been tasked with rewriting the Javascript engine that is currently activating my client's internal site. While looking at the code, I came across this flvFPW1 function which I don't recognize and cannot decipher the code (my knowledge of Javascript is modest at best). A Google search gives me a few hits, but most, if not all of the page images are from the Javascript used on that particular page. In other words, I cannot find a description of this function, even if it is obviously used by others.

Can someone here enlighten me?

Thanks / Fredrik

+1


source to share


6 answers


My own research agrees that this is a Dreamweaver extension: I found the code for version 1.44 (scroll down some on this page), not 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;}

      

Which of course went through the compressor to save bandwidth, which is very difficult to read. I spent a little time without obfuscating it before realizing that I could get better results by adding "Dreamweaver" to my search bar. By doing this, I was able to find more interesting documentation:



http://www.flevooware.nl/dreamweaver/extdetails.asp?extID=8 (short description) http://satsuki.altervista.org/basibloggers/source40.txt (full script code, in Italian)

In short: it's basically just a wrapper for window.open

. Here's the progress I made to translate the code:

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;
}

      

+4


source


on your site, enter it in the location bar:

javascript:alert(flvFPW1);

      



it will report the function code

+1


source


I don't think this is a built-in function, so it is just some function that your team wrote.

It might be a feature that Dreamweaver adds to the page to do something, though ...

0


source


Install Firefox ( http://www.mozilla.com/en-US/firefox/ ) and the FireBug extension ( https://addons.mozilla.org/en-US/firefox/addon/1843 ). Use the DOM FireBug tab to find a feature and click on it in the right column. It will take you to the file / line where the function is defined.

Or open the HTML page in your favorite powerful text editor (like TextPad or TextMate) and search / search for the function name.

If you say you've found a function but can't figure it out, then you should probably paste the code into your question.

0


source


Google gives:

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;
}

      

Comment url:

FlevOOware - Dreamweaver extensions - pop-up link

0


source


Thanks for helping the guys! spilth: Yes, I found the function in the js file but could not understand the code. Since I found the same feature on several other pages that were not linked to my customer page, I assumed that its purpose would already be known to other people. So I didn't bother posting the code. I'll be next time though.

Regards

0


source







All Articles