以下是从官网copy过来。 基本上jquery插件都是这个样子。记录下来参考。<html lang="en"><head><meta charset="utf-8" /><title>jQuery UI Widget - Default functionality</title><link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /><script src="http://code.jquery.com/jquery-1.9.1.js"></script><script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script><link rel="stylesheet" href="/resources/demos/style.css" /><style>.custom-colorize {font-size: 20px;position: relative;width: 75px;height: 75px;}.custom-colorize-changer {font-size: 10px;position: absolute;right: 0;bottom: 0;}</style><script>$(function() {// the widget definition, where "custom" is the namespace,// "colorize" the widget name$.widget( "custom.colorize", {// default optionsoptions: {red: 255,green: 0,blue: 0,// callbackschange: null,random: null},// the constructor_create: function() {this.element// add a class for theming.addClass( "custom-colorize" )// prevent double click to select text.disableSelection();this.changer = $( "<button>", {text: "change","class": "custom-colorize-changer"}).appendTo( this.element ).button();// bind click events on the changer button to the random methodthis._on( this.changer, {// _on won't call random when widget is disabledclick: "random"});this._refresh();},// called when created, and later when changing options_refresh: function() {this.element.css( "background-color", "rgb(" +this.options.red +"," +this.options.green + "," +this.options.blue + ")");// trigger a callback/eventthis._trigger( "change" );},// a public method to change the color to a random value// can be called directly via .colorize( "random" )random: function( event ) {var colors = {red: Math.floor( Math.random() * 256 ),green: Math.floor( Math.random() * 256 ),blue: Math.floor( Math.random() * 256 )};// trigger an event, check if it's canceledif ( this._trigger( "random", event, colors ) !== false ) {this.option( colors );}},// events bound via _on are removed automatically// revert other modifications here_destroy: function() {// remove generated elementsthis.changer.remove();this.element.removeClass( "custom-colorize" ).enableSelection().css( "background-color", "transparent" );},// _setOptions is called with a hash of all options that are changing// always refresh when changing options_setOptions: function() {// _super and _superApply handle keeping the right this-contextthis._superApply( arguments );this._refresh();},// _setOption is called for each individual option that is changing_setOption: function( key, value ) {// prevent invalid color valuesif ( /red|green|blue/.test(key) && (value < 0 || value > 255) ) {return;}this._super( key, value );}});// initialize with default options$( "#my-widget1" ).colorize();// initialize with two customized options$( "#my-widget2" ).colorize({red: 60,blue: 60});// initialize with custom green value// and a random callback to allow only colors with enough green$( "#my-widget3" ).colorize( {green: 128,random: function( event, ui ) {return ui.green > 128;}});// click to toggle enabled/disabled$( "#disable" ).click(function() {// use the custom selector created for each widget to find all instances// all instances are toggled together, so we can check the state from the firstif ( $( ":custom-colorize" ).colorize( "option", "disabled" ) ) {$( ":custom-colorize" ).colorize( "enable" );} else {$( ":custom-colorize" ).colorize( "disable" );}});// click to set options after initalization$( "#black" ).click( function() {$( ":custom-colorize" ).colorize( "option", {red: 0,green: 0,blue: 0});});});</script></head><body><div><div id="my-widget1">color me</div><div id="my-widget2">color me</div><div id="my-widget3">color me</div><button id="disable">Toggle disabled option</button><button id="black">Go black</button></div></body></html>
相关推荐
告别重复劳动:用Python+pywinauto打造你的微信个人助理(自动回复/收款/定时发消息)
本文介绍如何利用Python和pywinauto库构建微信个人助手,实现自动回复、定时消息、智能收款等功能,告别重复劳动。通过详细的代码示例和配置指南,帮助开发者快速掌握微信自动化技术,提升工作效率。
编写jQueryUI插件(widget)
使用jQueryUI的widget来写插件,相比于基本的jquery插件有一些好处: * 方便实现继承,代码重用 * 默认是单例 * widget已经给你实现好的一些常用方法,例如destroy 带来好处的同时也带来了荆棘和陷阱,本文的目的就是梳理这些荆棘,标出哪里有陷阱。 基本知识:命名规范,public, private, this, this.element 如何开始写一个...
ubunut 系统安装k8s集群
修改配置文件 kube-metrics-server.yaml 添加监控数据采集容器启动参数,启动 tls 证书验证,否则监控容器接口验证不通过,无法采集监控数据。kube-metrics-server.yaml 140行左右添加参数 --kubelet-insecure-tls。服务器添加配置(配置三台阿里云时间同步服务器作为时间源,本机作为时间同步服务器)客户端配置(第一个源选用集群内的 192.168.10.20 )时间同步配置文件参考如下。
$.widget方法
最近研究了下$.widget("ui.scroll",{})插件,记录下一些心得吧,还有待解决的问题 $.widget("ui.scroll",{ div:$('<div></div>'), t:{id:'id',name:'name'} _init:function(){ var str='' //调用这个插件时就直接执行这个方法 ...
开源智能相机- Xilinx Zynq-7000高清图像处理模块
Zynq-7000图像处理模块设计资料保存:开源智能相机- Xilinx Zynq-7000高清图像处理模块 一、产品概述 Z-turn Board是一款以Xilinx Zynq-7010/7020全可编程系统级芯片的嵌入式开发板。ARM处理器和FPGA架构紧密集成。拥有双核ARM Cortex-A9 MPCore的高性能,低功耗特性,在设计中能更好的满足各种工业需要。L...
CSV文件输入到simulink中
将示波器波形和数据CSV文件保存下来进行数据分析。将波形绘制到simulink中
$widget 两栏多项选择框 会触发默认提交事件的优化
******其中 按钮不要直接使用button标签,会触发默认提交事件,原数组只初始化一次,第二次加载的时候允许改变原数组,去form提交已改变的数据******* /*多选控件 js begin*/ /** * Created by ZhangML on 2019/3/5. */ (function($) { /** * 它带有两个参数:一个是要创建的插件名称,一个是包含支...
使用 Java + PaddleOCR 实现表格识别,支持导出 HTML 和 Excel(附源码)
使用Java+PaddleOCR快速搭建表格识别系统,无需处理底层模型细节。系统支持表格结构识别和内容识别,可将图片转换为可编辑表格格式。文章提供了完整的实现流程,包括Maven依赖引入、模型下载(包含检测、识别、分类和表格结构模型)及参数配置说明。SmartJavaAI支持多种高性能模型选择,适用于不同应用场景,帮助开发者快速实现表格识别功能。
jqueryUI之widget
jqueryUIwidget 分析 $.widget 理解是个注册ui组件的工厂方法,$.widget(name,prototype) 传入ui的name和ui的prototype,就会返回新ui的构造方法。 $.widget( "ui.buttonset",/* 原型*/ { version: "1.10.1", options: { items:...
【时时三省】tessy 进入调试模式 教程
山不在高,有仙则名。水不在深,有龙则灵。----CSDN 时时三省。
会话管理技巧——如何优化OpenClaw的上下文理解能力(2026进阶版)
本文深入探讨了OpenClaw系统的会话管理技术,重点介绍了会话定义、生命周期管理和上下文优化策略。会话管理包含会话ID、用户信息、状态等核心要素,以及创建、维护、终止和恢复四个生命周期阶段。上下文管理通过ContextManager类实现,支持创建、更新、消息添加和变量管理等功能,并采用历史记录机制确保会话连续性。ContextOptimizer类则负责应用优化规则,通过消息和变量压缩等技术提升系统性能。这些技术共同构建了OpenClaw强大的会话管理能力,为AI助手提供了高质量的交互体验基础。
C语言实现顺序表:从数组到动态扩容的完整指南
数据结构是编程的基石,线性表是最基础的逻辑结构。顺序表作为线性表的顺序存储实现,底层依赖数组连续内存,通过封装容量与长度,实现随机访问O(1)。理解其内存模型与增删查改原理,是掌握链表、栈、队列的关键。实际工程中,顺序表适合频繁按位访问、尾部操作的场景,常用于动态数组与缓存友好型容器。面对数据规模动态变化,可基于realloc自动扩容,摊还成本低至O(1)。文章用C语言完整演示结构体定义、初始化、插入删除、查找及扩容过程,并剖析位序与下标混淆、指针传参、内存泄漏等高频陷阱,助力零基础读者跨越“数据结构”第一
基于形状的模板匹配之候选点选择
基于形状的匹配匹配,顶层金字塔提取候选点
jQuery ui widget tutorial
http://bililite.com/blog/understanding-jquery-ui-widgets-a-tutorial/ This was written largely to help me make sense of using UI to create my own widgets,but I hope it may help others. "Widget"
复分析 阿尔福斯(Ahlfors) 第三版答案 英文
答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案
深度学习工具包 DeepLearningToolbox
深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[](https://bitdeli.com/free "Bitdeli Badge")
jQuery插件开发
jQuery插件开发模式 说到jQuery插件的编写,起初我把它当做封装一个方法那样简单,这显然是错的,因为这让我一开始完全不知道如何下手去编写一个插件。所以要先了解一下jQuery插件的三种开发方式: 通过$.extend()来扩展jQuery 通过$.fn 向jQuery添加新的方法 通过$.widget()应用jQuery UI的...
ET2012新版免狗免安装绿色软件
ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,
jQuery插件开发模式
为什么80%的码农都做不了架构师?>>> ...
WINCC7.3破解文件
WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!
JQuery插件开发(转)
原文:http://www.cnblogs.com/ajianbeyourself/p/5815689.html#_label0 jQuery插件开发模式(转) 软件开发过程中是需要一定的设计模式来指导开发的,有了模式,我们就能更好地组织我们的代码,并且从这些前人总结出来的模式中学到很多好的实践。 根据《jQuery高级编程》的描述,jQuery插件开发方式主要有三种: 通过$.ext...
js-jquery-插件开发(一)
jQuery插件开发模式 jQuery插件开发方式主要有三种:1、通过$.extend()来扩展jQuery 主要是在jQuery命名空间或者理解成jQuery身上添加了一个静态方法2、通过$.fn 向jQuery添加新的方法3、通过$.widget()应用jQuery UI的部件工厂方式创建【略,暂时没看】 主要是用来开发更高级jQuery部件的,该模式开发出来的部件带有很多jQuer...
jQuery: 插件开发模式详解 $.extend(), $.fn, $.widget()
原文:http://www.codeceo.com/article/jquery-plugin-develop.html 软件开发过程中是需要一定的设计模式来指导开发的,有了模式,我们就能更好地组织我们的代码,并且从这些前人总结出来的模式中学到很多好的实践。 根据《jQuery高级编程》的描述,jQuery插件开发方式主要有三种: 通过$.extend()来扩展jQuery ...
widget jquery 理解
jquery ui 的所有组件都是基于一个简单,可重用的widget。 这个widget是jquery ui的核心部分,实用它能实现一致的API,创建有状态的插件,而无需关心插件的内部转换。 $.widget( name, base, prototype ) widget一共有2或3个参数。base为可选。 这里之所以把base放在第二个参数里,主要是因为这样写代码更直观一些。(因为后面的
jQuery插件的几种写法
之前在一篇求职的帖子上看过,前端面试的景点题目:jquery插件的几种写法。 这是看到的一篇总结。比较到位。详尽且简单易懂。如果之前看过jquery的源码,应该特别好理解了。 插件编写的目的是给已经有的一系列方法或函数做一个封装,以便在其他地方重复使用,方便后期维护。 一、jQuery插件开发方式 1、通过$.extend()来扩展jQuery 2、通过$.fn 向j
jquery $与jQuery
jquery的兼容 ie8 <script type="text/javascript" src="<%=path%>/js/jquery-3.1.1.min.js"></script> <!--[if IE 8]> <script type="text/javascript" src="__PUBLIC__/home/j...
jquery ui widget 源码分析
jquery ui 的所有组件都是基于一个简单,可重用的widget。 这个widget是jquery ui的核心部分,实用它能实现一致的API,创建有状态的插件,而无需关心插件的内部转换。 $.widget( name, base, prototype ) widget一共有2或3个参数。base为可选。 这里之所以把base放在第二个参数里,主要是因为这样写代码更直观一些。(...
jQuery UI widget源码解析,想找工作的你还不看这份资料就晚了
// Copy everything else by reference} else {target[key] = value;}}}}return target;};//bridge 是设计模式的一种,这里将对象转为插件调用$.widget.bridge = function(name, object) {var fullName = object.prototype.widgetFullName || name;//这里就是插件了//这部分的实现主要做了几个工作,也是制作一个优雅的插件的主要代码//1、
340




被折叠的 条评论
为什么被折叠?



