Use inlineScript() everywhere inline scripts are written
This commit is contained in:
parent
aab7344002
commit
4c8bed8ba0
|
@ -154,8 +154,7 @@ class MessageForm extends Form
|
|||
|
||||
$contentLimit = Message::maxContent();
|
||||
|
||||
$this->out->element('script', array('type' => 'text/javascript'),
|
||||
'maxLength = ' . $contentLimit . ';');
|
||||
$this->out->inlineScript('maxLength = ' . $contentLimit . ';');
|
||||
|
||||
if ($contentLimit > 0) {
|
||||
$this->out->elementStart('dl', 'form_note');
|
||||
|
|
|
@ -178,8 +178,7 @@ class NoticeForm extends Form
|
|||
|
||||
$contentLimit = Notice::maxContent();
|
||||
|
||||
$this->out->element('script', array('type' => 'text/javascript'),
|
||||
'maxLength = ' . $contentLimit . ';');
|
||||
$this->out->inlineScript('maxLength = ' . $contentLimit . ';');
|
||||
|
||||
if ($contentLimit > 0) {
|
||||
$this->out->elementStart('dl', 'form_note');
|
||||
|
|
|
@ -185,7 +185,6 @@ class FacebookPlugin extends Plugin
|
|||
// XXX: Facebook says we don't need this FB_RequireFeatures(),
|
||||
// but we actually do, for IE and Safari. Gar.
|
||||
|
||||
$js = '<script type="text/javascript">';
|
||||
$js .= ' $(document).ready(function () {';
|
||||
$js .= ' FB_RequireFeatures(';
|
||||
$js .= ' ["XFBML"], function() {';
|
||||
|
@ -219,7 +218,6 @@ class FacebookPlugin extends Plugin
|
|||
$js .= ' }';
|
||||
$js .= ' );';
|
||||
$js .= ' });';
|
||||
$js .= '</script>';
|
||||
|
||||
$js = sprintf($js, $apikey, $login_url, $logout_url);
|
||||
|
||||
|
@ -227,7 +225,7 @@ class FacebookPlugin extends Plugin
|
|||
|
||||
$js = str_replace(' ', '', $js);
|
||||
|
||||
$action->raw(" $js"); // leading two spaces to make it line up
|
||||
$action->inlineScript($js);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -67,11 +67,7 @@ class GoogleAnalyticsPlugin extends Plugin
|
|||
'pageTracker._trackPageview();'.
|
||||
'} catch(err) {}',
|
||||
$this->code);
|
||||
$action->elementStart('script', array('type' => 'text/javascript'));
|
||||
$action->raw($js1);
|
||||
$action->elementEnd('script');
|
||||
$action->elementStart('script', array('type' => 'text/javascript'));
|
||||
$action->raw($js2);
|
||||
$action->elementEnd('script');
|
||||
$action->inlineScript($js1);
|
||||
$action->inlineScript($js2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,25 +81,20 @@ class PiwikAnalyticsPlugin extends Plugin
|
|||
|
||||
function onEndShowScripts($action)
|
||||
{
|
||||
$piwikCode = <<<ENDOFPIWIK
|
||||
|
||||
<!-- Piwik -->
|
||||
<script type="text/javascript">
|
||||
$piwikCode1 = <<<ENDOFPIWIK
|
||||
var pkBaseURL = (("https:" == document.location.protocol) ? "https://{$this->piwikroot}" : "http://{$this->piwikroot}");
|
||||
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
ENDOFPIWIK;
|
||||
$piwikCode2 = <<<ENDOFPIWIK
|
||||
try {
|
||||
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", {$this->piwikId});
|
||||
piwikTracker.trackPageView();
|
||||
piwikTracker.enableLinkTracking();
|
||||
} catch( err ) {}
|
||||
</script>
|
||||
<!-- End Piwik Tag -->
|
||||
|
||||
ENDOFPIWIK;
|
||||
|
||||
$action->raw($piwikCode);
|
||||
$action->inlineScript($piwikCode1);
|
||||
$action->inlineScript($piwikCode2);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,15 +105,11 @@ class RealtimePlugin extends Plugin
|
|||
$realtimeUI = ' RealtimeUpdate.initActions("'.$url.'", "'.$timeline.'", "'. $pluginPath .'");';
|
||||
}
|
||||
|
||||
$action->elementStart('script', array('type' => 'text/javascript'));
|
||||
|
||||
$script = ' $(document).ready(function() { '.
|
||||
$realtimeUI.
|
||||
$this->_updateInitialize($timeline, $user_id).
|
||||
'}); ';
|
||||
$action->raw($script);
|
||||
|
||||
$action->elementEnd('script');
|
||||
$action->inlineScript($script);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -145,9 +145,7 @@ class UserFlagPlugin extends Plugin
|
|||
|
||||
function onEndShowScripts($action)
|
||||
{
|
||||
$action->elementStart('script', array('type' => 'text/javascript'));
|
||||
$action->raw('/*<![CDATA[*/ if ($(".form_entity_flag").length > 0) { SN.U.FormXHR($(".form_entity_flag")); } /*]]>*/');
|
||||
$action->elementEnd('script');
|
||||
$action->inlineScript('if ($(".form_entity_flag").length > 0) { SN.U.FormXHR($(".form_entity_flag")); }');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user