Forráskód Böngészése

AddThis patch (#317)

* Fixes for addThis #295 

* Clean up README and fixing print.css

* Some final fixes for AddThis - easy on CSS of Follow Icons let user decide

* Bump version to 2.1.0-rc (Yay a release candidate!)
Tom Hutchison 7 éve
szülő
commit
9964d94bea

+ 2 - 0
CHANGELOG.md

@@ -1,5 +1,7 @@
 ## Version 2.1
 
+* [bug fix] AddThis div container #295
+* [enhancement] Hide AddThis on non content pages by disabling <script> from running
 * [bug fix] Fixes for VisualEditor changes in editor layout #313
 * [compatibilit] Remove IE 8 Support entirely
 * [code] CSS fixes for Issues #88, #172 and #196 (Print.css, firstHeading and Wikitable override by Foundation)

+ 15 - 9
Foreground.skin.php

@@ -23,8 +23,10 @@ class Skinforeground extends SkinTemplate {
 			'wikiName' => &$GLOBALS['wgSitename'],
 			'navbarIcon' => false,
 			'IeEdgeCode' => 1,
-			'showFooterIcons' => 0,
-			'addThisFollowPUBID' => ''
+			'showFooterIcons' => false,
+			'addThisPUBID' => '',
+			'useAddThisShare' => '',
+			'useAddThisFollow' => ''
 		);
 		foreach ($wgForegroundFeaturesDefaults as $fgOption => $fgOptionValue) {
 			if ( !isset($wgForegroundFeatures[$fgOption]) ) {
@@ -210,6 +212,11 @@ class foregroundTemplate extends BaseTemplate {
 					?><h4 class="namespace label"><?php print $namespace; ?></h4><?php } ?>
 					<div id="content">
 					<h1  id="firstHeading" class="title"><?php print $displaytitle; ?></h1>
+						<?php if ($wgForegroundFeatures['useAddThisShare'] !== '') { ?>
+						<!-- Go to www.addthis.com/dashboard to customize your tools -->
+						<div class="<?php echo $wgForegroundFeatures['useAddThisShare']; ?> hide-for-print"></div>
+						<!-- Go to www.addthis.com/dashboard to customize your tools -->
+						<?php } ?>
 					<?php if ( $this->data['isarticle'] ) { ?><h3 id="tagline"><?php $this->msg( 'tagline' ) ?></h3><?php } ?>
 					<h5 id="siteSub" class="subtitle"><?php $this->html('subtitle') ?></h5>
 					<div id="contentSub" class="clear_both"></div>
@@ -234,13 +241,10 @@ class foregroundTemplate extends BaseTemplate {
 
 			<footer class="row">
 				<div id="footer">
-					<?php if ($wgForegroundFeatures['addThisFollowPUBID'] != '') { ?>
-						<div class="social-footer large-12 small-12 columns">
-							<div class="social-links">
+					<?php if ($wgForegroundFeatures['useAddThisFollow'] !== '') { ?>
+						<div class="social-follow hide-for-print">
 							<!-- Go to www.addthis.com/dashboard to customize your tools -->
-							<div class="addthis_horizontal_follow_toolbox"></div>
-							<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgForegroundFeatures['addThisFollowPUBID'];?>"></script>
-							</div>
+							<div class="<?php echo $wgForegroundFeatures['useAddThisFollow']; ?> hide-for-print"></div>
 						</div>
 					<?php } ?>
 					<div id="footer-left" class="<?php echo $footerLeftClass;?>">
@@ -266,7 +270,9 @@ class foregroundTemplate extends BaseTemplate {
 		</div>
 		
 		<?php $this->printTrail(); ?>
-
+			<?php if ($this->data['isarticle'] && $wgForegroundFeatures['addThisPUBID'] !== '') { ?>
+				<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $wgForegroundFeatures['addThisPUBID']; ?>" async="async">></script>
+			<?php } ?>	
 		</body>
 		</html>
 

+ 8 - 4
README.md

@@ -43,8 +43,10 @@ Use following features in `LocalSettings.php` to change the behavior.
 - `wikiName => 'Alternate WikiName'` sets top navbar name to a different output of the wiki's name. Useful if your `$wgSitename` is long but need to keep it for other purposes.
 - `navbarIcon => true` to display an icon in the top navbar. See below for more information.
 - `IeEdgeCode => 1` will produce a meta tag with "X-UA-Compatible" content="IE=edge", `2` will sent a header, `0` nothing will be done
-- `showFooterIcons => 0` suppresses the output of footer icons. Set to `true` or `1` to display them.
-- `addThisFollowPUBID => 'your-id'` add an id to display Follow Us horizontal bar of icons from various social media sites available on [addThis](https://addthis.com).
+- `showFooterIcons => false` suppresses the output of footer icons. Set to `true` or `1` to display them.
+- `addThisPUBID => ''` empty string will not fire the AddThis script, `'ra-##-#######'` publisher ID will allow the run the AddThis script in async on content pages only.
+- `useAddThisShare => ''` default empty string, do not use AddThis share, `your_addthis_specific_div_class_string` will insert the share toolbox div directly under page title, but before the tagline with your custom div class.
+- `useAddThisFollow => ''` default empty string, do not use AddThis follow, `your_addthis_specific_div_class_string` will insert the follow toolbox div in the `footer` area before icon or text output with your custom div class.
 
 These are the default values:
 
@@ -57,8 +59,10 @@ These are the default values:
       'wikiName' => &$GLOBALS['wgSitename'],
       'navbarIcon' => false,
       'IeEdgeCode' => 1,
-      'showFooterIcons' => 0,
-      'addThisFollowPUBID' => ''
+      'showFooterIcons' => false,
+	  'addThisPUBID' => '',
+	  'useAddThisShare' => '',
+	  'useAddThisFollow' => ''
     );
 	
 ### Usage of NavWrapperType

+ 3 - 33
assets/stylesheets/foreground-print.css

@@ -1,6 +1,6 @@
-/* Show what will print */
+/* Control what will print */
 
-@media screen {
+@media print {
 	/* stop double border at bottom with print */
 	footer.row {
 		border: none;
@@ -29,37 +29,7 @@
 	nav {
     display: none !important;
 	}
-}
-
-/* Print what is shown */
-
-@media print {
-	/* stop double border at bottom with print */
-	footer.row {
-		border: none;
-	}
-	/*make namespace labels stand out */
-	h4.namespace.label {
-    padding: 0.25em;
-    font-size: 1.4em !important;
-    font-weight: normal;
-    background-color: #777777 !important;
-	color: #fff !important;
-	}
-	/* hide actions button as it is not needed */
-	#p-cactions a.button.dropdown.small.secondary.radius {
-    display: none !important;
-	}
-	/* if addThis share is used, make sure to hide mobile content from js */
-	#at4m-dock, .at4-show,
-	#atstbx	{
-	display: none !important;
-	}
-	/* hide Echo if being used */
-	#echo-notifications {
-	display: none !important;
-	}
-	nav {
+	a#actions-button {
     display: none !important;
 	}
 }

+ 3 - 28
assets/stylesheets/foreground.css

@@ -240,35 +240,10 @@ footer.row ul.views.columns li {
 	list-style-type: none;
 }
 
-/* Make social footer center need overflow:hidden and other div classes */
-
-.social-footer {
-	margin: 0 0 1em;
-	font-size: 90%;
-	overflow: hidden;
-}
-
-/* Hide all text in p elements */
-
-.social-footer p {
-	display: none;
-}
-
-/* Outer wrap */
-
-.social-links {
-	position: relative;
-	left: 50%;
-	float: left;
-}
+/* Make social follow float right */
 
-/* addThis container (inner wrap) */
-
-.addthis_horizontal_follow_toolbox {
-	position: relative;
-	left: -50%;
-	float: left;
-	z-index: 100000;
+.social-follow {
+    float: right;
 }
 
 /* end social footer classes */

+ 1 - 1
skin.json

@@ -1,6 +1,6 @@
 {
 	"name": "Foreground",
-	"version": "2.1.0-beta",
+	"version": "2.1.0-rc",
 	"author": [
 		"Garrick Van Buren",
 		"Jamie Thingelstad",