From 932d1fb7ce06081c788ea088171fd69ef03cd394 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 6 Aug 2009 15:26:13 -0400 Subject: [PATCH] Move inline javascript to a separate js file --- .../InfiniteScroll/InfiniteScrollPlugin.php | 18 +----------------- plugins/InfiniteScroll/infinitescroll.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 17 deletions(-) create mode 100644 plugins/InfiniteScroll/infinitescroll.js diff --git a/plugins/InfiniteScroll/InfiniteScrollPlugin.php b/plugins/InfiniteScroll/InfiniteScrollPlugin.php index 7e942550ae..1e4a03e4f1 100644 --- a/plugins/InfiniteScroll/InfiniteScrollPlugin.php +++ b/plugins/InfiniteScroll/InfiniteScrollPlugin.php @@ -41,22 +41,6 @@ class InfiniteScrollPlugin extends Plugin function onEndShowScripts($action) { $action->script('plugins/InfiniteScroll/jquery.infinitescroll.min.js'); - $loading_image = common_path('plugins/InfiniteScroll/ajax-loader.gif'); - $js_string = << -jQuery(document).ready(function($){ - $('notices_primary').infinitescroll({ - nextSelector : "li.nav_next a", - loadingImg : "$loading_image", - text : "Loading the next set of posts...", - donetext : "Congratulations, you\'ve reached the end of the Internet.", - navSelector : "div.pagination", - contentSelector : "#notices_primary", - itemSelector : "ol.notices" - }); -}); - -EOT; - $action->raw($js_string); + $action->script('plugins/InfiniteScroll/infinitescroll.js'); } } diff --git a/plugins/InfiniteScroll/infinitescroll.js b/plugins/InfiniteScroll/infinitescroll.js new file mode 100644 index 0000000000..b80bd4ec5e --- /dev/null +++ b/plugins/InfiniteScroll/infinitescroll.js @@ -0,0 +1,12 @@ +jQuery(document).ready(function($){ + $('notices_primary').infinitescroll({ + nextSelector : "li.nav_next a", + loadingImg : $('address .url')[0].href+'plugins/InfiniteScroll/ajax-loader.gif', + text : "Loading the next set of posts...", + donetext : "Congratulations, you\'ve reached the end of the Internet.", + navSelector : "div.pagination", + contentSelector : "#notices_primary", + itemSelector : "ol.notices" + }); +}); + -- 2.39.5