Pinterest Add-Ons

Changes the look of Pinterest and the way items are posted.

当前为 2015-01-05 提交的版本,查看 最新版本

// ==UserScript==
// @icon            http://s3.amazonaws.com/uso_ss/icon/177275/large.png?1378512285
// @name            Pinterest Add-Ons
// @version         20150104a
// @description     Changes the look of Pinterest and the way items are posted.
// @include         http://pinterest.com/*
// @include         http://www.pinterest.com/*
// @include         http://pinterest.com/pin/*
// @include         http://www.pinterest.com/pin/*
// @namespace       https://greasyfork.org/scripts/7275-pinterest-add-ons/code/Pinterest%20Add-Ons.user.js
// @license	    http://creativecommons.org/licenses/by-nc-sa/3.0/
// @grant	    GM_xmlhttpRequest
// @require	    http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js

// ==/UserScript==

//Auto scroll to top when page is loaded
$(document).ready(function () {

            $(window).scrollTop(0);
            return false;

        });


// Function to add style
function addGlobalStyle(css) {
    var head, style;
    head = document.getElementsByTagName('head')[0];
    if (!head) { return; }
    style = document.createElement('style');
    style.type = 'text/css';
    style.innerHTML = css;
    head.appendChild(style);
}

/* KeyFrames */
addGlobalStyle(' @-webkit-keyframes FadeIn {\
  0%   { opacity: 0; }\
  100% { opacity: 1; }\
}\
@-moz-keyframes FadeIn {\
  0%   { opacity: 0; }\
  100% { opacity: 1; }\
}\
@-o-keyframes FadeIn {\
  0%   { opacity: 0; }\
  100% { opacity: 1; }\
}\
@keyframes FadeIn {\
  0%   { opacity: 0; }\
  100% { opacity: 1; }\
}\
               ');

addGlobalStyle(' @-webkit-keyframes FadeInAlmost {\
  0%   { opacity: 0; }\
  100% { opacity: .75; }\
}\
@-moz-keyframes FadeIn {\
  0%   { opacity: 0; }\
  100% { opacity: .75; }\
}\
@-o-keyframes FadeIn {\
  0%   { opacity: 0; }\
  100% { opacity: .75; }\
}\
@keyframes FadeIn {\
  0%   { opacity: 0; }\
  100% { opacity: .75; }\
}\
               ');


/* TESTING */


/* END TESTING */

/* Main */
addGlobalStyle(' .Modal .modalMask, .BoardPickerOld .boardPickerInnerWrapper .boardPickerItem:hover, .App, .Closeup.canClose {\
		background: linear-gradient(45deg, #0072bc 0%,#8dc63f 100%);\
		background: #0072bc;\
		background: -moz-linear-gradient(45deg, #0072bc 0%, #8dc63f 100%);\
		background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,#0072bc), color-stop(100%,#8dc63f));\
		background: -webkit-linear-gradient(45deg, #0072bc 0%,#8dc63f 100%);\
		background: -o-linear-gradient(45deg, #0072bc 0%,#8dc63f 100%);\
		background: -ms-linear-gradient(45deg, #0072bc 0%,#8dc63f 100%);\
		background: linear-gradient(45deg, #0072bc 0%,#8dc63f 100%);\
		-webkit-animation: FadeInAlmost 1s; /* Safari 4+ */\
		-moz-animation:    FadeInAlmost 1s; /* Fx 5+ */\
		-o-animation:      FadeInAlmost 1s; /* Opera 12+ */\
		animation:         FadeInAlmost 1s; /* IE 10+, Fx 29+ */      } ');

addGlobalStyle(' .App, .Closeup.canClose {height: auto;	border-top: 1px solid #4B8CA8;	} ');
addGlobalStyle(' .Modal .modalContent {border-radius: 20px!important; transition: all .5s ease-in-out;}'); //Pin box that pops up

addGlobalStyle(' .Modal .modalMask {opacity: 0.75;} ');

/* BoardHeader */
addGlobalStyle(' .BoardHeader h1 {color: #fff;} ');

/* BoardPicker */
addGlobalStyle(' .boardPicker {height: 700px!important; border: 1px solid #000000!important; box-shadow: 2px 5px 10px 5px #000!important;}');
addGlobalStyle(' .boardPickerInnerWrapper.visible {height: 700px!important; border: 1px solid #000000!important; box-shadow: 2px 5px 10px 5px #000!important; top: -180px!important;}');

