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

📄 fullpage.js

📁 在线编辑器 非常适合jsf 有兴趣可以研究研究吧
💻 JS
📖 第 1 页 / 共 2 页
字号:
		f.leftmargin.value = style['margin-left'].replace(/[^0-9]/g, '');

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

	if (style['margin-top'])
		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 = tinyMCEPopup.dom.serializeStyle(style);

	// Update colors
	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');
}

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

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

	return '';
}

function updateAction() {
	var f = document.forms[0], nl, i, h, v, s, head, html, l, tmp, addlink = true, ser;

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

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

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

		tmp = tinyMCEPopup.dom.getAttrib(l, 'media');

		if (tinyMCEPopup.dom.getAttrib(l, 'mce_type') == "text/css" && (tmp == "" || tmp == "screen" || tmp == "all") && tinyMCEPopup.dom.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 = doc.createElement('link');

		l.setAttribute('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'));

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

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

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

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

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

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

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

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

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

	ser = tinyMCEPopup.editor.plugins.fullpage._createSerializer();
	ser.setRules('-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 = ser.serialize(doc.documentElement);
	h = h.substring(0, h.lastIndexOf('</body>'));

	if (h.indexOf('<title>') == -1)
		h = h.replace(/<head.*?>/, '$&\n' + '<title>' + tinyMCEPopup.dom.encode(f.metatitle.value) + '</title>');
	else
		h = h.replace(/<title>(.*?)<\/title>/, '<title>' + tinyMCEPopup.dom.encode(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;
	}

	h = h.replace(/type=\"\-mce\-/gi, 'type="');

	tinyMCEPopup.editor.plugins.fullpage.head = h;
	tinyMCEPopup.editor.plugins.fullpage._setBodyAttribs(tinyMCEPopup.editor, {});
	tinyMCEPopup.close();
}

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

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

	nl = he.getElementsByTagName('meta');
	for (i=0; i<nl.length; i++) {
		if (k == 'Content-Type' && tinyMCEPopup.dom.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 (tinyMCEPopup.dom.getAttrib(nl[i], 'name') == k) {
			if (v == '')
				nl[i].parentNode.removeChild(nl[i]);
			else
				nl[i].setAttribute('content', v);
			return;
		}
	}

	if (v == '')
		return;

	m = doc.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 = [];
	p = v.split(/{|}/);

	for (i=0; i<p.length; i+=2) {
		if (p[i] != "")
			r[r.length] = {rule : tinymce.trim(p[i]), data : tinyMCEPopup.dom.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;
}

tinyMCEPopup.onInit.add(init);

⌨️ 快捷键说明

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