1 /** 2 * @namespace plone.org site mobilization 3 * 4 * @requires mobilizePlone 5 */ 6 var mobilizePloneOrg = { 7 8 constructBody : function() { 9 10 // Move body to jQuery template 11 //if(window.location.pathname == "/") { 12 //} 13 14 this.constructFrontPage(); 15 16 this.constructHeader(); 17 this.constructFooter(); 18 }, 19 20 /** 21 * Use h1 class="documentFirstHeading" as mobile page title if available, 22 * otherwise use head title. 23 */ 24 constructHeader : function() { 25 // Set page heading from <title> tag 26 var title = jq("head title").text(); 27 jq("#mobile-body div[data-role=header]").append("<h1>" + title + "</h1>"); 28 }, 29 30 /** 31 * Use plone.org footer as is in mobile site footer 32 */ 33 constructFooter : function() { 34 jq("#mobile-body div[data-role=footer]").append(jq("#footer p")); 35 }, 36 37 38 /** 39 * Construct mobile front page based on plone.org front page web input 40 */ 41 constructFrontPage : function() { 42 43 44 // Move box on the left hand to body first 45 var content = jq("#mobile-body div[data-role=content]"); 46 if(content.size() == 0) { 47 throw "No template content section to fill in"; 48 } 49 50 content.append(jq("#current")); 51 52 var mainNavigation = mobilize.createNavigationBox(jq("#main-nav a"), "Site sections"); 53 content.append(mainNavigation); 54 55 var news = mobilize.createNavigationBox(jq("#news li").not(":contains('Add news')"), "News", mobilize.outputCollectionLink); 56 content.append(news); 57 58 var events = mobilize.createNavigationBox(jq("#events li").not(":contains('Add event')"), "Events", mobilize.outputCollectionLink); 59 content.append(events); 60 61 } 62 }; 63 64