Commits

Philippe Casgrain committed f469180

Version 2.0 for the new WIkipedia campaign

Comments (0)

Files changed (4)

Wikipedia aitalian.safariextension/Info.plist

 <dict>
 	<key>Author</key>
 	<string>Philippe Casgrain</string>
+	<key>Builder Version</key>
+	<string>7534.51.22</string>
 	<key>CFBundleDisplayName</key>
 	<string>Wikipedia Angelo Italiano</string>
 	<key>CFBundleIdentifier</key>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<key>CFBundleShortVersionString</key>
-	<string>1.0</string>
+	<string>2.0</string>
 	<key>CFBundleVersion</key>
 	<string>5</string>
 	<key>Chrome</key>

Wikipedia aitalian.safariextension/aitalian-appeal-normal.jpg

Old
Old image
New
New image

Wikipedia aitalian.safariextension/inject.js

+var newmsg = document.createElement('div');
+newmsg.setAttribute('id', 'cn-bold-blue-text');
+newmsg.appendChild(document.createTextNode('Please read:'));
+newmsg.appendChild(document.createElement('br'));
+newmsg.appendChild(document.createTextNode('A personal appeal from'));
+newmsg.appendChild(document.createElement('br'));
+newmsg.appendChild(document.createTextNode('Angelo Italiano'));
 
-var weAreChanging = false
-
-function getJABanner13() {
-	if( document.getElementById( "JABanner13" ) )
-		return document.getElementById( "cn-bold-blue-text" );
+function DocHasLoaded()
+{
+    if (document.getElementById('cn-bold-blue-text') != null)
+    {
+        if (document.getElementById('text-line-2') != null)
+        {
+            document.getElementById('text-line-1').firstChild.nodeValue="A personal appeal from";
+            document.getElementById('text-line-2').firstChild.nodeValue="Angelo Italiano";
+        }
+        else
+        {
+            var oldmsg = document.getElementById('cn-bold-blue-text');
+            var parentmsg = oldmsg.parentNode;
+            parentmsg.replaceChild(newmsg, omsg);
+        }
+        document.getElementById('cn-bold-blue-text').parentNode.parentNode.style.backgroundImage = "url(http://apps.casgrain.com/safari/aitalian/aitalian-appeal-normal.jpg)";
+        document.getElementById('cn-bold-blue-text').parentNode.parentNode.style.backgroundSize = "155px";
+    }
 }
 
-function replaceAppeal() {
-	if( weAreChanging )
-		return;
-
-	weAreChanging = true
-	
-	var elt
-	function getElt( name ) {
-		if( !elt )
-			elt = document.getElementById( name )
-	}
-	
-	getElt( "JA1banner3-text" );
-	
-	getElt( "EditorBanner1A-text" );
-	getElt( "EditorBanner2A-text" );
-	getElt( "EditorBanner3A-text" );
-	getElt( "EditorBanner4A-text" );
-	getElt( "EditorBanner5A-text" );
-	getElt( "EditorBanner6A-text" );
-	getElt( "EditorBanner7A-text" );
-	getElt( "EditorBanner8A-text" );
-	getElt( "EditorBanner9A-text" );
-	
-	// special cases:
-	
-	if( !elt ) {
-		if( document.getElementById( "JABanner13" ) ||
-				document.getElementById( "JABanner25A" ) ||
-				document.getElementById( "JA1Banner11" ) )
-			elt = document.getElementById( "cn-bold-blue-text" );
-				// This may be too-general a replacement, but since it was
-				// specified as the ID, not class, other elements *shouldn't*
-				// be using it.
-	}
-	
-	// replace the content:
-	
-	if( elt )
-		elt.innerHTML = "<span><a href=\"http://tumblr.seoulbrother.com/post/2065345794/six-years-ago-wikipedia-started-with-a-radical\">Please read:<br>A personal appeal from<br>Angelo Italiano</a></span><div id=notice-button></div>";
-	
-	weAreChanging = false;
-}
-
-replaceAppeal();
-
-window.addEventListener( 'DOMSubtreeModified', replaceAppeal );
-window.addEventListener( 'DOMNodeInserted', replaceAppeal );
-window.addEventListener( 'onload', replaceAppeal );
+(function(){document.addEventListener("DOMNodeInserted", DocHasLoaded, false);})();

website-files/update-manifest.plist

        <key>CFBundleVersion</key>
        <string>1</string>
        <key>CFBundleShortVersionString</key>
-       <string>1.0</string>
+       <string>2.0</string>
        <key>URL</key>
        <string>http://apps.casgrain.com/safari/aitalian/Wikipedia%20aitalian.safariextension</string>
      </dict>