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

📄 ocmsimagegallery.js

📁 找了很久才找到到源代码
💻 JS
📖 第 1 页 / 共 2 页
字号:
			result += vfsPathPlugin + "buttons/nav_step_forward.png";
			result += "\" border=\"0\" alt=\"\" width=\"16\" height=\"16\">";
			result += "</a> ";
			// build the "to end" link
			result += "<a href=\"javascript:buildHtmlGalleryItems(" + pageCount + ");\"><img src=\"";
			result += vfsPathPlugin + "buttons/nav_end.png";
			result += "\" border=\"0\" alt=\"\" width=\"16\" height=\"16\">";
			result += "</a>";
		} else {
			// build the "Next" image
			result += "<img src=\"";
			result += vfsPathPlugin + "buttons/nav_step_forward_i.png";
			result += "\" border=\"0\" alt=\"\" width=\"16\" height=\"16\"> ";
			// build the "to end" image
			result += "<img src=\"";
			result += vfsPathPlugin + "buttons/nav_end_i.png";
			result += "\" border=\"0\" alt=\"\" width=\"16\" height=\"16\">";

		}
		result += "</td></tr></table>";
	} else {
		result += "<span class=\"gallerypageactive \">&nbsp;</span>";
	}

	result += "</td></tr>\n";
	result += "</table>";

	var elem = document.getElementById("galleryitems");
	elem.innerHTML = result;
}

/* stores the hide image info timeout to interrupt it on a mouseover */
var imgDetailTimeout;

/* shows the additional image information (called on mouseover) */
function showGalleryImageInfo(imgIndex, idPrefix, currImg, showAll) {
	clearTimeout(imgDetailTimeout);
	if (imgIndex != -1 && currImg == null) {
		currImg = gItems[imgIndex];
	}
	if (idPrefix == null) {
		idPrefix = "galleryimage";
	}
	var imgName = "<span title=\"";
	imgName += currImg.url;
	imgName += "\">";
	imgName += currImg.url.substring(currImg.url.lastIndexOf("/") + 1);
	imgName += "</span>";
	var stateTxt = "";
	if (currImg.state == 1) {
		// changed image
		stateTxt = GetE("imgStateChanged").innerHTML;
		GetE(idPrefix + "state").className = "stateinfochanged";
	} else if (currImg.state == 2) {
		// new image
		stateTxt = GetE("imgStateNew").innerHTML;
		GetE(idPrefix + "state").className = "stateinfonew";
	}
	GetE(idPrefix + "state").innerHTML = stateTxt;
	GetE(idPrefix + "name").innerHTML = imgName;
	GetE(idPrefix + "title").innerHTML = currImg.title;
	GetE(idPrefix + "type").innerHTML = getImageType(currImg.type);
	GetE(idPrefix + "dc").innerHTML = currImg.dateCreated;
	GetE(idPrefix + "dm").innerHTML = currImg.dateModified;
	GetE(idPrefix + "id").innerHTML = currImg.structureId;
	if (showAll != null && showAll == true) {
		GetE(idPrefix + "format").innerHTML = currImg.width + " x " + currImg.height;
		GetE(idPrefix + "size").innerHTML = currImg.size;
		if (GetE("txtAlt").value == "") {
			GetE("txtAlt").value = currImg.title;
		}
	}
	
}

/* hides the additional image information delayed (called on mouseout) */
function hideGalleryImageInfo() {
	imgDetailTimeout = setTimeout("doHideGalleryImageInfo()", 350);
}

/* hides the additional image information */
function doHideGalleryImageInfo() {
	GetE("galleryimagestate").innerHTML = "";
	GetE("galleryimagename").innerHTML = "";
	GetE("galleryimagetitle").innerHTML = "";
	GetE("galleryimagetype").innerHTML = "";
	GetE("galleryimagedc").innerHTML = "";
	GetE("galleryimagedm").innerHTML = "";
	GetE("galleryimageid").innerHTML = "";
}

/* ######### General dialog helper methods ######### */

function setAltText() {
	GetE("txtAlt").value = activeImage.title;
}

function setCopyrightText() {
	var copyText = activeImage.copyright;
	if (copyText == null) {
		copyText = "";
	} else {
		copyText = "&copy; " + copyText;
	}
	GetE("txtCopyrightText").value = copyText;
}

function setImageBorder() {
	if (insertImageBorder()) {
		var hSp = GetE("txtHSpace").value;
		if (hSp == "") {
			GetE("txtHSpace").value = "5";
		}
		var vSp = GetE("txtVSpace").value;
		if (vSp == "") {
			GetE("txtVSpace").value = "5";
		}
	} else {
		GetE("txtHSpace").value = "";
		GetE("txtVSpace").value = "";
	}
}

