Import legacy nurinda.co.id website
This commit is contained in:
1 parent
3f59bb9038
commit
6e21646ac4
13389 files changed
+3246690
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,2 @@
|
||||
/* Chosen v1.5.1 | (c) 2011-2016 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
|
||||
(function(){var a,AbstractChosen,Chosen,SelectParser,b,c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),title:a.title?a.title:void 0,children:0,disabled:a.disabled,classes:a.className}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,title:a.title?a.title:void 0,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,group_label:null!=b?this.parsed[b].label:null,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"<",">":">",'"':""","'":"'","`":"`"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY},AbstractChosen.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.choice_label=function(a){return this.include_group_label_in_selected&&null!=a.group_label?"<b class='group-name'>"+a.group_label+"</b>"+a.html:a.html},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(a){var b=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return b.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(a){var b=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return b.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(aLine truncated
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
jQuery(document).ready(function(a){function b(){a.ajax("https://graph.facebook.com/v2.11/?id=http://www.google.com&access_token="+a("#mashsb_settings\\[fb_access_token_new\\]").val()).done(function(b){try{b.share.share_count&&a("#mashsb_token_notice").html("<strong>Token valid:</strong> Facebook share count for http://google.com: "+b.share.share_count)}catch(b){a("#mashsb_token_notice").html('<span style="color:red;"> <strong>Error:</strong> Access Token Invalid!</span>')}})}function c(a,b,c){if(c){var d=new Date;d.setTime(d.getTime()+24*c*60*60*1e3);var e="; expires="+d.toGMTString()}else var e="";document.cookie=a+"="+b+e+"; path=/"}function d(a){for(var b=a+"=",c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];" "==e.charAt(0);)e=e.substring(1,e.length);if(0==e.indexOf(b))return e.substring(b.length,e.length)}return null}function e(){var a=jQuery(".mashsb-tabs.active").find("a").attr("href");c("mashsb_active_tab",a)}function f(){var a=d("mashsb_active_tab");return null==a&&(a="#mashsb_settingsgeneral_header"),a}function g(){var a,b;return a=jQuery(".mashsb.nav-tab-wrapper a.nav-tab-active:nth-child(2)"),b=jQuery(".mashsb.nav-tab-wrapper a.nav-tab-active:nth-child(3)"),a.length>0||b.length>0?void 0:f()+"-nav"}a(".mashsb-color-box").each(function(){a(this).colpick({layout:"hex",submit:0,colorScheme:"light",onChange:function(b,c,d,e,f){a(e).css("border-color","#"+c),f||a(e).val(c)}}).keyup(function(){a(this).colpickSetColor(this.value)}),a(this).colpick({layout:"hex",submit:0,colorScheme:"light",onChange:function(b,c,d,e,f){a(e).css("border-color","#"+c),f||a(e).val(c)}}).keyup(function(){a(this).colpickSetColor(this.value)})}),a("#mashsb_verify_fbtoken").on("click",function(c){c.preventDefault(),a("#mashsb_settings\\[fb_access_token_new\\]").val()&&b()}),a("#mashsb_fb_auth").click(function(b){b.preventDefault(),winWidth=520,winHeight=350;var c=screen.height/2-winHeight/2,d=screen.width/2-winWidth/2,e=a(this).attr("href");mashsb_fb_auth=window.open(e,"mashsb_fb_auth","top="+c+",left="+d+",toolbar=0,status=0,width="+winWidth+",height="+winHeight+",resizable=yes")}),a("#mashsb_settings\\[responsive_buttons\\]").attr("checked")?a("#mashsb_settings\\[button_width\\]").closest(".row").css("display","none"):a("#mashsb_settings\\[button_width\\]").closest(".row").fadeIn(300).css("display","table-row"),a("#mashsb_settings\\[responsive_buttons\\]").click(function(){a(this).attr("checked")?a("#mashsb_settings\\[button_width\\]").closest(".row").css("display","none"):a("#mashsb_settings\\[button_width\\]").closest(".row").fadeIn(300).css("display","table-row")}),a(".mashsb-chosen-select").chosen({width:"400px"}),a("#mashsb_settings\\[caching_method\\]").change(function(){"refresh_loading"===a("#mashsb_settings\\[caching_method\\]").val()?a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").fadeIn(300).css("display","table-row"):a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").css("display","none")}),"refresh_loading"===a("#mashsb_settings\\[caching_method\\]").val()?a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").fadeIn(300).css("display","table-row"):a("#mashsb_settings\\[mashsharer_cache\\]").closest(".row").css("display","none"),a(".mashsb-tabs").length&&a("#mashsb_container").easytabs({animate:!0,updateHash:!0,defaultTab:g()}),a("#mashsb_container").bind("easytabs:after",function(){0==jQuery(".mashsb.nav-tab-wrapper a.nav-tab-active:nth-child(2)").length&&e()}),a(".mashtab").length&&a(".tabcontent_container").easytabs({animate:!0}),a("#mashsb_network_list").sortable({items:".mashsb_list_item",opacity:.6,cursor:"move",axis:"y",update:function(){var b=a(this).sortable("serialize")+"&action=mashsb_update_order";a.post(ajaxurl,b,function(a){})}}),a(".mashsb-helper").click(function(b){b.preventDefault();var c=a(this),d=a(this).next();a(".mashsb-message").not(d).hide();var e=c.position();d.hasClass("bottom")?d.css({left:e.left-d.width()/2+"px",top:e.top+c.height()+9+"px"}):d.css({left:e.left+c.width()+9+"px",top:e.top+c.height()/2-18+"px"}),d.toggle(),b.stopPropagation()}),a("body").click(function(){a(".mashsb-message").hide()}),a(".mashsb-message").click(function(a){a.stopPropagation()})}),function(a,b,c){"$:nomunge";function d(a){return a=a||location.href,"#"+a.replace(/^[^#]*#?(.*)$/,"$1")}var e,f="hashchange",g=document,h=a.event.special,i=g.documentMode,j="on"+f in b&&(i===c||i>7);a.fn[f]=function(a){return a?this.bind(f,a):this.trigger(f)},a.fn[f].delay=50,h[f]=a.extend(h[f],{setup:function(){return j?!1:void a(e.start)},teardown:function(){return j?!1:void a(e.stop)}}),e=function(){function e(){var c=d(),g=n(k);c!==k?(m(k=c,g),a(b).trigger(f)):g!==k&&(location.href=location.href.replace(/#.*/,"")+g),h=setTimeout(e,a.fn[f].delay)}var h,i={},k=d(),l=function(a){return a},m=l,n=l;i.start=function(){h||e()},i.stop=function(){h&&clearTimeout(h),h=c};var o=function(){for(var a,b=3,c=document.createElement("div"),d=c.getElementsByTagName("i");c.innerHTML="<!--[if gt IE "+ ++bLine truncated
|
||||
@@ -0,0 +1,80 @@
|
||||
var strict;
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
|
||||
/**
|
||||
* DEACTIVATION FEEDBACK FORM
|
||||
*/
|
||||
// show overlay when clicked on "deactivate"
|
||||
mashsb_deactivate_link = $('.wp-admin.plugins-php tr[data-slug="mashsharer"] .row-actions .deactivate a');
|
||||
mashsb_deactivate_link_url = mashsb_deactivate_link.attr('href');
|
||||
|
||||
mashsb_deactivate_link.click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
// only show feedback form once per 30 days
|
||||
var c_value = mashsb_admin_get_cookie("mashsb_hide_deactivate_feedback");
|
||||
|
||||
if (c_value === undefined) {
|
||||
$('#mashsb-feedback-overlay').show();
|
||||
} else {
|
||||
// click on the link
|
||||
window.location.href = mashsb_deactivate_link_url;
|
||||
}
|
||||
});
|
||||
// show text fields
|
||||
$('#mashsb-feedback-content input[type="radio"]').click(function () {
|
||||
// show text field if there is one
|
||||
$(this).parents('li').next('li').children('input[type="text"], textarea').show();
|
||||
});
|
||||
// send form or close it
|
||||
$('#mashsb-feedback-content .button').click(function (e) {
|
||||
e.preventDefault();
|
||||
// set cookie for 30 days
|
||||
var exdate = new Date();
|
||||
exdate.setSeconds(exdate.getSeconds() + 2592000);
|
||||
document.cookie = "mashsb_hide_deactivate_feedback=1; expires=" + exdate.toUTCString() + "; path=/";
|
||||
|
||||
$('#mashsb-feedback-overlay').hide();
|
||||
if ('mashsb-feedback-submit' === this.id) {
|
||||
// Send form data
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajaxurl,
|
||||
dataType: 'json',
|
||||
data: {
|
||||
action: 'mashsb_send_feedback',
|
||||
data: $('#mashsb-feedback-content form').serialize()
|
||||
},
|
||||
complete: function (MLHttpRequest, textStatus, errorThrown) {
|
||||
// deactivate the plugin and close the popup
|
||||
$('#mashsb-feedback-overlay').remove();
|
||||
window.location.href = mashsb_deactivate_link_url;
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#mashsb-feedback-overlay').remove();
|
||||
window.location.href = mashsb_deactivate_link_url;
|
||||
}
|
||||
});
|
||||
// close form without doing anything
|
||||
$('.mashsb-feedback-not-deactivate').click(function (e) {
|
||||
$('#mashsb-feedback-overlay').hide();
|
||||
});
|
||||
|
||||
function mashsb_admin_get_cookie (name) {
|
||||
var i, x, y, mashsb_cookies = document.cookie.split( ";" );
|
||||
for (i = 0; i < mashsb_cookies.length; i++)
|
||||
{
|
||||
x = mashsb_cookies[i].substr( 0, mashsb_cookies[i].indexOf( "=" ) );
|
||||
y = mashsb_cookies[i].substr( mashsb_cookies[i].indexOf( "=" ) + 1 );
|
||||
x = x.replace( /^\s+|\s+$/g, "" );
|
||||
if (x === name)
|
||||
{
|
||||
return unescape( y );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}); // document ready
|
||||
@@ -0,0 +1,80 @@
|
||||
var strict;
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
|
||||
/**
|
||||
* DEACTIVATION FEEDBACK FORM
|
||||
*/
|
||||
// show overlay when clicked on "deactivate"
|
||||
mashsb_deactivate_link = $('.wp-admin.plugins-php tr[data-slug="mashsharer"] .row-actions .deactivate a');
|
||||
mashsb_deactivate_link_url = mashsb_deactivate_link.attr('href');
|
||||
|
||||
mashsb_deactivate_link.click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
// only show feedback form once per 30 days
|
||||
var c_value = mashsb_admin_get_cookie("mashsb_hide_deactivate_feedback");
|
||||
|
||||
if (c_value === undefined) {
|
||||
$('#mashsb-feedback-overlay').show();
|
||||
} else {
|
||||
// click on the link
|
||||
window.location.href = mashsb_deactivate_link_url;
|
||||
}
|
||||
});
|
||||
// show text fields
|
||||
$('#mashsb-feedback-content input[type="radio"]').click(function () {
|
||||
// show text field if there is one
|
||||
$(this).parents('li').next('li').children('input[type="text"], textarea').show();
|
||||
});
|
||||
// send form or close it
|
||||
$('#mashsb-feedback-content .button').click(function (e) {
|
||||
e.preventDefault();
|
||||
// set cookie for 30 days
|
||||
var exdate = new Date();
|
||||
exdate.setSeconds(exdate.getSeconds() + 2592000);
|
||||
document.cookie = "mashsb_hide_deactivate_feedback=1; expires=" + exdate.toUTCString() + "; path=/";
|
||||
|
||||
$('#mashsb-feedback-overlay').hide();
|
||||
if ('mashsb-feedback-submit' === this.id) {
|
||||
// Send form data
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajaxurl,
|
||||
dataType: 'json',
|
||||
data: {
|
||||
action: 'mashsb_send_feedback',
|
||||
data: $('#mashsb-feedback-content form').serialize()
|
||||
},
|
||||
complete: function (MLHttpRequest, textStatus, errorThrown) {
|
||||
// deactivate the plugin and close the popup
|
||||
$('#mashsb-feedback-overlay').remove();
|
||||
window.location.href = mashsb_deactivate_link_url;
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#mashsb-feedback-overlay').remove();
|
||||
window.location.href = mashsb_deactivate_link_url;
|
||||
}
|
||||
});
|
||||
// close form without doing anything
|
||||
$('.mashsb-feedback-not-deactivate').click(function (e) {
|
||||
$('#mashsb-feedback-overlay').hide();
|
||||
});
|
||||
|
||||
function mashsb_admin_get_cookie (name) {
|
||||
var i, x, y, mashsb_cookies = document.cookie.split( ";" );
|
||||
for (i = 0; i < mashsb_cookies.length; i++)
|
||||
{
|
||||
x = mashsb_cookies[i].substr( 0, mashsb_cookies[i].indexOf( "=" ) );
|
||||
y = mashsb_cookies[i].substr( mashsb_cookies[i].indexOf( "=" ) + 1 );
|
||||
x = x.replace( /^\s+|\s+$/g, "" );
|
||||
if (x === name)
|
||||
{
|
||||
return unescape( y );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}); // document ready
|
||||
@@ -0,0 +1,487 @@
|
||||
var strict;
|
||||
|
||||
/*!------------------------------------------------------
|
||||
* jQuery nearest v1.0.3
|
||||
* http://github.com/jjenzz/jQuery.nearest
|
||||
* ------------------------------------------------------
|
||||
* Copyright (c) 2012 J. Smith (@jjenzz)
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
(function ($, d) {
|
||||
$.fn.nearest = function (selector) {
|
||||
var self, nearest, el, s, p,
|
||||
hasQsa = d.querySelectorAll;
|
||||
|
||||
function update(el) {
|
||||
nearest = nearest ? nearest.add(el) : $(el);
|
||||
}
|
||||
|
||||
this.each(function () {
|
||||
self = this;
|
||||
|
||||
$.each(selector.split(','), function () {
|
||||
s = $.trim(this);
|
||||
|
||||
if (!s.indexOf('#')) {
|
||||
// selector starts with an ID
|
||||
update((hasQsa ? d.querySelectorAll(s) : $(s)));
|
||||
} else {
|
||||
// is a class or tag selector
|
||||
// so need to traverse
|
||||
p = self.parentNode;
|
||||
while (p) {
|
||||
el = hasQsa ? p.querySelectorAll(s) : $(p).find(s);
|
||||
if (el.length) {
|
||||
update(el);
|
||||
break;
|
||||
}
|
||||
p = p.parentNode;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
return nearest || $();
|
||||
};
|
||||
}(jQuery, document));
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
|
||||
/* Show Whatsapp button on mobile devices iPhones and Android only */
|
||||
if (navigator.userAgent.match(/(iPhone)/i) || navigator.userAgent.match(/(Android)/i)) {
|
||||
$('.mashicon-whatsapp').show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get facebook share count vi js client request
|
||||
*
|
||||
* @returns {undefined}
|
||||
*
|
||||
* not used any longer
|
||||
*/
|
||||
var mashsb_get_fb_shares = function ()
|
||||
{
|
||||
|
||||
|
||||
if (document.querySelector('.mashsb-buttons') === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ('undefined' !== typeof (mashsb.refresh) && mashsb.refresh === '0') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ('undefined' === typeof (mashsb.share_url) && mashsb.share_url !== '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ('undefined' === typeof (mashsb.postid) && mashsb.postid !== '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mashsb_is_rate_limit()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//mashsb.share_url = 'https://www.google.de';
|
||||
|
||||
var facebookGraphURL = 'https://graph.facebook.com/?id=' + mashsb.share_url;
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: facebookGraphURL,
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
mashsb_set_fb_sharecount(data);
|
||||
console.log(data);
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
// Make sure page has been loaded completely before requesting any shares via ajax
|
||||
// This also prevents hitting the server too often
|
||||
//setTimeout(mashsb_get_fb_shares, 3000);
|
||||
|
||||
/**
|
||||
* If page is older than 30 second it's cached. So do not call FB API again
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
function mashsb_is_rate_limit() {
|
||||
|
||||
if ("undefined" === typeof (mashsb.servertime)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var serverTime = Number(mashsb.servertime);
|
||||
var clientTime = Math.floor(Date.now() / 1000);
|
||||
|
||||
if (clientTime > (serverTime + 30)) {
|
||||
console.log('rate limited: ' + (serverTime + 30));
|
||||
return true;
|
||||
} else {
|
||||
console.log('not rate limited: ' + (serverTime + 30));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store FB return data in mashshare cache vi js client request
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function mashsb_set_fb_sharecount(result) {
|
||||
|
||||
if ('undefined' === typeof (result.share)) {
|
||||
console.log('No valid result' + result);
|
||||
return false;
|
||||
}
|
||||
|
||||
var data = {
|
||||
action: 'mashsb_set_fb_shares',
|
||||
shares: result.share,
|
||||
postid: mashsb.postid,
|
||||
url: mashsb.share_url,
|
||||
nonce: mashsb.nonce
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: mashsb.ajaxurl,
|
||||
data: data,
|
||||
success: function (res) {
|
||||
console.log('Save fb results: ' + res);
|
||||
},
|
||||
error: function (e) {
|
||||
console.log('Unknown error ' + e)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// pinterest button logic
|
||||
$('body')
|
||||
.off('click', '.mashicon-pinterest')
|
||||
.on('click', '.mashicon-pinterest', function (e) {
|
||||
e.preventDefault();
|
||||
console.log('preventDefault:' + e);
|
||||
winWidth = 520;
|
||||
winHeight = 350;
|
||||
var winTop = (screen.height / 2) - (winHeight / 2);
|
||||
var winLeft = (screen.width / 2) - (winWidth / 2);
|
||||
var url = $(this).attr('data-mashsb-url');
|
||||
|
||||
window.open(url, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight + ',resizable=yes');
|
||||
|
||||
});
|
||||
|
||||
/* Load Pinterest Popup window
|
||||
*
|
||||
* @param string html container
|
||||
* @returns void
|
||||
*/
|
||||
function load_pinterest(html) {
|
||||
|
||||
mashnet_load_pinterest_body();
|
||||
|
||||
jQuery('.mashnet_pinterest_header').fadeIn(500);
|
||||
jQuery('.mashnet_pinterest_inner').html(html);
|
||||
|
||||
/* Close Pinterest popup*/
|
||||
jQuery('.mashnet_pinterest_close').click(function (e) {
|
||||
e.preventDefault();
|
||||
jQuery('.mashnet_pinterest_header').hide();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Load pinterest wrapper
|
||||
*
|
||||
* @returns voids
|
||||
*/
|
||||
function load_pinterest_body() {
|
||||
var winWidth = window.innerWidth;
|
||||
var popupWidth = 350;
|
||||
var popupHeight = 310;
|
||||
|
||||
/* Load Pinterest popup into body of page */
|
||||
if (winWidth <= 330)
|
||||
var popupWidth = 310;
|
||||
if (winWidth > 400)
|
||||
var popupWidth = 390;
|
||||
if (winWidth > 500)
|
||||
var popupWidth = 490;
|
||||
|
||||
var winTop = (window.innerHeight / 2) - (popupHeight / 2);
|
||||
var winLeft = (window.innerWidth / 2) - (popupWidth / 2);
|
||||
var struct = '<div class="mashnet_pinterest_header" style="position:fixed;z-index:999999;max-width:' + popupWidth + 'px; margin-left:' + winLeft + 'px;top:' + winTop + 'px;">\n\
|
||||
<div class="mashnet_pinit_wrapper" style="background-color:white;"><span class="mashnet_pin_it">Pin it! </span><span class="mashnet_pinicon"></span> \n\
|
||||
<div class="mashnet_pinterest_close" style="float:right;"><a href="#">X</a></div></div>\n\
|
||||
<div class="mashnet_pinterest_inner"></div>\n\
|
||||
</div>\n\
|
||||
';
|
||||
|
||||
jQuery('body').append(struct);
|
||||
}
|
||||
|
||||
/* Get all images on site
|
||||
*
|
||||
* @return html
|
||||
* */
|
||||
function get_images(url) {
|
||||
|
||||
var allImages = jQuery('img').not("[nopin='nopin']");
|
||||
var html = '';
|
||||
var url = '';
|
||||
|
||||
var largeImages = allImages.filter(function () {
|
||||
return (jQuery(this).width() > 70) || (jQuery(this).height() > 70)
|
||||
})
|
||||
for (i = 0; i < largeImages.length; i++) {
|
||||
html += '<li><a target="_blank" rel="" id="mashnetPinterestPopup" href="https://pinterest.com/pin/create/button/?url=' + encodeURIComponent(window.location.href) + '%2F&media=' + largeImages[i].src + '&description=' + largeImages[i].alt + '"><img src="' + largeImages[i].src + '"></a></li>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Fix for the inline post plugin which removes the zero share count
|
||||
if ($('.mashsbcount').text() == '') {
|
||||
$('.mashsbcount').text(0);
|
||||
}
|
||||
|
||||
// check the sharecount caching method
|
||||
mashsb_check_cache();
|
||||
|
||||
/**
|
||||
* Check Cache
|
||||
*
|
||||
*/
|
||||
function mashsb_check_cache() {
|
||||
|
||||
if (mashsb_is_rate_limit()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
if (typeof (mashsb) && mashsb.refresh == "1") {
|
||||
mashsb_update_cache();
|
||||
}
|
||||
|
||||
}, 6000);
|
||||
}
|
||||
|
||||
function mashsb_update_cache() {
|
||||
var mashsb_url = window.location.href;
|
||||
if (mashsb_url.indexOf("?") > -1) {
|
||||
mashsb_url += "&mashsb-refresh";
|
||||
} else {
|
||||
mashsb_url += "?mashsb-refresh";
|
||||
}
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", mashsb_url, true);
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
/* Opens a new minus button when plus sign is clicked */
|
||||
/* Toogle function for more services */
|
||||
$('.onoffswitch').on('click', function () {
|
||||
var $parent = $(this).parents('.mashsb-container');
|
||||
$parent.find('.onoffswitch').hide();
|
||||
$parent.find('.secondary-shares').show();
|
||||
$parent.find('.onoffswitch2').show();
|
||||
});
|
||||
$('.onoffswitch2').on('click', function () {
|
||||
var $parent = $(this).parents('.mashsb-container');
|
||||
$parent.find('.onoffswitch').show();
|
||||
$parent.find('.secondary-shares').hide();
|
||||
});
|
||||
|
||||
/* Network sharer scripts */
|
||||
/* deactivate FB sharer when likeaftershare is enabled */
|
||||
if (typeof lashare_fb == "undefined" && typeof mashsb !== 'undefined') {
|
||||
$('.mashicon-facebook').click(function (e) {
|
||||
winWidth = 520;
|
||||
winHeight = 550;
|
||||
var winTop = (screen.height / 2) - (winHeight / 2);
|
||||
var winLeft = (screen.width / 2) - (winWidth / 2);
|
||||
var url = $(this).attr('href');
|
||||
|
||||
window.open(url, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof mashsb !== 'undefined') {
|
||||
$('.mashicon-twitter').click(function (e) {
|
||||
winWidth = 520;
|
||||
winHeight = 350;
|
||||
var winTop = (screen.height / 2) - (winHeight / 2);
|
||||
var winLeft = (screen.width / 2) - (winWidth / 2);
|
||||
var url = $(this).attr('href');
|
||||
|
||||
// deprecated and removed because TW popup opens twice
|
||||
if (mashsb.twitter_popup === '1') {
|
||||
window.open(url, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
|
||||
}
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof mashsb !== 'undefined' && mashsb.subscribe === 'content') {
|
||||
/* Toogle container display:none */
|
||||
$('.mashicon-subscribe').not('.trigger_active').nearest('.mashsb-toggle-container').hide();
|
||||
$('.mashicon-subscribe').click(function () {
|
||||
var trig = $(this);
|
||||
if (trig.hasClass('trigger_active')) {
|
||||
$(trig).nearest('.mashsb-toggle-container').slideToggle('fast');
|
||||
trig.removeClass('trigger_active');
|
||||
//$(".mashicon-subscribe").css({"padding-bottom":"10px"});
|
||||
} else {
|
||||
$('.trigger_active').nearest('.mashsb-toggle-container').slideToggle('slow');
|
||||
$('.trigger_active').removeClass('trigger_active');
|
||||
$(trig).nearest('.mashsb-toggle-container').slideToggle('fast');
|
||||
trig.addClass('trigger_active');
|
||||
//$(".mashicon-subscribe").css({"padding-bottom":"13px"});
|
||||
}
|
||||
;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof mashsb !== 'undefined' && mashsb.subscribe === 'link') {
|
||||
$('.mashicon-subscribe').click(function () {
|
||||
var href = mashsb.subscribe_url;
|
||||
$(this).attr("href", href);
|
||||
});
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
/* Round the shares callback function
|
||||
*
|
||||
* @param {type} value
|
||||
* @returns {String|@exp;value@call;toFixed}
|
||||
*/
|
||||
function roundShares(value) {
|
||||
if (typeof mashsb !== "undefined" && mashsb.round_shares == 1) {
|
||||
if (value > 1000000) {
|
||||
shares = Math.round((value / 1000000) * 10) / 10 + 'M';
|
||||
return shares;
|
||||
|
||||
}
|
||||
if (value > 1000) {
|
||||
shares = Math.round((value / 1000) * 10) / 10 + 'k';
|
||||
return shares;
|
||||
|
||||
}
|
||||
}
|
||||
/* zero decimals */
|
||||
return value.toFixed(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Count up script jquery-countTo
|
||||
* by mhuggins
|
||||
*
|
||||
* Source: https://github.com/mhuggins/jquery-countTo
|
||||
*/
|
||||
(function ($) {
|
||||
$.fn.countTo = function (options) {
|
||||
options = options || {};
|
||||
|
||||
return $(this).each(function () {
|
||||
// set options for current element
|
||||
var settings = $.extend({}, $.fn.countTo.defaults, {
|
||||
from: $(this).data('from'),
|
||||
to: $(this).data('to'),
|
||||
speed: $(this).data('speed'),
|
||||
refreshInterval: $(this).data('refresh-interval'),
|
||||
decimals: $(this).data('decimals')
|
||||
}, options);
|
||||
|
||||
// how many times to update the value, and how much to increment the value on each update
|
||||
var loops = Math.ceil(settings.speed / settings.refreshInterval),
|
||||
increment = (settings.to - settings.from) / loops;
|
||||
|
||||
// references & variables that will change with each update
|
||||
var self = this,
|
||||
$self = $(this),
|
||||
loopCount = 0,
|
||||
value = settings.from,
|
||||
data = $self.data('countTo') || {};
|
||||
|
||||
$self.data('countTo', data);
|
||||
|
||||
// if an existing interval can be found, clear it first
|
||||
if (data.interval) {
|
||||
clearInterval(data.interval);
|
||||
}
|
||||
data.interval = setInterval(updateTimer, settings.refreshInterval);
|
||||
|
||||
// initialize the element with the starting value
|
||||
render(value);
|
||||
|
||||
function updateTimer() {
|
||||
value += increment;
|
||||
loopCount++;
|
||||
|
||||
render(value);
|
||||
|
||||
if (typeof (settings.onUpdate) == 'function') {
|
||||
settings.onUpdate.call(self, value);
|
||||
}
|
||||
|
||||
if (loopCount >= loops) {
|
||||
// remove the interval
|
||||
$self.removeData('countTo');
|
||||
clearInterval(data.interval);
|
||||
value = settings.to;
|
||||
|
||||
if (typeof (settings.onComplete) == 'function') {
|
||||
settings.onComplete.call(self, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function render(value) {
|
||||
var formattedValue = settings.formatter.call(self, value, settings);
|
||||
$self.text(formattedValue);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.countTo.defaults = {
|
||||
from: 0, // the number the element should start at
|
||||
to: 0, // the number the element should end at
|
||||
speed: 1000, // how long it should take to count between the target numbers
|
||||
refreshInterval: 100, // how often the element should be updated
|
||||
decimals: 0, // the number of decimal places to show
|
||||
//formatter: formatter, // handler for formatting the value before rendering
|
||||
formatter: roundShares,
|
||||
onUpdate: null, // callback method for every time the element is updated
|
||||
onComplete: null // callback method for when the element finishes updating
|
||||
};
|
||||
|
||||
function formatter(value, settings) {
|
||||
return value.toFixed(settings.decimals);
|
||||
}
|
||||
|
||||
|
||||
}(jQuery));
|
||||
|
||||
/*
|
||||
* Start the counter
|
||||
*
|
||||
*/
|
||||
if (typeof mashsb !== 'undefined' && mashsb.animate_shares == 1 && $('.mashsbcount').length) {
|
||||
$('.mashsbcount').countTo({from: 0, to: mashsb.shares, speed: 1000, refreshInterval: 100});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
var strict;!function(a,b){a.fn.nearest=function(c){function d(b){f=f?f.add(b):a(b)}var e,f,g,h,i,j=b.querySelectorAll;return this.each(function(){e=this,a.each(c.split(","),function(){if(h=a.trim(this),h.indexOf("#"))for(i=e.parentNode;i;){if(g=j?i.querySelectorAll(h):a(i).find(h),g.length){d(g);break}i=i.parentNode}else d(j?b.querySelectorAll(h):a(h))})}),f||a()}}(jQuery,document),jQuery(document).ready(function(a){function b(){if("undefined"==typeof mashsb.servertime)return!0;var a=Number(mashsb.servertime),b=Math.floor(Date.now()/1e3);return b>a+30?(console.log("rate limited: "+(a+30)),!0):(console.log("not rate limited: "+(a+30)),!1)}function c(){return b()?!1:void setTimeout(function(){"1"==mashsb.refresh&&d()},6e3)}function d(){var a=window.location.href;a+=a.indexOf("?")>-1?"&mashsb-refresh":"?mashsb-refresh";var b=new XMLHttpRequest;b.open("GET",a,!0),b.send()}function e(a){if("undefined"!=typeof mashsb&&1==mashsb.round_shares){if(a>1e6)return shares=Math.round(a/1e6*10)/10+"M",shares;if(a>1e3)return shares=Math.round(a/1e3*10)/10+"k",shares}return a.toFixed(0)}(navigator.userAgent.match(/(iPhone)/i)||navigator.userAgent.match(/(Android)/i))&&a(".mashicon-whatsapp").show();a("body").off("click",".mashicon-pinterest").on("click",".mashicon-pinterest",function(b){b.preventDefault(),console.log("preventDefault:"+b),winWidth=520,winHeight=350;var c=screen.height/2-winHeight/2,d=screen.width/2-winWidth/2,e=a(this).attr("data-mashsb-url");window.open(e,"sharer","top="+c+",left="+d+",toolbar=0,status=0,width="+winWidth+",height="+winHeight+",resizable=yes")}),""==a(".mashsbcount").text()&&a(".mashsbcount").text(0),c(),a(".onoffswitch").on("click",function(){var b=a(this).parents(".mashsb-container");b.find(".onoffswitch").hide(),b.find(".secondary-shares").show(),b.find(".onoffswitch2").show()}),a(".onoffswitch2").on("click",function(){var b=a(this).parents(".mashsb-container");b.find(".onoffswitch").show(),b.find(".secondary-shares").hide()}),"undefined"==typeof lashare_fb&&"undefined"!=typeof mashsb&&a(".mashicon-facebook").click(function(b){winWidth=520,winHeight=550;var c=screen.height/2-winHeight/2,d=screen.width/2-winWidth/2,e=a(this).attr("href");return window.open(e,"sharer","top="+c+",left="+d+",toolbar=0,status=0,width="+winWidth+",height="+winHeight),b.preventDefault(),!1}),"undefined"!=typeof mashsb&&a(".mashicon-twitter").click(function(b){winWidth=520,winHeight=350;var c=screen.height/2-winHeight/2,d=screen.width/2-winWidth/2,e=a(this).attr("href");return"1"===mashsb.twitter_popup&&window.open(e,"sharer","top="+c+",left="+d+",toolbar=0,status=0,width="+winWidth+",height="+winHeight),b.preventDefault(),!1}),"undefined"!=typeof mashsb&&"content"===mashsb.subscribe&&(a(".mashicon-subscribe").not(".trigger_active").nearest(".mashsb-toggle-container").hide(),a(".mashicon-subscribe").click(function(){var b=a(this);return b.hasClass("trigger_active")?(a(b).nearest(".mashsb-toggle-container").slideToggle("fast"),b.removeClass("trigger_active")):(a(".trigger_active").nearest(".mashsb-toggle-container").slideToggle("slow"),a(".trigger_active").removeClass("trigger_active"),a(b).nearest(".mashsb-toggle-container").slideToggle("fast"),b.addClass("trigger_active")),!1})),"undefined"!=typeof mashsb&&"link"===mashsb.subscribe&&a(".mashicon-subscribe").click(function(){var b=mashsb.subscribe_url;a(this).attr("href",b)}),function(a){a.fn.countTo=function(b){return b=b||{},a(this).each(function(){function c(){k+=g,j++,d(k),"function"==typeof e.onUpdate&&e.onUpdate.call(h,k),j>=f&&(i.removeData("countTo"),clearInterval(l.interval),k=e.to,"function"==typeof e.onComplete&&e.onComplete.call(h,k))}function d(a){var b=e.formatter.call(h,a,e);i.text(b)}var e=a.extend({},a.fn.countTo.defaults,{from:a(this).data("from"),to:a(this).data("to"),speed:a(this).data("speed"),refreshInterval:a(this).data("refresh-interval"),decimals:a(this).data("decimals")},b),f=Math.ceil(e.speed/e.refreshInterval),g=(e.to-e.from)/f,h=this,i=a(this),j=0,k=e.from,l=i.data("countTo")||{};i.data("countTo",l),l.interval&&clearInterval(l.interval),l.interval=setInterval(c,e.refreshInterval),d(k)})},a.fn.countTo.defaults={from:0,to:0,speed:1e3,refreshInterval:100,decimals:0,formatter:e,onUpdate:null,onComplete:null}}(jQuery),"undefined"!=typeof mashsb&&1==mashsb.animate_shares&&a(".mashsbcount").length&&a(".mashsbcount").countTo({from:0,to:mashsb.shares,speed:1e3,refreshInterval:100})});
|
||||
Reference in new issue
Block a user