~pablocapeluto/unity-webapps-askubuntu/devel

« back to all changes in this revision

Viewing changes to askubuntu.user.js

  • Committer: Pablo Capeluto
  • Date: 2013-06-10 00:33:48 UTC
  • Revision ID: pcapeluto@gmail.com-20130610003348-kyk3x3b6rymf4l6k
Primer version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ==UserScript==
 
2
// @include       http://askubuntu.com/*
 
3
// @require        utils.js
 
4
// ==/UserScript==
 
5
 
 
6
// Copyright (C) 2012 - 2013 Unity Shell
 
7
// <unityshellblog@gmail.com>
 
8
//
 
9
// This program is free software: you can redistribute it and/or modify
 
10
// it under the terms of the GNU General Public License as published by
 
11
// the Free Software Foundation, either version 3 of the License, or
 
12
// (at your option) any later version.
 
13
 
 
14
// This program is distributed in the hope that it will be useful,
 
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
// GNU General Public License for more details.
 
18
//
 
19
// You should have received a copy of the GNU General Public License
 
20
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
21
// =====================================================================
 
22
 
 
23
var Unity = external.getUnityObject(1.0);
 
24
 
 
25
function unityReady() {
 
26
 
 
27
        
 
28
        // HUD  
 
29
    Unity.addAction('/Enlace1/', makeRedirector('http://www.sitio.com.uy/enlace1'));
 
30
    Unity.addAction('/Enlace2/', makeRedirector('http://www.sitio.com.uy/enlace2'));
 
31
    
 
32
    // Appindicator (contador)
 
33
    //Unity.MessagingIndicator.showIndicator(_("Contador 1"), { count: 2,  callback: function () {}});
 
34
    //Unity.MessagingIndicator.showIndicator(_("Contador 2"), { count: 12, callback: function () {}});
 
35
    //Unity.MessagingIndicator.showIndicator(_("Contador 3"), { count: 32, callback: function () {}});
 
36
        
 
37
        // QuickList's
 
38
        Unity.Launcher.addAction("Consultas:", function() {
 
39
    location.href = "http://askubuntu.com/questions?sort=newest"
 
40
    });
 
41
        Unity.Launcher.addAction("··     Nuevas preguntas", function() {
 
42
    location.href = "http://askubuntu.com/questions?sort=newest"
 
43
    });
 
44
    Unity.Launcher.addAction("··     Respuestas con más puntaje", function() {
 
45
    location.href = "http://askubuntu.com/questions?sort=featured"
 
46
    });
 
47
    Unity.Launcher.addAction("··     Respuestas más vistas", function() {
 
48
    location.href = "http://askubuntu.com/questions?sort=frequent"
 
49
    });
 
50
    Unity.Launcher.addAction("··     Las más votadas", function() {
 
51
    location.href = "http://askubuntu.com/questions?sort=votes"
 
52
    });
 
53
    Unity.Launcher.addAction("··     Con más actividad", function() {
 
54
    location.href = "http://askubuntu.com/questions?sort=active"
 
55
    });
 
56
    Unity.Launcher.addAction("··     Sin responder", function() {
 
57
    location.href = "http://askubuntu.com/questions?sort=unanswered"
 
58
    });
 
59
    
 
60
    Unity.Launcher.addAction("------------------------------------------", function() {
 
61
    location.href = "#"
 
62
    });
 
63
    
 
64
        
 
65
    Unity.Launcher.addAction("Chat:", function() {
 
66
    popup('http://chat.stackexchange.com/',1000,600);
 
67
    });
 
68
                Unity.Launcher.addAction("··     Salas más activas", function() {
 
69
                popup('http://chat.stackexchange.com/?tab=all&sort=active',1000,600);
 
70
                });
 
71
                Unity.Launcher.addAction("··     Eventos", function() {
 
72
                popup('http://chat.stackexchange.com/?tab=all&sort=event',1000,600);
 
73
                });
 
74
                Unity.Launcher.addAction("··     Salas con más integrantes", function() {
 
75
                popup('http://chat.stackexchange.com/?tab=all&sort=people',1000,600);
 
76
                });
 
77
                Unity.Launcher.addAction("··     Salas nuevas", function() {
 
78
                popup('http://chat.stackexchange.com/?tab=all&sort=created',1000,600);
 
79
                });
 
80
    
 
81
    Unity.Launcher.addAction("Usuarios:", function() {
 
82
    popup('http://askubuntu.com/users',1000,600);
 
83
    });
 
84
                Unity.Launcher.addAction("··     Nuevos", function() {
 
85
                popup('http://askubuntu.com/users?tab=newusers',1000,600);
 
86
                });
 
87
                Unity.Launcher.addAction("··     Con más votos", function() {
 
88
                popup('http://askubuntu.com/users?tab=voters',1000,600);
 
89
                });
 
90
                Unity.Launcher.addAction("··     Con más reputación", function() {
 
91
                popup('http://askubuntu.com/users?tab=reputation',1000,600);
 
92
                });   
 
93
 
 
94
    Unity.Launcher.addAction("Insignias", function() {
 
95
    popup('http://askubuntu.com/badges',1000,600);
 
96
    });
 
97
    //Unity.Launcher.addAction("··     Oro", function() {
 
98
    //popup('http://askubuntu.com/badges?tab=general&filter=gold',1000,600);
 
99
    //});
 
100
    //Unity.Launcher.addAction("··     Plata", function() {
 
101
    //popup('http://askubuntu.com/badges?tab=general&filter=silver',1000,600);
 
102
    //});
 
103
    //Unity.Launcher.addAction("··     Bronce", function() {
 
104
    //popup('http://askubuntu.com/badges?tab=general&filter=bronze',1000,600);
 
105
    //});
 
106
 
 
107
}
 
108
 
 
109
        
 
110
        // Función que abre Popups
 
111
        //function popup(url,ancho,alto) {
 
112
        //      var posicion_x; 
 
113
        //      var posicion_y; 
 
114
        //      posicion_x=(screen.width/2)-(ancho/2); 
 
115
        //      posicion_y=(screen.height/2)-(alto/2); 
 
116
        //      window.open(url, "#", "width="+ancho+",height="+alto+",menubar=0,toolbar=0,directories=0,scrollbars=yes,resizable=no,left="+posicion_x+",top="+posicion_y+"");
 
117
        //}
 
118
        
 
119
function popup(URL) {
 
120
        day = new Date();
 
121
        id = day.getTime();
 
122
        eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = 112,top = 0');");
 
123
}
 
124
 
 
125
Unity.init({ name: "Askubuntu",
 
126
                        domain: 'askubuntu.com',
 
127
                        homepage: 'http://askubuntu.com',
 
128
                        iconUrl: "http://ubuntuone.com/0T7vI7eMxer6d5a6yyOrFM",
 
129
                        onInit: wrapCallback(unityReady) });
 
130
 
 
131