Conversaciones » Peticiones de scripts

Pixiv Ajax Bookmarking Not working in FF36-37-UP

§
Publicado: 17/1/2015
Editado: 26/3/2015

Pixiv Ajax Bookmarking Not working in FF36-37-UP

This is a really old script to bookmark art in Pixiv.net using ajax in a simple click, like Deviantart, for some reason it works just fine in Chromium based browsers+Tampermonkey, but the same script doest work in Firefox 34-35+GreaseMonkey, I really appreciate if someone can modify and improve the script for use in Firefox and all other browsers, it is strange that no one has put this kind of function in a script for pixiv. Thanks in advance.

§
Publicado: 17/1/2015

Try add this line between first and third line, see if it works.

// @grant GM_xmlhttpRequest
§
Publicado: 17/1/2015

Thanks, but keep not working. :(

§
Publicado: 19/1/2015

Again, I need this script to work in Firefox 35 and up, please if someone can fix it. Thanks.

§
Publicado: 20/1/2015

Up for fix to this script

§
Publicado: 21/1/2015

Try this.

文科Mod
§
Publicado: 21/1/2015

Try this.

Thanks!

§
Publicado: 21/1/2015

Thanks, keep not working, but i find this in the Java console as error:

TypeError: related is undefined Pixiv_AJAX_bookmarking.user.js:123

And in the script:

//Get the individual elements that contain the tags
var tagEl = related.getElementsByClassName('tag');

§
Publicado: 24/1/2015

up for the fix

§
Publicado: 4/2/2015

Again, anyone can fix this script for firefox 35 and up? Thanks

§
Publicado: 4/2/2015

Maybe the script is conflicted with some extensions or userscripts on your firefox since it works fine on mine.

Had you tried to install this script on a clean firefox? You can start a new profile using profile manager by running firefox -p.

§
Publicado: 4/2/2015
Editado: 4/2/2015

Maybe the script is conflicted with some extensions or userscripts on your firefox since it works fine on mine.

Had you tried to install this script on a clean firefox? You can start a new profile using profile manager by running firefox -p.

Ok, it works with the a new clean profile, the fix was to remove an old addon I have, the script now works like a charm. Thanks eigth!!

§
Publicado: 26/3/2015

Well, again this script stop work in the last update of FF36, Not working in Beta FF37 and not working in FF38 and up, can anyone let me know where is the problem or make some adjustments to put it work again? Here is the complete script with the fix of above:

// ==UserScript==
// @name Pixiv AJAX bookmarking
// @grant GM_xmlhttpRequest
// @namespace RevPsych
// @description Allows bookmarking images on Pixiv without leaving the image page.
// @include *pixiv.net/*
// @version 0.2
// ==/UserScript==

/*
BEGIN OPTIONS
*/

/*
defaultPrivacy

Set to "0" for public bookmarks of non-R18 images. Set to "1" to always set to private
*/
defaultPrivacy = "0";

/*END OPTIONS*/




/*BEGIN CODE*/

//Find the bookmark button
el = document.getElementsByClassName("bookmark-container")[0];

//Because the manga page does things differently
if(el == null){
//Get the illustration ID#
el = document.getElementsByName("illust_id")[0];
illustId = el.value;

//Create the url to the bookmark_add page
url = "http://www.pixiv.net/bookmark_add.php?type=illust&illust_id=" + illustId;

//Get the text from the button
inner = el.parentNode.childNodes[2].value;

//Select the section
el = el.parentNode.parentNode;

//Remove the button
el.removeChild(el.childNodes[0]);
}
else{
el = document.getElementsByClassName("bookmark-container")[0].getElementsByClassName("_button")[0];

//Copy the url and text
url = el.href;
inner = el.innerHTML;

//Remove the button
el.parentNode.innerHTML="";

el = document.getElementsByClassName("bookmark-container")[0];
}

//Create a new button
z = document.createElement("p");
z.setAttribute("class", "_button");
z.innerHTML = inner;
z.setAttribute('value', url);

//Add it to the document
z = el.appendChild(z);

//Add an event listener to launch our function
z.addEventListener('click',ajaxRelated,false);

function ajaxRelated() {

// Grab the element that called this function
el = this;

//Update the innerHTML
el.innerHTML = "Adding...";

// get the url that's stored in the link's value attribute
url = el.getAttribute("value");

//Fetch the bookmark page to pull tags and other necessary data
GM_xmlhttpRequest({
method: "GET",
url: url,
onload: function(o) {

//Store the response
response = o.responseText;

//Create a new element to attach the response text to
temp = document.createElement('div');
temp.style.display = "none";

//Select the text between the body tags
body = response.slice(response.indexOf(">", response.indexOf('"));

//Now put the response text into our temporary element
temp.innerHTML = body;

//Now attach it to the document so we can use it
document.body.appendChild(temp);

//Get the div element of the recommended tags section (there are two, but we only want the first one)
related = temp.getElementsByClassName('recommend-tag')[0];

//Initialize string
tags = "";

//Set privacy
r18 = defaultPrivacy;

//Get the individual elements that contain the tags
tagEl = related.getElementsByClassName('tag');

//Get the tags and store them in a string
for(i=0;i< tagEl.length;i++){
cur = tagEl[i].getAttribute("data-tag");

//If r-18, mark it as such
if(defaultPrivacy == "0" && (cur.toLowerCase() == '*r-18' || cur.toLowerCase() == 'r-18'))
r18 = '1';

//Add the tag to the tag list
tags = tags + cur + ' ';
}

//Get the hidden tt value for POSTing
var tt = document.getElementsByName('tt')[0].value;

//Extract the illustration ID from the url
var patt = /(?:[0-9]{1,})$/;
var illustId = patt.exec(url);

//Submit our information to bookmark_add.php
GM_xmlhttpRequest({
method: "POST",
url: "http://www.pixiv.net/bookmark_add.php",
headers:{'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
data: "type=illust&id="+illustId+"&tt="+tt+"&restrict="+r18+"&comment=&mode=add&from_sid=&submit=&tag="+tags,
onload: function(o) {
//Remove bookmark button
el.parentNode.removeChild(el);

//Replace the bookmark button with the edit bookmark button
bC = document.createElement("a");
bC.className = "button-on";
bC.href = url;
bC.innerHTML = "Edit Bookmark";
document.getElementsByClassName('bookmark-container')[0].appendChild(bC);
}
});

}
});



}

§
Publicado: 27/3/2015

Up for a solution

§
Publicado: 30/3/2015
Editado: 30/3/2015

up thread

§
Publicado: 2/4/2015

Up thread

§
Publicado: 4/4/2015

Up for a fix

§
Publicado: 6/4/2015

Up

§
Publicado: 18/4/2015

I rewrote this script and it works on Firefox:

https://greasyfork.org/en/scripts/9303-pixiv-ajax-bookmarking

Publicar respuesta

Inicia sesión para responder.