博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mootools 获取类名_MooTools类嗅探器书签
阅读量:2511 次
发布时间:2019-05-11

本文共 1706 字,大约阅读时间需要 5 分钟。

mootools 获取类名

I was recently reviewing a few MooTools-driven websites and one of the questions I wrote down was "Which MooTools Core classes do you use and how many classes have you created?" Then I asked myself if there was a way I could figure that out myself. The end result is a JavaScript bookmarklet that finds all of the MooTools classes defined within the Window object.

我最近正在审查一些由MooTools驱动的网站,我写下的问题之一是“您使用哪个MooTools核心类,并且创建了多少个类?” 然后我问自己是否有办法解决这个问题。 最终结果是一个JavaScript小书签,可找到Window对象中定义的所有MooTools类。

MooTools JavaScript (The MooTools JavaScript)

(function() { if(window.MooTools == undefined) return false;var classes = [];for(obj in window) {	try {		var typo = (window.$type != undefined ? $type(window[obj]) : typeOf(window[obj]));		if(typo == 'class') {			classes.push(obj);		}	} catch(e) { }}classes.sort();console.log('# Classes: ' + classes.length);classes.each(function(klass) {	console.log(klass);}); })();

The key to finding each class is using the $type (< MooTools 1.3) or typeOf (MooTools 1.3) functions. If the result is "class", we've found a class in the given scope. The scope we're searching for is window scope. You can easily change the code snippet to change scope. Checking every scope would be far too taxing so I've stuck to window-level objects.

查找每个类的关键是使用$ type(<MooTools 1.3)或typeOf(MooTools 1.3)函数。 如果结果为“ class”,则在给定范围内找到一个类。 我们正在搜索的范围是窗口范围。 您可以轻松地更改代码段以更改范围。 检查每个范围都太费力了,所以我坚持使用窗口级对象。

There you have it. MooTools 1.3 is structured a bit differently than 1.2 so you'll see far fewer classes with 1.3. Just a part of minimizing globals and tightening up this masterful framework!

你有它。 MooTools 1.3的结构与1.2有所不同,因此使用1.3可以看到更少的类。 只是最小化全局变量和加强这个精巧框架的一部分!

翻译自:

mootools 获取类名

转载地址:http://tipwd.baihongyu.com/

你可能感兴趣的文章
llg的农场(farm)
查看>>
Delphi的FIFO实现
查看>>
Anti StrongOD Kernel Mode
查看>>
bootstrap字体图标在谷歌显示正常,在火狐显示异常的问题
查看>>
Luogu CF22C 【System Administrator】
查看>>
【原】使用less实现随机下雪动画
查看>>
Urozero Autumn 2016. UKIEPC 2016
查看>>
ActiveReport使用心得(四):WebForm下的显示类型及数据的导出
查看>>
《精通CSS:高级Web标准解决方案》学习笔记之二:可视化格式模型
查看>>
Flash调用Lua脚本: 五
查看>>
一次oracle大量数据删除经历
查看>>
npm重要知识点梳理
查看>>
Windows 7安装Service Pack 1失败问题
查看>>
How To Move Or Rebuild A Lob Partition
查看>>
请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理解决方案
查看>>
3-STM32物联网开发WIFI+GPRS基础篇(开发板测试-GPRS)
查看>>
CSS教程:彻底掌握Z-index属性
查看>>
C++中值类型形参、指针类型形参和引用形参的探讨
查看>>
css3:bacground-size
查看>>
双系统开机引导菜单修复方法 进win7无须重启|metro引导|双系统菜单名字修改
查看>>