Permalink
Browse files

added local copy of sausage and tweaked js formatting to match existing;

  • Loading branch information...
1 parent 6c9704a commit 4c2ad9468f4ea57001748d8da07794a9ece9dba5 @christophercliff christophercliff committed Jul 3, 2011
Showing with 35 additions and 51 deletions.
  1. +29 −51 script.js
  2. +6 −0 script/all/jquery.sausage.js
View
@@ -79,7 +79,7 @@ var l10n = {
var scripts = [
"http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js",
"https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js",
- "https://github.com/christophercliff/sausage/raw/master/jquery.sausage.js",
+ "/script/all/jquery.sausage.js",
"http://www.google-analytics.com/ga.js"
];
@@ -315,59 +315,37 @@ function autolink() {
}
function chop() {
-
- var $content = $(".content"),
- $sections = $("<div/>"),
- $as = $content.find("a.anchor"),
- j = -1;
-
- $as
- .each(function(i, el){
-
- $sections
- .append("<section/>")
- ;
-
- })
- ;
-
- $content.children()
- .each(function(i, el){
-
- var $el = $(el),
- $section;
-
- if ($el.hasClass("anchor"))
- {
- j++;
- }
-
- $section = $sections.find("section").eq(j) || $sections;
-
- $section
- .append($(el).clone())
- ;
-
- })
- ;
-
- $content
- .html($sections)
- ;
-
+ var $content = $(".content");
+ var $sections = $("<div/>");
+ var $as = $content.find("a.anchor");
+ var j = -1;
+ $as.each(function(i, el) {
+ $sections.append("<section/>");
+ });
+ $content.children().each(function(i, el) {
+ var $el = $(el);
+ var $section;
+ if ($el.hasClass("anchor")) {
+ j++;
+ }
+ $section = $sections.find("section").eq(j) || $sections;
+ $section.append($(el).clone());
+ });
+ $content.html($sections);
}
function sausage() {
- $(window)
- .sausage({
- page: "section",
- content: function (i, $page) {
- return "<span class='sausage-span'>"
- + $page.find(".anchor").first().text()
- + "</span>";
- }
- })
- ;
+ if ($("section").length < 1) {
+ return;
+ }
+ $(window).sausage({
+ page: "section",
+ content: function(i, $page) {
+ return "<span class='sausage-span'>"
+ + $page.find(".anchor").first().text()
+ + "</span>";
+ }
+ });
}
function get_lang() {
Oops, something went wrong.

0 comments on commit 4c2ad94

Please sign in to comment.