gpt4 book ai didi

javascript - 有人可以解释一下 Google 主页 JS 吗?

转载 作者:数据小太阳 更新时间:2023-10-29 04:28:11 25 4
gpt4 key购买 nike

以下是 Google 主页上的一些“奇怪”片段..(即 google.com/ncr)

({"s":{"#":[{"h":"ad","g":["Google","E4hE342CDKOgAFYm15AW","1",0,0,1]},{"h":"p","g":["ghead","

,0]},{"h":"p","g":["footer","

",0]},{"h":"p","g":["body","

",0]},{"h":"p","g":["xjsi","

然后是这个:

<script>if(google.y)google.y.first=[];if(google.y)google.y.first=[];if(!google.xjs){google.dstr=[];google.rein=[];window.setTimeout(function(){var a=document.createElement(\"script\");a.src=\"/extern_js/f/CgJlbiswCjhMQAgsKzAOOAosKzAWOBQsKzAXOAQsKzAYOAQsKzAZOA0sKzAdOBssKzAhOCtAASwrMCU4yYgBLCswJjgILCswJzgCLCswKjgCLCswKzgJLCswPDgCLCswQDgFLCswRDgALCswRTgALA/JqRMsHQD1vo.js\";(document.getElementById(\"xjsd\")||document.body).appendChild(a);if(google.timers&&google.timers.load.t)google.timers.load.t.xjsls=(new Date).getTime();},0);\u000agoogle.xjs=1};google.y.first.push(function(){google.ac.m=1;google.ac.b=true;google.ac.i(document.f,document.f.q,'','','OvaKevzR5YKoeJu2mSddyQ');(function(){\u000avar a=window.google.f={};a.f=1;a.s=1;a.a=(new Date).getTime();google.rein.push(function(){a.f=1;a.s=1;a.a=(new Date).getTime()});google.dstr.push(function(){google.fade=null});function m(b,g,e,f){var d,c=[],i=[];for(var h=0,k;k=b[h++];){var l=document.getElementById(k);if(l)c.push(l)}for(var h=0,j;j=g[h++];){var o=n(j[0],j[1]);while(d=o.pop())c.push(d)}while(d=c.pop())i.push([d,\"opacity\",e,f,0,\"\"]);return i}function n(b,\u000ag){var e=[];for(var f=document.getElementsByTagName(b),d=0,c=f[d];c=f[d++];)if(c.className==g)e.push(c);return e}google.fade=function(b){b=b||window.event;var g=1;if(b&&b.type==\"mousemove\"){var e=b.clientX,f=b.clientY;g=a.x||a.y?Math.abs(a.x-e)+Math.abs(a.y-f):0;a.x=e;a.y=f}var d=(new Date).getTime(),c=d-a.a;if(google.fx&&g&&c>602)if(a.f){a.f=0;var i=[\"fctr\",\"ghead\",\u000a\"pmocntr\",\"sbl\",\"tba\",\"tbe\"],h=[[\"span\",\"fade\"],[\"div\",\"gbh\"]];google.fx.animate(602,m(i,h,0,1))}};\u000a})();\u000a});if(google.j&&google.j.en&&google.j.xi){window.setTimeout(google.j.xi,0);google.fade=null;}</script>",0]},{"h":"zz","g":[0,1]}]},"c":{"1":{"cc":[],"co":["ghead","body","footer","xjsi"],"pc":[],"nb":0,"css":"td{line-height:.8em;}.gac_m td{line-height:17px;}form{margin-bottom:20px;}body,td,a,p,.h{font-family:arial,sans-serif}.h{color:#36c;font-size:20px}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}em{font-weight:bold;font-style:normal}.lst{font:17px arial,sans-serif;margin-bottom:.2em;vertical-align:bottom;}input{font-family:inherit}.lsb,.gac_sb{font-size:15px;height:1.85em!important;margin:.2em;}#fctr,#ghead,#pmocntr,#sbl,#tba,#tbe,.fade{opacity:0;}#fctr,#ghead,#pmocntr,#sbl,#tba,#tbe,.fade{background:#fff;}#gbar{float:left;height:22px}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}#gbs,.gbm{background:#fff;left:0;position:absolute;text-align:left;visibility:hidden;z-index:1000}.gbm{border:1px solid;border-color:#c9d7f1 #36c #36c #a2bae7;z-index:1001}#guser{padding-bottom:7px !important;text-align:right}#gbar,#guser{font-size:13px;padding-top:1px !important}.gb1,.gb3,.gb3i,.gb3f{zoom:1;margin-right:.5em}.gb2,.gb2i,.gb2f{display:block;padding:.2em .5em}a.gb1,a.gb2,a.gb3,a.gb4{color:#00c !important}.gb2,.gb2i,.gb2f,.gb3,.gb3i,.gb3f{text-decoration:none}a.gb2:hover{background:#36c;color:#fff !important}","main":"<div id=ghead></div><span id=body></span><span id=footer></span><span id=xjsi></span>"}}})

这是一个非常有趣的例子:

onload=\"window.lol&amp;&amp;lol()\"

为什么他们逃避一切?

这似乎很容易解释:

onblur=\"google&amp;&amp;google.fade&amp;&amp;google.fade()\" 

如果您能解释以上任何一项,我们将不胜感激。谢谢!

最佳答案

早期的示例基本上只是缩小(删除空格、使用短变量名等)以减小页面大小。

至于:

onload=\"window.lol&amp;&amp;lol()\"

页面实际有:

onload="window.lol&amp;&amp;lol()"

它有 & 因为 & 必须在 HTML 中以这种方式表示(除了 CDATA block ,属性值永远不会)。所以这意味着:

window.lol && lol();

这意味着:

If the window object has a property called lol, execute that property as a function.

在第一个实例中使用显式 window 对象是为了在属性未定义时阻止它出错,在第二个实例中不使用它是为了减小窗口的大小页面(因为 window 在调用不是另一个对象的方法的函数时是隐含的)。

关于javascript - 有人可以解释一下 Google 主页 JS 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2013034/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com