/* BoardPickerItem */
addGlobalStyle(' .BoardPickerOld .boardPickerInnerWrapper .boardPickerItem.active {background: #156369;color: #fff;} ');
addGlobalStyle(' .boardPickerItem:hover {color: #fff; transition: all .2s ease;}');
addGlobalStyle(' .boardPickerItem {transition: all .7s ease;} ');

/* Pins */
addGlobalStyle(' .AddPinRep {background: #000000; border: 2px dashed #E93B3B; color: #FFF; border-radius: 35px; text-shadow: 0; transition: all 1s ease-in-out;} .appContent.guided { height: 100%; transition: all 1s ease-in-out;}');
addGlobalStyle(' .Pin.summary .pinImageActionButtonWrapper:hover .repinSendButtonWrapper, .Pin.summary .pinImageActionButtonWrapper:hover .likeEditButtonWrapper, .Pin.summary .pinImageActionButtonWrapper:hover .navLinkOverlay, .Pin.summary .pinImageActionButtonWrapper:hover .pinImageDim {\
  -webkit-animation: FadeIn .85s; /* Safari 4+ */\
  -moz-animation:    FadeIn .85s; /* Fx 5+ */\
  -o-animation:      FadeIn .85s; /* Opera 12+ */\
  animation:         FadeIn .85s; /* IE 10+, Fx 29+ */ } ');

/* Footer */
addGlobalStyle(' .formFooter {border-radius: 0px 0 20px 20px!important;');

/* Unused Items right now */
//addGlobalStyle(' .Pin.summary .pinHolder:hover .hoverMask {background: rgba(255, 255, 255, 0.4)!important;}');
//addGlobalStyle(' .Grid.hasFooter, .mainContainer {background-color: #490E0E!important;}');



if (document.URL.search('pin/create/*') >= 0) {
    window.resizeTo(780,825);

    addGlobalStyle(' body {overflow-y: hidden;} ');
    addGlobalStyle('.boardPickerInnerWrapper.visible {height: 680px!important; border: 1px solid #000000!important; box-shadow: 2px 5px 10px 5px #000!important; top: 0px!important;  transition: all .4s ease-in-out;} ');
    addGlobalStyle('.App {height:100%;');
    addGlobalStyle('.PinForm.Module {border: 1px Solid #000; box-shadow: 4px 4px 10px -3px #000000; transition: all .4s ease-in-out;} ');
}





// Pinterest++ Script 
// credits go to ifugu for creating the Visist Source button
// Original script can be found here *** https://greasyfork.org/en/scripts/3075-pinterest ***
// Alterations I made were moving the botton up to the main buttonWrapper and shortening the text so it didn't overlay the "like" button.

(function () {
	hookUpPinHoverEvent();
})();




function hookUpPinHoverEvent() {
	$(document.body).on('mouseover', '.PinBase' ,function(){
		var $pin = $(this),
			$buttonWrapper = $pin.find('.repinSendButtonWrapper');

		if (!$buttonWrapper.find('.sourceLaunchButton').length) {
			var $pinLink = $pin.find('.pinImageWrapper'); //richPinMetaLink
			if ($pinLink.length) {
				var href = window.location.origin + $pinLink.attr('href'),
                    $btn = $('<button data-element-type="196" type="button" class="rounded Button likeSmall btn hasText sourceLaunchButton" style="margin-left: 2px; height: 31.5px; position: relative;">VS<span class="buttonText"></span></button>');
				$buttonWrapper.append($btn);

				$btn.click(function () {
					var $btn = $(this),
						dataHref = $btn.attr('data-href');

					if (dataHref && dataHref.length)
						window.open(dataHref);
					else {
						$btn.attr('disabled', 'disabled').html('retrieving link ...');
						var w = window.open();
						if ($.browser.webkit)
							w.document.write('<b><i>Navigating to source page ...</i></b>');
						GM_xmlhttpRequest({
							method: 'GET',
							url: href,
							onload: function(response) {
								var $sourceLink = $('.richPinNameLink, .paddedPinLink', response.responseText);
								if ($sourceLink.length) {
									var sourceHref = $sourceLink.first().attr('href');
									if (sourceHref && sourceHref.length) {
										$btn.html('opening ...').attr('data-href', sourceHref);
										w.location = sourceHref;
										$btn.removeAttr('disabled').html('VS');
									}
									else
										$btn.html('Unable to retrieve source link');
								}
							}
						});
					}
				});

			}
		}
	});
}






  

/* 
I'm looking for someone help with This script. I am piecing scripts together and playing with them until they work but I know there is a better way. 
If you would like to assist, I would greatly appreciate it.
*/