Alexander Nazarov (nfokz) wrote in changelog,
Alexander Nazarov
nfokz
changelog

[livejournal] r22662: LJSUP-12123: Font-size select dialog

Committer: anazarov
LJSUP-12123: Font-size select dialog
U   trunk/htdocs/js/ck/config.js
U   trunk/htdocs/js/ck/plugins/livejournal/plugin.js
Modified: trunk/htdocs/js/ck/config.js
===================================================================
--- trunk/htdocs/js/ck/config.js	2012-08-15 14:19:19 UTC (rev 22661)
+++ trunk/htdocs/js/ck/config.js	2012-08-15 14:25:23 UTC (rev 22662)
@@ -206,6 +206,22 @@
 	if (!Site.page.ljpost) {
 		config.protectedSource.push(/<lj-poll-\d+\s*\/?>/gi); // created lj polls;
 	}
+
+	config.LJFontDefault = 'normal'; 
+
+	config.LJFontStyle = {
+		element: 'span',
+		styles: { 'font-size' : '#(size)' },
+		overrides: [ { element : 'font', attributes : { 'size' : null } } ]
+	};
+
+	config.LJFontSize = {
+		tiny: '0.7em',
+		small: '0.9em',
+		normal: '1.0em',
+		large: '1.4em',
+		huge: '1.8em'
+	};
 	
 	config.protectedSource.push(/<lj-replace name="first_post"\s*\/?>/gi);
 };

Modified: trunk/htdocs/js/ck/plugins/livejournal/plugin.js
===================================================================
--- trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2012-08-15 14:19:19 UTC (rev 22661)
+++ trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2012-08-15 14:25:23 UTC (rev 22662)
@@ -584,30 +584,15 @@
 					hooked = false,
 					styles = {},
 					defaultFont = 'normal',  // This value probably should not be hardcoded
-					currentFont = defaultFont,
-					sizes = config.fontSize_sizes,
-					style = config.fontSize_style,
+					currentFont = config.LJFontDefault,
+					sizes = config.LJFontSize,
+					style = config.LJFontStyle,
 					selectedItem = 'b-fontsize-select-item-active',
 					i, part, vars, name, $items = jQuery();
 
-				sizes = sizes.split(';');
-
-				for (i = 0; i < sizes.length; i++) {
-					part = sizes[i];
-
-					if (part) {
-						part = part.split( '/' );
-
-						vars = {};
-						name = sizes[i] = part[0].toLowerCase();
-
-						vars['size'] = part[1] || name;
-
-						styles[name] = new CKEDITOR.style(style, vars);
-						styles[name]._.definition.name = name;
-					} else {
-						sizes.splice(i--, 1);
-					}
+				for (name in sizes) {
+					styles[name] = new CKEDITOR.style(style, { size: sizes[name] });
+					styles[name]._.definition.name = name;
 				}
 
 				function setValue(value) {

Tags: anazarov, js, livejournal, nfokz
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments