// ==UserScript==
// @icon http://s3.amazonaws.com/uso_ss/icon/177275/large.png?1378512285
// @name Pinterest Add-Ons
// @version 20150214a
// @description Changes the look of Pinterest and the way items are posted.
// @include https://pinterest.com/*
// @include https://www.pinterest.com/*
// @include https://pinterest.com/pin/*
// @include https://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: 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; }\
}\
');
/* Main */
addGlobalStyle(' .Modal .modalMask, .BoardPickerOld .boardPickerInnerWrapper .boardPickerItem:hover, .App, .Closeup.canClose, .ui-SelectList.compact .item.selected {\
background: linear-gradient(45deg, #0072bc 0%,#8dc63f 100%);\
background: #0072bc;\
background: -moz-linear-gradient(45deg, rgba(0, 114, 188, 0.90) 0%,rgba(141, 198, 63, 0.90) 100%);\
background: -webkit-gradient(linear, left bottom, right top, color-stop(0%,rgba(0, 114, 188, 0.90), color-stop(100%,rgba(141, 198, 63, 0.90))));\
background: -webkit-linear-gradient(45deg, rgba(0, 114, 188, 0.90) 0%,rgba(141, 198, 63, 0.90) 100%);\
background: -o-linear-gradient(45deg, rgba(0, 114, 188, 0.90) 0%,rgba(141, 198, 63, 0.90) 100%);\
background: -ms-linear-gradient(45deg, rgba(0, 114, 188, 0.90) 0%,rgba(141, 198, 63, 0.90) 100%);\
background: linear-gradient(45deg, rgba(0, 114, 188, 0.90) 0%,rgba(141, 198, 63, 0.90) 100%);\
-webkit-animation: FadeInAlmost .15s; /* Safari 4+ */\
-moz-animation: FadeInAlmost .15s; /* Fx 5+ */\
-o-animation: FadeInAlmost .15s; /* Opera 12+ */\
animation: FadeInAlmost .15s; /* IE 10+, Fx 29+ */ } ');
addGlobalStyle(' .App, .Closeup.canClose {height: auto; border-top: 1px solid #4B8CA8; } ');
addGlobalStyle(' .Modal .modalContent {border-radius: 20px!important; transition: all .25s ease-in-out;}'); //Pin box that pops up
//addGlobalStyle(' .columns-10 .centeredWithinWrapper {width: 100%; } ');
addGlobalStyle(' .Modal .modalMask {opacity: 0.75;} ');
addGlobalStyle(' .Modal .modalContainer {zoom: document;} ');
/* 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;}');
addGlobalStyle(' .BoardPicker.inPopover .ui-SelectList {max-height: 700px;} ');
addGlobalStyle(' .Dropdown2.visible {top: -180px;} ');
/* BoardPickerItem */
addGlobalStyle(' .BoardPickerOld .boardPickerInnerWrapper .boardPickerItem.active {background: #156369;color: #fff;} ');
addGlobalStyle(' .boardPickerItem:hover {color: #fff; transition: all .2s ease;}');
addGlobalStyle(' .boardPickerItem {transition: all .5s 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 .35s; /* Safari 4+ */\
-moz-animation: FadeIn .35s; /* Fx 5+ */\
-o-animation: FadeIn .35s; /* Opera 12+ */\
animation: FadeIn .35s; /* IE 10+, Fx 29+ */ } ');
addGlobalStyle(' .Pin.summary .pinHolder:hover .hoverMask {background: rgba(210, 104, 28, 0.6);} ');
/* 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 .3s ease-in-out;} ');
addGlobalStyle('.App {height:100%;}');
addGlobalStyle('.mainContainer {padding-top: 25%;}');
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.
*/
/* * DO NOT COPY THIS IN TO GREASYFORK *************
var e = document.createElement('div'); //Make a div element (we also could have made it with Html)
e.createAttribute("id","myDiv"); //Set the id to "myDiv"
myButton = document.getElementById("myButton"); //searches for and detects the input element from the 'myButton' id
myButton.value = "I'm a changed button"; //changes the value
myButton.type = "text"; //changes the input type from 'button' to 'text'.
*/