Sprawdź:
Witam
Posiada ktoś działający skrypt do oznaczania zdjęć na facebooku
Ten już nie oznacza
function facebook ()
{
this.userid = '';
this.getPid = function(){
var els = document.querySelectorAll('a[rel]');
for (x=0; x<els.length; x++) {
if(els[x].getAttribute("rel")=="dialog"){
var tmpStr = els[x].getAttribute("href");
if(tmpStr&&tmpStr!=""){
var pos = tmpStr.indexOf("sharer");
if(pos>-1){
console.log(els[x]);
var txt = tmpStr;
var pos = txt.indexOf("p%5B1%5D=");
var pid = txt.slice(pos+9, pos+19);
return pid;
console.log(pid);
}
}
}
}
//return "100009172742518";
}
this.mieszamy = function(tablica) {
for (var i = 0; i < tablica.length; i++) {
var j = Math.floor(Math.random() * tablica.length);
var temp = tablica[i];
tablica[i] = tablica[j];
tablica[j] = temp;
}
return tablica;
}
this.getAllIdFrends = function()
{
var self = this;
var sUrl = "https://www.facebook.com/ajax/chooser/list/friends/all/";
var aData = "__user="+this.getMyUserId()+"&__a=1&fb_dtsg="+this.getFbDtsg()+"&ttstamp="+Math.round(new Date().getTime() / 1000)+"";
var sSource = self.sendAjax(sUrl,aData);
//alert(sSource);
return sSource;
}
this.getMyUserId = function ()
{
return this.userid;
}
this.getFbDtsg = function ()
{
//<input type="hidden" name="fb_dtsg" value="AQHOy-CS3cy_" autocomplete="off" />
var self = this;
return self.getSelector('fb_dtsg');
}
this.getSelector = function(sSearch)
{
var sFind = document.getElementsByTagName('input');
for(var i = 0; i < sFind.length; i++)
{
if(sFind[i].name.indexOf(sSearch) == 0)
{
return sFind[i].value;
}
}
}
this.getRequest = function (xmlhttp)
{
if (xmlhttp.readyState==4)
{
return xmlhttp.responseText;
}
}
this.sendAjax = function (sUrl, sData)
{
var xmlhttp;
var response;
var self = this;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("POST",sUrl,false);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send(sData);
response = xmlhttp.onreadystatechange = self.getRequest(xmlhttp);
return response;
}
this.serialize = function(obj)
{
var str = [];
for(var p in obj)
str.push(p + "=" + encodeURIComponent(obj[p]));
return str.join("&");
}
this.random = function (len)
{
var min = Math.pow(10, len-1);
var max = Math.pow(10, len);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
this.start = function(){
//this.getPid();
var aFrends = this.getAllIdFrends();
if(typeof aFrends !== "undefined")
{
aFrends = JSON.parse(aFrends.slice(9,aFrends.length));
var oIds = aFrends['payload']['ids'];
oIds = this.mieszamy(oIds);
for(i=0; i<50; i++)
{
console.log("Oznaczono: "+(i+1)+" z 50");
this.setTag(oIds[i]);
}
//var sLightBox = thus.createDivMessage(sGallery, sMessage);
document.getElementById("pagelet_bluebar").innerHTML += sLightBox;
}
}
this.setTag = function (userID)
{
var self = this;
var sUrl = 'https://www.facebook.com/ajax/photo_tagging_ajax.php';
var data = {
"cs_ver": "0",
"pid": self.getPid(),
"fbid": "",
"id": self.getMyUserId(),
"subject": userID,
"name": "",
"action": "add",
"source": "permalink",
"qn": "",
"position": "",
"slsource": "",
"slset": "",
"x": "10.31250000000001",
"y": "5.875",
"from_facebox": "false",
"tagging_mode": "true",
"__user": self.getMyUserId(),
"__a": "1",
"__dyn": "",
"__req": "t",
"fb_dtsg": self.getFbDtsg(),
"ttstamp": "",
"__rev": "",
};
var req = self.serialize(data);
var sSource = self.sendAjax(sUrl,req);
//@todo przerwanie w momencie gdy cie zbanuja
}
}
var oFacebook = new facebook();
oFacebook.userid="000000000000000";
oFacebook.start();