Commit 2d60b8f3 authored by unknown's avatar unknown

updating web-browser, notes and calculator

parent 42a7fef6
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>ubwidget</title>
......@@ -16,9 +16,9 @@
<link rel="stylesheet" type="text/css" href="css/ubwidget.css" />
</head>
</head>
<body>
<body>
<script type="text/javascript">
$(document).ready(function(){
......@@ -28,6 +28,6 @@
<div id="ubwidget"></div>
</body>
</body>
</html>
\ No newline at end of file
......@@ -103,7 +103,9 @@ function init(){
minimize.click(
function(){
$('.ubw-container').animate({height:"26px"},500);
$('.ubw-container').animate({
height:"26px"
},500);
minimizedHeight = $('.ubw-container').height();
minimize.hide();
maximize.show();
......@@ -118,7 +120,9 @@ function init(){
maximize.click(
function(){
var lastHeight = String(minimizedHeight)+'px';
$('.ubw-container').animate({height: lastHeight},500);
$('.ubw-container').animate({
height: lastHeight
},500);
maximize.hide();
minimize.show();
......@@ -149,8 +153,7 @@ function init(){
if(textField.html().length === 0){
textField.focus();
}
titletext
.attr('rows','1');
titletext.attr('rows','1');
function controlTextField(){
if(textField.text().length < 25)
......@@ -159,12 +162,12 @@ function init(){
$('#headtitle').val(textField.text().substr(0,25) + "...");
textField.css({
height : $('.ubw-container').height()-28,
height : $('.ubw-container').height()-28
})
if(textField.text().length == 0){
textField.css({
fontSize: defaultFontSize,
fontSize: defaultFontSize
});
}
......@@ -193,7 +196,11 @@ function init(){
textField.css({
fontSize : parseInt(currentFontSize)
})
if(text)
textField.html(text);
else
textField.html("Enter your notes here ...");
textField.focus();
}
window.onresize = function(){
......
......@@ -3,18 +3,23 @@
<html>
<head>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Video Picker</title>
<title>Web Browser</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
<script src="scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="scripts/jquery.oembed.js" type="text/javascript"></script>
<!--DEFAULT FR-->
</head>
</head>
<body>
<body>
<script type="text/javascript">
var loadingState = false;
function changeLoadingState(){
loadingState = true;
}
$(document).ready(function(){
//var resizer; // Timer
//var resizerIndex;
......@@ -31,7 +36,11 @@
left: cssToInt($("body").css("margin-left"))
};
//resizerIndex = 0;
var resizer; // Timer
var resizerIndex;
resizerIndex = 0;
if(window.sankore){
url = window.sankore.preference("url", "");
......@@ -44,17 +53,19 @@
$("#back-button")
.click(function(){
loadingState = false;
if((currentHistory - 1) > 0){
$("#textbox").val(references[--currentHistory-1]);
frames['web-content'].location.href = references[currentHistory-1];
$("#search-button").trigger("click");
}
});
$("#forward-button")
.click(function(){
loadingState = false;
if(currentHistory < references.length) {
$("#textbox").val(references[currentHistory++]);
frames['web-content'].location.href = $("#textbox").val();
$("#search-button").trigger("click");
}
});
......@@ -64,9 +75,9 @@
}
});
$("#search-button")
.click(function(){
$("#search-button").click(function(){
if($("#textbox").val().length > 0){
loadingState = false;
var url = $("#textbox").val();
var urlStart = url.split("://");
......@@ -82,19 +93,16 @@
}
window.resizeTo(globalWidth, globalHeight);
$("#container")
.removeClass("welcome")
.removeClass("change")
.removeClass("error")
.addClass("load");
$("#container").removeClass("welcome").removeClass("change")
.removeClass("error").addClass("load");
$("#container-shadow").hide();
$("#arrow").hide();
$("#embeded-content").hide();
$("#web-content").show();
frames['web-content'].location.href = url;
$('#web-content').attr('src',url);
checkcontent();
checkLoading();
} else {
$("#embeded-content").load("locales/" + "en" + "/howto.html"); // Welcome screen with some explanations
$("#container")
......@@ -125,26 +133,6 @@
$("#embeded-content").load("locales/" + "en" + "/howto.html"); // Welcome screen with some explanations
};
/*$("#show-inputfield-button")
.click(
function(){
$("#show-area").hide();
$("#inputfield").show();
$("#shadow").show();
$("#container")
.removeClass("show")
.addClass("change");
adaptWidgetSize(18, 82);
})
.mouseenter(function(){
$(this)
.addClass("over");
})
.mouseleave(function(){
$(this)
.removeClass("over");
});*/
$(window).resize(function(){
globalWidth = $(window).width();
globalHeight = $(window).height();
......@@ -154,8 +142,6 @@
});
function checkcontent(){
//clearTimeout(resizer);
//resizerIndex = 0;
if(window.sankore){
window.sankore.setPreference("url", $("#textbox").val());
......@@ -165,13 +151,22 @@
$("#container").removeClass("load").addClass("show");
};
/*function adaptWidgetSize(adjustmentX, adjustmentY){
var widgetWidth = $("#container").width() + margins.right + margins.left + adjustmentX;
var widgetHeight = $("#container").position().top + $("#container").height() + margins.bottom + adjustmentY;
function checkLoading(){
if(loadingState){
window.resizeTo(widgetWidth, $(window).height());
window.resizeTo($(window).width(), widgetHeight);
};*/
clearTimeout(resizer);
resizerIndex = 0;
return false;
};
if(resizerIndex > 70){
resizerIndex = 0;
$("#textbox").val("http://www.google.com/search?q=" + $("#textbox").val().replace("http://", ""));
$("#search-button").trigger("click");
}else{
resizer = setTimeout(function(){checkLoading()}, 100);
resizerIndex++;
};
};
function cssToInt(cssvalue){
return(parseInt(cssvalue.replace("px", "")));
......@@ -213,7 +208,7 @@
<div id="show-container">
<div id="embeded-content"></div>
<iframe id="web-content" name="web-content" src="" scrolling=auto frameborder=1 ></iframe>
<iframe id="web-content" name="web-content" src="" scrolling=auto frameborder=1 onload="changeLoadingState()"></iframe>
</div>
<table cellspacing="0" cellpadding="0" id="container-shadow">
......@@ -226,6 +221,6 @@
</div>
</div>
</body>
</body>
</html>
\ No newline at end of file
(function($) {
$.fn.oembed = function(url, options) {
options = $.extend({}, $.fn.oembed.defaults, options);
return this.each(function() {
var container = $(this),
target = (url != null) ? url : container.attr("href"),
provider;
if (target != null) {
provider = getOEmbedProvider(target);
if (provider != null) {
provider.maxWidth = options.maxWidth;
provider.maxHeight = options.maxHeight;
provider.embedCode(target, function(code) { container.html(code); });
}
}
});
};
// Plugin defaults
$.fn.oembed.defaults = {
maxWidth: 500,
maxHeight: 400
};
$.fn.oembed.getPhotoCode = function(url, data) {
var code = '<div><a href="' + url + '" target="_blank"><img src="' + data.url + '"/></a></div>';
if (data.html)
code += "<div>" + data.html + "</div>";
return code;
};
$.fn.oembed.getVideoCode = function(url, data) {
var code = data.html;
return code;
};
$.fn.oembed.getRichCode = function(url, data) {
var code = data.html;
return code;
};
$.fn.oembed.getGenericCode = function(url, data) {
var title = (data.title != null) ? data.title : url,
code = '<a href="' + url + '">' + title + '</a>';
if (data.html)
code += "<div>" + data.html + "</div>";
return code;
};
$.fn.oembed.isAvailable = function(url) {
var provider = getOEmbedProvider(url);
return (provider != null);
};
/* Private Methods */
function getOEmbedProvider(url) {
for (var i = 0; i < providers.length; i++) {
if (providers[i].matches(url))
return providers[i];
}
return null;
}
var providers = [
new OEmbedProvider("fivemin", "5min.com"),
new OEmbedProvider("amazon", "amazon.com"),
new OEmbedProvider("flickr", "flickr", "http://flickr.com/services/oembed", "jsoncallback"),
new OEmbedProvider("googlevideo", "video.google."),
new OEmbedProvider("hulu", "hulu.com"),
new OEmbedProvider("imdb", "imdb.com"),
new OEmbedProvider("metacafe", "metacafe.com"),
new OEmbedProvider("qik", "qik.com"),
new OEmbedProvider("revision3", "slideshare"),
new OEmbedProvider("slideshare", "5min.com"),
new OEmbedProvider("twitpic", "twitpic.com"),
new OEmbedProvider("viddler", "viddler.com"),
new OEmbedProvider("vimeo", "vimeo.com", "http://vimeo.com/api/oembed.json"),
new OEmbedProvider("wikipedia", "wikipedia.org"),
new OEmbedProvider("wordpress", "wordpress.com"),
new OEmbedProvider("youtube", "youtube.com")
];
function OEmbedProvider(name, urlPattern, oEmbedUrl, callbackparameter) {
this.name = name;
this.urlPattern = urlPattern;
this.oEmbedUrl = (oEmbedUrl != null) ? oEmbedUrl : "http://oohembed.com/oohembed/";
this.callbackparameter = (callbackparameter != null) ? callbackparameter : "callback";
this.maxWidth = 500;
this.maxHeight = 400;
this.matches = function(externalUrl) {
// TODO: Convert to Regex
return externalUrl.indexOf(this.urlPattern) >= 0;
};
this.getRequestUrl = function(externalUrl) {
var url = this.oEmbedUrl;
if (url.indexOf("?") <= 0)
url = url + "?";
url += "maxwidth=" + this.maxWidth +
"&maxHeight=" + this.maxHeight +
"&format=json" +
"&url=" + escape(externalUrl) +
"&" + this.callbackparameter + "=?";
return url;
}
this.embedCode = function(externalUrl, embedCallback) {
var request = this.getRequestUrl(externalUrl);
$.getJSON(request, function(data) {
var code, type = data.type;
switch (type) {
case "photo":
code = $.fn.oembed.getPhotoCode(externalUrl, data);
break;
case "video":
code = $.fn.oembed.getVideoCode(externalUrl, data);
break;
case "rich":
code = $.fn.oembed.getRichCode(externalUrl, data);
break;
default:
code = $.fn.oembed.getGenericCode(externalUrl, data);
break;
}
embedCallback(code);
});
}
}
})(jQuery);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment