`
xinlingwuyu
  • 浏览: 138691 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Class-based Javascript analog clock

阅读更多
var analogClock = function (divElem, index) { this.mainElem = divElem; this.index = index; var numStyles = Array(); numStyles["1"] = Array("1","2","3","4","5","6","7","8","9","10","11","12"); numStyles["i"] = Array("i","ii","iii","iv","v","vi","vii","viii","ix","x","xi","xii"); numStyles["I"] = Array("I","II","III","IV","V","VI","VII","VIII","IX","X","XI","XII"); numStyles["."] = Array("�","�","�","�","�","|","�","�","�","�","�","||"); this.position = analogClock.prototypes.position; numstyle = String(this.mainElem.getAttribute('numstyle')); if ("1I.".indexOf(numstyle.toUpperCase())==-1) numstyle="1"; var numstyle=numStyles[numstyle]; var radius = Math.floor(parseInt(this.mainElem.getAttribute('size'))/2); if (isNaN(radius)) radius=50; this.mainElem.style.width=radius*2; this.mainElem.style.height=radius*2; this.mainElem.style.position='relative'; this.mainElem.style.overflow='hidden'; this.mainElem.style.margin='0px'; this.mainElem.style.padding='0px'; //Create Hour labels this.hourLabels = Array(); for (var i=0; i=24) Hour-=12; while (Hour=12)?"PM":"AM"; this.AmPm.style.bottom=1.333*radius; this.AmPm.style.left=radius-parseInt(this.AmPm.offsetWidth)/2; this.AmPm.style.zIndex=-1; this.DoW.innerHTML=Week[Today.getDay()]; this.DoW.style.top=0.666*radius; this.DoW.style.left=radius-parseInt(this.DoW.offsetWidth)/2; this.DoW.style.zIndex=-1; this.City.innerHTML=this.mainElem.getAttribute('city'); this.City.style.bottom=0.666*radius; this.City.style.left=radius-parseInt(this.City.offsetWidth)/2; this.City.style.zIndex=-1; this.Country.innerHTML=this.mainElem.getAttribute('country'); this.Country.style.top=1.333*radius; this.Country.style.left=radius-parseInt(this.Country.offsetWidth)/2; this.Country.style.zIndex=-1; } analogClock.arClocks = new Array(); analogClock.replace = function () { var Divs = document.getElementsByTagName('div'); for (var i=0; i<divs i if analogclock settimeout function for var interval="Math.floor(50*Math.pow(analogClock.arClocks.length,1.5));" day today="new" date gmtadjust="-Today.getTimezoneOffset()/60;" lsm="new" lso="new">= lso) gmtAdjust -= 1; return gmtAdjust; } analogClock.needDST = function (a) { if ((a-5)) return 0; var day; var Today = new Date(); var dst=0; var lsm = new Date; var lso = new Date; lsm.setMonth(2); lsm.setDate(31); day = lsm.getDay(); lsm.setDate(31-day); lso.setMonth(9); lso.setDate(31); day = lso.getDay(); lso.setDate(31-day); if (Today &gt;= lsm || Today </divs>
分享到:
评论

相关推荐

    zone-based policy配置个人总结

    class-map type inspect match-any [Private-To-Internet] match protocol http match protocol ip match protocol ipv6 … class-map type inspect match-any [Internet-To-DMZ] match protocol http match ...

    The-implementation-of-the-class-based-utility-to-_The Work

    The implementation of the class-based utility to work with vectors.

    前端开源库-eslint-plugin-class-property

    `eslint-plugin-class-property`是一个专门为解决这个问题而设计的开源库,它是一个针对ESLint的插件,专注于处理类属性(class properties)的语法。本文将深入探讨这个插件的功能、用途以及如何在项目中集成和配置...

    JSSC 2022.06

    3. **偶次谐波Class-E CMOS振荡器** (Even-Harmonic Class-E CMOS Oscillator) M. Barzgari等人开发了一种基于CMOS的偶次谐波Class-E振荡器,该振荡器具有高效率和良好的频率稳定性。这种新型振荡器设计优化了谐波...

    working-with-class-based-components

    Create React App入门该项目是通过引导的。可用脚本在项目目录中,可以运行:npm start 在开发模式下运行应用程序。 打开在浏览器中查看它。 如果您进行编辑,则页面将重新加载。 您还将在控制台中看到任何棉绒错误...

    Large-Scale-Multi-Class-Image-Based-Cell-Classification-with-Deep-Learning:具有深度学习的大规模多类基于图像的细胞分类

    具有深度学习的大规模多类基于图像的细胞分类 ... git clone https://github.com/monaen/Large-Scale-Multi-Class-Image-Based-Cell-Classification-with-Deep-Learning .git --branch code --single-branch cd Meng20

    前端开源库-class-inspector

    "class-inspector"就是这样一款专为前端开发者设计的开源库,它的主要功能是作为类检查器,帮助我们获取类的静态方法和实例方法,从而更好地理解和操作JavaScript对象。 一、什么是class-inspector "class-...

    JS-CSS-Class-Based-Validation:通过向 DOM 元素添加类来创建表单验证

    本项目“JS-CSS-Class-Based-Validation”提供了一种利用JavaScript和CSS通过添加类的方式来实现表单验证的方法。这种方法灵活且易于维护,下面将详细解释其工作原理和应用。 首先,我们要理解JavaScript(JS)在...

    class-dump-z_0.2-0.tar.gz

    包括了class-dump的mac版,LINUX版,Windows版 具体用法: class-dump -H Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.1.sdk/System/Library/CoreServices/SpringBoard.app/...

    a Freeware MFC class to display an analog clock(67KB)

    标题中的"a Freeware MFC class to display an analog clock"是一个免费的MFC(Microsoft Foundation Class)类库,用于展示模拟时钟。这个类库可能是由开发者为了方便其他程序员在Windows应用程程序中集成模拟时钟...

    Clock-LD-.rar_Clock.Java_clock_java clock

    1. **类定义**:首先,我们需要定义一个名为`Clock`的公共类,这可以通过`public class Clock {`来完成。 2. **属性**:为了存储时间,我们需要三个私有变量,分别代表小时、分钟和秒,可以声明为`int`类型,如`...

    HMM-based Script Identification for OCR

    We propose an approach that repurposes the same HMM-based system used for OCR to the task of script/language ID, by replacing character labels with script class labels. We apply it in a multi-pass ...

    前端开源库-class-extend

    "class-extend"就是一个这样的开源库,专注于类的扩展功能,类似于JavaScript中的类继承机制。在这个库中,我们可以找到一系列用于处理和扩展类的实用工具,使我们能够更加灵活地构建和组织代码。 在JavaScript中,...

    前端开源库-class-is

    "class-is"是一个专门针对JavaScript的开源库,它提供了一种优雅的方式来增强JavaScript的类,允许我们更加灵活地进行类型检查和比较。这个库的核心概念是通过添加`is&lt;class&gt;`属性来帮助开发者判断对象所属的类或...

    ember-class-based-modifier:基于类的API,用于在Ember中创作元素修饰符

    基于余烬类的修饰符 :warning_selector: :backhand_index_pointing_right: ...ember install ember-class-based-modifier 用法 此插件不提供任何开箱即用的修饰符。 相反,该库允许您编写自己的库。 这个插件的大部分

    GPU-based Techniques for Global Illumination Effects

    此书不看就不可能理解啥叫未来的GPU~~~ 以及啥叫Crysis 3的图形...这本书对于DX10-class GPU的硬件机制描述是我见过的所有图形学书籍里面最详细的 。 总之这本书对于做下一代实时渲染引擎和GPU体系结构的人都是必读的

Global site tag (gtag.js) - Google Analytics