@ -0,0 +1,15 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<widget xmlns="http://www.w3.org/ns/widgets" |
||||
xmlns:ub="http://uniboard.mnemis.com/widgets" |
||||
id="http://www.njin.fr/sankore/apps/balance" |
||||
version="1.0" |
||||
width="1025" |
||||
height="880" |
||||
ub:resizable="true"> |
||||
|
||||
<name>La Balance</name> |
||||
<author href="http://www.njin.fr" email="contact@njin.fr">njin</author> |
||||
<description></description> |
||||
|
||||
<content src="index.html"/> |
||||
</widget> |
After Width: | Height: | Size: 165 KiB |
@ -0,0 +1,33 @@ |
||||
<!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" xml:lang="en" lang="en"> |
||||
<head> |
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
||||
|
||||
<title>Font Face Demo</title> |
||||
<link rel="stylesheet" href="stylesheet.css" type="text/css" charset="utf-8"> |
||||
<style type="text/css" media="screen"> |
||||
h1.fontface {font: 60px/68px 'Lobster13Regular', Arial, sans-serif;letter-spacing: 0;} |
||||
|
||||
p.style1 {font: 18px/27px 'Lobster13Regular', Arial, sans-serif;} |
||||
|
||||
#container { |
||||
width: 800px; |
||||
margin-left: auto; |
||||
margin-right: auto; |
||||
} |
||||
</style> |
||||
</head> |
||||
|
||||
<body> |
||||
<div id="container"> |
||||
<h1 class="fontface">Font-face Demo for the Lobster Font</h1> |
||||
|
||||
|
||||
|
||||
<p class="style1">Lobster Regular - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> |
||||
|
||||
</div> |
||||
</body> |
||||
</html> |
@ -0,0 +1,16 @@ |
||||
/* Generated by Font Squirrel (http://www.fontsquirrel.com) on March 26, 2012 06:03:05 AM America/New_York */ |
||||
|
||||
|
||||
|
||||
@font-face { |
||||
font-family: 'Lobster13Regular'; |
||||
src: url('Lobster_1.3-webfont.eot'); |
||||
src: url('Lobster_1.3-webfont.eot?#iefix') format('embedded-opentype'), |
||||
url('Lobster_1.3-webfont.woff') format('woff'), |
||||
url('Lobster_1.3-webfont.ttf') format('truetype'), |
||||
url('Lobster_1.3-webfont.svg#Lobster13Regular') format('svg'); |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
|
||||
} |
||||
|
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 101 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 96 KiB |
After Width: | Height: | Size: 95 KiB |
@ -0,0 +1,58 @@ |
||||
<!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" xml:lang="en" lang="en"> |
||||
<head> |
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
||||
|
||||
<title>Font Face Demo</title> |
||||
<link rel="stylesheet" href="stylesheet.css" type="text/css" charset="utf-8"> |
||||
<style type="text/css" media="screen"> |
||||
h1.fontface {font: 60px/68px 'SFToontimeRegular', Arial, sans-serif;letter-spacing: 0;} |
||||
|
||||
p.style1 {font: 18px/27px 'SFToontimeRegular', Arial, sans-serif;} |
||||
p.style2 {font: 18px/27px 'SFToontimeItalic', Arial, sans-serif;} |
||||
p.style3 {font: 18px/27px 'SFToontimeBold', Arial, sans-serif;} |
||||
p.style4 {font: 18px/27px 'SFToontimeBoldItalic', Arial, sans-serif;} |
||||
p.style5 {font: 18px/27px 'SFToontimeBlotchRegular', Arial, sans-serif;} |
||||
p.style6 {font: 18px/27px 'SFToontimeBlotchItalic', Arial, sans-serif;} |
||||
|
||||
#container { |
||||
width: 800px; |
||||
margin-left: auto; |
||||
margin-right: auto; |
||||
} |
||||
</style> |
||||
</head> |
||||
|
||||
<body> |
||||
<div id="container"> |
||||
<h1 class="fontface">FONT-FACE DEMO FOR THE TOONTIME FONT</h1> |
||||
|
||||
|
||||
|
||||
<p class="style1">SF Toontime Regular - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> |
||||
|
||||
|
||||
|
||||
<p class="style2">SF Toontime Italic - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> |
||||
|
||||
|
||||
|
||||
<p class="style3">SF Toontime Bold - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> |
||||
|
||||
|
||||
|
||||
<p class="style4">SF Toontime Bold Italic - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> |
||||
|
||||
|
||||
|
||||
<p class="style5">SF Toontime Blotch Regular - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> |
||||
|
||||
|
||||
|
||||
<p class="style6">SF Toontime Blotch Italic - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> |
||||
|
||||
</div> |
||||
</body> |
||||
</html> |
@ -0,0 +1,76 @@ |
||||
/* Generated by Font Squirrel (http://www.fontsquirrel.com) on March 26, 2012 04:36:35 PM America/New_York */ |
||||
|
||||
|
||||
|
||||
@font-face { |
||||
font-family: 'SFToontimeRegular'; |
||||
src: url('SF_Toontime-webfont.eot'); |
||||
src: url('SF_Toontime-webfont.eot?#iefix') format('embedded-opentype'), |
||||
url('SF_Toontime-webfont.woff') format('woff'), |
||||
url('SF_Toontime-webfont.ttf') format('truetype'), |
||||
url('SF_Toontime-webfont.svg#SFToontimeRegular') format('svg'); |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
|
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'SFToontimeItalic'; |
||||
src: url('SF_Toontime_Italic-webfont.eot'); |
||||
src: url('SF_Toontime_Italic-webfont.eot?#iefix') format('embedded-opentype'), |
||||
url('SF_Toontime_Italic-webfont.woff') format('woff'), |
||||
url('SF_Toontime_Italic-webfont.ttf') format('truetype'), |
||||
url('SF_Toontime_Italic-webfont.svg#SFToontimeItalic') format('svg'); |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
|
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'SFToontimeBold'; |
||||
src: url('SF_Toontime_Bold-webfont.eot'); |
||||
src: url('SF_Toontime_Bold-webfont.eot?#iefix') format('embedded-opentype'), |
||||
url('SF_Toontime_Bold-webfont.woff') format('woff'), |
||||
url('SF_Toontime_Bold-webfont.ttf') format('truetype'), |
||||
url('SF_Toontime_Bold-webfont.svg#SFToontimeBold') format('svg'); |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
|
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'SFToontimeBoldItalic'; |
||||
src: url('SF_Toontime_Bold_Italic-webfont.eot'); |
||||
src: url('SF_Toontime_Bold_Italic-webfont.eot?#iefix') format('embedded-opentype'), |
||||
url('SF_Toontime_Bold_Italic-webfont.woff') format('woff'), |
||||
url('SF_Toontime_Bold_Italic-webfont.ttf') format('truetype'), |
||||
url('SF_Toontime_Bold_Italic-webfont.svg#SFToontimeBoldItalic') format('svg'); |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
|
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'SFToontimeBlotchRegular'; |
||||
src: url('SF_Toontime_Blotch-webfont.eot'); |
||||
src: url('SF_Toontime_Blotch-webfont.eot?#iefix') format('embedded-opentype'), |
||||
url('SF_Toontime_Blotch-webfont.woff') format('woff'), |
||||
url('SF_Toontime_Blotch-webfont.ttf') format('truetype'), |
||||
url('SF_Toontime_Blotch-webfont.svg#SFToontimeBlotchRegular') format('svg'); |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
|
||||
} |
||||
|
||||
@font-face { |
||||
font-family: 'SFToontimeBlotchItalic'; |
||||
src: url('SF_Toontime_Blotch_Italic-webfont.eot'); |
||||
src: url('SF_Toontime_Blotch_Italic-webfont.eot?#iefix') format('embedded-opentype'), |
||||
url('SF_Toontime_Blotch_Italic-webfont.woff') format('woff'), |
||||
url('SF_Toontime_Blotch_Italic-webfont.ttf') format('truetype'), |
||||
url('SF_Toontime_Blotch_Italic-webfont.svg#SFToontimeBlotchItalic') format('svg'); |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
|
||||
} |
||||
|
After Width: | Height: | Size: 753 KiB |
After Width: | Height: | Size: 9.8 KiB |
After Width: | Height: | Size: 552 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 175 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 732 B |
After Width: | Height: | Size: 707 B |
After Width: | Height: | Size: 999 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.4 KiB |
@ -0,0 +1,271 @@ |
||||
#scene { |
||||
position: relative; |
||||
} |
||||
|
||||
#scene > div { |
||||
|
||||
} |
||||
|
||||
#scalesCell { |
||||
display: table; |
||||
} |
||||
#scalesCell > div { |
||||
display: table-cell; |
||||
vertical-align: middle; |
||||
} |
||||
|
||||
#scalesWrapper { |
||||
padding: 0px 100px 200px; |
||||
position: relative; |
||||
} |
||||
|
||||
.onEdit #scalesWrapper { |
||||
padding-top: 100px; |
||||
} |
||||
|
||||
#scales { |
||||
position: relative; |
||||
} |
||||
|
||||
.scale { |
||||
position: absolute; |
||||
width: 250px; |
||||
height: 0; |
||||
padding: 200px 45px 50px; |
||||
top: 145px; |
||||
background: url(images/scale.png) no-repeat center bottom; |
||||
} |
||||
|
||||
#tray, .scale { |
||||
-webkit-transition: -webkit-transform 0.25s ease-in; |
||||
-moz-transition: -moz-transform 0.25s ease-in; |
||||
-ms-transition: -ms-transform 0.25s ease-in; |
||||
transition: transform 0.25s ease-in; |
||||
} |
||||
|
||||
#leftScale { |
||||
left: 0; |
||||
margin-left: -150px; |
||||
} |
||||
|
||||
#rightScale { |
||||
right: 0; |
||||
margin-right: -150px; |
||||
} |
||||
|
||||
#tray { |
||||
position: relative; |
||||
background-color: red; |
||||
top: 50%; |
||||
margin-top: -1px; |
||||
width: 550px; |
||||
height: 288px; |
||||
background: url("images/scales.png") no-repeat center; |
||||
} |
||||
|
||||
#graduations { |
||||
width: 100px; |
||||
height: 30px; |
||||
position: absolute; |
||||
top: 0; |
||||
left: 50%; |
||||
margin-left: -50px; |
||||
background: url(images/graduations.png) center no-repeat; |
||||
} |
||||
|
||||
#pivot { |
||||
position: absolute; |
||||
width: 80px; |
||||
height: 80px; |
||||
left: 235px; |
||||
top: 106px; |
||||
background: url(images/pivot.png) center no-repeat; |
||||
} |
||||
|
||||
#objects { |
||||
position: relative; |
||||
display: inline-block; |
||||
padding: 0 5px 0 10px; |
||||
} |
||||
|
||||
#objects .object { |
||||
display: inline-block; |
||||
vertical-align: top; |
||||
} |
||||
|
||||
#objects button[role="add"] { |
||||
display: none; |
||||
|
||||
position: relative; |
||||
overflow: hidden; |
||||
|
||||
text-indent: -100px; |
||||
|
||||
width: 68px; |
||||
height: 70px; |
||||
|
||||
margin-left: 10px; |
||||
|
||||
cursor: pointer; |
||||
|
||||
border-radius: 4px; |
||||
border: 1px solid rgba(255,255,255, 0.15); |
||||
background: rgba(0,0,0, 0.15) url(images/weight-add.png) center no-repeat; |
||||
} |
||||
|
||||
.onEdit #objects button[role="add"] { |
||||
display: inline-block; |
||||
} |
||||
|
||||
#leftScale .object { |
||||
position: absolute; |
||||
bottom: 0; |
||||
} |
||||
|
||||
.object input { |
||||
border: none; |
||||
width: 40px; |
||||
padding: none; |
||||
margin: 0 2px 0 0; |
||||
|
||||
text-align: center; |
||||
font-size: 16px; |
||||
|
||||
color: #000; |
||||
border-radius: 3px; |
||||
background-color: #FFF; |
||||
box-shadow: 0 1px 2px rgba(0,0,0, 0.4); |
||||
} |
||||
|
||||
.object .tools { |
||||
display: none; |
||||
position: absolute; |
||||
top: -23px; |
||||
width: 100%; |
||||
text-align: center; |
||||
} |
||||
|
||||
.onEdit button[role="remove"] { |
||||
display: inline-block; |
||||
position: relative; |
||||
overflow: hidden; |
||||
cursor: pointer; |
||||
width: 22px; |
||||
height: 22px; |
||||
text-indent: -100px; |
||||
border: none; |
||||
margin: 0; |
||||
outline: 0; |
||||
padding: 0; |
||||
background: transparent url(images/delete.png) center no-repeat; |
||||
} |
||||
|
||||
.onEdit .object .tools { |
||||
display: block; |
||||
} |
||||
|
||||
.object input:disabled { |
||||
color: #CCC; |
||||
background: none; |
||||
box-shadow: none; |
||||
} |
||||
|
||||
.object input:disabled::-webkit-outer-spin-button, |
||||
.object input:disabled::-webkit-inner-spin-button { |
||||
-webkit-appearance: none; |
||||
margin: 0; |
||||
} |
||||
|
||||
#objects .desk { |
||||
position: absolute; |
||||
width: 100%; |
||||
height: 20px; |
||||
top: 72px; |
||||
border-radius: 4px; |
||||
box-shadow: 0 3px 0 #999, 0 1px 2px rgba(0,0,0, .65); |
||||
background-color: #CCC; |
||||
background-image: -moz-linear-gradient(90deg, #FFF 0%, #CCC 100%); |
||||
background-image: -o-linear-gradient(90deg, #FFF 0%, #CCC 100%); |
||||
background-image: -webkit-linear-gradient(90deg, #FFF 0%, #CCC 100%); |
||||
background-image: linear-gradient(90deg, #FFF 0%, #CCC 100%); |
||||
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFF', endColorstr='#CCC', GradientType=0); |
||||
} |
||||
|
||||
#rightScale .weight { |
||||
position: absolute !important; |
||||
} |
||||
|
||||
#weights { |
||||
display: none; |
||||
position: absolute; |
||||
top: 40px; |
||||
right: 40px; |
||||
width: 230px; |
||||
} |
||||
|
||||
.onEdit #weights { |
||||
display: block; |
||||
} |
||||
|
||||
#weights .weight { |
||||
display: inline-block; |
||||
} |
||||
|
||||
.weight { |
||||
position: relative; |
||||
width: 64px; |
||||
height: 70px; |
||||
|
||||
margin-left: 10px; |
||||
margin-bottom: 30px; |
||||
|
||||
font-size: 16px; |
||||
text-align: center; |
||||
color: #CCC; |
||||
text-shadow: 0 -1px 0 #000; |
||||
} |
||||
|
||||
.weight .amount { |
||||
height: 100%; |
||||
padding: 4px 4px 0; |
||||
border-radius: 4px; |
||||
border: 1px solid rgba(255,255,255, 0.15); |
||||
background-color: rgba(0,0,0, 0.15); |
||||
} |
||||
|
||||
.weight > div.bg { |
||||
position: absolute; |
||||
left: -3px; |
||||
bottom: -18px; |
||||
width: 70px; |
||||
height: 64px; |
||||
background: url(images/weight.png) no-repeat center bottom; |
||||
} |
||||
|
||||
.weight.w500 { |
||||
|
||||
} |
||||
|
||||
.weight.w200 { |
||||
|
||||
} |
||||
|
||||
.weight.w100 { |
||||
|
||||
} |
||||
|
||||
.weight.w50 { |
||||
|
||||
} |
||||
|
||||
.weight.w20 { |
||||
|
||||
} |
||||
|
||||
.weight.w10 { |
||||
|
||||
} |
||||
|
||||
.onOut .amount { |
||||
background-color: rgba(255,0,0, 0.15); |
||||
} |
@ -0,0 +1,46 @@ |
||||
html, body { |
||||
margin:0; |
||||
padding: 0; |
||||
height: 100%; |
||||
font-family: "helvetica neue"; |
||||
font-size: 14px; |
||||
color: #666666; |
||||
} |
||||
|
||||
#body { |
||||
|
||||
} |
||||
|
||||
#core { |
||||
width: 100%; |
||||
height: 100%; |
||||
|
||||
position: relative; |
||||
|
||||
-webkit-border-radius: 8px; |
||||
-moz-border-radius: 8px; |
||||
-ms-border-radius: 8px; |
||||
border-radius: 8px; |
||||
|
||||
-webkit-box-shadow: 0 1px 3px rgba(0,0,0, 0.65); |
||||
-moz-box-shadow: 0 1px 3px rgba(0,0,0, 0.65); |
||||
-ms-box-shadow: 0 1px 3px rgba(0,0,0, 0.65); |
||||
box-shadow: 0 1px 3px rgba(0,0,0, 0.65); |
||||
background-image: linear-gradient(top, white 0%, #CCC 100%); |
||||
background-image: -o-linear-gradient(top, white 0%, #CCC 100%); |
||||
background-image: -moz-linear-gradient(top, white 0%, #CCC 100%); |
||||
background-image: -webkit-linear-gradient(top, white 0%, #CCC 100%); |
||||
background-image: -ms-linear-gradient(top, white 0%, #CCC 100%); |
||||
background-image: -webkit-gradient( linear, 50% top, 50% bottom, color-stop(0, white), color-stop(1, #CCC) ); |
||||
} |
||||
|
||||
#core .wrapper { |
||||
width: 100%; |
||||
height: 100%; |
||||
|
||||
overflow: auto; |
||||
} |
||||
|
||||
#core .wrapper > div { |
||||
padding: 10px 20px; |
||||
} |
@ -0,0 +1,310 @@ |
||||
html, body { |
||||
margin:0; |
||||
padding: 0; |
||||
font-family: "helvetica neue"; |
||||
font-size: 14px; |
||||
color: #666666; |
||||
} |
||||
|
||||
#ubwidget { |
||||
position: absolute; |
||||
top: 0; |
||||
bottom: 0; |
||||
left: 0; |
||||
right: 0; |
||||
background: url("images/bg.png"); |
||||
} |
||||
|
||||
.theme-pad #ubwidget { |
||||
border-radius: 40px; |
||||
border-width: 52px; |
||||
|
||||
-webkit-border-image: url("images/pad-bd.png") 52 repeat; |
||||
-moz-border-image: url("images/pad-bd.png") 52 repeat; |
||||
border-image: url("images/pad-bd.png") 52 repeat; |
||||
} |
||||
|
||||
.theme-slate #ubwidget { |
||||
border-radius: 44px; |
||||
border-width: 52px; |
||||
|
||||
-webkit-border-image: url("images/slate-bd.png") 52 repeat; |
||||
-moz-border-image: url("images/slate-bd.png") 52 repeat; |
||||
border-image: url("images/slate-bd.png") 52 repeat; |
||||
} |
||||
|
||||
#ubwidget > .wrapper { |
||||
position: absolute; |
||||
top: 0px; |
||||
bottom: 0px; |
||||
left: 0px; |
||||
right: 0px; |
||||
overflow: hidden; |
||||
} |
||||
|
||||
|
||||
.theme-slate #ubwidget > .wrapper, .theme-pad #ubwidget > .wrapper { |
||||
position: absolute; |
||||
top: -49px; |
||||
bottom: -5px; |
||||
left: -5px; |
||||
right: -5px; |
||||
overflow: hidden; |
||||
} |
||||
|
||||
#toolbar { |
||||
display: table; |
||||
width: 100%; |
||||
height: 44px; |
||||
font-family: "Lobster13Regular"; |
||||
font-size: 24px; |
||||
color: #FFCC99; |
||||
padding:0 10px; |
||||
} |
||||
|
||||
.theme-pad #toolbar, .theme-slate #toolbar { |
||||
height: 38px; |
||||
padding: 6px 0 0; |
||||
} |
||||
|
||||
.theme-slate #toolbar { |
||||
color: #7F613F; |
||||
text-shadow: #FFDCA9 0 1px 0; |
||||
} |
||||
|
||||
|
||||
#toolbar > * { |
||||
display: table-cell; |
||||
height: 100%; |
||||
vertical-align: middle; |
||||
} |
||||
|
||||
#toolbar .actions { |
||||
text-align: right; |
||||
} |
||||
|
||||
#toolbar button, h1 { |
||||
font-weight: normal; |
||||
font-family: "Lobster13Regular"; |
||||
font-size: 24px; |
||||
color: #FFCC99; |
||||
margin: 0; |
||||
} |
||||
|
||||
.theme-slate #toolbar button, .theme-slate h1 { |
||||
color: #7F613F; |
||||
text-shadow: #FFDCA9 0 1px 0; |
||||
} |
||||
|
||||
#toolbar button { |
||||
border: none; |
||||
padding: none; |
||||
outline: none; |
||||
background: none; |
||||
|
||||
cursor: pointer; |
||||
padding-left: 34px; |
||||
margin-left: 10px; |
||||
height: 32px; |
||||
} |
||||
|
||||
#toolbar button span { |
||||
display: block; |
||||
line-height: 32px; |
||||
} |
||||
|
||||
#toolbar button[role='edit'] { |
||||
background: url("images/toolbar-edit.png") left top no-repeat; |
||||
} |
||||
|
||||
#toolbar button[role='view'] { |
||||
display: none; |
||||
color: #FFF; |
||||
background: url("images/toolbar-edit.png") left -32px no-repeat; |
||||
} |
||||
|
||||
#toolbar button[role='reload'] { |
||||
background: url("images/toolbar-reload.png") left top no-repeat; |
||||
} |
||||
|
||||
#toolbar button[role='help'] { |
||||
background: url("images/toolbar-help.png") left top no-repeat; |
||||
display: none; |
||||
} |
||||
|
||||
.hasHelp #toolbar button[role='help'] { |
||||
display: inline-block; |
||||
} |
||||
|
||||
.showHelp #toolbar button[role='help'] { |
||||
color: #FFF; |
||||
background-position: left -32px; |
||||
} |
||||
|
||||
.theme-slate #toolbar button[role='edit'] { |
||||
background-image: url("images/slate-toolbar-edit.png"); |
||||
} |
||||
|
||||
.theme-slate #toolbar button[role='view'] { |
||||
text-shadow: #7F613F 0 -1px 0; |
||||
background: url("images/slate-toolbar-edit.png") left -32px no-repeat; |
||||
} |
||||
|
||||
.theme-slate #toolbar button[role='reload'] { |
||||
background-image: url("images/slate-toolbar-reload.png"); |
||||
} |
||||
|
||||
.theme-slate #toolbar button[role='help'] { |
||||
background-image: url("images/slate-toolbar-help.png"); |
||||
} |
||||
|
||||
.showHelp.theme-slate #toolbar button[role='help'] { |
||||
text-shadow: #7F613F 0 -1px 0; |
||||
} |
||||
|
||||
|
||||
.onEdit #toolbar button[role='view'] { |
||||
display: inline-block; |
||||
} |
||||
|
||||
.onEdit #toolbar button[role='edit'] { |
||||
display: none; |
||||
} |
||||
|
||||
#help { |
||||
width: 300px; |
||||
height: 400px; |
||||
position: absolute; |
||||
margin-top: 10px; |
||||
right: 10px; |
||||
z-index: 10000; |
||||
display: none; |
||||
} |
||||
|
||||
.showHelp #help { |
||||
display: block; |
||||
} |
||||
|
||||
#content { |
||||
position: absolute; |
||||
top: 44px; |
||||
bottom: 0; |
||||
overflow: auto; |
||||
left: 0; |
||||
right: 0; |
||||
|
||||
background-image: -moz-radial-gradient(center center, ellipse closest-side, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 100%); |
||||
background-image: -webkit-radial-gradient(center center, ellipse closest-side, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 100%); |
||||
background-image: -o-radial-gradient(center center, ellipse closest-side, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 100%); |
||||
background-image: -ms-radial-gradient(center center, ellipse closest-side, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 100%); |
||||
background-image: radial-gradient(center center, ellipse closest-side, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 100%); |
||||
} |
||||
|
||||
#parameters { |
||||
display:none; |
||||
padding: 10px 20px; |
||||
background: url("images/parameters-bg.png"); |
||||
|
||||
-webkit-border-radius: 4px 4px 0 0; |
||||
-moz-border-radius: 4px 4px 0 0; |
||||
-mz-border-radius: 4px 4px 0 0; |
||||
border-radius: 4px 4px 0 0; |
||||
} |
||||
|
||||
#parameters label { |
||||
font-style: italic; |
||||
} |
||||
|
||||
#parameters label > select, #parameters label > input{ |
||||
margin-left: 10px; |
||||
} |
||||
|
||||
#parameters > div.inline { |
||||
display: inline-block; |
||||
} |
||||
|
||||
#parameters > div.inline+div.inline { |
||||
margin-left: 20px; |
||||
} |
||||
|
||||
#parameters input[type=text], |
||||
#parameters input[type=number] { |
||||
height: 26px; |
||||
border: 1px solid #BBB; |
||||
background-color: #FFF; |
||||
|
||||
padding: 0 4px; |
||||
|
||||
-webkit-border-radius: 4px; |
||||
-moz-border-radius: 4px; |
||||
-ms-border-radius: 4px; |
||||
border-radius: 4px; |
||||
|
||||
-webkit-box-shadow: 0 1px 0 #FFF; |
||||
-moz-box-shadow: 0 1px 0 #FFF; |
||||
-ms-box-shadow: 0 1px 0 #FFF; |
||||
box-shadow: 0 1px 0 #FFF; |
||||
} |
||||
|
||||
#parameters input.tiny { |
||||
width: 40px; |
||||
} |
||||
|
||||
#parameters input.small { |
||||
width: 80px; |
||||
} |
||||
|
||||
#parameters input.medium { |
||||
width: 120px; |
||||
} |
||||
|
||||
#parameters input.long { |
||||
width: 160px; |
||||
} |
||||
|
||||
#scene { |
||||
padding: 20px; |
||||
} |
||||
|
||||
#scene > * { |
||||
margin: 0 auto; |
||||
} |
||||
.onEdit #scene { |
||||
} |
||||
|
||||
.onEdit #parameters { |
||||
display: block; |
||||
} |
||||
|
||||
/* |
||||
.card-container { |
||||
-webkit-perspective: 600px; |
||||
width:100%; |
||||
height: 100%; |
||||
} |
||||
.card { |
||||
position: relative; |
||||
width:100%; |
||||
height: 100%; |
||||
} |
||||
.card > div { |
||||
position: absolute; |
||||
width:100%; |
||||
height: 100%; |
||||
-webkit-transform-style: preserve-3d; |
||||
-webkit-transition: all .5s ease-in-out; |
||||
-webkit-backface-visibility: hidden; |
||||
} |
||||
.card > div:first-child { |
||||
-webkit-transform: rotateY( 0deg ); |
||||
} |
||||
.card > div:last-child { |
||||
-webkit-transform: rotateY( -180deg ); |
||||
} |
||||
.card.flip > div:first-child { |
||||
-webkit-transform: rotateY( 180deg ); |
||||
} |
||||
.card.flip > div:last-child { |
||||
-webkit-transform: rotateY( 0deg ); |
||||
} |
||||
*/ |
@ -0,0 +1,62 @@ |
||||
<!doctype html> |
||||
<html xmlns="http://www.w3.org/1999/xhtml"> |
||||
|
||||
<head> |
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
||||
<!-- |
||||
<link rel="stylesheet" href="css/fonts/Lobster/stylesheet.css"> |
||||
<link rel="stylesheet" href="css/fonts/SF-Toontime/stylesheet.css"> |
||||
--> |
||||
<link rel="stylesheet" href="css/ubw-help.css"> |
||||
|
||||
<script src="js/lib/modernizr.js" type="text/javascript"></script> |
||||
<script src="js/lib/jquery-1.7.1.min.js" type="text/javascript"></script> |
||||
<script src="js/lib/mustache.js" type="text/javascript"></script> |
||||
</head> |
||||
|
||||
<body> |
||||
<div id="core"> |
||||
<div class="wrapper"> |
||||
<div> |
||||
<script> |
||||
function loadFile(filename, locale) { |
||||
var toload = filename; |
||||
var nextlocale = undefined; |
||||
|
||||
if(locale.length >= 5) { |
||||
toload += '_' + locale.substring(0, 5) +'-template.js'; |
||||
nextlocale = locale.substring(0, 2); |
||||
} |
||||
|
||||
else if(locale.length >= 2){ |
||||
toload += '_' + locale.substring(0, 2) +'-template.js'; |
||||
nextlocale = ''; |
||||
} |
||||
else |
||||
toload += '-template.js'; |
||||
|
||||
$.ajax({ |
||||
url: toload, |
||||
async: false, |
||||
contentType:'text/plain;charset=UTF-8', |
||||
dataType: 'text', |
||||
success: function(data, status) { |
||||
$("#core>.wrapper>div").html(Mustache.render(data, window)); |
||||
} |
||||
}) |
||||
.fail(function() { |
||||
if(nextlocale !== undefined) |
||||
loadFile(filename, nextlocale); |
||||
}); |
||||
} |
||||
$(document).ready(function(){ |
||||
var locale = window.parent.sankore ? window.parent.sankore.locale() : ""; |
||||
loadFile("js/help", locale); |
||||
}); |
||||
</script> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</body> |
||||
|
||||
</html> |
@ -0,0 +1,13 @@ |
||||
fr.njin.i18n.document.title = balance |
||||
|
||||
fr.njin.i18n.toolbar.edit = Edit |
||||
fr.njin.i18n.toolbar.view = Close |
||||
fr.njin.i18n.toolbar.reload = Reload |
||||
fr.njin.i18n.toolbar.help = Help |
||||
|
||||
fr.njin.i18n.parameters.label.themes = Theme |
||||
fr.njin.i18n.parameters.label.slate.themes = slate |
||||
fr.njin.i18n.parameters.label.pad.themes = pad |
||||
fr.njin.i18n.parameters.label.none.themes = none |
||||
|
||||
fr.njin.i18n.balance.parameters.label.remove = Remove |
@ -0,0 +1,13 @@ |
||||
fr.njin.i18n.document.title = La Balance |
||||
|
||||
fr.njin.i18n.toolbar.edit = Editer |
||||
fr.njin.i18n.toolbar.view = Fermer |
||||
fr.njin.i18n.toolbar.reload = Recharger |
||||
fr.njin.i18n.toolbar.help = Aide |
||||
|
||||
fr.njin.i18n.parameters.label.themes = Thème |
||||
fr.njin.i18n.parameters.label.slate.themes = ardoise |
||||
fr.njin.i18n.parameters.label.pad.themes = tablette |
||||
fr.njin.i18n.parameters.label.none.themes = aucun |
||||
|
||||
fr.njin.i18n.balance.parameters.label.remove = Enlever |
After Width: | Height: | Size: 12 KiB |
@ -0,0 +1,61 @@ |
||||
<!doctype html> |
||||
<html xmlns="http://www.w3.org/1999/xhtml"> |
||||
|
||||
<head> |
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
||||
<!-- |
||||
<link rel="stylesheet" href="css/fonts/Lobster/stylesheet.css"> |
||||
<link rel="stylesheet" href="css/fonts/SF-Toontime/stylesheet.css"> |
||||
--> |
||||
|
||||
<link rel="stylesheet" href="css/ubw-main.css"> |
||||
<link rel="stylesheet" href="css/main.css"> |
||||
|
||||
<script src="js/templates.js" type="text/javascript" charset="utf-8"></script> |
||||
|
||||
<script src="js/lib/modernizr.js" type="text/javascript"></script> |
||||
<script src="js/lib/jquery-1.7.1.min.js" type="text/javascript"></script> |
||||
<script src="js/lib/jquery-css-transform.js" type="text/javascript"></script> |
||||
<script src="js/lib/jquery-ui-1.8.17.custom.min.js" type="text/javascript"></script> |
||||
<script src="js/lib/jquery.i18n.properties-min-1.0.9.js" type="text/javascript" charset="utf-8"></script> |
||||
<script src="js/lib/mustache.js" type="text/javascript"></script> |
||||
<script src="js/lib/ubw-main.js" type="text/javascript"></script> |
||||
<script src="js/main.js" type="text/javascript" charset="utf-8"></script> |
||||
|
||||
</head> |
||||
|
||||
<body class="hasHelp"> |
||||
<div id="ubwidget" data-themes="pad"> |
||||
<div class="wrapper"> |
||||
<div id="toolbar"> |
||||
</div> |
||||
<div id="help"> |
||||
<iframe src="help.html" width="100%" height="100%" frameborder="0"></iframe> |
||||
</div> |
||||
<div id="content"> |
||||
<div id="parameters"></div> |
||||
<div id="scene"> |
||||
<div id="scalesCell" class=""> |
||||
<div id="scalesWrapper" class=""> |
||||
<div id="scales" class=""> |
||||
<div id="graduations"></div> |
||||
<div id="pivot"></div> |
||||
<div id="tray"></div> |
||||
<div id="leftScale" class="scale"></div> |
||||
<div id="rightScale" class="scale"></div> |
||||
</div> |
||||
<div id="weights"></div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div id="objects" class=""> |
||||
<div class="desk"></div> |
||||
<button role="add">+</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</body> |
||||
|
||||
</html> |
@ -0,0 +1 @@ |
||||
<h3>balance</h3> |
@ -0,0 +1 @@ |
||||
<h3>balance</h3> |
@ -0,0 +1,112 @@ |
||||
(function ($) { |
||||
// Monkey patch jQuery 1.3.1+ css() method to support CSS 'transform'
|
||||
// property uniformly across Safari/Chrome/Webkit, Firefox 3.5+, IE 9+, and Opera 11+.
|
||||
// 2009-2011 Zachary Johnson www.zachstronaut.com
|
||||
// Updated 2011.05.04 (May the fourth be with you!)
|
||||
function getTransformProperty(element) |
||||
{ |
||||
// Try transform first for forward compatibility
|
||||
// In some versions of IE9, it is critical for msTransform to be in
|
||||
// this list before MozTranform.
|
||||
var properties = ['transform', 'WebkitTransform', 'msTransform', 'MozTransform', 'OTransform']; |
||||
var p; |
||||
while (p = properties.shift()) |
||||
{ |
||||
if (typeof element.style[p] != 'undefined') |
||||
{ |
||||
return p; |
||||
} |
||||
} |
||||
|
||||
// Default to transform also
|
||||
return 'transform'; |
||||
} |
||||
|
||||
var _propsObj = null; |
||||
|
||||
var proxied = $.fn.css; |
||||
$.fn.css = function (arg, val) |
||||
{ |
||||
// Temporary solution for current 1.6.x incompatibility, while
|
||||
// preserving 1.3.x compatibility, until I can rewrite using CSS Hooks
|
||||
if (_propsObj === null) |
||||
{ |
||||
if (typeof $.cssProps != 'undefined') |
||||
{ |
||||
_propsObj = $.cssProps; |
||||
} |
||||
else if (typeof $.props != 'undefined') |
||||
{ |
||||
_propsObj = $.props; |
||||
} |
||||
else |
||||
{ |
||||
_propsObj = {} |
||||
} |
||||
} |
||||
|
||||
// Find the correct browser specific property and setup the mapping using
|
||||
// $.props which is used internally by jQuery.attr() when setting CSS
|
||||
// properties via either the css(name, value) or css(properties) method.
|
||||
// The problem with doing this once outside of css() method is that you
|
||||
// need a DOM node to find the right CSS property, and there is some risk
|
||||
// that somebody would call the css() method before body has loaded or any
|
||||
// DOM-is-ready events have fired.
|
||||
if |
||||
( |
||||
typeof _propsObj['transform'] == 'undefined' |
||||
&& |
||||
( |
||||
arg == 'transform' |
||||
|| |
||||
( |
||||
typeof arg == 'object' |
||||
&& typeof arg['transform'] != 'undefined' |
||||
) |
||||
) |
||||
) |
||||
{ |
||||
_propsObj['transform'] = getTransformProperty(this.get(0)); |
||||
} |
||||
|
||||
// We force the property mapping here because jQuery.attr() does
|
||||
// property mapping with jQuery.props when setting a CSS property,
|
||||
// but curCSS() does *not* do property mapping when *getting* a
|
||||
// CSS property. (It probably should since it manually does it
|
||||
// for 'float' now anyway... but that'd require more testing.)
|
||||
//
|
||||
// But, only do the forced mapping if the correct CSS property
|
||||
// is not 'transform' and is something else.
|
||||
if (_propsObj['transform'] != 'transform') |
||||
{ |
||||
// Call in form of css('transform' ...)
|
||||
if (arg == 'transform') |
||||
{ |
||||
arg = _propsObj['transform']; |
||||
|
||||
// User wants to GET the transform CSS, and in jQuery 1.4.3
|
||||
// calls to css() for transforms return a matrix rather than
|
||||
// the actual string specified by the user... avoid that
|
||||
// behavior and return the string by calling jQuery.style()
|
||||
// directly
|
||||
if (typeof val == 'undefined' && jQuery.style) |
||||
{ |
||||
return jQuery.style(this.get(0), arg); |
||||
} |
||||
} |
||||
|
||||
// Call in form of css({'transform': ...})
|
||||
else if |
||||
( |
||||
typeof arg == 'object' |
||||
&& typeof arg['transform'] != 'undefined' |
||||
) |
||||
{ |
||||
arg[_propsObj['transform']] = arg['transform']; |
||||
delete arg['transform']; |
||||
} |
||||
} |
||||
|
||||
return proxied.apply(this, arguments); |
||||
}; |
||||
})(jQuery); |
@ -0,0 +1,9 @@ |
||||
(function(k){function n(c,a){k.ajax({url:c,async:!1,cache:a.cache,contentType:"text/plain;charset="+a.encoding,dataType:"text",success:function(b){r(b,a.mode)}})}function r(c,a){for(var b="",e=c.split(/\n/),d=/(\{\d+\})/g,q=/\{(\d+)\}/g,m=/(\\u.{4})/ig,f=0;f<e.length;f++)if(e[f]=e[f].replace(/^\s\s*/,"").replace(/\s\s*$/,""),e[f].length>0&&e[f].match("^#")!="#"){var g=e[f].split("=");if(g.length>0){for(var o=unescape(g[0]).replace(/^\s\s*/,"").replace(/\s\s*$/,""),h=g.length==1?"":g[1];h.match(/\\$/)== |
||||
"\\";)h=h.substring(0,h.length-1),h+=e[++f].replace(/\s\s*$/,"");for(var l=2;l<g.length;l++)h+="="+g[l];h=h.replace(/^\s\s*/,"").replace(/\s\s*$/,"");if(a=="map"||a=="both"){if(g=h.match(m))for(l=0;l<g.length;l++)h=h.replace(g[l],s(g[l]));k.i18n.map[o]=h}if(a=="vars"||a=="both")if(h=h.replace(/"/g,'\\"'),t(o),d.test(h)){for(var g=h.split(d),l=!0,j="",n=[],p=0;p<g.length;p++)if(d.test(g[p])&&(n.length==0||n.indexOf(g[p])==-1))l||(j+=","),j+=g[p].replace(q,"v$1"),n.push(g[p]),l=!1;b+=o+"=function("+ |
||||
j+"){";o='"'+h.replace(q,'"+v$1+"')+'"';b+="return "+o+";};"}else b+=o+'="'+h+'";'}}eval(b)}function t(c){if(/\./.test(c))for(var a="",c=c.split(/\./),b=0;b<c.length;b++)b>0&&(a+="."),a+=c[b],eval("typeof "+a+' == "undefined"')&&eval(a+"={};")}function s(c){var a=[],c=parseInt(c.substr(2),16);c>=0&&c<Math.pow(2,16)&&a.push(c);for(var c="",b=0;b<a.length;++b)c+=String.fromCharCode(a[b]);return c}k.i18n={};k.i18n.map={};k.i18n.properties=function(c){c=k.extend({name:"Messages",language:"",path:"",mode:"vars", |
||||
cache:!1,encoding:"UTF-8",callback:null},c);if(c.language===null||c.language=="")c.language=k.i18n.browserLang();if(c.language===null)c.language="";var a=c.name&&c.name.constructor==Array?c.name:[c.name];for(i=0;i<a.length;i++)n(c.path+a[i]+".properties",c),c.language.length>=2&&n(c.path+a[i]+"_"+c.language.substring(0,2)+".properties",c),c.language.length>=5&&n(c.path+a[i]+"_"+c.language.substring(0,5)+".properties",c);c.callback&&c.callback()};k.i18n.prop=function(c){var a=k.i18n.map[c];if(a==null)return"["+ |
||||
c+"]";var b;if(typeof a=="string"){for(b=0;(b=a.indexOf("\\",b))!=-1;)a=a[b+1]=="t"?a.substring(0,b)+"\t"+a.substring(b++ +2):a[b+1]=="r"?a.substring(0,b)+"\r"+a.substring(b++ +2):a[b+1]=="n"?a.substring(0,b)+"\n"+a.substring(b++ +2):a[b+1]=="f"?a.substring(0,b)+"\u000c"+a.substring(b++ +2):a[b+1]=="\\"?a.substring(0,b)+"\\"+a.substring(b++ +2):a.substring(0,b)+a.substring(b+1);var e=[],d,j;for(b=0;b<a.length;)if(a[b]=="'")if(b==a.length-1)a=a.substring(0,b);else if(a[b+1]=="'")a=a.substring(0,b)+ |
||||
a.substring(++b);else{for(d=b+2;(d=a.indexOf("'",d))!=-1;)if(d==a.length-1||a[d+1]!="'"){a=a.substring(0,b)+a.substring(b+1,d)+a.substring(d+1);b=d-1;break}else a=a.substring(0,d)+a.substring(++d);d==-1&&(a=a.substring(0,b)+a.substring(b+1))}else if(a[b]=="{")if(d=a.indexOf("}",b+1),d==-1)b++;else if(j=parseInt(a.substring(b+1,d)),!isNaN(j)&&j>=0){var m=a.substring(0,b);m!=""&&e.push(m);e.push(j);b=0;a=a.substring(d+1)}else b=d+1;else b++;a!=""&&e.push(a);a=e;k.i18n.map[c]=e}if(a.length==0)return""; |
||||
if(a.lengh==1&&typeof a[0]=="string")return a[0];m="";for(b=0;b<a.length;b++)m+=typeof a[b]=="string"?a[b]:a[b]+1<arguments.length?arguments[a[b]+1]:"{"+a[b]+"}";return m};k.i18n.browserLang=function(){var c=navigator.language||navigator.userLanguage,c=c.toLowerCase();c.length>3&&(c=c.substring(0,3)+c.substring(3).toUpperCase());return c};var j;if(!j)j=function(c,a,b){if(Object.prototype.toString.call(a)!=="[object RegExp]")return typeof j._nativeSplit=="undefined"?c.split(a,b):j._nativeSplit.call(c, |
||||
a,b);var e=[],d=0,k=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.sticky?"y":""),a=RegExp(a.source,k+"g"),m,f,g;c+="";j._compliantExecNpcg||(m=RegExp("^"+a.source+"$(?!\\s)",k));if(b===void 0||+b<0)b=Infinity;else if(b=Math.floor(+b),!b)return[];for(;f=a.exec(c);){k=f.index+f[0].length;if(k>d&&(e.push(c.slice(d,f.index)),!j._compliantExecNpcg&&f.length>1&&f[0].replace(m,function(){for(var a=1;a<arguments.length-2;a++)arguments[a]===void 0&&(f[a]=void 0)}),f.length>1&&f.index<c.length&&Array.prototype.push.apply(e, |
||||
f.slice(1)),g=f[0].length,d=k,e.length>=b))break;a.lastIndex===f.index&&a.lastIndex++}d===c.length?(g||!a.test(""))&&e.push(""):e.push(c.slice(d));return e.length>b?e.slice(0,b):e},j._compliantExecNpcg=/()??/.exec("")[1]===void 0,j._nativeSplit=String.prototype.split;String.prototype.split=function(c,a){return j(this,c,a)}})(jQuery); |
@ -0,0 +1,536 @@ |
||||
/*! |
||||
* mustache.js - Logic-less {{mustache}} templates with JavaScript |
||||
* http://github.com/janl/mustache.js
|
||||
*/ |
||||
var Mustache = (typeof module !== "undefined" && module.exports) || {}; |
||||
|
||||
(function (exports) { |
||||
|
||||
exports.name = "mustache.js"; |
||||
exports.version = "0.5.0-dev"; |
||||
exports.tags = ["{{", "}}"]; |
||||
exports.parse = parse; |
||||
exports.compile = compile; |
||||
exports.render = render; |
||||
exports.clearCache = clearCache; |
||||
|
||||
// This is here for backwards compatibility with 0.4.x.
|
||||
exports.to_html = function (template, view, partials, send) { |
||||
var result = render(template, view, partials); |
||||
|
||||
if (typeof send === "function") { |
||||
send(result); |
||||
} else { |
||||
return result; |
||||
} |
||||
}; |
||||
|
||||
var _toString = Object.prototype.toString; |
||||
var _isArray = Array.isArray; |
||||
var _forEach = Array.prototype.forEach; |
||||
var _trim = String.prototype.trim; |
||||
|
||||
var isArray; |
||||
if (_isArray) { |
||||
isArray = _isArray; |
||||
} else { |
||||
isArray = function (obj) { |
||||
return _toString.call(obj) === "[object Array]"; |
||||
}; |
||||
} |
||||
|
||||
var forEach; |
||||
if (_forEach) { |
||||
forEach = function (obj, callback, scope) { |
||||
return _forEach.call(obj, callback, scope); |
||||
}; |
||||
} else { |
||||
forEach = function (obj, callback, scope) { |
||||
for (var i = 0, len = obj.length; i < len; ++i) { |
||||
callback.call(scope, obj[i], i, obj); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
var spaceRe = /^\s*$/; |
||||
|
||||
function isWhitespace(string) { |
||||
return spaceRe.test(string); |
||||
} |
||||
|
||||
var trim; |
||||
if (_trim) { |
||||
trim = function (string) { |
||||
return string == null ? "" : _trim.call(string); |
||||
}; |
||||
} else { |
||||
var trimLeft, trimRight; |
||||
|
||||
if (isWhitespace("\xA0")) { |
||||
trimLeft = /^\s+/; |
||||
trimRight = /\s+$/; |
||||
} else { |
||||
// IE doesn't match non-breaking spaces with \s, thanks jQuery.
|
||||
trimLeft = /^[\s\xA0]+/; |
||||
trimRight = /[\s\xA0]+$/; |
||||
} |
||||
|
||||
trim = function (string) { |
||||
return string == null ? "" : |
||||
String(string).replace(trimLeft, "").replace(trimRight, ""); |
||||
}; |
||||
} |
||||
|
||||
var escapeMap = { |
||||
"&": "&", |
||||
"<": "<", |
||||
">": ">", |
||||
'"': '"', |
||||
"'": ''' |
||||
}; |
||||
|
||||
function escapeHTML(string) { |
||||
return String(string).replace(/&(?!\w+;)|[<>"']/g, function (s) { |
||||
return escapeMap[s] || s; |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Adds the `template`, `line`, and `file` properties to the given error |
||||
* object and alters the message to provide more useful debugging information. |
||||
*/ |
||||
function debug(e, template, line, file) { |
||||
file = file || "<template>"; |
||||
|
||||
var lines = template.split("\n"), |
||||
start = Math.max(line - 3, 0), |
||||
end = Math.min(lines.length, line + 3), |
||||
context = lines.slice(start, end); |
||||
|
||||
var c; |
||||
for (var i = 0, len = context.length; i < len; ++i) { |
||||
c = i + start + 1; |
||||
context[i] = (c === line ? " >> " : " ") + context[i]; |
||||
} |
||||
|
||||
e.template = template; |
||||
e.line = line; |
||||
e.file = file; |
||||
e.message = [file + ":" + line, context.join("\n"), "", e.message].join("\n"); |
||||
|
||||
return e; |
||||
} |
||||
|
||||
/** |
||||
* Looks up the value of the given `name` in the given context `stack`. |
||||
*/ |
||||
function lookup(name, stack, defaultValue) { |
||||
if (name === ".") { |
||||
return stack[stack.length - 1]; |
||||
} |
||||
|
||||
var names = name.split("."); |
||||
var lastIndex = names.length - 1; |
||||
var target = names[lastIndex]; |
||||
|
||||
var value, context, i = stack.length, j, localStack; |
||||
while (i) { |
||||
localStack = stack.slice(0); |
||||
context = stack[--i]; |
||||
|
||||
j = 0; |
||||
while (j < lastIndex) { |
||||
context = context[names[j++]]; |
||||
|
||||
if (context == null) { |
||||
break; |
||||
} |
||||
|
||||
localStack.push(context); |
||||
} |
||||
|
||||
if (context && target in context) { |
||||
value = context[target]; |
||||
break; |
||||
} |
||||
} |
||||
|
||||
// If the value is a function, call it in the current context.
|
||||
if (typeof value === "function") { |
||||
value = value.call(localStack[localStack.length - 1]); |
||||
} |
||||
|
||||
if (value == null) { |
||||
return defaultValue; |
||||
} |
||||
|
||||
return value; |
||||
} |
||||
|
||||
function renderSection(name, stack, callback, inverted) { |
||||
var buffer = ""; |
||||
var value = lookup(name, stack); |
||||
|
||||
if (inverted) { |
||||
// From the spec: inverted sections may render text once based on the
|
||||
// inverse value of the key. That is, they will be rendered if the key
|
||||
// doesn't exist, is false, or is an empty list.
|
||||
if (value == null || value === false || (isArray(value) && value.length === 0)) { |
||||
buffer += callback(); |
||||
} |
||||
} else if (isArray(value)) { |
||||
forEach(value, function (value) { |
||||
stack.push(value); |
||||
buffer += callback(); |
||||
stack.pop(); |
||||
}); |
||||
} else if (typeof value === "object") { |
||||
stack.push(value); |
||||
buffer += callback(); |
||||
stack.pop(); |
||||
} else if (typeof value === "function") { |
||||
var scope = stack[stack.length - 1]; |
||||
var scopedRender = function (template) { |
||||
return render(template, scope); |
||||
}; |
||||
buffer += value.call(scope, callback(), scopedRender) || ""; |
||||
} else if (value) { |
||||
buffer += callback(); |
||||
} |
||||
|
||||
return buffer; |
||||
} |
||||
|
||||
/** |
||||
* Parses the given `template` and returns the source of a function that, |
||||
* with the proper arguments, will render the template. Recognized options |
||||
* include the following: |
||||
* |
||||
* - file The name of the file the template comes from (displayed in |
||||
* error messages) |
||||
* - tags An array of open and close tags the `template` uses. Defaults |
||||
* to the value of Mustache.tags |
||||
* - debug Set `true` to log the body of the generated function to the |
||||
* console |
||||
* - space Set `true` to preserve whitespace from lines that otherwise |
||||
* contain only a {{tag}}. Defaults to `false` |
||||
*/ |
||||
function parse(template, options) { |
||||
options = options || {}; |
||||
|
||||
var tags = options.tags || exports.tags, |
||||
openTag = tags[0], |
||||
closeTag = tags[tags.length - 1]; |
||||
|
||||
var code = [ |
||||
'var buffer = "";', // output buffer
|
||||
"\nvar line = 1;", // keep track of source line number
|
||||
"\ntry {", |
||||
'\nbuffer += "' |
||||
]; |
||||
|
||||
var spaces = [], // indices of whitespace in code on the current line
|
||||
hasTag = false, // is there a {{tag}} on the current line?
|
||||
nonSpace = false; // is there a non-space char on the current line?
|
||||
|
||||
// Strips all space characters from the code array for the current line
|
||||
// if there was a {{tag}} on it and otherwise only spaces.
|
||||
var stripSpace = function () { |
||||
if (hasTag && !nonSpace && !options.space) { |
||||
while (spaces.length) { |
||||
code.splice(spaces.pop(), 1); |
||||
} |
||||
} else { |
||||
spaces = []; |
||||
} |
||||
|
||||
hasTag = false; |
||||
nonSpace = false; |
||||
}; |
||||
|
||||
var sectionStack = [], updateLine, nextOpenTag, nextCloseTag; |
||||
|
||||
var setTags = function (source) { |
||||
tags = trim(source).split(/\s+/); |
||||
nextOpenTag = tags[0]; |
||||
nextCloseTag = tags[tags.length - 1]; |
||||
}; |
||||
|
||||
var includePartial = function (source) { |
||||
code.push( |
||||
'";', |
||||
updateLine, |
||||
'\nvar partial = partials["' + trim(source) + '"];', |
||||
'\nif (partial) {', |
||||
'\n buffer += render(partial,stack[stack.length - 1],partials);', |
||||
'\n}', |
||||
'\nbuffer += "' |
||||
); |
||||
}; |
||||
|
||||
var openSection = function (source, inverted) { |
||||
var name = trim(source); |
||||
|
||||
if (name === "") { |
||||
throw debug(new Error("Section name may not be empty"), template, line, options.file); |
||||
} |
||||
|
||||
sectionStack.push({name: name, inverted: inverted}); |
||||
|
||||
code.push( |
||||
'";', |
||||
updateLine, |
||||
'\nvar name = "' + name + '";', |
||||
'\nvar callback = (function () {', |
||||
'\n return function () {', |
||||
'\n var buffer = "";', |
||||
'\nbuffer += "' |
||||
); |
||||
}; |
||||
|
||||
var openInvertedSection = function (source) { |
||||
openSection(source, true); |
||||
}; |
||||
|
||||
var closeSection = function (source) { |
||||
var name = trim(source); |
||||
var openName = sectionStack.length != 0 && sectionStack[sectionStack.length - 1].name; |
||||
|
||||
if (!openName || name != openName) { |
||||
throw debug(new Error('Section named "' + name + '" was never opened'), template, line, options.file); |
||||
} |
||||
|
||||
var section = sectionStack.pop(); |
||||
|
||||
code.push( |
||||
'";', |
||||
'\n return buffer;', |
||||
'\n };', |
||||
'\n})();' |
||||
); |
||||
|
||||
if (section.inverted) { |
||||
code.push("\nbuffer += renderSection(name,stack,callback,true);"); |
||||
} else { |
||||
code.push("\nbuffer += renderSection(name,stack,callback);"); |
||||
} |
||||
|
||||
code.push('\nbuffer += "'); |
||||
}; |
||||
|
||||
var sendPlain = function (source) { |
||||
code.push( |
||||
'";', |
||||
updateLine, |
||||
'\nbuffer += lookup("' + trim(source) + '",stack,"");', |
||||
'\nbuffer += "' |
||||
); |
||||
}; |
||||
|
||||
var sendEscaped = function (source) { |
||||
code.push( |
||||
'";', |
||||
updateLine, |
||||
'\nbuffer += escapeHTML(lookup("' + trim(source) + '",stack,""));', |
||||
'\nbuffer += "' |
||||
); |
||||
}; |
||||
|
||||
var line = 1, c, callback; |
||||
for (var i = 0, len = template.length; i < len; ++i) { |
||||
if (template.slice(i, i + openTag.length) === openTag) { |
||||
i += openTag.length; |
||||
c = template.substr(i, 1); |
||||
updateLine = '\nline = ' + line + ';'; |
||||
nextOpenTag = openTag; |
||||
nextCloseTag = closeTag; |
||||
hasTag = true; |
||||
|
||||
switch (c) { |
||||
case "!": // comment
|
||||
i++; |
||||
callback = null; |
||||
break; |
||||
case "=": // change open/close tags, e.g. {{=<% %>=}}
|
||||
i++; |
||||
closeTag = "=" + closeTag; |
||||
callback = setTags; |
||||
break; |
||||
case ">": // include partial
|
||||
i++; |
||||
callback = includePartial; |
||||
break; |
||||
case "#": // start section
|
||||
i++; |
||||
callback = openSection; |
||||
break; |
||||
case "^": // start inverted section
|
||||
i++; |
||||
callback = openInvertedSection; |
||||
break; |
||||
case "/": // end section
|
||||
i++; |
||||
callback = closeSection; |
||||
break; |
||||
case "{": // plain variable
|
||||
closeTag = "}" + closeTag; |
||||
// fall through
|
||||
case "&": // plain variable
|
||||
i++; |
||||
nonSpace = true; |
||||
callback = sendPlain; |
||||
break; |
||||
default: // escaped variable
|
||||
nonSpace = true; |
||||
callback = sendEscaped; |
||||
} |
||||
|
||||
var end = template.indexOf(closeTag, i); |
||||
|
||||
if (end === -1) { |
||||
throw debug(new Error('Tag "' + openTag + '" was not closed properly'), template, line, options.file); |
||||
} |
||||
|
||||
var source = template.substring(i, end); |
||||
|
||||
if (callback) { |
||||
callback(source); |
||||
} |
||||
|
||||
// Maintain line count for \n in source.
|
||||
var n = 0; |
||||
while (~(n = source.indexOf("\n", n))) { |
||||
line++; |
||||
n++; |
||||
} |
||||
|
||||
i = end + closeTag.length - 1; |
||||
openTag = nextOpenTag; |
||||
closeTag = nextCloseTag; |
||||
} else { |
||||
c = template.substr(i, 1); |
||||
|
||||
switch (c) { |
||||
case '"': |
||||
case "\\": |
||||
nonSpace = true; |
||||
code.push("\\" + c); |
||||
break; |
||||
case "\r": |
||||
// Ignore carriage returns.
|
||||
break; |
||||
case "\n": |
||||
spaces.push(code.length); |
||||
code.push("\\n"); |
||||
stripSpace(); // Check for whitespace on the current line.
|
||||
line++; |
||||
break; |
||||
default: |
||||
if (isWhitespace(c)) { |
||||
spaces.push(code.length); |
||||
} else { |
||||
nonSpace = true; |
||||
} |
||||
|
||||
code.push(c); |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (sectionStack.length != 0) { |
||||
throw debug(new Error('Section "' + sectionStack[sectionStack.length - 1].name + '" was not closed properly'), template, line, options.file); |
||||
} |
||||
|
||||
// Clean up any whitespace from a closing {{tag}} that was at the end
|
||||
// of the template without a trailing \n.
|
||||
stripSpace(); |
||||
|
||||
code.push( |
||||
'";', |
||||
"\nreturn buffer;", |
||||
"\n} catch (e) { throw {error: e, line: line}; }" |
||||
); |
||||
|
||||
// Ignore `buffer += "";` statements.
|
||||
var body = code.join("").replace(/buffer \+= "";\n/g, ""); |
||||
|
||||
if (options.debug) { |
||||
if (typeof console != "undefined" && console.log) { |
||||
console.log(body); |
||||
} else if (typeof print === "function") { |
||||
print(body); |
||||
} |
||||
} |
||||
|
||||
return body; |
||||
} |
||||
|
||||
/** |
||||
* Used by `compile` to generate a reusable function for the given `template`. |
||||
*/ |
||||
function _compile(template, options) { |
||||
var args = "view,partials,stack,lookup,escapeHTML,renderSection,render"; |
||||
var body = parse(template, options); |
||||
var fn = new Function(args, body); |
||||
|
||||
// This anonymous function wraps the generated function so we can do
|
||||
// argument coercion, setup some variables, and handle any errors
|
||||
// encountered while executing it.
|
||||
return function (view, partials) { |
||||
partials = partials || {}; |
||||
|
||||
var stack = [view]; // context stack
|
||||
|
||||
try { |
||||
return fn(view, partials, stack, lookup, escapeHTML, renderSection, render); |
||||
} catch (e) { |
||||
throw debug(e.error, template, e.line, options.file); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
// Cache of pre-compiled templates.
|
||||
var _cache = {}; |
||||
|
||||
/** |
||||
* Clear the cache of compiled templates. |
||||
*/ |
||||
function clearCache() { |
||||
_cache = {}; |
||||
} |
||||
|
||||
/** |
||||
* Compiles the given `template` into a reusable function using the given |
||||
* `options`. In addition to the options accepted by Mustache.parse, |
||||
* recognized options include the following: |
||||
* |
||||
* - cache Set `false` to bypass any pre-compiled version of the given |
||||
* template. Otherwise, a given `template` string will be cached |
||||
* the first time it is parsed |
||||
*/ |
||||
function compile(template, options) { |
||||
options = options || {}; |
||||
|
||||
// Use a pre-compiled version from the cache if we have one.
|
||||
if (options.cache !== false) { |
||||
if (!_cache[template]) { |
||||
_cache[template] = _compile(template, options); |
||||
} |
||||
|
||||
return _cache[template]; |
||||
} |
||||
|
||||
return _compile(template, options); |
||||
} |
||||
|
||||
/** |
||||
* High-level function that renders the given `template` using the given |
||||
* `view` and `partials`. If you need to use any of the template options (see |
||||
* `compile` above), you must compile in a separate step, and then call that |
||||
* compiled function. |
||||
*/ |
||||
function render(template, view, partials) { |
||||
return compile(template)(view, partials); |
||||
} |
||||
|
||||
})(Mustache); |
@ -0,0 +1,269 @@ |
||||
/* |
||||
* This program is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, either version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/ |
||||
function log(object) { |
||||
console.log(object); |
||||
} |
||||
|
||||
function initAfterI18nMessagesLoaded(reload, templates, callbacks) { |
||||
document.title = fr.njin.i18n.document.title; |
||||
|
||||
var ubwidget = $("#ubwidget"); |
||||
|
||||
var parameters = Object.create(Parameters,{ |
||||
container: { |
||||
value: ubwidget |
||||
}, |
||||
delegate: { |
||||
value: window.sankore || Object.create(ParametersDelegate) |
||||
} |
||||
}); |
||||
|
||||
var app = Object.create(App, { |
||||
container: { |
||||
value: ubwidget |
||||
}, |
||||
parameters: { |
||||
value: parameters |
||||
}, |
||||
reload: { |
||||
value: reload |
||||
} |
||||
}); |
||||
|
||||
app.init(); |
||||
app.onEdit = false; |
||||
|
||||
if(templates.toolbar) { |
||||
$("#toolbar").html(Mustache.render(templates.toolbar, window)); |
||||
} |
||||
if(templates.parameters) { |
||||
$("#parameters").html(Mustache.render(templates.parameters, window)); |
||||
} |
||||
|
||||
if(callbacks.onTemplatesLoaded && typeof callbacks.onTemplatesLoaded === 'function') { |
||||
callbacks.onTemplatesLoaded(app); |
||||
} |
||||
|
||||
log("Update setting views with stored parameters"); |
||||
$("#parameters (input|select)[role=parameter]").each(function(i, input) { |
||||
(function(input){ |
||||
var key = input.name; |
||||
var type = input.type; |
||||
var isRadioOrcheckbox = (type !== undefined && (type === "checkbox" || type === "radio")); |
||||
var stored = parameters.value(key); |
||||
if(isRadioOrcheckbox) |
||||
$(input).attr("checked", (typeof stored === "string" ? stored === "true" : stored)); |
||||
else |
||||
$(input).val(stored); |
||||
$(input).change(function(){ |
||||
var val = (isRadioOrcheckbox ? $(this).is(":checked") : $(this).val()); |
||||
parameters.value(key, val); |
||||
}); |
||||
})(input); |
||||
}); |
||||
|
||||
log("Toobar Initialisation"); |
||||
$("button[role=edit]").click(function(){ |
||||
app.onEdit = true; |
||||
$(document.body).addClass("onEdit"); |
||||
if(callbacks.onEdit && typeof callbacks.onEdit === 'function') { |
||||
callbacks.onEdit(app); |
||||
} |
||||
}); |
||||
$("button[role=view]").click(function(){ |
||||
app.onEdit = false;
|
||||
$(document.body).removeClass("onEdit"); |
||||
if(callbacks.onView && typeof callbacks.onView === 'function') { |
||||
callbacks.onView(app); |
||||
} |
||||
}); |
||||
$("button[role=reload]").click(function(){ |
||||
app.reload(); |
||||
}); |
||||
$("button[role=help]").click(function(){ |
||||
$("body").toggleClass("showHelp"); |
||||
}); |
||||
|
||||
$("select[name='themes']").change(function() { |
||||
$("body").get(0).className = $("body")[0].className.replace(/\btheme-[^\s]*\b/gi, ''); |
||||
$("body").addClass("theme-"+$(this).val()); |
||||
}); |
||||
$("body").addClass("theme-"+$("select[name='themes']").val()); |
||||
} |
||||
|
||||
function init(reload, templates, callbacks){ |
||||
var locale = window.sankore ? sankore.locale() : ""; |
||||
$.i18n.properties({ |
||||
name: 'Messages',
|
||||
path: 'i18n/', |
||||
language: locale, |
||||
callback: function(){
|
||||
initAfterI18nMessagesLoaded(reload, templates, callbacks); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
var Parameters = (function(){ |
||||
var self = Object.create({}, { |
||||
container: { |
||||
value: null |
||||
}, |
||||
delegate: { |
||||
value: null |
||||
}, |
||||
value: { |
||||
value: function(key, value) { |
||||
if(value === undefined) { |
||||
var val = this.delegate.preference(key); |
||||
log("Retrieve parameter value ["+val+"] as type ["+(typeof val)+"] for key : ["+key+"]"); |
||||
return (val !== undefined && (typeof val !== "string" || val)) ? val : $("#ubwidget").data(key); |
||||
} |
||||
else { |
||||
log("Set parameter value ["+value+"] for key : ["+key+"]"); |
||||
this.delegate.setPreference(key, value); |
||||
this.container.trigger("preferenceChange", {key: key, value: value});
|
||||
} |
||||
} |
||||
} |
||||
}); |
||||
return self; |
||||
})(); |
||||
|
||||
var ParametersDelegate = (function(){ |
||||
var self = Object.create({}, { |
||||
preference: { |
||||
value: function(key) { |
||||
return this[key]; |
||||
} |
||||
}, |
||||
setPreference: { |
||||
value: function(key, value) { |
||||
this[key] = value; |
||||
} |
||||
} |
||||
}); |
||||
return self; |
||||
})(); |
||||
|
||||
var App = (function() { |
||||
var self = Object.create({}, { |
||||
container: { |
||||
value: null |
||||
}, |
||||
parameters: { |
||||
value: null |
||||
}, |
||||
init: { |
||||
value: function() { |
||||
var that = this; |
||||
this.container.bind("preferenceChange", function(evt, parameter) { |
||||
that.reload(parameter); |
||||
}); |
||||
this.reload(); |
||||
} |
||||
}, |
||||
reload: { |
||||
value: function(parameter) { |
||||
if(parameter === undefined) |
||||
log("Reload"); |
||||
else |
||||
log("Update"); |
||||
} |
||||
}, |
||||
utils: { |
||||
value: Object.create({}, { |
||||
shuffle: { |
||||
value: function(array) { |
||||
var unpickedSize = array.length; |
||||
while(unpickedSize > 0) { |
||||
var n = Math.floor(Math.random()*unpickedSize); |
||||
var temp = array[unpickedSize-1]; |
||||
array[unpickedSize-1] = array[n]; |
||||
array[n] = temp; |
||||
unpickedSize--; |
||||
} |
||||
} |
||||
}, |
||||
guid: { |
||||
value: function() { |
||||
var S4 = function() { |
||||
return (((1+Math.random())*0x10000)|0).toString(16).substring(1); |
||||
}; |
||||
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4()); |
||||
} |
||||
}, |
||||
droppable: { |
||||
value: function($e, callback) {
|
||||
$e.bind("dragover", function(){ |
||||
$(this).addClass("hover"); |
||||
return false; |
||||
}); |
||||
$e.bind("dragleave", function(){ |
||||
$(this).removeClass("hover"); |
||||
return false; |
||||
}); |
||||
$e.bind("drop", function(e){ |
||||
$(this).removeClass("hover"); |
||||
e = e || window.event; |
||||
e.preventDefault(); |
||||
// jQuery wraps the originalEvent, so we try to detect that here...
|
||||
e = e.originalEvent || e; |
||||
|
||||
if(window.sankore) { |
||||
function stringToXML(text){ |
||||
if (window.ActiveXObject){ |
||||
var doc=new ActiveXObject('Microsoft.XMLDOM'); |
||||
doc.async='false'; |
||||
doc.loadXML(text); |
||||
} else { |
||||
var parser=new DOMParser(); |
||||
doc=parser.parseFromString(text,'text/xml'); |
||||
} |
||||
return doc; |
||||
} |
||||
var file = stringToXML(e.dataTransfer.getData("text/plain")); |
||||
callback({ |
||||
src: $(file).find("path:eq(0)").text() |
||||
}); |
||||
return false; |
||||
} |
||||
|
||||
// Using e.files with fallback because e.dataTransfer is immutable and can't be overridden in Polyfills (http://sandbox.knarly.com/js/dropfiles/).
|
||||
var files = (e.files || e.dataTransfer.files); |
||||
for (var i = 0; i < files.length; i++) { |
||||
// Loop through our files with a closure so each of our FileReader's are isolated.
|
||||
(function (i) { |
||||
if(typeof FileReader !== "undefined") { |
||||
var reader = new FileReader(); |
||||
reader.onload = function (event) { |
||||
callback({ |
||||
src: event.target.result, |
||||
title: (files[i].name), |
||||
alt: (files[i].name) |
||||
}); |
||||
}; |
||||
reader.readAsDataURL(files[i]); |
||||
} |
||||
})(i); |
||||
} |
||||
return false; |
||||
}); |
||||
} |
||||
} |
||||
}) |
||||
} |
||||
}); |
||||
return self; |
||||
})(); |
@ -0,0 +1,321 @@ |
||||
function onTemplateLoadedCallback(app) { |
||||
$("#weights").append($(Mustache.render(weightTemplate, {weight: 500}))); |
||||
$("#weights").append($(Mustache.render(weightTemplate, {weight: 200}))); |
||||
$("#weights").append($(Mustache.render(weightTemplate, {weight: 100}))); |
||||
$("#weights").append($(Mustache.render(weightTemplate, {weight: 50}))); |
||||
$("#weights").append($(Mustache.render(weightTemplate, {weight: 20}))); |
||||
$("#weights").append($(Mustache.render(weightTemplate, {weight: 10}))); |
||||
|
||||
$("#weights > .weight").draggable({helper: "clone"});
|
||||
$("#rightScale").droppable({ |
||||
accept: ".weight", |
||||
drop: function(event, ui) { |
||||
if($(ui.draggable).hasClass("inScale")) |
||||
return; |
||||
var object = createWeight(app, $(ui.draggable).data("weight")); |
||||
|
||||
$("#rightScale").append(object); |
||||
|
||||
placeObject($("#rightScale"), object); |
||||
|
||||
refreshScales();
|
||||
}, |
||||
out: function(event, ui) { |
||||
$(ui.draggable).addClass("onOut"); |
||||
}, |
||||
over: function(event, ui) { |
||||
$(ui.draggable).removeClass("onOut"); |
||||
} |
||||
}); |
||||
|
||||
$("#objects button[role=add]").click(function(){ |
||||
var object = createObject(app); |
||||
$(this).before(object); |
||||
}); |
||||
} |
||||
|
||||
function addObjectWithId(app, id) { |
||||
var objects = app.parameters.value("Objects"); |
||||
app.parameters.value("Objects", objects === undefined ? id : objects+","+id); |
||||
} |
||||
|
||||
function removeObjectWithId(app, id) { |
||||
var objects = app.parameters.value("Objects"); |
||||
objects = objects.split(","); |
||||
for(var i=0 ; i<objects.length ; i++) { |
||||
if(id === objects[i]) { |
||||
objects.splice(i, 1); |
||||
break; |
||||
} |
||||
} |
||||
app.parameters.value("Objects", objects.join(","));
|
||||
} |
||||
|
||||
function addWeightWithId(app, id) { |
||||
var objects = app.parameters.value("Weights"); |
||||
app.parameters.value("Weights", objects === undefined ? id : objects+","+id); |
||||
} |
||||
|
||||
function removeWeightWithId(app, id) { |
||||
var objects = app.parameters.value("Weights"); |
||||
objects = objects.split(","); |
||||
for(var i=0 ; i<objects.length ; i++) { |
||||
if(id === objects[i]) { |
||||
objects.splice(i, 1); |
||||
break; |
||||
} |
||||
} |
||||
app.parameters.value("Weights", objects.join(","));
|
||||
} |
||||
|
||||
function objectForGUID(app, guid) { |
||||
window.object = guid; |
||||
var objectUi = $(Mustache.render(objectTemplate, window)); |
||||
var weight = getWeightFor(app.parameters, guid); |
||||
if(weight !== undefined) { |
||||
objectUi.data("weight", weight); |
||||
objectUi.find("input[name=weight]").val(weight); |
||||
} |
||||
if(app.onEdit) { |
||||
objectUi.find("input[name=weight]").change(function(event) { |
||||
var o = objectUi; |
||||
o.data("weight", $(this).val()); |
||||
setWeightFor(app.parameters, o.attr("id"), $(this).val()); |
||||
}); |
||||
objectUi.find("button[role=remove]").click(function(){ |
||||
removeObjectWithId(app, guid);
|
||||
objectUi.remove(); |
||||
}); |
||||
objectUi.find("button[role=duplicate]").click(function(){ |
||||
$("#objects button[role=add]").before(createObject(app, guid));
|
||||
}); |
||||
}else{ |
||||
objectUi.find("input[name=weight]").attr("disabled","disabled"); |
||||
objectUi.draggable({ |
||||
containment: "#scene", |
||||
scroll: false, |
||||
helper: "clone" |
||||
}); |
||||
} |
||||
return objectUi; |
||||
} |
||||
|
||||
function weightForGUID(app, guid) { |
||||
var weight = getWeightValueFor(app.parameters, guid); |
||||
window.object = guid; |
||||
window.weight = weight; |
||||
var objectUi = $(Mustache.render(weightTemplate, window)); |
||||
var position = getPositionFor(app.parameters, guid); |
||||
objectUi.css("left", position.left); |
||||
objectUi.css("top", position.top); |
||||
objectUi.addClass("inScale"); |
||||
if(app.onEdit) { |
||||
objectUi.draggable({ |
||||
stop: function(event, ui) { |
||||
if($(ui.helper).hasClass("onOut")) { |
||||
removeWeightWithId(app, $(ui.helper).attr('id')); |
||||
$(ui.helper).remove(); |
||||
refreshScales(); |
||||
}else{ |
||||
var id = ui.helper.attr("id"); |
||||
var left = ui.position.left ; |
||||
var top = ui.position.top; |
||||
log(left+"-"+top); |
||||
setPositionFor(app.parameters, id, ui.position); |
||||
} |
||||
} |
||||
}); |
||||
}else{ |
||||
} |
||||
return objectUi; |
||||
} |
||||
|
||||
function placeObject($container, $object) { |
||||
|
||||
var width = $object.outerHeight(); |
||||
var height = $object.outerHeight()+15; |
||||
|
||||
var count = $container.children().size() - 1; |
||||
|
||||
var left = width * (count % 4) + 25; |
||||
var bottom = height * (Math.floor(count / 4)) + 40; |
||||
|
||||
log("Place at ["+left+" , "+bottom+"]"); |
||||
$object.css("left", left+"px").css("bottom", bottom+"px"); |
||||
} |
||||
|
||||
function createObject(app, duplicateID) { |
||||
var id = app.utils.guid(); |
||||
addObjectWithId(app, id); |
||||
|
||||
//TODO Duplication : Recupérer les images du dupliqué
|
||||
|
||||
return objectForGUID(app, id); |
||||
} |
||||
|
||||
function createWeight(app, weight) { |
||||
var id = app.utils.guid(); |
||||
addWeightWithId(app, id);
|
||||
setWeightValueFor(app.parameters, id, weight); |
||||
return weightForGUID(app, id); |
||||
} |
||||
|
||||
function getWeightFor(parameters, id) { |
||||
return parameters.value("Object#"+id+"Weight"); |
||||
} |
||||
|
||||
function setWeightFor(parameters, id, weight) { |
||||
parameters.value("Object#"+id+"Weight", weight); |
||||
} |
||||
|
||||
function getWeightValueFor(parameters, id) { |
||||
return parameters.value("Weight#"+id+"Weight"); |
||||
} |
||||
|
||||
function setWeightValueFor(parameters, id, weight) { |
||||
parameters.value("Weight#"+id+"Weight", weight); |
||||
} |
||||
|
||||
function getPositionFor(parameters, id) { |
||||
var left = parameters.value("Weight#"+id+"left"); |
||||
var top = parameters.value("Weight#"+id+"top"); |
||||
return {left: parseInt(left), top: parseInt(top)}; |
||||
} |
||||
|
||||
function setPositionFor(parameters, id, position) { |
||||
parameters.value("Weight#"+id+"left", position.left); |
||||
parameters.value("Weight#"+id+"top", position.top); |
||||
} |
||||
|
||||
function reloadApp(app) { |
||||
$("#leftScale, #rightScale").empty(); |
||||
$("#objects > .object").remove(); |
||||
|
||||
refreshScales(); |
||||
|
||||
var objects = app.parameters.value("Objects"); |
||||
if(objects !== undefined) { |
||||
objects = objects.split(","); |
||||
for(var i=0 ; i<objects.length ; i++) { |
||||
var id = objects[i]; |
||||
var object = objectForGUID(app, id); |
||||
$("#objects button[role=add]").before(object); |
||||
} |
||||
} |
||||
|
||||
var weights = app.parameters.value("Weights"); |
||||
if(weights !== undefined) { |
||||
weights = weights.split(","); |
||||
for(var i=0 ; i<weights.length ; i++) { |
||||
var id = weights[i]; |
||||
var weight = weightForGUID(app, id); |
||||
$("#rightScale").append(weight); |
||||
placeObject($("#rightScale"), weight); |
||||
} |
||||
} |
||||
|
||||
refreshScales(); |
||||
|
||||
$("#leftScale").droppable({ |
||||
accept: ".object", |
||||
drop: function(event, ui) { |
||||
if($(ui.draggable).hasClass("inScale")) |
||||
return; |
||||
|
||||
var object = $(ui.draggable).clone(); |
||||
object.data("weight", $(ui.draggable).data("weight")); |
||||
|
||||
object.addClass("inScale"); |
||||
$("#leftScale").append(object); |
||||
|
||||
placeObject($("#leftScale"), object); |
||||
|
||||
refreshScales(); |
||||
|
||||
object.draggable({ |
||||
stop: function(event, ui) { |
||||
if($(ui.helper).hasClass("onOut")) { |
||||
$(ui.helper).remove(); |
||||
refreshScales(); |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
out: function(event, ui) { |
||||
$(ui.draggable).addClass("onOut"); |
||||
}, |
||||
over: function(event, ui) { |
||||
$(ui.draggable).removeClass("onOut"); |
||||
} |
||||
}); |
||||
|
||||
if(app.onEdit) { |
||||
|
||||
} |
||||
} |
||||
|
||||
function refreshScales() { |
||||
var leftWeight = getLeftWeight(); |
||||
var rightWeight = getRightWeight(); |
||||
var dWeight = rightWeight - leftWeight; |
||||
var angle = maxAngle * dWeight / maxWeight; |
||||
angle = angle >= 0 ? Math.min(maxAngle, angle) : Math.max(-maxAngle, angle); |
||||
var rad = angle * Math.PI / 180; |
||||
|
||||
var w = $("#tray").width()/2; |
||||
var dx = w - (w * Math.cos(rad)); |
||||
var dy = -(w * Math.sin(rad)); |
||||
|
||||
log("Rotate to "+angle); |
||||
log("Tanslate to ["+dx+" , "+dy+"]"); |
||||
|
||||
var rotate = "rotate("+angle+"deg)"; |
||||
var leftTranslate = "translate("+dx+"px, "+dy+"px)"; |
||||
var rightTranslate = "translate("+(-dx)+"px, "+(-dy)+"px)"; |
||||
|
||||
$("#tray").css("transform", rotate); |
||||
$("#leftScale").css("transform", leftTranslate); |
||||
$("#rightScale").css("transform", rightTranslate); |
||||
} |
||||
|
||||
function getWeightForSelector(selector) { |
||||
var weight = 0; |
||||
$(selector).each(function(){ |
||||
var temp = $(this).data("weight"); |
||||
if(temp !== undefined) |
||||
weight += parseInt(temp); |
||||
}); |
||||
return weight; |
||||
} |
||||
|
||||
function getLeftWeight() { |
||||
return getWeightForSelector("#leftScale > div"); |
||||
} |
||||
|
||||
function getRightWeight() { |
||||
return getWeightForSelector("#rightScale > div"); |
||||
} |
||||
|
||||
function reloadCallback(parameter) { |
||||
if(parameter === undefined) |
||||
reloadApp(this); |
||||
} |
||||
|
||||
var maxAngle; |
||||
var maxWeight; |
||||
|
||||
$(document).ready(function(){ |
||||
var w = $("#scales").width(); |
||||
var h = $("#scales").height(); |
||||
maxAngle = 17;//Math.atan((h/2)/(w/2)) * (180/Math.PI);
|
||||
maxWeight = 10; |
||||
|
||||
log(w+"-"+h+":"+maxAngle); |
||||
|
||||
var callbacks = { |
||||
onTemplatesLoaded: onTemplateLoadedCallback, |
||||
onEdit: reloadApp, |
||||
onView: reloadApp |
||||
}; |
||||
init(reloadCallback, {toolbar: toolbarTemplate, parameters: parametersTemplate}, callbacks); |
||||
}); |
@ -0,0 +1,30 @@ |
||||
var toolbarTemplate =
|
||||
'<h1 class="title">{{fr.njin.i18n.document.title}}</h1>'+ |
||||
'<div class="actions">'+ |
||||
'<button role="edit"><span>{{fr.njin.i18n.toolbar.edit}}</span></button>'+ |
||||
'<button role="view"><span>{{fr.njin.i18n.toolbar.view}}</span></button>'+ |
||||
'<button role="reload"><span>{{fr.njin.i18n.toolbar.reload}}</span></button>'+ |
||||
'<button role="help"><span>{{fr.njin.i18n.toolbar.help}}</span></button>'+ |
||||
'</div>'; |
||||
|
||||
var parametersTemplate =
|
||||
'<div class="inline">'+ |
||||
'<label>{{fr.njin.i18n.parameters.label.themes}}'+ |
||||
'<select name="themes" role="parameter">'+ |
||||
'<option value="pad">{{fr.njin.i18n.parameters.label.pad.themes}}</option>'+
|
||||
'<option value="slate">{{fr.njin.i18n.parameters.label.slate.themes}}</option>'+ |
||||
'<option value="none">{{fr.njin.i18n.parameters.label.none.themes}}</option>'+ |
||||
'</select>'+ |
||||
'</label>'+ |
||||
'</div>'; |
||||
|
||||
var objectTemplate =
|
||||
'<div id="{{object}}" class="object weight">'+ |
||||
'<div class="tools">'+ |
||||
'<button role="remove">{{fr.njin.i18n.balance.parameters.label.remove}}</button>'+ |
||||
'</div>'+ |
||||
'<div class="amount"><input type="text" name="weight">g</div><div class="bg"></div>'+ |
||||
'</div>'; |
||||
|
||||
var weightTemplate =
|
||||
'<div id="{{object}}" class="weight w{{weight}}" data-weight="{{weight}}"><div class="amount">{{weight}}g</div><div class="bg"></div></div>';
|
@ -0,0 +1,15 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<widget xmlns="http://www.w3.org/ns/widgets" |
||||
xmlns:ub="http://uniboard.mnemis.com/widgets" |
||||
id="http://www.njin.fr/sankore/apps/Cadran opératoire" |
||||
version="1.0" |
||||
width="630" |
||||
height="540" |
||||
ub:resizable="true"> |
||||
|
||||
<name>Cadran opératoire</name> |
||||
<author href="http://www.njin.fr" email="contact@njin.fr">njin</author> |
||||
<description></description> |
||||
|
||||
<content src="index.html"/> |
||||
</widget> |
After Width: | Height: | Size: 165 KiB |
@ -0,0 +1,33 @@ |
||||
<!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" xml:lang="en" lang="en"> |
||||
<head> |
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
||||
|
||||
<title>Font Face Demo</title> |
||||
<link rel="stylesheet" href="stylesheet.css" type="text/css" charset="utf-8"> |
||||
<style type="text/css" media="screen"> |
||||
h1.fontface {font: 60px/68px 'Lobster13Regular', Arial, sans-serif;letter-spacing: 0;} |
||||
|
||||
p.style1 {font: 18px/27px 'Lobster13Regular', Arial, sans-serif;} |
||||
|
||||
#container { |
||||
width: 800px; |
||||
margin-left: auto; |
||||
margin-right: auto; |
||||
} |
||||
</style> |
||||
</head> |
||||
|
||||
<body> |
||||
<div id="container"> |
||||
<h1 class="fontface">Font-face Demo for the Lobster Font</h1> |
||||
|
||||
|
||||
|
||||
<p class="style1">Lobster Regular - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> |
||||
|
||||
</div> |
||||
</body> |
||||
</html> |
@ -0,0 +1,16 @@ |
||||
/* Generated by Font Squirrel (http://www.fontsquirrel.com) on March 26, 2012 06:03:05 AM America/New_York */ |
||||
|
||||
|
||||
|
||||
@font-face { |
||||
font-family: 'Lobster13Regular'; |
||||
src: url('Lobster_1.3-webfont.eot'); |
||||
src: url('Lobster_1.3-webfont.eot?#iefix') format('embedded-opentype'), |
||||
url('Lobster_1.3-webfont.woff') format('woff'), |
||||
url('Lobster_1.3-webfont.ttf') format('truetype'), |
||||
url('Lobster_1.3-webfont.svg#Lobster13Regular') format('svg'); |
||||
font-weight: normal; |
||||
font-style: normal; |
||||
|
||||
} |
||||
|
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 101 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 96 KiB |