can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[livejournal] r22130: LJSUP-11909: Fast Repost feature

Committer: dpetrov
LJSUP-11909: Fast Repost feature
U   trunk/cgi-bin/LJ/Widget/EntryChooser.pm
U   trunk/htdocs/js/basic.js
Modified: trunk/cgi-bin/LJ/Widget/EntryChooser.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/EntryChooser.pm	2012-05-31 11:07:07 UTC (rev 22129)
+++ trunk/cgi-bin/LJ/Widget/EntryChooser.pm	2012-05-31 11:28:50 UTC (rev 22130)
@@ -5,7 +5,10 @@
 use base qw( LJ::Widget::Template );
 
 sub need_res {
-    qw(stc/widgets/entrychooser.css);
+    qw(
+        stc/widgets/entrychooser.css
+        js/jquery/jquery.lj.editentriesmanager.js
+    );
 }
 
 sub template_filename {

Modified: trunk/htdocs/js/basic.js
===================================================================
--- trunk/htdocs/js/basic.js	2012-05-31 11:07:07 UTC (rev 22129)
+++ trunk/htdocs/js/basic.js	2012-05-31 11:28:50 UTC (rev 22130)
@@ -383,9 +383,8 @@
 
 (function() {
 	var base = (LJ.pageVar('siteroot', true) || 'http://www.livejournal.com')
-						.replace('http://www', '')
-						.replace(/\./, '\\.'),
-		journalReg  = new RegExp('^http:\\/\\/(\\w+)' + base + '(?:\\/(?:(\\w+)\\/)?(?:(\\d+)\\.html)?)?$');
+						.replace('http://www', ''),
+		journalReg  = new RegExp('^http:\\/\\/(\\w+)' + base.replace(/\./, '\\.') + '(?:\\/(?:(\\w+)\\/)?(?:(\\d+)\\.html)?)?$');
 
 	/**
 	 * Parse journal link to retrieve information from it
@@ -420,6 +419,38 @@
 		return result;
 	};
 
+	/**
+	 * Render journal link according to the standard scheme.
+	 *
+	 * @param {string} journal Journal name.
+	 * @param {string|number}  ditemid Id of the post in the journal.
+	 * @param {boolean} iscomm Whether to treat the journal as community.
+	 *
+	 * @return {string|null} Result is a link to the journal page or null if no journal was specified.
+	 */
+	LJ.Util.Journal.renderLink = function(journal, ditemid, iscomm) {
+		if (!journal) {
+			return null;
+		}
+
+		var url = 'http://';
+		if (iscomm) {
+			url += 'community' + base + '/' + journal;
+		} else if (journal.match(/^_|_$/)) {
+			url += 'users' + base + '/' + journal;
+		} else {
+			url += journal.replace(/_/g, '-') + base;
+		}
+
+		url += '/';
+
+		if (ditemid) {
+			url += ditemid + '.html';
+		}
+
+		return url;
+	};
+
 }());
 
 /**

Tags: can3p, dpetrov, js, livejournal, pm
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