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

📄 fullpage.js

📁 AdamCMS是免费开源软件,使用简单功能实用,针对个人和中小型企业能够方便快速的架设自己网站,可自定义模块和文档,自制网站样式风格,使用UTF-8编码,方便发布各种语言的信息,欢迎大家使用
💻 JS
📖 第 1 页 / 共 2 页
字号:
		f.topmargin.value = style['margin-top'].replace(/[^0-9]/g, '');

	if (style['margin-bottom'])
		f.bottommargin.value = style['margin-bottom'].replace(/[^0-9]/g, '');

	f.style.value = tinyMCE.serializeStyle(style);

	updateColor('textcolor_pick', 'textcolor');
	updateColor('bgcolor_pick', 'bgcolor');
	updateColor('visited_color_pick', 'visited_color');
	updateColor('active_color_pick', 'active_color');
	updateColor('link_color_pick', 'link_color');
	//updateColor('hover_color_pick', 'hover_color');
}

function updateAction() {
	var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
	var f = document.forms[0];
	var nl, i, h, v, s, head, html, l, tmp, addlink = true;

	head = topDoc.getElementsByTagName('head')[0];

	// Fix scripts without a type
	nl = topDoc.getElementsByTagName('script');
	for (i=0; i<nl.length; i++) {
		if (tinyMCE.getAttrib(nl[i], 'mce_type') == '')
			nl[i].setAttribute('mce_type', 'text/javascript');
	}

	// Get primary stylesheet
	nl = topDoc.getElementsByTagName("link");
	for (i=0; i<nl.length; i++) {
		l = nl[i];

		tmp = tinyMCE.getAttrib(l, 'media');

		if (tinyMCE.getAttrib(l, 'mce_type') == "text/css" && (tmp == "" || tmp == "screen" || tmp == "all") && tinyMCE.getAttrib(l, 'rel') == "stylesheet") {
			addlink = false;

			if (f.stylesheet.value == '')
				l.parentNode.removeChild(l);
			else
				l.setAttribute('mce_href', f.stylesheet.value);

			break;
		}
	}

	// Add new link
	if (f.stylesheet.value != '') {
		l = topDoc.createElement('link');

		l.setAttribute('mce_type', 'text/css');
		l.setAttribute('mce_href', f.stylesheet.value);
		l.setAttribute('rel', 'stylesheet');

		head.appendChild(l);
	}

	setMeta(head, 'keywords', f.metakeywords.value);
	setMeta(head, 'description', f.metadescription.value);
	setMeta(head, 'author', f.metaauthor.value);
	setMeta(head, 'copyright', f.metacopyright.value);
	setMeta(head, 'robots', getSelectValue(f, 'metarobots'));
	setMeta(head, 'Content-Type', getSelectValue(f, 'docencoding'));

	topDoc.body.dir = getSelectValue(f, 'langdir');
	topDoc.body.style.cssText = f.style.value;

	topDoc.body.setAttribute('vLink', f.visited_color.value);
	topDoc.body.setAttribute('link', f.link_color.value);
	topDoc.body.setAttribute('text', f.textcolor.value);
	topDoc.body.setAttribute('aLink', f.active_color.value);

	topDoc.body.style.fontFamily = getSelectValue(f, 'fontface');
	topDoc.body.style.fontSize = getSelectValue(f, 'fontsize');
	topDoc.body.style.backgroundColor = f.bgcolor.value;

	if (f.leftmargin.value != '')
		topDoc.body.style.marginLeft = f.leftmargin.value + 'px';

	if (f.rightmargin.value != '')
		topDoc.body.style.marginRight = f.rightmargin.value + 'px';

	if (f.bottommargin.value != '')
		topDoc.body.style.marginBottom = f.bottommargin.value + 'px';

	if (f.topmargin.value != '')
		topDoc.body.style.marginTop = f.topmargin.value + 'px';

	html = topDoc.getElementsByTagName('html')[0];
	html.setAttribute('lang', f.langcode.value);
	html.setAttribute('xml:lang', f.langcode.value);

	if (f.bgimage.value != '')
		topDoc.body.style.backgroundImage = "url('" + f.bgimage.value + "')";
	else
		topDoc.body.style.backgroundImage = '';

	inst.cleanup.addRuleStr('-title,meta[http-equiv|name|content],base[href|target],link[href|rel|type|title|media],style[type],script[type|language|src],html[lang|xml:lang|xmlns],body[style|dir|vlink|link|text|alink],head');

	h = inst.cleanup.serializeNodeAsHTML(topDoc.documentElement);

	h = h.substring(0, h.lastIndexOf('</body>'));

	if (h.indexOf('<title>') == -1)
		h = h.replace(/<head.*?>/, '$&\n' + '<title>' + inst.cleanup.xmlEncode(f.metatitle.value) + '</title>');
	else
		h = h.replace(/<title>(.*?)<\/title>/, '<title>' + inst.cleanup.xmlEncode(f.metatitle.value) + '</title>');

	if ((v = getSelectValue(f, 'doctypes')) != '')
		h = v + '\n' + h;

	if (f.xml_pi.checked) {
		s = '<?xml version="1.0"';

		if ((v = getSelectValue(f, 'docencoding')) != '')
			s += ' encoding="' + v + '"';

		s += '?>\n';
		h = s + h;
	}

	inst.fullpageTopContent = h;

	tinyMCEPopup.execCommand('mceFullPageUpdate', false, '');
	tinyMCEPopup.close();
}

function setMeta(he, k, v) {
	var nl, i, m;

	nl = he.getElementsByTagName('meta');
	for (i=0; i<nl.length; i++) {
		if (k == 'Content-Type' && tinyMCE.getAttrib(nl[i], 'http-equiv') == k) {
			if (v == '')
				nl[i].parentNode.removeChild(nl[i]);
			else
				nl[i].setAttribute('content', "text/html; charset=" + v);

			return;
		}

		if (tinyMCE.getAttrib(nl[i], 'name') == k) {
			if (v == '')
				nl[i].parentNode.removeChild(nl[i]);
			else
				nl[i].setAttribute('content', v);
			return;
		}
	}

	if (v == '')
		return;

	m = topDoc.createElement('meta');

	if (k == 'Content-Type')
		m.httpEquiv = k;
	else
		m.setAttribute('name', k);

	m.setAttribute('content', v);
	he.appendChild(m);
}

function parseStyleElement(e) {
	var v = e.innerHTML;
	var p, i, r;

	v = v.replace(/<!--/gi, '');
	v = v.replace(/-->/gi, '');
	v = v.replace(/[\n\r]/gi, '');
	v = v.replace(/\s+/gi, ' ');

	r = new Array();
	p = v.split(/{|}/);

	for (i=0; i<p.length; i+=2) {
		if (p[i] != "")
			r[r.length] = {rule : tinyMCE.trim(p[i]), data : tinyMCE.parseStyle(p[i+1])};
	}

	return r;
}

function serializeStyleElement(d) {
	var i, s, st;

	s = '<!--\n';

	for (i=0; i<d.length; i++) {
		s += d[i].rule + ' {\n';

		st = tinyMCE.serializeStyle(d[i].data);

		if (st != '')
			st += ';';

		s += st.replace(/;/g, ';\n');
		s += '}\n';

		if (i != d.length - 1)
			s += '\n';
	}

	s += '\n-->';

	return s;
}

function getReItem(r, s, i) {
	var c = r.exec(s);

	if (c && c.length > i)
		return c[i];

	return '';
}

function changedStyleField(field) {
	//alert(field.id);
}

function showAddMenu() {
	var re = document.getElementById('addbutton');

	addMenuLayer.moveRelativeTo(re, 'tr');
	if (addMenuLayer.isMSIE)
		addMenuLayer.moveBy(2, 0);

	addMenuLayer.show();
	addMenuLayer.setAutoHide(true, hideAddMenu);
	addMenuLayer.addCSSClass(re, 'selected');
}

function hideAddMenu(l, e, mx, my) {
	var re = document.getElementById('addbutton');
	addMenuLayer.removeCSSClass(re, 'selected');
}

function addHeadElm(type) {
	var le = document.getElementById('headlist');
	var re = document.getElementById('addbutton');
	var te = document.getElementById(type + '_element');

	if (lastElementType)
		lastElementType.style.display = 'none';

	te.style.display = 'block';

	lastElementType = te;

	addMenuLayer.hide();
	addMenuLayer.removeCSSClass(re, 'selected');

	document.getElementById(type + '_updateelement').value = tinyMCE.getLang('lang_insert', 'Insert', true);

	le.size = 10;
}

function updateHeadElm(item) {
	var type = item.substring(0, item.indexOf('_'));
	var le = document.getElementById('headlist');
	var re = document.getElementById('addbutton');
	var te = document.getElementById(type + '_element');

	if (lastElementType)
		lastElementType.style.display = 'none';

	te.style.display = 'block';

	lastElementType = te;

	addMenuLayer.hide();
	addMenuLayer.removeCSSClass(re, 'selected');

	document.getElementById(type + '_updateelement').value = tinyMCE.getLang('lang_update', 'Update', true);

	le.size = 10;
}

function cancelElementUpdate() {
	var le = document.getElementById('headlist');

	if (lastElementType)
		lastElementType.style.display = 'none';

	le.size = 26;
}

⌨️ 快捷键说明

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