add light mode: no script loaded
tests in migration task add an id to the div on picture page git-svn-id: http://piwigo.org/svn/extensions/SocialButtons@24757 68402e56-0260-453c-a942-63ccdbb3a9ee
@@ -11,6 +11,7 @@ if (isset($_POST['submit']))
|
||||
$conf['SocialButtons'] = array(
|
||||
'position' => $_POST['position'],
|
||||
'on_index' => get_boolean($_POST['on_index']),
|
||||
'light' => isset($_POST['light']),
|
||||
'twitter' => array(
|
||||
'enabled' => isset($_POST['twitter']['enabled']),
|
||||
'size' => $_POST['twitter']['size'],
|
||||
|
||||
@@ -10,6 +10,7 @@ function socialbutt_install()
|
||||
$default_config = array(
|
||||
'position' => 'toolbar',
|
||||
'on_index' => true,
|
||||
'light' => false,
|
||||
'twitter' => array(
|
||||
'enabled' => true,
|
||||
'size' => 'small',
|
||||
@@ -41,21 +42,21 @@ function socialbutt_install()
|
||||
if (isset($conf['TumblrShare']))
|
||||
{
|
||||
$temp = is_string($conf['TumblrShare']) ? unserialize($conf['TumblrShare']) : $conf['TumblrShare'];
|
||||
$default_config['tumblr']['type'] = $temp['type'];
|
||||
$default_config['tumblr']['img_size'] = $temp['img_size'];
|
||||
if (!empty($temp['type'])) $default_config['tumblr']['type'] = $temp['type'];
|
||||
if (!empty($temp['img_size'])) $default_config['tumblr']['img_size'] = $temp['img_size'];
|
||||
}
|
||||
if (isset($conf['TweetThis']))
|
||||
{
|
||||
$temp = is_string($conf['TweetThis']) ? unserialize($conf['TweetThis']) : $conf['TweetThis'];
|
||||
$default_config['twitter']['size'] = $temp['size'];
|
||||
$default_config['twitter']['count'] = $temp['count'] ? 'bubble' : 'none';
|
||||
$default_config['twitter']['via'] = $temp['via'];
|
||||
if (!empty($temp['type'])) $default_config['twitter']['size'] = $temp['size'];
|
||||
if (!empty($temp['count'])) $default_config['twitter']['count'] = $temp['count'] ? 'bubble' : 'none';
|
||||
if (!empty($temp['via'])) $default_config['twitter']['via'] = $temp['via'];
|
||||
}
|
||||
if (isset($conf['GooglePlusOne']))
|
||||
{
|
||||
$temp = is_string($conf['GooglePlusOne']) ? unserialize($conf['GooglePlusOne']) : $conf['GooglePlusOne'];
|
||||
$default_config['google']['size'] = $temp['size'];
|
||||
$default_config['google']['annotation'] = $temp['annotation'];
|
||||
if (!empty($temp['size'])) $default_config['google']['size'] = $temp['size'];
|
||||
if (!empty($temp['annotation'])) $default_config['google']['annotation'] = $temp['annotation'];
|
||||
}
|
||||
|
||||
$conf['SocialButtons'] = serialize($default_config);
|
||||
@@ -63,7 +64,7 @@ function socialbutt_install()
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_conf = unserialize($conf['SocialButtons']);
|
||||
$new_conf = is_string($conf['SocialButtons']) ? unserialize($conf['SocialButtons']) : $conf['SocialButtons'];
|
||||
|
||||
if (empty($new_conf['pinterest']))
|
||||
{
|
||||
@@ -73,6 +74,7 @@ function socialbutt_install()
|
||||
'img_size' => 'Original',
|
||||
);
|
||||
}
|
||||
|
||||
if (!isset($new_conf['on_index']))
|
||||
{
|
||||
$new_conf['on_index'] = true;
|
||||
@@ -83,6 +85,11 @@ function socialbutt_install()
|
||||
$new_conf['facebook']['layout'] = 'button_count';
|
||||
}
|
||||
|
||||
if (!isset($new_conf['light']))
|
||||
{
|
||||
$new_conf['light'] = false;
|
||||
}
|
||||
|
||||
$conf['SocialButtons'] = serialize($new_conf);
|
||||
conf_update_param('SocialButtons', $conf['SocialButtons']);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ defined('SOCIALBUTT_PATH') or die('Hacking attempt!');
|
||||
|
||||
function socialbutt_pinterest($basename, $root_url, &$tpl_vars, &$buttons)
|
||||
{
|
||||
// only on piture page
|
||||
// only on picture page
|
||||
if ($basename != 'picture')
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -5,7 +5,7 @@ function socialbutt_twitter($basename, $root_url, &$tpl_vars, &$buttons)
|
||||
{
|
||||
global $conf, $template, $user;
|
||||
|
||||
$twitter_langs = array(
|
||||
$twitter_langs = array(
|
||||
'fr','en','ar','ja','es','de','it','id','pt','ko','tr','ru','nl','fil','msa','zh-tw',
|
||||
'zh-cn','hi','no','sv','fi','da','pl','hu','fa','he','ur','th','uk','ca','el','eu','cs'
|
||||
);
|
||||
|
||||
@@ -12,4 +12,6 @@ $lang['Top bubble'] = 'Top bubble';
|
||||
$lang['Display buttons'] = 'Display buttons';
|
||||
$lang['on photo and album'] = 'on photo and album';
|
||||
$lang['only on photo'] = 'only on photo';
|
||||
$lang['Light mode'] = 'Light mode';
|
||||
$lang['When light mode is activated no external script is loaded, it <b>speeds up the load of the page and disables user tracking</b> but also disables annotations and in-page popups.'] = 'When light mode is activated no external script is loaded, it <b>speeds up the load of the page and disables user tracking</b> but also disables annotations and in-page popups.';
|
||||
?>
|
||||
@@ -14,4 +14,6 @@ $lang['Top bubble'] = 'Bulle en haut';
|
||||
$lang['Display buttons'] = 'Afficher les boutons';
|
||||
$lang['on photo and album'] = 'sur les photos et les albums';
|
||||
$lang['only on photo'] = 'uniquement sur les photos';
|
||||
$lang['Light mode'] = 'Mode léger';
|
||||
$lang['When light mode is activated no external script is loaded, it <b>speeds up the load of the page and disables user tracking</b> but also disables annotations and in-page popups.'] = 'Quand le mode léger est activé aucun script externe n\'est chargé, celà <b>accélère le chargement de la page est désactive le tracking des utilisateurs</b> mais désactive aussi les annotations et les popups détaillés.';
|
||||
?>
|
||||
@@ -118,10 +118,10 @@ function socialbutt_add_button()
|
||||
}
|
||||
|
||||
|
||||
define('SOCIALBUTT_POSITION', $conf['SocialButtons']['position']);
|
||||
$tpl_vars = array(
|
||||
'share_url' => $share_url,
|
||||
'position' => $conf['SocialButtons']['position'],
|
||||
'light' => $conf['SocialButtons']['light'],
|
||||
'copyright' => '(from <a href="'.$share_url.'">'.$conf['gallery_title'].'</a>)',
|
||||
);
|
||||
$buttons = array();
|
||||
@@ -176,16 +176,19 @@ function socialbutt_add_button()
|
||||
switch ($conf['SocialButtons']['position'])
|
||||
{
|
||||
case 'index':
|
||||
foreach ($buttons as $button) {
|
||||
$template->add_index_button('<li>'.$button.'</li>', 100);
|
||||
foreach ($buttons as $button)
|
||||
{
|
||||
$template->add_index_button($button, 100);
|
||||
}
|
||||
break;
|
||||
case 'toolbar':
|
||||
foreach ($buttons as $button) {
|
||||
foreach ($buttons as $button)
|
||||
{
|
||||
$template->add_picture_button($button, 100);
|
||||
}
|
||||
break;
|
||||
default;
|
||||
define('SOCIALBUTT_POSITION', $conf['SocialButtons']['position']);
|
||||
$template->assign('SOCIALBUTT_BUTTONS', $buttons);
|
||||
$template->set_prefilter('picture', 'socialbutt_add_button_prefilter');
|
||||
}
|
||||
@@ -197,12 +200,12 @@ function socialbutt_add_button_prefilter($content)
|
||||
{
|
||||
case 'top':
|
||||
$search = '<div id="theImage">';
|
||||
$add = '<div>{foreach from=$SOCIALBUTT_BUTTONS item=BUTTON}{$BUTTON} {/foreach}</div>';
|
||||
$add = '<div id="socialButtons">{foreach from=$SOCIALBUTT_BUTTONS item=BUTTON}{$BUTTON} {/foreach}</div>';
|
||||
break;
|
||||
|
||||
case 'bottom':
|
||||
$search = '{$ELEMENT_CONTENT}';
|
||||
$add = '<div>{foreach from=$SOCIALBUTT_BUTTONS item=BUTTON}{$BUTTON} {/foreach}</div>';
|
||||
$add = '<div id="socialButtons">{foreach from=$SOCIALBUTT_BUTTONS item=BUTTON}{$BUTTON} {/foreach}</div>';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,10 @@ function plugin_activate()
|
||||
|
||||
function plugin_uninstall()
|
||||
{
|
||||
pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "SocialButtons" LIMIT 1;');
|
||||
global $conf;
|
||||
|
||||
pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "SocialButtons";');
|
||||
unset($conf['SocialButtons']);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -2,11 +2,15 @@
|
||||
|
||||
{html_style}{literal}
|
||||
.socialbutt.disabled thead img {
|
||||
-webkit-filter: grayscale(100%); /* Chrome 19+ & Safari 6+ */
|
||||
filter: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'><filter id='grayscale'><feColorMatrix type='saturate' values='0'/></filter></svg>#grayscale"); /* Firefox 10+ */
|
||||
filter: gray; /* IE6-9 */
|
||||
-webkit-filter: grayscale(100%); /* Chrome 19+ & Safari 6+ */
|
||||
}
|
||||
{/literal}{/html_style}
|
||||
{/literal}
|
||||
{if $light}
|
||||
.not-light {ldelim} display:none; }
|
||||
{/if}
|
||||
{/html_style}
|
||||
|
||||
{footer_script}{literal}
|
||||
jQuery("input.enable").change(function() {
|
||||
@@ -22,6 +26,23 @@ jQuery("input.enable").change(function() {
|
||||
$parent.removeClass('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
jQuery("input#light_mode").on('change', function() {
|
||||
if ($(this).is(":checked")) {
|
||||
$('.not-light').hide();
|
||||
}
|
||||
else {
|
||||
$('.not-light').show();
|
||||
}
|
||||
});
|
||||
|
||||
jQuery(".showInfo").tipTip({
|
||||
delay: 0,
|
||||
fadeIn: 200,
|
||||
fadeOut: 200,
|
||||
maxWidth: '300px',
|
||||
defaultPosition: 'bottom'
|
||||
});
|
||||
{/literal}{/footer_script}
|
||||
|
||||
|
||||
@@ -53,6 +74,15 @@ jQuery("input.enable").change(function() {
|
||||
<label><input type="radio" name="on_index" value="false" {if not $on_index}checked="checked"{/if}/> {'only on photo'|@translate}</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="property">
|
||||
<td>
|
||||
<label for="light_mode">{'Light mode'|@translate}</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" id="light_mode" name="light" {if $light}checked="checked"{/if}/>
|
||||
<a class="showInfo" title="{'When light mode is activated no external script is loaded, it <b>speeds up the load of the page and disables user tracking</b> but also disables annotations and in-page popups.'|@translate}">i</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -86,7 +116,7 @@ jQuery("input.enable").change(function() {
|
||||
<img src="{$SOCIALBUTT_PATH}template/images/twitter_large.png"/>
|
||||
</label></td>
|
||||
</tr>
|
||||
<tr class="property">
|
||||
<tr class="property not-light">
|
||||
<td>
|
||||
{'Annotation'|@translate}
|
||||
</td>
|
||||
@@ -144,7 +174,7 @@ jQuery("input.enable").change(function() {
|
||||
<img src="{$SOCIALBUTT_PATH}template/images/google_tall.png"/>
|
||||
</label></td>
|
||||
</tr>
|
||||
<tr class="property">
|
||||
<tr class="property not-light">
|
||||
<td>
|
||||
{'Annotation'|@translate}
|
||||
</td>
|
||||
@@ -179,7 +209,7 @@ jQuery("input.enable").change(function() {
|
||||
{html_options name="pinterest[img_size]" values=$img_sizes output=$img_sizes|translate selected=$pinterest.img_size}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="property">
|
||||
<tr class="property not-light">
|
||||
<td>
|
||||
{'Annotation'|@translate}
|
||||
</td>
|
||||
@@ -220,7 +250,7 @@ jQuery("input.enable").change(function() {
|
||||
<img src="{$SOCIALBUTT_PATH}template/images/facebook_dark.png"/>
|
||||
</label></td>
|
||||
</tr>
|
||||
<tr class="property">
|
||||
<tr class="property not-light">
|
||||
<td>
|
||||
{'Annotation'|@translate}
|
||||
</td>
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
{strip}
|
||||
{if $SOCIALBUTT.light}
|
||||
<a href="https://www.facebook.com/sharer.php?u={$SOCIALBUTT.share_url|urlencode}&t={$PAGE_TITLE|cat:' | '|cat:$GALLERY_TITLE|urlencode}" rel="nofollow"
|
||||
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=500');return false;" target="_blank">
|
||||
<img src="{$ROOT_PATH}{$SOCIALBUTT_PATH}template/images/facebook_{$SOCIALBUTT.FACEBOOK.color}.png" alt="Share on Facebook"></a>
|
||||
{else}
|
||||
{footer_script}jQuery('body').prepend('<div id="fb-root"></div>');{/footer_script}
|
||||
{combine_script id='facebook_jssdk' load='footer' path='https://connect.facebook.net/'|cat:$SOCIALBUTT.FACEBOOK.lang|cat:'/all.js#xfbml=1'}
|
||||
|
||||
<div style="display:inline-block;" class="fb-like" data-send="false" data-show-faces="false"
|
||||
data-href="{$SOCIALBUTT.share_url}" data-layout="{$SOCIALBUTT.FACEBOOK.layout}" data-colorscheme="{$SOCIALBUTT.FACEBOOK.color}"></div>
|
||||
{/if}
|
||||
{/strip}
|
||||
@@ -1,6 +1,11 @@
|
||||
{strip}
|
||||
{if $SOCIALBUTT.light}
|
||||
<a title="Google +" href="https://plus.google.com/share?url={$SOCIALBUTT.share_url|urlencode}&hl={$SOCIALBUTT.GOOGLE.lang}" rel="nofollow"
|
||||
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=390,width=480');return false;" target="_blank">
|
||||
<img src="{$ROOT_PATH}{$SOCIALBUTT_PATH}template/images/google_{$SOCIALBUTT.GOOGLE.size}.png" alt="Share on Google+"></a>
|
||||
{else}
|
||||
{combine_script id='google_plusone' load='footer' path='https://apis.google.com/js/plusone.js'}
|
||||
|
||||
<script type="text/javascript">window.___gcfg = {ldelim}lang: '{$SOCIALBUTT.GOOGLE.lang}'};</script>
|
||||
<div style="display:inline-block;" class="g-plusone" data-size="{$SOCIALBUTT.GOOGLE.size}" data-annotation="{$SOCIALBUTT.GOOGLE.annotation}" data-href="{$SOCIALBUTT.share_url}" data-recommendations="false"></div>
|
||||
{/if}
|
||||
{/strip}
|
||||
|
Before Width: | Height: | Size: 605 B After Width: | Height: | Size: 693 B |
|
Before Width: | Height: | Size: 803 B After Width: | Height: | Size: 886 B |
|
Before Width: | Height: | Size: 608 B After Width: | Height: | Size: 699 B |
|
Before Width: | Height: | Size: 949 B After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 844 B After Width: | Height: | Size: 940 B |
@@ -1,6 +1,10 @@
|
||||
{strip}
|
||||
{combine_script id='pinterest_pinit' load='footer' path='https://assets.pinterest.com/js/pinit.js'}
|
||||
|
||||
<a href="http://pinterest.com/pin/create/button/?url={$SOCIALBUTT.share_url|urlencode}&media={$SOCIALBUTT.PINTEREST.source|urlencode}&description={$SOCIALBUTT.PINTEREST.title|cat:' '|cat:$SOCIALBUTT.copyright|urlencode}"
|
||||
class="pin-it-button" count-layout="{$SOCIALBUTT.PINTEREST.layout}"><img border="0" src="http://assets.pinterest.com/images/PinExt.png" title="Pin It"/></a>
|
||||
<a href="http://pinterest.com/pin/create/button/?url={$SOCIALBUTT.share_url|urlencode}&media={$SOCIALBUTT.PINTEREST.source|urlencode}&description={$SOCIALBUTT.PINTEREST.title|cat:' '|cat:$SOCIALBUTT.copyright|urlencode}" rel="nofollow"
|
||||
{if $SOCIALBUTT.light}
|
||||
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=470,width=600');return false;" target="_blank"
|
||||
{else}
|
||||
class="pin-it-button" count-layout="{$SOCIALBUTT.PINTEREST.layout}"
|
||||
{combine_script id='pinterest_pinit' load='footer' path='https://assets.pinterest.com/js/pinit.js'}
|
||||
{/if}
|
||||
><img border="0" src="http://assets.pinterest.com/images/PinExt.png" title="Pin It"/></a>
|
||||
{/strip}
|
||||
@@ -115,4 +115,15 @@
|
||||
}
|
||||
.socialbutt.enabled thead label:before {
|
||||
content:"\2611";
|
||||
}
|
||||
|
||||
|
||||
.showInfo {
|
||||
position:static;
|
||||
display:inline-block;
|
||||
padding:1px 6px;
|
||||
width:4px;
|
||||
height:14px;
|
||||
line-height:14px;
|
||||
font-size:0.8em;
|
||||
}
|
||||
@@ -1,11 +1,14 @@
|
||||
{strip}
|
||||
{combine_script id='tumblr_share' load='footer' path='http://platform.tumblr.com/v1/share.js'}
|
||||
|
||||
{if $SOCIALBUTT.TUMBLR.mode=='photo'}
|
||||
{capture assign="inline_tags"}{foreach from=$related_tags item=tag name=tag_loop}{if !$smarty.foreach.tag_loop.first},{/if}{$tag.name}{/foreach}{/capture}
|
||||
<a href="http://www.tumblr.com/share/photo?source={$SOCIALBUTT.TUMBLR.source|urlencode}&caption={$SOCIALBUTT.TUMBLR.title|cat:' '|cat:$SOCIALBUTT.copyright|urlencode}&clickthru={$SOCIALBUTT.share_url|urlencode}&tags={$inline_tags|urlencode}"
|
||||
<a href="http://www.tumblr.com/share/photo?source={$SOCIALBUTT.TUMBLR.source|urlencode}&caption={$SOCIALBUTT.TUMBLR.title|cat:' '|cat:$SOCIALBUTT.copyright|urlencode}&clickthru={$SOCIALBUTT.share_url|urlencode}&tags={$inline_tags|urlencode}" rel="nofollow"
|
||||
{else}
|
||||
<a href="http://www.tumblr.com/share/link?url={$SOCIALBUTT.share_url|urlencode}&name={$SOCIALBUTT.TUMBLR.title|cat:' | '|cat:$GALLERY_TITLE|urlencode}&description={$CONTENT_DESCRIPTION|cat:$SOCIALBUTT.copyright|urlencode}"
|
||||
<a href="http://www.tumblr.com/share/link?url={$SOCIALBUTT.share_url|urlencode}&name={$SOCIALBUTT.TUMBLR.title|cat:' | '|cat:$GALLERY_TITLE|urlencode}&description={$CONTENT_DESCRIPTION|cat:$SOCIALBUTT.copyright|urlencode}" rel="nofollow"
|
||||
{/if}
|
||||
{if $SOCIALBUTT.light}
|
||||
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=430,width=500');return false;" target="_blank"
|
||||
{else}
|
||||
{combine_script id='tumblr_share' load='footer' path='http://platform.tumblr.com/v1/share.js'}
|
||||
{/if}
|
||||
><img src="http://platform.tumblr.com/v1/{$SOCIALBUTT.TUMBLR.type}.png" alt="Share on Tumblr"></a>
|
||||
{/strip}
|
||||
@@ -1,8 +1,11 @@
|
||||
{strip}
|
||||
{combine_script id='twitter_widgets' load='footer' path='https://platform.twitter.com/widgets.js'}
|
||||
|
||||
<a href="https://twitter.com/share?url={$SOCIALBUTT.share_url|urlencode}&text={$PAGE_TITLE|cat:' | '|cat:$GALLERY_TITLE|urlencode}{if $SOCIALBUTT.TWITTER.via}&via={$SOCIALBUTT.TWITTER.via}{/if}"
|
||||
<a href="https://twitter.com/share?url={$SOCIALBUTT.share_url|urlencode}&text={$PAGE_TITLE|cat:' | '|cat:$GALLERY_TITLE|urlencode}{if $SOCIALBUTT.TWITTER.via}&via={$SOCIALBUTT.TWITTER.via}{/if}" rel="nofollow"
|
||||
{if $SOCIALBUTT.light}
|
||||
onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=470,width=600');return false;" target="_blank"
|
||||
{else}
|
||||
data-url="{$SOCIALBUTT.share_url}" data-lang="{$SOCIALBUTT.TWITTER.lang}" data-via="{$SOCIALBUTT.TWITTER.via}"
|
||||
data-size="{$SOCIALBUTT.TWITTER.size}" data-count="{$SOCIALBUTT.TWITTER.count}" class="twitter-share-button">
|
||||
<img src="{$ROOT_PATH}{$SOCIALBUTT_PATH}template/images/twitter_{$SOCIALBUTT.TWITTER.size}.png" alt="Share on Twitter"></a>
|
||||
data-size="{$SOCIALBUTT.TWITTER.size}" data-count="{$SOCIALBUTT.TWITTER.count}" class="twitter-share-button"
|
||||
{combine_script id='twitter_widgets' load='footer' path='https://platform.twitter.com/widgets.js'}
|
||||
{/if}
|
||||
><img src="{$ROOT_PATH}{$SOCIALBUTT_PATH}template/images/twitter_{$SOCIALBUTT.TWITTER.size}.png" alt="Share on Twitter"></a>
|
||||
{/strip}
|
||||