⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 widget.js

📁 ZK 基础介绍 功能操作 模块 结合数据库操作
💻 JS
📖 第 1 页 / 共 2 页
字号:
		//if no border-bottom, hide the shadow		var sdw = $e(cmp.id + "!sdw");		if (sdw) {			var w = $int(Element.getStyle(n, "border-bottom-width"));			sdw.style.display = w ? "": "none";		}	}};zkGrbox.setAttr = function (cmp, nm, val) {	switch (nm) {	case "z.open":		zkGrbox.open(cmp, val == "true", true);		return true; //no need to store z.open	case "z.cntStyle":		var n = $e(cmp.id + "!cave");		if (n) {			zk.setStyle(n, val != null ? val: "");			zkGrbox._fixHgh(cmp);		}		return true; //no need to store z.cntType	case "z.cntScls":		var n = $e(cmp.id + "!cave");		if (n) {			n.className = val != null ? val: "";			zkGrbox._fixHgh(cmp); //border's dimension might be changed		}		return true; //no need to store it	case "style":	case "style.height":		zkau.setAttr(cmp, nm, val);		zkGrbox._fixHgh(cmp);		return true;	}	return false;};zkGrbox.onclick = function (evt, uuid) {	if (!evt) evt = window.event;	var target = Event.element(evt);	var tn = $tag(target);	if ("BUTTON" == tn || "INPUT" == tn || "TEXTAREA" == tn || "SELECT" == tn	|| "A" == tn || ("TD" != tn && "TR" != tn && target.onclick))		return;	if (uuid) {		var cmp = $e(uuid);		if (getZKAttr(cmp, "closable") == "false")			return;		cmp = $e(uuid + "!slide");		if (cmp)			zkGrbox.open(uuid, !$visible(cmp));	}};zkGrbox.open = function (gb, open, silent) {	var gb = $e(gb);	if (gb) {		var panel = $e(gb.id + "!slide");		if (panel && open != $visible(panel)		&& !panel.getAttribute("zk_visible")) {			if (open) anima.slideDown(panel);			else anima.slideUp(panel);			if (!silent)				zkau.send({uuid: gb.id, cmd: "onOpen", data: [open]},					zkau.asapTimeout(gb, "onOpen"));			setTimeout(function() {zkGrbox._fixHgh(gb);}, 500); //after slide down		}	}};zkCapt.init = function (cmp) {	var gb = zkCapt._parentGrbox(cmp);	cmp = cmp.rows[0]; //first row	if (gb && cmp) {		zk.listen(cmp, "click",			function (evt) {zkGrbox.onclick(evt, gb.id);});	}};zkCapt._parentGrbox = function (p) {	while (p = p.parentNode) { //yes, assign		var type = $type(p);		if (type == "Grbox") return p;		if (type) break;	}	return null;};////// Image//zkImg = {};if (zk.ie && !zk.ie7) {	//Request 1522329: PNG with alpha color in IE	//To simplify the implementation, Image.java invalidates instead of smartUpdate	zkImg.init = function (cmp) {		return zkImg._fixpng(cmp);	};	zkImg._fixpng = function (img) {		if (img.getAttribute("zk_alpha") && img.src		&& img.src.toLowerCase().endsWith(".png")) {			var id = img.id;			var wd = img.width, hgh = img.height;			if (!wd) wd = img.offsetWidth;			if (!hgh) hgh = img.offsetHeight;			var commonStyle = "width:"+wd+"px;height:"+hgh+"px;";			if (img.hspace) commonStyle +="margin-left:"+img.hspace+"px;margin-right:"+img.hspace+"px;";			if (img.vspace) commonStyle +="margin-top:"+img.vspace+"px;margin-bottom:"+img.vspace+"px;";			commonStyle += img.style.cssText;			var html = '<span id="'+id				+'" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''				+img.src+"', sizingMethod='scale');display:inline-block;";			if (img.align == "left") html += "float:left;";			else if (img.align == "right") html += "float:right;";			if ($tag(img.parentNode) == "A") html += "cursor:hand;";			html += commonStyle+'"';			if (img.className) html += ' class="'+img.className+'"';			if (img.title) html += ' title="'+img.title+'"';			//process zk_xxx			for (var attrs = img.attributes, j = 0; j < attrs.length; ++j) {				var attr = attrs.item(j);				if (attr.name.startsWith("z."))					html += ' '+attr.name+'="'+attr.value+'"';			}			html += '></span>';			if (img.isMap) {				html += '<img style="position:relative;left:-'+wd+'px;'+commonStyle					+'" src="'+zk.getUpdateURI('/web/img/spacer.gif')					+'" ismap="ismap"';				if (img.useMap) html += ' usemap="'+img.useMap+'"';				html += '/>';			}			img.outerHTML = html;			return $e(id); //transformed		}	}}////// Imagemap //zkMap = {};zkArea = {};zkMap.init = function (cmp) {	zk.newFrame("zk_hfr_",		null, zk.safari ? "width:0;height:0;display:inline": "display:none");		//creates a hidden frame. However, in safari, we cannot use invisible frame		//otherwise, safari will open a new window	if (zk.ie && !zk.ie7) {		var img = $real(cmp);		return zkImg._fixpng(img);	}};zkArea.init = function (cmp) {	var map = $parentByType(cmp, "Map");	var img = $real(map);	if (img && !img.useMap)		img.useMap = "#" + map.id + "_map";};zkArea.cleanup = function (cmp) {	if (cmp.parentNode.areas.length <= 1) { //removing the last area		var img = $real($parentByType(cmp, "Map"));		if (img) img.useMap = "";			//Safari bug not solved yet: once useMap is cleaned up, ismap won't			//fall back to no-useMap	}};/** Called when an area is clicked. */zkArea.onclick = function (id) {	if (zkMap._toofast()) return;	var cmp = $e(id);	if (cmp) {		var map = $parentByType(cmp, "Map");		if (map)			zkau.send({uuid: map.id,				cmd: "onClick", data: [getZKAttr(cmp, "aid")], ctl: true});	}};/** Called by map-done.dsp */zkMap.onclick = function (href) {	if (zkMap._toofast()) return;	var j = href.indexOf('?');	if (j < 0) return;	var k = href.indexOf('?', ++j);	if (k < 0 ) return;	var id = href.substring(j, k);	if (!$e(id)) return; //component might be removed	j = href.indexOf(',', ++k);	if (j < 0) return;	var x = href.substring(k, j);	var y = href.substring(j + 1);	zkau.send({uuid: id, cmd: "onClick", data: [x, y], ctl: true});};zkMap._toofast = function () {	if (zk.gecko) { //bug 1510374		var now = $now();		if (zkMap._stamp && now - zkMap._stamp < 800)			return true;		zkMap._stamp = now;	}	return false}//progressmeter//zkPMeter = {};zkPMeter.init = function (cmp) {	var img = $e(cmp.id + "!img");	if (img) {		var val = $int(getZKAttr(cmp, "value"));		img.style.width = Math.round((cmp.clientWidth * val) / 100) + "px";	}};zkPMeter.setAttr = function (cmp, nm, val) {	zkau.setAttr(cmp, nm, val);	if ("z.value" == nm)		zkPMeter.init(cmp);	return true;}//Paging//zkPg = {};zkPg.go = function (anc, pgno) {	var cmp = $parentByType(anc, "Pg");	if (cmp)		zkau.send({uuid: cmp.id, cmd: "onPaging", data: [pgno]});};//popup//zkPop = {};/** Called by au.js's context menu. */zkPop.context = function (ctx, ref) {	zk.show(ctx); //onVisiAt is called in zk.show	zkPop._pop.addFloatId(ctx.id, true); //it behaves like Popup (rather than dropdown)	zkau.hideCovered();	if (zkau.asap(ctx, "onOpen"))		zkau.send({uuid: ctx.id, cmd: "onOpen", data: [true, ref.id]});};zkPop.close = function (ctx) {	zkPop._pop.removeFloatId(ctx.id);	zkPop._close(ctx);};zkPop._close = function (ctx) {	ctx.style.display = "none";	zk.unsetVParent(ctx);	zkau.hideCovered();	if (zkau.asap(ctx, "onOpen"))		zkau.send({uuid: ctx.id, cmd: "onOpen", data: [false]});};zk.Popup = Class.create();Object.extend(Object.extend(zk.Popup.prototype, zk.Floats.prototype), {	_close: function (el) {		zkPop._close(el);	}});if (!zkPop._pop)	zkau.floats.push(zkPop._pop = new zk.Popup()); //hook to zkau.js//iframe//if (zk.gecko) { //Bug 1692495	zkIfr = {}	zkIfr.onVisi = function (cmp) {		if (cmp.src.indexOf(".xml") >= 0)			cmp.src = cmp.src; //strange workaround: reload xml	};}//utilities//var zkWgt = {}/** Fixes the button align with an input box, such as combobox, datebox. */zkWgt.fixDropBtn = function (cmp) {	//Bug 1752477: we have to delay it for sophisticated layout in IE	var cmp = $e(cmp);	if (cmp)		setTimeout("zkWgt._fixdbtn($e('" + cmp.id +"'))", 66);};zkWgt._fixdbtn = function (cmp) {	cmp = $e(cmp);	if (!cmp) return; //it might be gone if the user press too fast	var inp = $real(cmp);	var btn = $e(cmp.id + "!btn");	//note: isRealVisible handles null argument	if (zk.isRealVisible(btn) && btn.style.position != "relative") {		if (!inp.offsetHeight || !btn.offsetHeight) {			zkWgt.fixDropBtn(cmp);			return;		}		//Bug 1738241: don't use align="xxx"		var v = inp.offsetHeight - btn.offsetHeight;		if (v > 0) {			var v2 = Math.round(v/2); //yes, round to integer			btn.style.paddingTop = v2 + "px";			btn.style.paddingBottom = (v - v2) + "px";		}		v = inp.offsetTop - btn.offsetTop;		btn.style.position = "relative";		btn.style.top = v + "px";		if (zk.safari) btn.style.left = "-2px";	}};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -