Commit 70f6231f authored by unknown's avatar unknown

message

parent d2583e0a
function init(){
var ubwidget = $("#ubwidget").ubwidget({
width:300,
height:240
});
var text = "";
var winwidth;
var minimizedHeight;
var winheight;
var scroll = false;
var defaultFontSize = 35;
var currentFontSize = defaultFontSize;
var header = $('<div id="head"><input id="headtitle" class="stickytitle" readonly="readonly"></input></div>');
var fontUp = $('<img src="images/stick-but-aplus.png">');
var fontDown = $('<img src="images/stick-but-aminus.png">');
var minimize = $('<img src="images/stick-but-minimize.png">');
var maximize = $('<img src="images/stick-but-maximize.png">');
var title = $('<div id="menu"></div>');
var textField = $('<div id="txt"></div>');
var shadow = $("<table width='100%' height='18' border='0' cellspacing='0' cellpadding='0'><tr><td id='sl' width='139'></td><td id='sc' style='background-image:url(images/shadowcenter.png)'>&nbsp;</td><td id='sr' width='139'></td></tr></table>")
.appendTo("body");
var shadowleft = $("<img src='images/shadowleft.png'>")
.appendTo($("#sl"));
var shadowright = $("<img src='images/shadowright.png'>")
.appendTo($("#sr"));
$("#ubwidget")
.append(header)
.append(textField);
fontUp.addClass('menuElement');
fontDown.addClass('menuElement');
minimize.addClass('menuElement');
maximize.addClass('menuElement')
.hide();
header.append(maximize)
.append(minimize)
.append(fontUp)
.append(fontDown);
var titletext = header.find('textarea');
titletext.click(
function(){
titletext.focus();
});
fontDown.click(
function(){
var newFontSize = parseInt(currentFontSize) - 3;
textField.css({
fontSize : newFontSize
})
controlTextField();
if(window.sankore){
window.sankore.setPreference("fontSize", newFontSize);
};
//textField.focus();
});
fontUp.click(
function(){
var newFontSize = parseInt(currentFontSize) + 3;
textField.css({
fontSize : newFontSize
})
controlTextField();
if(window.sankore){
window.sankore.setPreference("fontSize", newFontSize);
};
//textField.focus();
});
minimize.click(
function(){
$('.ubw-container').animate({height:"26px"},100);
minimizedHeight = $('.ubw-container').height() ;
minimize.hide();
maximize.show();
$('#headtitle').show();
window.resizeTo($('.ubw-container').width(),0);
if(window.sankore){
window.sankore.setPreference("minimized", "true");
};
});
maximize.click(
function(){
var lastHeight = String(minimizedHeight)+'px';
$('.ubw-container').animate({height: lastHeight},100);
maximize.hide();
minimize.show();
$('#headtitle').hide();
window.resizeTo($('.ubw-container').width()+15,minimizedHeight+20);
if(window.sankore){
window.sankore.setPreference("minimized", "false");
};
});
header
.append(title);
title
.addClass('menu');
header
.addClass('head');
textField
.addClass("textField")
.css("fontSize",currentFontSize)
.attr('contentEditable','true')
.keyup(function(){
if(window.sankore){
window.sankore.setPreference("text", textField.html());
}
controlTextField();
$('#headtitle').hide();
});
if(textField.html().length === 0){
textField.focus();
}
titletext
.attr('rows','1');
function controlTextField(){
if(textField.text().length < 25){
var titleStr = textField.text() + '...';
$('#headtitle').val(titleStr);
}
textField.css({
height : $('.ubw-container').height()-28,
})
if(textField.text().length == 0){
textField.css({
fontSize: defaultFontSize,
});
}
currentFontSize = textField.css('fontSize').replace('px','');
}
textField.bind('paste', function(e) {
controlTextField();
});
$('#headtitle').hide();
if(window.sankore){
text = window.sankore.preference('text', text);
currentFontSize = window.sankore.preference('fontSize', defaultFontSize);
$('.ubw-container').css({
width:parseInt(window.sankore.preference('width', "300")),
height:parseInt(window.sankore.preference('height', "240"))
});
if(window.sankore.preference('minimized', "false") == "true"){
minimize.trigger("click");
};
textField.css({
fontSize : parseInt(currentFontSize)
})
textField.html(text);
}
window.onresize = function(){
winwidth = window.innerWidth;
winheight = window.innerHeight;
if(winwidth <= 290)
{
window.resizeTo(290,winheight);
}
if(winheight <= 100)
{
window.resizeTo(winwidth,100);
}
if(winheight > 600)
{
window.resizeTo(winwidth,600);
}
$('.ubw-container').width(winwidth-2) ;
$('.ubw-container').height(winheight-20) ;
if(window.sankore){
window.sankore.setPreference("width", winwidth-2);
window.sankore.setPreference("height", winheight-20);
}
controlTextField();
}
}
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Video Picker</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>
<body>
<script type="text/javascript">
var oembedUrl = "";
var language = "en";
function initialize() {
if(window.sankore){
oembedUrl = window.sankore.preference("oembedUrl", "");
}
if(oembedUrl.length > 0){
$("#textbox").val(oembedUrl);
$("#search-button").trigger("click");
}else{
//var language = navigator.userAgent.split(";");
//language = language[3].replace(/\s/g, "").substr(0, 2);
$("#embeded-content").load("locales/" + language + "/howto.html"); // Welcome note with some explanations
};
};
$(document).ready(function(){
var resizer; // Timer
var resizerIndex;
resizerIndex = 0;
//language = navigator.userAgent.split(";");
//language = language[3].replace(/\s/g, "").substr(0, 2);
$("#search-button")
.click(function(){
window.resizeTo(385, 80);
$("#container")
.removeClass("welcome")
.removeClass("change")
.removeClass("error")
.addClass("load");
$("#container-shadow")
.hide();
$("#arrow")
.hide();
$("#embeded-content")
.css({
marginLeft:-9000,
marginTop:-9000
})
.empty()
.oembed($("#textbox").val());
checkcontent();
})
.mouseenter(function(){
$(this)
.addClass("over");
})
.mouseleave(function(){
$(this)
.removeClass("over");
});
/*$("#ubwidget").mouseenter(function(){
$("#show-area").fadeIn(1000);
});
$("#ubwidget").mouseout(function(){
$("#show-area").fadeOut(600);
});*/
$('#textbox').keypress(function(e){
if (e.which == 13){
$('#search-button').click();
};
});
$("#show-inputfield-button")
.click(
function(){
$("#show-area").fadeOut(0);
$("#inputfield").show();
$("#shadow").show();
$("#container")
.removeClass("show").addClass("change");
adaptWidgetSize(18, 88);
})
.mouseenter(function(){
$(this)
.addClass("over");
})
.mouseleave(function(){
$(this)
.removeClass("over");
});
function checkcontent(){
if($("#embeded-content").html().length != 0 && $("#embeded-content").children(":first").width() > 0){
clearTimeout(resizer);
resizerIndex = 0;
if(window.sankore){
window.sankore.setPreference("oembedUrl", $("#textbox").val());
};
$("#inputfield")
.hide();
$("#shadow")
.hide();
$("#embeded-content")
.css({
marginLeft:0,
marginTop:0
})
.width($("#embeded-content").children(":first").width())
.height($("#embeded-content").children(":first").height());
$("#container")
.removeClass("load").addClass("show");
$("#show-area")
.fadeIn(2000)
.css({
left:$("#embeded-content").children(":first").width()-25,
top:($("#embeded-content").children(":first").height()-35)/2
});
adaptWidgetSize(5, 13);
return false;
};
if(resizerIndex > 30){
resizerIndex = 0;
$("#container")
.removeClass("show").addClass("error");
$("#arrow")
.show();
$("#embeded-content")
.css({
marginTop:0,
marginLeft:0
})
.width(395)
.load("locales/" + language + "/error.html",
function(){
adaptWidgetSize(20, 125);
});
$("#container-shadow")
.show();
}else{
resizer = setTimeout(function(){checkcontent()}, 100);
resizerIndex++;
};
};
function adaptWidgetSize(adjustmentX, adjustmentY){
var margins = {
top: cssToInt($("body").css("margin-top")),
right: cssToInt($("body").css("margin-right")),
bottom: cssToInt($("body").css("margin-bottom")),
left: cssToInt($("body").css("margin-left"))
};
var widgetWidth = $("#embeded-content").width() + margins.right + margins.left + adjustmentX;
var widgetHeight = $("#embeded-content").position().top + $("#embeded-content").height() + margins.bottom + adjustmentY;
window.resizeTo(widgetWidth, $(window).height());
window.resizeTo($(window).width(), widgetHeight);
window.sankore.resize(widgetWidth, widgetHeight);
};
function cssToInt(cssvalue){
return(parseInt(cssvalue.replace("px", "")));
};
if (window.widget) {
window.widget.onremove = function(){
//$("#show-inputfield-button").trigger("click");
$("#embeded-content")
.empty()
.oembed($("#textbox").val());
}
}
window.initialize();
});
</script>
<div id="ubwidget">
<div id="shadow"></div>
<div id="inputfield">
<input id="textbox" type="text">
<div id="search-button" class="button">Show</div>
</div>
<div id="container" class="welcome">
<div id="arrow"><img src="imgs/arrow.png" alt="arrow-top"></div>
<div id="show-container">
<div id="embeded-content"></div>
<div id="show-area">
<img id="show-inputfield-button" src="imgs/bts.png">
</div>
</div>
<table cellspacing="0" cellpadding="0" id="container-shadow">
<tr>
<td id="shadow-left"></td>
<td id="shadow-center">&nbsp;</td>
<td id="shadow-right"></td>
</tr>
</table>
</div>
</div>
</body>
</html>
\ No newline at end of file
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