Jump to content

Extension talk:Add to Any Share/Save/Bookmark Button

About this board

7 previous topics. Previous discussion was archived at Extension talk:Add to Any Share/Save/Bookmark Button/Archive 1 on 2016-10-25.

Download on AddtoAny website is not available

1
90.177.12.108 (talkcontribs)
Reply to "Download on AddtoAny website is not available"

Alter Location of Button from Pooroldluser

1
Summary by Jkmartindale

I removed Pooroldluser's tip from the extension page because it's an unofficial hack. It's retained below for future reference.

Jkmartindale (talkcontribs)

Quick fix to shift button from the left to the right. This was required because it was very annoying trying to edit the page but having the pop up appearing all the time. All I did was put a DIV around the button and give it negative top margin so it is now in a better location. Others may wish for nicer coding, however this seems to work fine.

Steps:

  1. Open add-to-any-share-save.php (it will be in your extensions/add-to-any-share-save/ directory)
  2. Go to line 72, and insert the following code directly after the apostrophe (') and before <a class=...: <div style="width:100%;text-align:right;margin-top:-21px;">
  3. Go to line 75 and insert </div> immediately after </script> and before the apostrophe (').
  4. Save the file and upload it to the directory.
Summary by Jkmartindale

I removed this from the extension page as it's unofficial and confusing. It's retained below for future reference.

Jkmartindale (talkcontribs)
<?php

/*
 * add-to-any-share-save - Helps visitors share, save, bookmark, and email your pages using any service, such as Delicious, Digg, Facebook, Twitter, and over 100 more.
 * @authors Add to Any
 * @version 0.1
 * @copyright Copyright (C) addtoany.com
 * @license The MIT License - http://www.opensource.org/licenses/mit-license.php 
 * -----------------------------------------------------------------------
 * Description:
 *     Helps visitors share, save, bookmark, and email your pages using any service, such as Delicious, Digg, Facebook, Twitter, and over 100 more. 
 *     The button comes with Add to Any's customizable Smart Menu, which places the services visitors use at the top of the menu, based on each visitor's browsing history.
 * Requirements:
 *     MediaWiki 1.6+
 * Installation:
 *     1. Upload the `add-to-any-share-save` folder (and all contents) to your MediaWiki extensions directory so you have: `/extensions/add-to-any-share-save/`
 *     2. Enable the extension by adding this line to your LocalSettings.php:
 *            require_once('extensions/add-to-any-share-save/add-to-any-share-save.php');
 * Version Notes:
 *     0.1:
 *        Initial release. Add to Any is available for MediaWiki!
 * To-do:
 *     1. Have the <sharesave /> tag (functions below) additionally load the external JavaScript call before the </body> tag - please get in touch if you have any ideas on how to do this!
 */
 
 
 
// Confirm MW environment
if (defined('MEDIAWIKI')) {
	
	
	// OPTIONS
	$wg_addtoany_share_save_button_filename = "share_save_171_16.png"; // Located in /extensions/add-to-any-share-save/
	$wg_addtoany_share_save_button_width = "171";
	$wg_addtoany_share_save_button_height = "16";
	
	
	
	// Version
	define('ADDTOANY_SHARE_SAVE_VERSION','0.1');
	 
	// Credits
	$wgExtensionCredits['parserhook'][] = array(
		'name'=>'Add to Any Share/Save/Bookmark Button',
		'author'=>'Add to Any',
		'url'=>'http://www.addtoany.com/contact/',
		'description'=>'Helps visitors share, save, bookmark, and email your pages using any service, such as Delicious, Digg, Facebook, Twitter, and over 100 more.',
		'version'=>ADDTOANY_SHARE_SAVE_VERSION
	);
	
	// Call Share/Save widget
	// $wgExtensionFunctions[] = 'wf_addtoany_share_save_ExtensionSetup';
	
	
	
	//if $everyPage isn't set -> default = addToAny in every Page below header
	if(!isset($everyPage))
	  $everyPage=true;
	
	//EF is in the house!! YIIIHHAAAA
	if($everyPage)
	 {
	 //addToAny below every Header
	 $wgHooks['SkinSubPageSubtitle'][] = 'wf_addtoany_share_save_below_header';
	 }
	else 
	 {
	 //addToAny in the area, you embedded the tag
	$wgHooks['ParserFirstCallInit'][] = 'wf_addtoany_per_tag';
	 }
	
	 function wf_addtoany_per_tag( &$parser ) {
	$parser->setHook("addtoany","add_to_any_per_tag");
	return true;
}
	
	function add_to_any_per_tag( $in, $param=array(), $parser=null, $frame=false) {
	
	return wf_addtoany_share_save_markup();
}
	
	
	function wf_addtoany_share_save_below_header(&$subpages) {
	
		$subpages .=wf_addtoany_share_save_markup();
		return true;
	}
	
	

	function wf_addtoany_share_save_markup(){
		// MediaWiki globals
		global $wgTitle, $wgScriptPath, $wgHooks;
		
		// Add to Any Share/Save extension globals
		global $wg_addtoany_share_save_button_filename, 
			$wg_addtoany_share_save_button_width, 
			$wg_addtoany_share_save_button_height;
		
		$button_src = $wg_addtoany_share_save_button_filename;
		$button_width = ' width="'.$wg_addtoany_share_save_button_width.'"';
		$button_height = ' height="'.$wg_addtoany_share_save_button_height.'"';
		
		// Load external JavaScript before closing </body> tag
		$wgHooks['SkinAfterBottomScripts'][] = 'wf_addtoany_share_save_external_script_call';
		
		$link_title = $wgTitle->getText();
		$link_url = $wgTitle->getFullURL();
	
		$markup = 
			'<a class="a2a_dd" href="http://www.addtoany.com/share_save?linkurl=' . rawurlencode($link_url) . '&amp;linkname=' . rawurlencode($link_title) . '">' .
			'<img src="'.$wgScriptPath.'/extensions/add-to-any-share-save/'.$button_src.'"' . $button_width.$button_height . ' alt="Share/Save/Bookmark"/>' .
			'</a>' .
			'<script type="text/javascript">a2a_linkname="' .$link_title. '";a2a_linkurl="' .$link_url. '";</script>';
			
		return $markup;
	}
	
	
	
	function wf_addtoany_share_save_external_script_call($skin, &$text='') {
		$text .= '<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>';
		return true;
	}
	
	/* 
	
		See "To-do" section above
	
	// Sets up the parser hook and global messages
	function wf_addtoany_share_save_ExtensionSetup() {
		global $wgParser, $wgMessageCache;

		// <sharesave /> tag
		$wgParser->setHook('sharesave', 'wf_addtoany_share_save_ParserHook');
	}
	 
	// Parser hook for the <sharesave /> tag extension.
	function wf_addtoany_share_save_ParserHook($text, $params, &$parser) {
		
		$output = '';
		
		$output .= wf_addtoany_share_save_markup();
		
		return $output;
	}
	*/

} // Closing MW Environment wrapper
There are no older topics