限时优惠活动
亲爱的苦力吧用户,我们为了回馈新老用户一直以来的鼎力支持,即日起(2025-02-06至2025-03-06)凡是购买苦力吧VIP/充值K币的新老用户,都直接可获得买一送一的优惠馈赠。例如:购买一个月的VIP会员可直接获得两个月的VIP会员;充值100K币可直接获得200K币,以此类推!有任何疑问可联系在线客服,感谢各位用户对苦力吧素材的信任与厚爱,我们将一如既往的给大家上新更多优质的素材源码,祝大家开工大吉、工作顺利、心想事成。

jquery在线网站URL网址Ping工具插件

所属分类: 网页特效-实用工具    2023-11-21 08:53:25

jquery在线网站URL网址Ping工具插件 ie兼容6
 查看演示  登录后下载 温馨提示
登录会员即可享受免费下载
 我要建站

jquery在线网站URL网址Ping工具插件(共3个文件)

    • ping.js
    • runping.js
    • index.html

使用方法

  • code
  • source
  1. var Ping = function(opt) {
  2. this.opt = opt || {};
  3. this.favicon = this.opt.favicon || "/favicon.ico";
  4. this.timeout = this.opt.timeout || 0;
  5. this.logError = this.opt.logError || false;
  6. };
  7. Ping.prototype.ping = function(source, callback) {
  8. var self = this;
  9. self.wasSuccess = false;
  10. self.img = new Image();
  11. self.img.onload = onload;
  12. self.img.onerror = onerror;
  13. var timer;
  14. var start = new Date();
  15. function onload(e) {
  16. self.wasSuccess = true;
  17. pingCheck.call(self, e);
  18. }
  19. function onerror(e) {
  20. self.wasSuccess = false;
  21. pingCheck.call(self, e);
  22. }
  23. if (self.timeout) {
  24. timer = setTimeout(function() {
  25. pingCheck.call(self, undefined);
  26. }, self.timeout); }
  27. /**
  28. * Times ping and triggers callback.
  29. */
  30. function pingCheck() {
  31. if (timer) { clearTimeout(timer); }
  32. var pong = new Date() - start;
  33. if (typeof callback === "function") {
  34. // When operating in timeout mode, the timeout callback doesn't pass [event] as e.
  35. // Notice [this] instead of [self], since .call() was used with context
  36. if (!this.wasSuccess) {
  37. if (self.logError) { console.error("error loading resource"); }
  38. return callback("error", pong);
  39. }
  40. return callback(null, pong);
  41. }
  42. }
  43. self.img.src = source + self.favicon + "?" + (+new Date()); // Trigger image load with cache buster
  44. };
  45. if (typeof exports !== "undefined") {
  46. if (typeof module !== "undefined" && module.exports) {
  47. module.exports = Ping;
  48. }
  49. } else {
  50. window.Ping = Ping;
  51. }
var Ping = function(opt) {
    this.opt = opt || {};
    this.favicon = this.opt.favicon || "/favicon.ico";
    this.timeout = this.opt.timeout || 0;
    this.logError = this.opt.logError || false;
};

Ping.prototype.ping = function(source, callback) {
    var self = this;
    self.wasSuccess = false;
    self.img = new Image();
    self.img.onload = onload;
    self.img.onerror = onerror;

    var timer;
    var start = new Date();

    function onload(e) {
        self.wasSuccess = true;
        pingCheck.call(self, e);
    }

    function onerror(e) {
        self.wasSuccess = false;
        pingCheck.call(self, e);
    }

    if (self.timeout) {
        timer = setTimeout(function() {
            pingCheck.call(self, undefined);
    }, self.timeout); }


    /**
     * Times ping and triggers callback.
     */
    function pingCheck() {
        if (timer) { clearTimeout(timer); }
        var pong = new Date() - start;

        if (typeof callback === "function") {
            // When operating in timeout mode, the timeout callback doesn't pass [event] as e.
            // Notice [this] instead of [self], since .call() was used with context
            if (!this.wasSuccess) {
                if (self.logError) { console.error("error loading resource"); }
                return callback("error", pong);
            }
            return callback(null, pong);
        }
    }

    self.img.src = source + self.favicon + "?" + (+new Date()); // Trigger image load with cache buster
};

if (typeof exports !== "undefined") {
    if (typeof module !== "undefined" && module.exports) {
        module.exports = Ping;
    }
} else {
    window.Ping = Ping;
}

站长提示:
1. 苦力吧素材官方QQ群:950875342
2. 平台上所有素材资源,需注册登录会员方能正常下载。
3. 会员用户积极反馈网站、素材资源BUG或错误问题,每次奖励2K币
4. PHP源码类素材,如需协助安装调试,或你有二次开发需求,可联系苦力吧客服。
5. 付费素材资源,需充值后方能下载,如有任何疑问可直接联系苦力吧客服
相关资源 / 实用工具

javascript创建的在线头像DIY生成器工具

一款头像图片在线生成实用工具,用户可以为头像设置不同的肤色、眉毛、嘴巴、发型、发色、胡须、配饰、衣服面料颜色等。还可设置眼睛镜片不透明度、纹身和头像背景颜色,可下载头像图片。
  实用工具
 3173  0

jquery网页html表格数据转可下载EXCEL插件

一款html网页table表格数据到excel转换器,可基于HTML表生成一个可下载的Excel XSL文件。
  实用工具
 8350  0

js在线自定义更改元素CSS工具代码

核心功能使用进度滑块和颜色选择器等在线动态更改CSS特效。可自定义设置间距、背景颜色和模糊等级等。
  实用工具
 3315  0

javascript创建的随机密码生成器工具

一个简洁的界面、一个文本字段和一个密码生成按钮。当单击“生成”按钮时,立即会生成以小写字母、大写字母、数字和特殊字符的随机组合字符串。这是一个简单的在线生成工具,你可以根据自身需求创建不同复杂程度的密码。
  实用工具
 1339  0

评论数(1) 回复有机会获得K币 用户协议

    great0
    2023-12-07 21:22:59
😀
  • 😀
  • 😊
  • 😂
  • 😍
  • 😑
  • 😷
  • 😵
  • 😛
  • 😣
  • 😱
  • 😋
  • 😎
  • 😵
  • 😕
  • 😶
  • 😚
  • 😜
  • 😭
发表评论