Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

New Reference Reveal code + Toggle code #218

Closed
wants to merge 6 commits into from

2 participants

Yuvi Panda Jon Robson
Yuvi Panda
Owner
  1. Uses Reference reveal from MF
  2. Uses toggle.js code from MF (see #217)
Yuvi Panda
Owner

I also suppose that the .patch file should be eliminated - and the appropriate changes should be made in MF itself

Yuvi Panda
Owner

Doctored commits to make the page.js deserialize removal into a separate commit

Jon Robson jdlrobson referenced this pull request
Closed

Fix saved pages again #221

Jon Robson
Collaborator

Please remove mf-patches.diff

Yuvi Panda
Owner

I just pushed that.

Jon Robson jdlrobson closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
2  assets/www/MobileFrontend
... ...
@@ -1 +1 @@
1  
-Subproject commit 70678ffddd08c94df9237af1c78e031b05161a4f
  1
+Subproject commit 1c33a9b6f78be77e1cc2598dd860f008a20f5be4
11  assets/www/index.html
@@ -54,6 +54,8 @@
54 54
 	
55 55
 	<!-- MobileFrontend -->
56 56
 	<script type="text/javascript" charset="utf-8" src="js/mobilefrontend.js"></script>
  57
+	<script type="text/javascript" charset="utf-8" src="MobileFrontend/javascripts/toggle.js"></script>
  58
+	<script type="text/javascript" charset="utf-8" src="MobileFrontend/javascripts/references.js"></script>
57 59
 
58 60
 	<!-- platform-specific setup and overrides -->
59 61
   <script type="text/javascript" charset="utf-8" src="js/platform-stub.js"></script>
@@ -63,6 +65,7 @@
63 65
 	<link rel="stylesheet" href="MobileFrontend/stylesheets/beta_common.css" />
64 66
 	<link rel="stylesheet" href="MobileFrontend/stylesheets/hacks.css" />
65 67
 	<link rel="stylesheet" href="MobileFrontend/stylesheets/sections.css" />
  68
+	<link rel="stylesheet" href="MobileFrontend/stylesheets/references.css" />
66 69
 	<link rel="stylesheet" href="app.css" />
67 70
 
68 71
 </head>
@@ -147,8 +150,12 @@
147 150
             </div>
148 151
 			{{#sections}}
149 152
 			<div class="section">
150  
-				<h{{level}} class="section_heading" data-section-id="{{id}}">{{{line}}} <button></button></h{{level}}>
151  
-				<div class="content_block" id="content_{{id}}"> </div>
  153
+				<h{{level}} class="section_heading" id="section_{{id}}" data-section-id="{{id}}">{{{line}}} <button></button></h{{level}}>
  154
+				<div class="content_block" id="content_{{id}}">
  155
+					{{#references}}
  156
+						{{{text}}}
  157
+					{{/references}}
  158
+				</div>
152 159
 			</div>
153 160
 			{{/sections}}
154 161
 		</script>
1  assets/www/js/app.js
@@ -38,7 +38,6 @@ window.app = function() {
38 38
 
39 39
 		setPageActionsState(true);
40 40
 		setMenuItemState('read-in', true);
41  
-		MobileFrontend.init();
42 41
 		chrome.setupScrolling("#content");
43 42
 		chrome.scrollTo("#content", 0);
44 43
 		appHistory.addCurrentPage();
13  assets/www/js/chrome.js
@@ -31,6 +31,7 @@ window.chrome = function() {
31 31
 		}
32 32
 		$("#main").html(page.toHtml());
33 33
 
  34
+		MobileFrontend.references.init($("#main")[0], true); 
34 35
 		handleSectionExpansion();
35 36
 	}
36 37
 
@@ -42,18 +43,10 @@ window.chrome = function() {
42 43
 			if(!$contentBlock.data('populated')) {
43 44
 				var sectionHtml = app.curPage.getSectionHtml(sectionID);
44 45
 				$contentBlock.append($(sectionHtml)).data('populated', true);
  46
+				MobileFrontend.references.init($contentBlock[0], false); 
45 47
 			} 
46 48
 
47  
-			// TODO: this should use the same code as MFE
48  
-			if($contentBlock.hasClass('openSection')) {
49  
-				$contentBlock.removeClass('openSection');
50  
-				$btn.removeClass('openSection');
51  
-				$contentBlock.prev('.section_heading').removeClass('openSection');
52  
-			} else {
53  
-				$contentBlock.addClass('openSection');
54  
-				$btn.addClass('openSection');
55  
-				$contentBlock.prev('.section_heading').addClass('openSection');
56  
-			}
  49
+			MobileFrontend.toggle.wm_toggle_section(sectionID);
57 50
 			chrome.setupScrolling("#content");
58 51
 		});
59 52
 	}
3  assets/www/js/mobilefrontend.js
... ...
@@ -1,7 +1,8 @@
1 1
 MobileFrontend = (function() {
2 2
 	return {
3 3
 		init: function() {
4  
-			//MobileFrontend.toggle.init();
  4
+		},
  5
+		registerModule: function() {
5 6
 		},
6 7
 		message: function(name) {
7 8
 			return mw.message(name).plain();
7  assets/www/js/page.js
@@ -6,10 +6,6 @@
6 6
 		this.lang = lang;
7 7
 	};
8 8
 
9  
-	Page.deserialize = function(data) {
10  
-		return new Page(data.title, data.lead, data.sections);
11  
-	};
12  
-
13 9
 	Page.fromRawJSON = function(title, rawJSON, lang) {
14 10
 		var lead = {};
15 11
 		var sections = [];
@@ -25,6 +21,9 @@
25 21
 				lastCollapsibleSection = section;
26 22
 				return;
27 23
 			} 
  24
+			if(typeof section.references !== "undefined") {
  25
+				section.references = true;
  26
+			}
28 27
 			// Only consider leve 2 sections as 'sections'
29 28
 			// Group *all* subsections under them, no matter which level they are at
30 29
 			if(section.level == 2) {
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.