summaryrefslogtreecommitdiffstats
path: root/.conkerorrc
blob: e9fea2aadbb58d42836beac03421d7aebb7e12f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// -*- mode: javascript -*-
require("new-tabs.js");
require("clicks-in-new-buffer.js");

// STYLE
/*let (sheet = get_home_directory()) {
    sheet.append(".conkerorrc.d");
    sheet.append("stylesheets");
    sheet.append("tabs.css");
    register_user_stylesheet(make_uri(sheet));
}*/
function test(window)
{
    var test = window.tab2-bar;
    window.buffers.container.removeChild(test);
}

//add_hook("window_initialize_hook", test);

// VARIABLES
// Make middle mouse button open new tab in background
clicks_in_new_buffer_target = OPEN_NEW_BUFFER_BACKGROUND;

// WEBJUMPS
define_webjump("delicious",
               "http://delicious.com/search?p=linux&lc=0&context=userposts%7Cslashed%7C",
               $alternative="http://delicious.com/slashed");
define_webjump("gmail",
               "https://mail.google.com/mail/#search/%s");
define_webjump("greader",
               "http://www.google.com/reader/view/#search/%s/");
define_webjump("github",
               "http://github.com/search?q=%s",
               $alternative="http://github.com/ryuslash/");
define_webjump("archwiki",
               "http://wiki.archlinux.org/index.php?search=%s");
define_webjump("fedorawiki",
               "https://fedoraproject.org/wiki/search=%s");

// FUNCTIONS
interactive("delicious-post",
            "bookmark the page via delicious",
            function (I) {
                check_buffer(I.buffer, content_buffer);
                let posturl = 'https://api.del.icio.us/v1/posts/add?&url=' +
                    encodeURIComponent(
                        load_spec_uri_string(
                            load_spec(I.buffer.top_frame))) +
                    "&description=" +
                    encodeURIComponent(
                        yield I.minibuffer.read(
                            $prompt = "name (required): ",
                            $initial_value = I.buffer.title)) +
                    "&tags=" +
                    encodeURIComponent(
                        yield I.minibuffer.read(
                            $prompt = "tags (space delimited): ")) +
                    "&extended=" +
                    encodeURIComponent(
                        yield I.minibuffer.read(
                            $prompt = "extended description: "));

                try {
                    var content = yield send_http_request(
                        load_spec({uri: posturl}));
                    I.window.minibuffer.message(content.responseText);
                } catch (e) { }
            });

interactive("delicious-post-link",
            "bookmar the link via delicious",
            function (I) {
                bo = yield read_browser_object(I);
                mylink = load_spec_uri_string(
                    load_spec(encodeURIComponent(bo)));
                check_buffer(I.buffer, content_buffer);
                let postlinkurl = "https://api.del.icio.us/v1/posts/add?&yrl=" +
                    mylink +
                    "&description=" +
                    encodeURIComponent(
                        yield I.minibuffer.read(
                            $prompt = "name (required): ",
                            $initial_value = bo.textContent)) +
                    "&tags=" +
                    encodeURIComponent(
                        yield I.minibuffer.read(
                            $prompt = "tags (space delimited): ")) +
                    "&extended=" +
                    encodeURIComponent(
                        yield I.minibuffer.read(
                            $prompt = "extended description: "));

                try {
                    var content = yield send_http_request(
                        load_spec({uri: postlinkurl}));
                    I.window.minibuffer.message(content.responseText);
                } catch (e) { }
            }, $browser_object = browser_object_links);

// KEYMAPPINGS
define_key(default_global_keymap, "p", "delicious-post");
define_key(default_global_keymap, "P", "delicious-post-link");