2009-05-07 20:22:43 +00:00
|
|
|
<!--
|
|
|
|
Speed Dial head template for Midori.
|
|
|
|
Copyright (C) 2009 Jean-François Guchens <zcx000@gmail.com>
|
|
|
|
This file is licensed under the terms of the expat license, see the file EXPAT.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<head>
|
|
|
|
<title>{title}</title>
|
|
|
|
<script type="text/javascript" src="{res}/mootools.js"></script>
|
2009-05-09 14:41:01 +00:00
|
|
|
|
2009-05-07 20:22:43 +00:00
|
|
|
<style>
|
2009-05-13 21:56:55 +00:00
|
|
|
|
|
|
|
html, body, #content {
|
|
|
|
margin: 0px;
|
|
|
|
padding: 0px
|
|
|
|
}
|
|
|
|
|
2009-05-07 20:22:43 +00:00
|
|
|
body {
|
|
|
|
text-align: center;
|
|
|
|
background-color: #fefefe;
|
|
|
|
font-family: sans-serif;
|
|
|
|
}
|
|
|
|
|
|
|
|
#wrap {
|
|
|
|
width: 660px;
|
2009-05-13 21:56:55 +00:00
|
|
|
height: 550px;
|
2009-05-07 20:22:43 +00:00
|
|
|
margin: 0px auto;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
div.shortcut {
|
|
|
|
float: left;
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
position: relative;
|
|
|
|
width: 200px;
|
|
|
|
height: 150px;
|
2009-05-13 21:56:55 +00:00
|
|
|
margin: 20px 20px 0px 0px;
|
2009-05-07 20:22:43 +00:00
|
|
|
background-color: #fff;
|
|
|
|
-webkit-border-radius: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
div.right {
|
|
|
|
margin-right: 0px;
|
|
|
|
margin-left: 0px;
|
|
|
|
}
|
|
|
|
|
|
|
|
div.top {
|
|
|
|
margin-top: 0px;
|
|
|
|
}
|
|
|
|
|
|
|
|
h1 {
|
|
|
|
font-size: 50px;
|
|
|
|
font-weight: bold;
|
|
|
|
margin: 0px;
|
|
|
|
height: 30px;
|
|
|
|
padding: 10px 0px 0px 0px;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
h4 {
|
|
|
|
font-size: 11px;
|
|
|
|
font-weight: bold
|
|
|
|
margin: 10px 0px 0px 0px;
|
|
|
|
padding: 10px 5px 0px;
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
|
|
|
|
h4 span:before {
|
|
|
|
content: "{click_to_add}";
|
|
|
|
font-size: 11px;
|
|
|
|
}
|
|
|
|
|
|
|
|
h4 span {
|
|
|
|
font-size: 11px;
|
|
|
|
}
|
|
|
|
|
|
|
|
div.shortcut a {
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
display: block;
|
|
|
|
width: 160px;
|
|
|
|
height: 107px;
|
|
|
|
margin: 15px auto 0px;
|
|
|
|
background-color: #fafafa;
|
|
|
|
color: #aaa;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.waiter img {
|
|
|
|
margin-top: 38px;
|
|
|
|
}
|
|
|
|
|
|
|
|
div.shortcut a:hover {
|
|
|
|
border: 1px solid #999;
|
|
|
|
}
|
|
|
|
|
|
|
|
div.shortcut p {
|
|
|
|
font-size: 12px;
|
|
|
|
margin: 0px;
|
|
|
|
padding: 5px 0px 0px;
|
|
|
|
color: #222;
|
|
|
|
}
|
|
|
|
|
|
|
|
#search_bar {
|
|
|
|
margin: 20px 0px 20px;
|
|
|
|
}
|
|
|
|
|
|
|
|
div.clear {
|
|
|
|
clear: both;
|
|
|
|
}
|
|
|
|
|
|
|
|
input[type=text] {
|
|
|
|
color: #ddd;
|
2009-05-13 21:56:55 +00:00
|
|
|
vertical-align: middle;
|
|
|
|
font-size: 13px;
|
2009-05-07 20:22:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
input[type=text]:active, input[type=text]:focus {
|
|
|
|
color: #222;
|
|
|
|
}
|
|
|
|
|
2009-05-13 21:56:55 +00:00
|
|
|
button {
|
|
|
|
font-size: 12px;
|
|
|
|
padding: 5px 7px;
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
|
2009-05-07 20:22:43 +00:00
|
|
|
div.activated {
|
|
|
|
background-color: #f5f5f5;
|
|
|
|
}
|
|
|
|
|
|
|
|
.cross {
|
|
|
|
-webkit-border-radius: 7px;
|
|
|
|
background-color: #ddd;
|
|
|
|
height: 15px;
|
|
|
|
width: 15px;
|
|
|
|
font-size: 11px;
|
|
|
|
font-weight: bolder;
|
|
|
|
font-family: sans-serif;
|
|
|
|
margin-bottom: -17px;
|
|
|
|
margin-left: 183px;
|
|
|
|
margin-top: 2px;
|
|
|
|
text-align: center;
|
|
|
|
color: #fff;
|
|
|
|
cursor: pointer;
|
|
|
|
z-index: -4;
|
|
|
|
}
|
|
|
|
|
|
|
|
.cross:hover {
|
|
|
|
background-color: #ff7575;
|
|
|
|
}
|
2009-05-09 14:41:01 +00:00
|
|
|
|
|
|
|
.activated p {
|
|
|
|
cursor: text;
|
2009-05-13 21:56:55 +00:00
|
|
|
background: url({stock}/gtk-edit) 98% 70% no-repeat;
|
|
|
|
-webkit-background-size: 16px 15px;
|
|
|
|
opacity: 0.6;
|
|
|
|
color: rgba(0,0,0,1);
|
|
|
|
}
|
|
|
|
|
|
|
|
.activated p:hover {
|
|
|
|
opacity: 1;
|
|
|
|
color: rgba(0,0,0,0.5);
|
2009-05-09 14:41:01 +00:00
|
|
|
}
|
2009-05-07 20:22:43 +00:00
|
|
|
</style>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2009-05-13 21:56:55 +00:00
|
|
|
|
|
|
|
sc = JSON.decode ({json_data});
|
|
|
|
|
2009-05-07 20:22:43 +00:00
|
|
|
var getAction = function (id)
|
|
|
|
{
|
|
|
|
var a = $(id).getFirst ();
|
|
|
|
if (a.getProperty ('href') != "#" )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
var url = prompt ("{enter_shortcut_address}", "http://");
|
|
|
|
if (!url) return false;
|
|
|
|
|
|
|
|
var name = prompt ("{enter_shortcut_name}", "");
|
|
|
|
if (!name) name = "";
|
|
|
|
|
|
|
|
a.setProperty('href', url);
|
|
|
|
a.getNext().set('text', name);
|
|
|
|
|
2009-05-13 21:56:55 +00:00
|
|
|
var num = id.charAt (1) - 1;
|
|
|
|
sc.shortcuts[num].title = name;
|
|
|
|
|
2009-05-07 20:22:43 +00:00
|
|
|
a.empty();
|
|
|
|
var im = new Element('img', { src: '{stock}/throbber.gif' });
|
|
|
|
|
|
|
|
a.addClass ('waiter');
|
|
|
|
a.grab (im);
|
|
|
|
|
|
|
|
getThumbnail (id, url);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
var getThumbnail = function (id, url)
|
|
|
|
{
|
2009-05-13 21:56:55 +00:00
|
|
|
console.log ("speed_dial-get-thumbnail " + id + " " + url);
|
2009-05-07 20:22:43 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
var setThumbnail = function (id, data, href)
|
|
|
|
{
|
|
|
|
var a = $(id).getFirst ();
|
|
|
|
var im = new Element ('img', { src: 'data:image/png;base64,' + data });
|
|
|
|
|
|
|
|
a.empty ().removeClass ('waiter').grab (im);
|
|
|
|
a.setProperty ('href', href);
|
|
|
|
|
|
|
|
var cross = new Element ('div', { 'html': 'x' });
|
2009-05-09 14:41:01 +00:00
|
|
|
cross.setProperty ('onclick', 'clearShortcut("' + id + '");');
|
|
|
|
cross.addClass ('cross');
|
|
|
|
cross.inject ($(id), 'top');
|
|
|
|
|
|
|
|
$(id).addClass ('activated');
|
|
|
|
|
2009-05-13 21:56:55 +00:00
|
|
|
var p = a.getNext ();
|
|
|
|
p.setProperty('onclick', 'javascript:renameShortcut("' + id + '");');
|
|
|
|
|
|
|
|
var num = id.charAt (1) - 1;
|
|
|
|
sc.shortcuts[num].href = href;
|
|
|
|
sc.shortcuts[num].img = data;
|
|
|
|
|
|
|
|
console.log ("speed_dial-save '" + JSON.encode (sc) + "'");
|
2009-05-07 20:22:43 +00:00
|
|
|
}
|
|
|
|
|
2009-05-13 21:56:55 +00:00
|
|
|
var renameShortcut = function (id)
|
2009-05-09 14:41:01 +00:00
|
|
|
{
|
|
|
|
var name = prompt ("{enter_shortcut_name}", "");
|
|
|
|
if (!name) return;
|
|
|
|
|
2009-05-13 21:56:55 +00:00
|
|
|
var num = id.charAt (1) - 1;
|
|
|
|
|
2009-05-09 14:41:01 +00:00
|
|
|
$(id).getLast ().set ('html', name);
|
2009-05-13 21:56:55 +00:00
|
|
|
sc.shortcuts[num].title = name;
|
2009-05-09 21:29:35 +00:00
|
|
|
|
2009-05-13 21:56:55 +00:00
|
|
|
console.log ("speed_dial-save '" + JSON.encode (sc) + "'");
|
2009-05-09 14:41:01 +00:00
|
|
|
}
|
2009-05-07 20:22:43 +00:00
|
|
|
|
|
|
|
var clearShortcut = function (id)
|
|
|
|
{
|
|
|
|
if(!confirm("{are_you_sure}"))
|
|
|
|
return;
|
|
|
|
|
|
|
|
var num = id.charAt (1);
|
2009-05-13 21:56:55 +00:00
|
|
|
var div = $(id);
|
|
|
|
var cross = div.getFirst ();
|
2009-05-07 20:22:43 +00:00
|
|
|
var a = cross.getNext ();
|
|
|
|
var p = a.getNext ();
|
|
|
|
|
|
|
|
cross.dispose ();
|
2009-05-13 21:56:55 +00:00
|
|
|
div.removeClass ('activated');
|
2009-05-07 20:22:43 +00:00
|
|
|
a.empty ();
|
|
|
|
|
|
|
|
cross.dispose ();
|
2009-05-13 21:56:55 +00:00
|
|
|
div.removeClass ('activated');
|
2009-05-07 20:22:43 +00:00
|
|
|
a.empty ().set ('html', '<h1>' + num + '</h1><h4><span/></h4>');
|
|
|
|
a.setProperty ('href', '#');
|
2009-05-09 14:41:01 +00:00
|
|
|
p.empty ().removeProperty ('onclick');
|
2009-05-07 20:22:43 +00:00
|
|
|
|
2009-05-13 21:56:55 +00:00
|
|
|
num -= 1;
|
|
|
|
sc.shortcuts[num].href = "#";
|
|
|
|
sc.shortcuts[num].title = "";
|
|
|
|
sc.shortcuts[num].img = "";
|
|
|
|
|
|
|
|
console.log ("speed_dial-save '" + JSON.encode (sc) + "'");
|
2009-05-07 20:22:43 +00:00
|
|
|
}
|
|
|
|
|
2009-05-09 21:29:35 +00:00
|
|
|
var speeddialSearch = function ()
|
|
|
|
{
|
2009-05-13 21:56:55 +00:00
|
|
|
var reg = new RegExp ("%s", "g");
|
2009-05-09 21:29:35 +00:00
|
|
|
var search_url = $('search_bar').getProperty ('action');
|
|
|
|
var search_content = $('search_bar').getFirst ().get ('value');
|
|
|
|
window.location.href = search_url.replace (reg, encodeURIComponent (search_content));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-05-13 21:56:55 +00:00
|
|
|
var buildSpeeddial = function ()
|
2009-05-09 21:29:35 +00:00
|
|
|
{
|
2009-05-13 21:56:55 +00:00
|
|
|
sc.shortcuts.each (function (item, index, sc)
|
|
|
|
{
|
|
|
|
var cl = "shortcut";
|
|
|
|
|
|
|
|
if (index == 0 || index == 1 || index == 2)
|
|
|
|
cl += " top";
|
|
|
|
if (index == 2 || index == 5 || index == 8)
|
|
|
|
cl += " right";
|
|
|
|
|
|
|
|
var div = new Element ('div', {
|
|
|
|
'class': cl,
|
|
|
|
'id': item.id
|
|
|
|
});
|
|
|
|
|
|
|
|
var a = new Element ('a', {
|
|
|
|
'href': item.href,
|
|
|
|
'events': {
|
|
|
|
'click': function () {
|
|
|
|
return getAction (item.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var p = new Element ('p', {
|
|
|
|
'text': item.title
|
|
|
|
});
|
|
|
|
|
|
|
|
if (item.href == "#")
|
|
|
|
a.set ('html', '<h1>' + item.id.charAt (1) + '</h1><h4><span/></h4>');
|
|
|
|
else
|
|
|
|
{
|
|
|
|
div.addClass ('activated');
|
|
|
|
var im = new Element ('img', { src: 'data:image/png;base64,' + item.img });
|
|
|
|
var cross = new Element ('div', { 'html': 'x' });
|
|
|
|
cross.setProperty ('onclick', 'clearShortcut("' + item.id + '");');
|
|
|
|
cross.addClass ('cross');
|
|
|
|
cross.inject (div, 'top');
|
|
|
|
a.grab (im);
|
|
|
|
p.setProperty('onclick', 'javascript:renameShortcut("' + item.id + '");');
|
|
|
|
}
|
|
|
|
|
|
|
|
div.grab (a);
|
|
|
|
div.grab (p);
|
|
|
|
$('content').grab (div);
|
|
|
|
});
|
2009-05-09 21:29:35 +00:00
|
|
|
}
|
|
|
|
|
2009-05-13 21:56:55 +00:00
|
|
|
window.addEvent ('domready', function () {
|
|
|
|
buildSpeeddial ();
|
|
|
|
});
|
2009-05-08 00:56:26 +00:00
|
|
|
</script>
|
2009-05-07 20:22:43 +00:00
|
|
|
</head>
|
2009-05-09 21:29:35 +00:00
|
|
|
<body>
|
|
|
|
<div id="wrap">
|
|
|
|
<form id="search_bar" name="search_bar" action="{search_uri}"
|
|
|
|
method="get" onsubmit="javascript:return speeddialSearch();">
|
|
|
|
<input type="text" name="q" value="{search_title}" onfocus="javascript:this.value='';"
|
|
|
|
onblur="javascript:if(this.value=='') this.value='{search_title}';" />
|
|
|
|
<button>{search}</button>
|
|
|
|
</form>
|
2009-05-13 21:56:55 +00:00
|
|
|
<div id="content">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|
2009-05-07 20:22:43 +00:00
|
|
|
|