View difference between Paste ID: pPXWpccy and r3PnbnZK
SHOW: | | - or go back to the newest paste.
1
// ==UserScript==
2
// @name  View cams
3
// @namespace  None
4
// @version    1.3
5
// @description  View all cams without paying
6
// @match  http://reallifecam.com/
7
// @copyright  2013+, None
8
// @require    http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
9
// ==/UserScript==
10
11
var theElements = document.getElementsByTagName("a");
12
var count = 0;
13
var camNumber = 0;
14
var camID = "";
15-
var camPerson = "";
15+
16
var clipsDiv = $(".left_column");
17
var clipsDiv2 = $(".right_column"); 
18
var newHTML = '<div class="clips">';
19
var newHTML2 = '<div class="clips">';
20
21
var cookie = document.cookie;
22
var urlraw = readCookie("sign_w");
23
var urlSign = cropURL(urlraw);
24
25
for (var i = 0;i < theElements.length; i++)
26
{
27
    var current = theElements[i];
28
    
29
    if(current.id.match("0[0-9]_[0-9]"))
30
    {        
31
        count++;
32
        
33
        camID = current.id;
34
        
35
        if(current.className.match("cams"))
36
        {
37
            //It's a normal cam
38
            camName = "cam" + camID;
39
        }
40
        else
41
        {
42
            //It's a passworded cam, presumabley gotta do individual checks here
43
            camName = "cam" + camID;
44
        }
45
        
46
        if(count < 20)
47
        {
48
            newHTML = newHTML + '<div class="galki-vpravo menu1" onclick="changeclass('+camID+');return false;"><a href="'+camName+'.stream?'+urlSign+'" id="'+camID+'" data-camid="'+camID+'" class=""> Cam #'+camID+'</a></div>';
49
        }
50
        else
51
        {
52
            newHTML2 = newHTML2 + '<div class="galki-vpravo menu1" onclick="changeclass('+camID+');return false;"><a href="'+camName+'.stream?'+urlSign+'" id="'+camID+'" data-camid="'+camID+'" class=""> Cam #'+camID+'</a></div>';
53
        } 
54
    }
55
}
56
57
//-----This part overrides the old links
58
newHTML = newHTML + "</div>";
59
newHTML2 = newHTML2 + "</div>";
60
clipsDiv.html(newHTML);
61
clipsDiv2.html(newHTML2);
62
//------------------------
63
64
65
//-----Console logs for info
66
//console.log("Number of Found Links:" + count);
67
console.log(urlSign);
68
console.log(cookie);
69
//-------------
70
71
72
//Functions used to crop URL and read the cookie for the URL
73
function readCookie(name) {
74
    var nameEQ = name + "=";
75
    var ca = cookie.split(';');
76
    for(var i = 0; i < ca.length; i++) {
77
        var c = ca[i];
78
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
79
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
80
    }
81
    return null;
82
}
83
84
//Cookie Result: sign_w=%3Fkey%3D18ed0Sexpire%3D1377854835Ssign%3Df385fafdda73a2b3224d6e54631db7d7;
85
//Link Result: <a href="cam02_1.stream?key=18ed0Sexpire=1377854835Ssign=f385fafdda73a2b3224d6e54631db7d7"
86
// So the link is linked with the cookie
87
// %3F is a '?'
88
// %3D is a '='
89
function cropURL(oldurl)
90
{
91
    var splits = oldurl.split("%");
92
    
93
    for(int x=0; x<splits.length; x++)
94
    {
95
        if(splits[x].substr(0,3) == "%3F")
96
        {
97
            splits[x].substr(0,3) = "  ?";
98
            splits[x].trim();
99
        }
100
        else if(splits[x].substr(0,3) == "%3D")
101
        {
102
            splits[x].substr(0,3) = "  =";
103
            splits[x].trim();
104
        }
105
    }
106
    
107
    var newurl = splits.join("");
108
    
109
    return newurl;
110
}