我正在搜索苹果的网站,我在他们的代码_###
中发现了这三个#是什么意思,或者它根本没什么用处?在这里找到它:http://images.apple.com/v/macbook-pro/e/scripts/features_retina.js
来源:
(function () {
var c = AC.Class({
initialize: function (a) {
this._element = AC.Element.getElementById(a);
this._viewer = null;
this._showOnScroll = new AC.ShowOnScroll(this._element, {
threshold: 0.6,
timeInView: 0.05
});
this._showOnScroll.setDelegate(this);
AC.Object.synthesize(this);
if (!AC.Element.isElement(this.element())) {
return false
}
this.setupViewer();
if (AC.Detector.isCSSAvailable("transition")) {
AC.Element.addClassName(this.element(), "can-animate");
this.viewer().setDelegate(this)
}
},
setupViewer: function () {
var h = this.element();
var b = AC.Element.selectAll(".gallery-content", h);
var g = AC.AutoGallery.Types.Registries.gallery.__lookup["image-fadein"].getOptions();
var a = new AC.ViewMaster.Viewer(b, h, h.id, g);
this.setViewer(a)
},
willAnimate: function (m, k, l, b) {
var a = (m.orderedSections.indexOf(l.id.replace("MASKED-", "")) === 1);
var n = this.element();
var o = false;
var p = function () {
if (!o) {
b();
o = true
}
};
if (k) {
k.setOpacity(0)
}
if (l) {
l.setOpacity(1)
}
window.setTimeout(function () {
if (a) {
AC.Element.addClassName(n, "second-section")
} else {
AC.Element.removeClassName(n, "second-section")
}
n.addVendorEventListener("transitionEnd", p, true);
window.setTimeout(p, 910)
}, 10)
},
visitorEngaged: function () {
this.showOnScroll().stopObserving();
AC.Element.addClassName(this._element, "animate")
}
});
var d = AC.Class({
initialize: function (a) {
this._element = AC.Element.getElementById(a);
if (AC.Detector.isCSSAvailable("transition")) {
AC.Element.addClassName(this._element, "can-animate")
}
this._showOnScroll = new AC.ShowOnScroll(this._element, {
threshold: 0.6,
timeInView: 0.05
});
this._showOnScroll.setDelegate(this);
AC.Object.synthesize(this)
},
visitorEngaged: function () {
this.showOnScroll().stopObserving();
AC.Element.addClassName(this._element, "animate")
}
});
AC.onDOMReady(function () {
var b = new d("flash-chart");
var t = new d("wifi-chart");
var a = new AC.BatteryClock("clock-wrapper-1", $("clock-wrapper-1"), {
angleHours: 60,
angleMinutes: 720,
duration: 2,
initialMinutes: 0,
initialHours: 210,
backgroundAngleHours: 270,
fillStyle: "#80e869",
animatedFillStyle: "#5bcc41"
});
var q = new AC.BatteryClock("clock-wrapper-2", $("clock-wrapper-2"), {
angleHours: 30,
angleMinutes: 360,
duration: 2,
initialMinutes: 0,
initialHours: 210,
backgroundAngleHours: 240,
fillStyle: "#80e869",
animatedFillStyle: "#5bcc41"
});
if (AC.Environment.Feature.cssPropertyAvailable("transform")) {
var r = $("ambient-backlit-keyboard");
r.addClassName("ambient-backlit-keyboard-prepped");
var p = new AC.ShowOnScroll(r);
var o = false;
p.setDelegate({
visitorEngaged: function () {
if (o === false) {
r.addClassName("ambient-backlit-keyboard-complete")
}
o = true
}
})
}
var u = !AC.Detector.isIEStrict();
var w = new AC.ViewMaster.Viewer(AC.Element.selectAll(".av .gallery-content"), AC.Element.select("#av-gallery"), "av-gallery", {
silentTriggers: true,
useKeyboardNav: true,
shouldAnimateContentChange: u
});
if (AC.Environment.Feature.canvasAvailable()) {
var s = AC.Element.select("#flash .hero-container");
var v = AC.Element.select("#flash .flow");
var x = {
flow: null,
init: function () {
var g = ".jpg";
var f = (!AC.Environment.Feature.isHandheld() && AC.Environment.Feature.isRetina()) ? "_2x" : "";
var m = "/105/media/us/macbook-pro/2013/flash_hero_flow" + f + "/";
var e = "flash_hero_flow" + f;
var k = AC.require("flow/playerFactory");
var h = new AC.ShowOnScroll(v, {
threshold: 0.9,
timeInView: 0.5
});
var l = [m + e + "_keyframe" + g, m + e + "_endframe" + g];
var i = m + e + "_###" + g;
var j = m + e + "_manifest.json";
this.flow = k(v, l, i, j, {
superframes: false,
keyframeCache: false,
benchmark: false
});
this.flow.frameRate = 30;
this.flow.on("canplaythrough", function () {
h.setDelegate({
visitorEngaged: function () {
x.flow.play()
}
})
})
}
};
x.init();
AC.Element.addClassName(s, "enhanced")
}
})
}());
答案 0 :(得分:5)
以下是相关的代码部分:
init: function () {
var g = ".jpg";
var f = (!AC.Environment.Feature.isHandheld() && AC.Environment.Feature.isRetina()) ? "_2x" : "";
var m = "/105/media/us/macbook-pro/2013/flash_hero_flow" + f + "/";
var e = "flash_hero_flow" + f;
var k = AC.require("flow/playerFactory");
var h = new AC.ShowOnScroll(v, {
threshold: 0.9,
timeInView: 0.5
});
var l = [m + e + "_keyframe" + g, m + e + "_endframe" + g];
var i = m + e + "_###" + g;
var j = m + e + "_manifest.json";
this.flow = k(v, l, i, j, {
superframes: false,
keyframeCache: false,
benchmark: false
});
this.flow.frameRate = 30;
this.flow.on("canplaythrough", function () {
h.setDelegate({
visitorEngaged: function () {
x.flow.play()
}
})
})
}
它会创建一个/105/media/us/macbook-pro/2013/flash_hero_flow/flash_hero_flow_###.jpg
或/105/media/us/macbook-pro/2013/flash_hero_flow/flash_hero_flow_2x_###.jpg
的网址。然后将URL传递给某个初始化函数,该函数根据属性名称看起来像是flow player的一部分,这是一个流行的Flash视频播放器。
苹果网站上不存在该链接
URL是相对于页面的,因此它取决于脚本将嵌入到哪个域。也可能是 flow 应用程序已经在同一页面上由其他脚本设置了一些基本URL。
另请注意,第一个#
表示的片段部分通常不会发送到服务器。这意味着可以忽略###.jpg
,这似乎有点奇怪。我认为###
更有可能是占位符,在后面的步骤中将替换为其他内容。