Split up the files, and move the inline script to below the existing
library tags.
Patch by fu.
diffs (67 lines):
diff -r 0a7dcc4d9f1f -r 8b4914e597b4 cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm Fri Oct 29 19:03:05 2010 +0800
+++ b/cgi-bin/LJ/S2.pm Fri Oct 29 19:36:06 2010 +0800
@@ -160,10 +160,29 @@ sub make_journal
# like print_stylesheet() won't run, which don't have an method invocant
return $page if $page && ref $page ne 'HASH';
+ # Control strip
+ my $show_control_strip = LJ::Hooks::run_hook( 'show_control_strip' );
+ if ($show_control_strip) {
+ LJ::Hooks::run_hook( 'control_strip_stylesheet_link' );
+
+ LJ::need_res(qw(
+ js/core.js
+ js/dom.js
+ js/httpreq.js
+ js/livejournal.js
+ js/md5.js
+ js/login.js
+ ));
+ }
+
# Include any head stc or js head content
LJ::Hooks::run_hooks("need_res_for_journals", $u);
my $extra_js = LJ::statusvis_message_js($u);
$page->{head_content} .= LJ::res_includes() . $extra_js;
+
+ # inject the control strip JS, but only after any libraries have been
injected
+ $page->{head_content} .= LJ::control_strip_js_inject( user => $u->user )
+ if( $show_control_strip );
s2_run($r, $ctx, $opts, $entry, $page);
@@ -2120,13 +2139,6 @@ sub Page
# other useful link rels
$p->{head_content} .= qq{<link rel="help" href="$LJ::SITEROOT/support/faq"
/>\n};
- # Control strip
- my $show_control_strip = LJ::Hooks::run_hook( 'show_control_strip' );
- if ($show_control_strip) {
- LJ::Hooks::run_hook( 'control_strip_stylesheet_link' );
- $p->{'head_content'} .= LJ::control_strip_js_inject( user =>
$u->{user} );
- }
-
# FOAF autodiscovery
my $foafurl = $u->{external_foaf_url} ? LJ::eurl($u->{external_foaf_url})
: "$p->{base_url}/data/foaf";
$p->{head_content} .= qq{<link rel="meta" type="application/rdf+xml"
title="FOAF" href="$foafurl" />\n};
diff -r 0a7dcc4d9f1f -r 8b4914e597b4 cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl Fri Oct 29 19:03:05 2010 +0800
+++ b/cgi-bin/weblib.pl Fri Oct 29 19:36:06 2010 +0800
@@ -2887,16 +2887,6 @@ sub control_strip_js_inject
my $ret;
- $ret .= "<script src='$LJ::JSPREFIX/core.js'
type='text/javascript'></script>\n";
- $ret .= "<script src='$LJ::JSPREFIX/dom.js'
type='text/javascript'></script>\n";
- $ret .= "<script src='$LJ::JSPREFIX/httpreq.js'
type='text/javascript'></script>\n";
-
- LJ::need_res(qw(
- js/livejournal.js
- js/md5.js
- js/login.js
- ));
-
my $r = DW::Request->get;
my $baseuri = $r->header_in( 'Host' ) . $r->uri;
my $args = LJ::eurl( $r->query_string ) || '';
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog