Reference
yui-ext Documentation Centerhttp://www.yui-ext.com/deploy/yui-ext/docs/
via
phpspot開発日誌 - 2006-11-30 - Yahoo UI Libraryを拡張した超リッチなコンポーネント集http://phpspot.org/blog/archives/2006/11/yahoo_ui_librar_4.html
var p = new Poly9.URLParser('http://user:password@poly9.com/pathname?arguments=1#fragment');
/* OUT *
p.getHost() == 'poly9.com'
p.getProtocol() == 'http'
p.getPathname() == '/pathname'
p.getQuerystring() == 'arguments=1'
p.getFragment() == 'fragment'
p.getUsername() == 'user'
p.getPassword() == 'password'
*/
p.setURL('another.url.com');
/* OUT *
p.getHost() == 'another.url.com'
p.getProtocol() == ''
*/
<script type="text/javascript" src="prototype.js.gz"></script>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ".*Safari.*" [OR]
RewriteCond %{HTTP:Accept-Encoding} !gzip
RewriteRule (.*)\.jgz$ $1\.js [L]
AddType "text/javascript;charset=UTF-8" .jgz
AddEncoding gzip .jgz
アンカーに付けられたtarget属性の判別とページ内リンクを視覚的に明示する仕組みを提供する補助スクリプト
function backToTop() {
var x1 = x2 = x3 = 0;
var y1 = y2 = y3 = 0;
if (document.documentElement) {
x1 = document.documentElement.scrollLeft || 0;
y1 = document.documentElement.scrollTop || 0;
}
if (document.body) {
x2 = document.body.scrollLeft || 0;
y2 = document.body.scrollTop || 0;
}
x3 = window.scrollX || 0;
y3 = window.scrollY || 0;
var x = Math.max(x1, Math.max(x2, x3));
var y = Math.max(y1, Math.max(y2, y3));
window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));
if (x > 0 || y > 0) {
window.setTimeout("backToTop()", 25);
}
}
<a href="#" onclick="backToTop(); return false">
このページの先頭へ
</a>
function fileLinks() {
var fileLink;
if (document.getElementsByTagName('a')) {
for (var i = 0; (fileLink = document.getElementsByTagName('a')[i]); i++) {
if (fileLink.href.indexOf('.pdf') != -1) {
fileLink.setAttribute('target', '_blank');
fileLink.className = 'pdfLink';
}
if (fileLink.href.indexOf('.doc') != -1) {
fileLink.setAttribute('target', '_blank');
fileLink.className = 'docLink';
}
if (fileLink.href.indexOf('.zip') != -1) {
fileLink.setAttribute('target', '_blank');
fileLink.className = 'zipLink';
}
}
}
}
window.onload = function() {
fileLinks();
}
a:hover {
text-decoration: none;
}
.pdfLink {
padding-right: 19px;
background: url(pdf.gif) no-repeat 100% .5em;
}
.docLink {
padding-right: 19px;
background: url(doc.gif) no-repeat 100% .5em;
}
.zipLink {
padding-right: 17px;
background: url(zip.gif) no-repeat 100% .5em;
}
benchmark({
'test1': function() {
// do something
},
'test2': function() {
// do something
},
'test3': function() {
// do something
}
});
benchmark({
'getElementById': function() {
document.getElementById('target');
},
'getElementsByTagName': function() {
document.getElementsByTagName('target');
},
'Prototype\'s $ function': function() {
$('target');
}
});