function setSize(dimension, val) {
	if (val == null || val == "") {
		return;
	}
	if (dimension == "Height") {
		GetE("txtHeight").value = val;
		GetE("txtWidthPreset").selectedIndex = 0;
	} else {
		GetE("txtWidth").value = val;
		GetE("txtHeightPreset").selectedIndex = 0;
	}
	OnSizeChanged(dimension,val);
}

/* determines the image type, e.g. gif or jpg image */
function getImageType(imgSuffix) {
	if (imgSuffix == null || imgSuffix .length == 0) {
		return "";
	}
	if (imgSuffix == "gif") {
		return FCKLang.DlgImgDetailTypegif;
	}
	if (imgSuffix == "jpg" || imgSuffix == "jpeg") {
		return FCKLang.DlgImgDetailTypejpg;
	}
	if (imgSuffix == "png") {
		return FCKLang.DlgImgDetailTypepng;
	}
	if (imgSuffix == "tif" || imgSuffix == "tiff") {
		return FCKLang.DlgImgDetailTypetif;
	}
	if (imgSuffix == "bmp") {
		return FCKLang.DlgImgDetailTypebmp;
	}
	return FCKLang.DlgImgDetailTypeNo; 
}

function insertSubTitle() {
	return checkChecked("txtSubtitle");
}

function insertCopyright() {
	return checkChecked("txtCopyright");
}

function insertLinkToOriginal() {
	return checkChecked("txtLinkOriginal");
}

function insertImageBorder() {
	return checkChecked("txtImageBorder");
}


function checkChecked(elemName) {
	var elem = GetE(elemName);
	if (elem) {
		return elem.checked;
	}
	return false;
}

/* ######### Definition of objects usable in dialog and methods to create them ######### */

/* represents an image file to display in the gallery */
var ImgFile = function(sitePath, url, link, title, width, height, size, dateCreated, dateModified, structureId, type, hashCode, state, copyright) {
	this.sitePath = sitePath;
	this.url = url;
	this.link = link;
	this.title = title;
	this.width = width;
	this.height = height;
	this.size = size;
	this.dateCreated = dateCreated;
	this.dateModified = dateModified;
	this.structureId = structureId;
	this.type = type;
	this.hashCode = hashCode;
	this.state = state;
	this.copyright = copyright;
}

/* represents an image scaler to use */
var OCmsScaler = function(width, height, type, color, quality) {
	this.width = width;
	this.height = height;
	this.type = 4;
	if (type != null) {
		this.type = type;
	}
	this.color = "#FFFFFF";
	if (color != null) {
		this.color = color;
	}
	this.quality = -1;
	if (quality != null) {
		this.quality = quality;
	}

}

/* image scaler method to get the members as vails request parameter string */
OCmsScaler.prototype.toParams = function() {
	var result = "?";
	result += paramScale;
	result += "="
	if(!isEmpty(this.width)) {
		result += "w:";
		result += this.width;
	}
	if(!isEmpty(this.height)) {
		if(!isEmpty(this.width)) {
			result += ",";
		}
		result += "h:";
		result += this.height;
	}
	result += ",t:";
	result += this.type;
	result += ",c:";
	if (this.color.charAt(0) == "#") {
		result += this.color.substring(1);
	} else {
		result += this.color;
	}
	if (this.quality > -1) {
		result += ",q:";
		result += this.quality;
	}
	return result;
}

/* helper for testing for empty string. */
function isEmpty(string) {
	return (string == null) || (string == "");
}

/* returns an initialized scaler object generated from the given parameter */
function createScaler(paramValue) {
	var width = getScalerSettingFromString("w", paramValue);
	var height = getScalerSettingFromString("h", paramValue);
	var type = getScalerSettingFromString("t", paramValue);
	var col = getScalerSettingFromString("c", paramValue);
	if (col != null) {
		col = "#" + col;
	}
	var q = getScalerSettingFromString("q", paramValue);
	return new OCmsScaler(width, height, type, col, q);
}

/* helper method that returns a scaler setting value from a parameter string */
function getScalerSettingFromString(setting, paramValue) {
	var checkValue = paramValue;
	var begin = setting + ":";
	var settingStart = checkValue.indexOf(begin);
	if (settingStart != -1) {
		checkValue = checkValue.substring(settingStart + begin.length);
		var settingEnd = checkValue.indexOf(",");
		if (settingEnd != -1) {
			checkValue = checkValue.substring(0, settingEnd);
		}
		return checkValue;
	}
	return null;
}

⌨️ 快捷键说明

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