x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
hash.js - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\sarrey\videoart\-ANA\CATALOGO\turnjs4\lib\hash.js
旋转
特效
属性
历史版本
/** * hash.js * * Copyright (C) 2012 Emmanuel Garcia * MIT Licensed * * **************************************** * * Hash.pushState(true); * * Hash.on('/page/([0-9]+)$', * {yep: function(path, parts) { }, nop: function() { }}, * 'Page $1'); * * Hash.go('/page/1'); **/ (function() { 'use strict'; var hashes = {}, regexp = {}, history = [], freq = 100, num = 0, pushState = false, timer = null, currentUrl = null, freeze = function(obj) { if (Object.freeze) return Object.freeze(obj); return obj; }, getHashParts = function() { return window.location.href.split('#'); }, startTimer = function() { if (!timer) timer = setInterval(function() { if (num>0 && currentUrl!=window.location.href) { currentUrl = window.location.href; window.Hash.check(); } }, freq); }, stopTimer = function() { if (timer) { clearInterval(timer); timer = null; } }; window.Hash = freeze({ pushState: function(yes) { if (window.history && window.history.pushState) pushState = yes; return this; }, fragment: function() { var hash = getHashParts(); return (pushState) ? window.location.pathname + ((hash[1]) ? '#' + hash[1] : '') : hash[1] || ''; }, get: function(path, params) { var p, fragment = '', parameters = []; for(p in params) { if (!Object.prototype.hasOwnProperty(p)) continue; parameters.push(encodeURIComponent(p) + '=' + encodeURIComponent(params[p])); } if (parameters.length>0) parameters = '?' + parameters.join('&'); return (pushState) ? path + parameters : getHashParts()[0] + '#' + path + parameters; }, go: function(hash, params) { if (this.fragment()!=hash) { var to = this.get(hash, params); if (pushState) window.history.pushState(null, document.title, to); else window.location.href = to; } return this; }, update: function () { currentUrl = window.location.href; return this; }, on: function(hash, callback, title) { if (!hashes[hash]) hashes[hash] = {title: title, listeners: []}; hashes[hash].listeners.push(callback); num++; startTimer(); return this; }, check: function() { var i, hash, parts, fragment = this.fragment(); for (hash in hashes) { if (!Object.prototype.hasOwnProperty.call(hashes, hash)) continue; hashes[hash].regexp = hashes[hash].regexp || new RegExp(hash); if ((parts = hashes[hash].regexp.exec(fragment))) { if (hashes[hash].title) document.title = hashes[hash].title; for (i = 0; i
hash.js
网页地址
文件地址
上一页
2/10
下一页
下载
( 2 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.