我的任务是重写当前为我客户的内部网站提供支持的Javascript引擎。在查看代码时,我遇到了这个函数 flvFPW1 我无法识别,也无法解密代码(我的Javascript知识充其量只是谦虚)。谷歌搜索给了我一些点击,但大多数(如果不是全部)页面点击来自该特定页面上使用的Javascript。换句话说,我找不到这个函数的描述,即使它显然是被其他人使用的。
有人可以在这里启发我吗?
谢谢/ Fredrik
答案 0 :(得分:4)
我自己的研究同意这是一个Dreamweaver扩展:我发现code for version 1.44(在此页面上向下滚动)而不是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;
}
答案 1 :(得分:1)
,在位置栏中输入:
javascript:alert(flvFPW1);
它将报告功能代码
答案 2 :(得分:0)
我认为它不是内置函数,所以它只是你团队编写的一些函数。
它可能是Dreamweaver添加到页面中以执行某些操作的功能...
答案 3 :(得分:0)
安装Firefox(http://www.mozilla.com/en-US/firefox/)和FireBug扩展程序(https://addons.mozilla.org/en-US/firefox/addon/1843)。使用FireBug的DOM选项卡查找功能,然后在右栏中单击它。它将带您到定义函数的文件/行。
或者在您最喜爱的强大文本编辑器(如TextPad或TextMate)中打开HTML页面,然后搜索/查找功能名称。
如果您说您已找到该功能但实际上无法理解,那么您应该将代码粘贴到您的问题中。
答案 4 :(得分:0)
Google收益:
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;
}
评论中的网址会导致:
答案 5 :(得分:0)
感谢您帮助帮助! spilth:是的我在js文件中找到了这个函数但是无法理解代码。由于我在与客户页面无关的其他几个页面上发现了相同的功能,我认为其目的已经为其他人所知。所以我没有费心去发布代码。我下次会的。
最好的问候