Allow custom shortcut and column count in speed dial

This commit is contained in:
Peter de Ridder 2010-05-16 17:56:22 +02:00 committed by Christian Dywan
parent 2f5a65947f
commit 84d4865e22
2 changed files with 58 additions and 3 deletions

View file

@ -30,7 +30,7 @@
}
#content {
margin-top: 40px;
margin-top: 10px;
}
div.shortcut {
@ -140,6 +140,20 @@
opacity: 1;
color: rgba(0,0,0,0.5);
}
div.config {
padding: 12px;
text-align: left;
}
div.config span {
color: #ccc;
}
div.config span:hover {
color: #999;
cursor: pointer;
}
</style>
<script type="text/javascript">
@ -252,7 +266,7 @@
var buildSpeeddial = function ()
{
var width = 3;
if (sc.width != undefined)
if (sc.width)
{
width = sc.width;
$('wrap').style.width = (width * 220) + 'px';
@ -305,6 +319,39 @@
});
}
var setWidth = function ()
{
var width = prompt ("{enter_dial_width}", "");
if (!width || isNaN (width)) return;
sc.width = width;
$('content').empty ();
buildSpeeddial ();
console.log ("speed_dial-save '" + encodeSafe (sc) + "'");
}
var setCount = function ()
{
var count = prompt ("{enter_shortcut_count}", "");
if (!count || isNaN (count)) return;
sc.shortcuts = sc.shortcuts.slice (0, count);
var i = sc.shortcuts.length;
while (i < count)
{
i++;
sc.shortcuts.push ({"id" : "s" + i, "href" : "#", "title" : "", "img" : ""});
}
$('content').empty ();
buildSpeeddial ();
console.log ("speed_dial-save '" + encodeSafe (sc) + "'");
}
window.addEvent ('domready', function () {
buildSpeeddial ();
});
@ -326,6 +373,10 @@
</script>
</head>
<body>
<div class="config">
<span onclick="javascript:setWidth()">{set_dial_width}</span>
<span onclick="javascript:setCount()">{set_shortcut_count}</span>
</div>
<div id="wrap">
<div id="content">
</div>

View file

@ -3483,7 +3483,11 @@ midori_view_set_uri (MidoriView* view,
"{click_to_add}", _("Click to add a shortcut"),
"{enter_shortcut_address}", _("Enter shortcut address"),
"{enter_shortcut_name}", _("Enter shortcut title"),
"{are_you_sure}", _("Are you sure you want to delete this shortcut?"), NULL);
"{are_you_sure}", _("Are you sure you want to delete this shortcut?"),
"{set_dial_width}", _("Set number of columns"),
"{enter_dial_width}", _("Enter number of columns:"),
"{set_shortcut_count}", _("Set number of shortcuts"),
"{enter_shortcut_count}", _("Enter number of shortcuts:"), NULL);
midori_view_load_alternate_string (view,