-var _GET=parseGet();\r
+var _GET = parseGet();\r
\r
-function getWmode(){\r
- if(_GET['wmode']!=undefined){\r
+function getWmode() {\r
+ if (_GET['wmode'] != undefined) {\r
return _GET['wmode'];\r
}\r
- \r
- var ua=navigator.userAgent;\r
- if(ua.search(/mac/i)>-1 && ua.search(/opera/i)>-1){\r
+\r
+ var ua = navigator.userAgent;\r
+ if (ua.search(/mac/i) > -1 && ua.search(/opera/i) > -1) {\r
return 'normal';\r
- }else{\r
+ } else {\r
return 'direct';\r
}\r
}\r
\r
-function getLocation(){\r
+function getLocation() {\r
return window.location.toString();\r
}\r
-function getFlashvars(junk,fv){\r
- \r
- var res={};\r
- if(fv!=undefined){\r
- res=fv;\r
+function getFlashvars(junk, fv) {\r
+\r
+ var res = {};\r
+ if (fv != undefined) {\r
+ res = fv;\r
}\r
- \r
- res=parseGet(res);\r
\r
- res['junk']=junk;\r
+ res = parseGet(res);\r
+\r
+ res['junk'] = junk;\r
return res;\r
}\r
\r
-function parseGet(res){\r
- if(res==undefined){\r
- res={};\r
+function parseGet(res) {\r
+ if (res == undefined) {\r
+ res = {};\r
}\r
- var couples=window.location.search.substr(1).split('&');\r
- var couple=new Array();\r
- for (var i=0;i<couples.length;i++){\r
- couple=couples[i].split('=');\r
- res[couple[0]]=couple[1];\r
+ var couples = window.location.search.substr(1).split('&');\r
+ var couple = new Array();\r
+ for (var i = 0; i < couples.length; i++) {\r
+ couple = couples[i].split('=');\r
+ res[couple[0]] = couple[1];\r
}\r
return res;\r
}\r
\r
-function getLang(){\r
- if(_GET.lang==undefined || _GET.lang==null || _GET.lang==''){\r
+function getLang() {\r
+ if (_GET.lang == undefined || _GET.lang == null || _GET.lang == '') {\r
return FB_DEFAULT_LANG;\r
}\r
return _GET.lang;\r
}\r
\r
-function mailto(adresse){\r
- window.location='mailto:'+adresse;\r
+function mailto(adresse) {\r
+ window.location = 'mailto:' + adresse;\r
}\r
-function getBookmarks(id){\r
- return getCookie('fb_bookmarks_'+id);\r
+function getBookmarks(id) {\r
+ return getCookie('fb_bookmarks_' + id);\r
}\r
-function setBookmarks(data,id){\r
- date=new Date;\r
- date.setFullYear(date.getFullYear()+10);\r
- setCookie('fb_bookmarks_'+id, data,date,'/');\r
+function setBookmarks(data, id) {\r
+ date = new Date;\r
+ date.setFullYear(date.getFullYear() + 10);\r
+ setCookie('fb_bookmarks_' + id, data, date, '/');\r
}\r
\r
-function popupFS(page){\r
- if(page==undefined){\r
- page=0;\r
+function popupFS(page) {\r
+ if (page == undefined) {\r
+ page = 0;\r
}\r
- var date=new Date().getTime();\r
- window.open('index.html#/'+page, 'fbpopupfs_'+date, 'width='+screen.width+',height='+screen.height+',resizable=yes');\r
+ var date = new Date().getTime();\r
+ window.open('index.html#/' + page, 'fbpopupfs_' + date, 'width=' + screen.width + ',height=' + screen.height + ',resizable=yes');\r
}\r
\r
function getCookieVal(offset)\r
{\r
- var endstr=document.cookie.indexOf(";", offset);\r
- if (endstr==-1){\r
- endstr=document.cookie.length;\r
+ var endstr = document.cookie.indexOf(";", offset);\r
+ if (endstr == -1) {\r
+ endstr = document.cookie.length;\r
}\r
return unescape(document.cookie.substring(offset, endstr));\r
}\r
function getCookie(nom)\r
{\r
- var arg=nom+"=";\r
- var alen=arg.length;\r
- var clen=document.cookie.length;\r
- var i=0;\r
- while (i<clen){\r
- var j=i+alen;\r
- if (document.cookie.substring(i, j)==arg){\r
+ var arg = nom + "=";\r
+ var alen = arg.length;\r
+ var clen = document.cookie.length;\r
+ var i = 0;\r
+ while (i < clen) {\r
+ var j = i + alen;\r
+ if (document.cookie.substring(i, j) == arg) {\r
return getCookieVal(j);\r
}\r
- i=document.cookie.indexOf(" ",i)+1;\r
- if (i==0){\r
+ i = document.cookie.indexOf(" ", i) + 1;\r
+ if (i == 0) {\r
break;\r
}\r
}\r
}\r
function setCookie(nom, valeur)\r
{\r
- date=new Date;\r
- date.setFullYear(date.getFullYear()+10);\r
-\r
- var argv=setCookie.arguments;\r
- var argc=setCookie.arguments.length;\r
- var expires=(argc > 2) ? argv[2] : date;\r
- var path=(argc > 3) ? argv[3] : '/';\r
- var domain=(argc > 4) ? argv[4] : null;\r
- var secure=(argc > 5) ? argv[5] : false;\r
- document.cookie=nom+"="+escape(valeur)+\r
- ((expires==null) ? "" : ("; expires="+expires.toGMTString()))+\r
- ((path==null) ? "" : ("; path=/"))+\r
- ((domain==null) ? "" : ("; domain="+domain))+\r
- ((secure==true) ? "; secure" : "");\r
-}\r
-function addThis(x){\r
- addthis_offset_left=parseFloat(x);\r
+ date = new Date;\r
+ date.setFullYear(date.getFullYear() + 10);\r
+\r
+ var argv = setCookie.arguments;\r
+ var argc = setCookie.arguments.length;\r
+ var expires = (argc > 2) ? argv[2] : date;\r
+ var path = (argc > 3) ? argv[3] : '/';\r
+ var domain = (argc > 4) ? argv[4] : null;\r
+ var secure = (argc > 5) ? argv[5] : false;\r
+ document.cookie = nom + "=" + escape(valeur) +\r
+ ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +\r
+ ((path == null) ? "" : ("; path=/")) +\r
+ ((domain == null) ? "" : ("; domain=" + domain)) +\r
+ ((secure == true) ? "; secure" : "");\r
+}\r
+function addThis(x) {\r
+ addthis_offset_left = parseFloat(x);\r
addthis_open(document.getElementById('addThisBt'), '', '[URL]', '[TITLE]');\r
}\r
-function handleWheel(delta){\r
- try{\r
+function handleWheel(delta) {\r
+ try {\r
document.getElementById('fluidbook').mouseWheel(delta);\r
- }catch(e){\r
+ } catch (e) {\r
\r
}\r
}\r
\r
-function isMobile(){\r
- var devices = ['iphone', 'ipad', 'ipod', 'droid', 'blackberry', 'mobile','htc','samsung','nokia','archos','galaxy','motorola','pad','slate','symbian', 'phone', 'nintendo', 'playstation','touch','webos','ericsson','metro'];\r
+function isMobile() {\r
+ var devices = ['iphone', 'ipad', 'ipod', 'droid', 'blackberry', 'mobile', 'htc', 'samsung', 'nokia', 'archos', 'galaxy', 'motorola', 'pad', 'slate', 'symbian', 'phone', 'nintendo', 'playstation', 'touch', 'webos', 'ericsson', 'metro'];\r
return _isMobile(devices);\r
}\r
\r
-function isBadMobile(){\r
+function isBadMobile() {\r
var devices = ['kindle'];\r
return _isMobile(devices);\r
}\r
\r
-function _isMobile(devices){\r
- var ua=navigator.userAgent;\r
+function _isMobile(devices) {\r
+ var ua = navigator.userAgent;\r
var pattern;\r
\r
- for(i=0;i<devices.length;i++){\r
- pattern=new RegExp(devices[i],'i');\r
- if(ua.search(pattern)>-1){\r
+ for (i = 0; i < devices.length; i++) {\r
+ pattern = new RegExp(devices[i], 'i');\r
+ if (ua.search(pattern) > -1) {\r
return true;\r
}\r
}\r
return false;\r
}\r
\r
-function redirectPDF(){\r
- window.location='data/document.pdf';\r
+function redirectPDF() {\r
+ window.location = 'data/document.pdf';\r
}\r
\r
-function redirectMobile(){\r
- var get=parseGet();\r
- var page='index.html';\r
- if(get['widget']!=undefined && get['widget']=='1'){\r
- page='widget.html';\r
+function redirectMobile() {\r
+ var get = parseGet();\r
+ var html = 'index.html';\r
+ if (get['widget'] != undefined && get['widget'] == '1') {\r
+ html = 'widget.html';\r
+ }\r
+ var pageNr = 0;\r
+ if (get.page != undefined) {\r
+ pageNr = parseInt(get.page);\r
}\r
- window.location='m/'+page;\r
+ if (window.location.hash != '') {\r
+ var e = window.location.hash.split('/');\r
+ var pnr = parseInt(e[1]);\r
+ if (!isNaN(pnr)) {\r
+ pageNr = pnr;\r
+ }\r
+ }\r
+ \r
+ var page='';\r
+ if(pageNr>0){\r
+ page='#/page/'+pageNr;\r
+ }\r
+\r
+ window.location = 'm/' + html + page;\r
}\r
\r
\r
-function wheel(event){\r
+function wheel(event) {\r
var delta = 0;\r
if (!event) /* For IE. */\r
event = window.event;\r
if (event.wheelDelta) { /* IE/Opera. */\r
- delta = event.wheelDelta/120;\r
+ delta = event.wheelDelta / 120;\r
/** In Opera 9, delta differs in sign as compared to IE.\r
*/\r
if (window.opera)\r
/** In Mozilla, sign of delta is different than in IE.\r
* Also, delta is multiple of 3.\r
*/\r
- delta = -event.detail/3;\r
+ delta = -event.detail / 3;\r
}\r
/** If delta is nonzero, handle it.\r
* Basically, delta is now positive if wheel was scrolled up,\r
* and negative, if wheel was scrolled down.\r
*/\r
- if (delta){\r
+ if (delta) {\r
handleWheel(delta);\r
}\r
/** Prevent default actions caused by mouse wheel.\r
* That might be ugly, but we handle scrolls somehow\r
* anyway, so don't bother here..\r
*/\r
- if (event.preventDefault){\r
+ if (event.preventDefault) {\r
event.preventDefault();\r
}\r
event.returnValue = false;\r
}\r
\r
-function ready(){\r
- document.body.style.backgroundColor='#'+getBackgroundColor();\r
+function ready() {\r
+ document.body.style.backgroundColor = '#' + getBackgroundColor();\r
}\r
\r
-function getBackgroundColor(){\r
- if(_GET['background']!=undefined){\r
+function getBackgroundColor() {\r
+ if (_GET['background'] != undefined) {\r
return _GET['background'];\r
- }else{\r
+ } else {\r
return backgroundColor;\r
}\r
}\r
/** Initialization code.\r
* If you use your own event management code, change it as required.\r
*/\r
-if (window.addEventListener){\r
+if (window.addEventListener) {\r
/** DOMMouseScroll is for mozilla. */\r
window.addEventListener('DOMMouseScroll', wheel, false);\r
}\r
/** IE/Opera. */\r
window.onmousewheel = document.onmousewheel = wheel;\r
\r
-window.onkeydown=key;\r
-window.onkeypress=key;\r
-window.onkeydown=key;\r
+window.onkeydown = key;\r
+window.onkeypress = key;\r
+window.onkeydown = key;\r
\r
-function key(e){\r
- if(e.ctrlKey && (e.keyCode==80 || e.keyCode==112)){\r
+function key(e) {\r
+ if (e.ctrlKey && (e.keyCode == 80 || e.keyCode == 112)) {\r
return false;\r
}\r
- \r
+\r
return true;\r
}
\ No newline at end of file
$res.='<table class="liste">';
$res.='<tr><th><strong>' . __('Générer un kit webfont') . '</strong></th></tr>';
$res.='<tr><td>' . __('Veuillez charger une police de caractères') . '</td></tr>';
- $res.='<tr class="odd"><td><input type="file" name="file" /></td></tr>';
+ $res.='<tr class="odd"><td><input type="file" name="file[]" multiple="multiple" /></td></tr>';
+ $res.='<tr><td><label><input type="checkbox" value="1" name="rename" /> Renommer les polices</label></td></tr>';
$res.='<tr><td class="right"><a href="#" class="submit">' . $core->typo->BoutonOK(__('Générer le kit webfont')) . '</a></td></td>';
$res.='</table>';
$res.='</form>';
mkdir($tmp, 0777, true);
}
- $ex = explode('.', strtolower($_FILES['file']['name']));
- $upext = array_pop($ex);
- $fontName = implode('.', $ex);
-
- $fontFile = $tmp . '/' . strtolower($_FILES['file']['name']);
- move_uploaded_file($_FILES['file']['tmp_name'], $fontFile);
-
- $ext = array('ttf', 'woff', 'eot');
-
- foreach ($ext as $e) {
- $out = $tmp . '/' . $fontName . '.' . $e;
- if ($e != 'eot') {
- $fontforge = new cubeCommandLine('convertrn.pe');
- $fontforge->setPath(CONVERTER_PATH);
- $fontforge->setArg(null, $fontFile);
- $fontforge->setArg(null, $out);
- $fontforge->setArg(null, $fontName);
- $fontforge->execute();
- fb($fontforge->commande);
- fb($fontforge->output);
- } else {
- $ttf = $tmp . '/' . $fontName . '.ttf';
- `/usr/local/bin/ttf2eot < $ttf > $out`;
+ $rename = isset($_POST['rename']);
+
+
+
+ foreach ($_FILES['file']['name'] as $k => $name) {
+ $tmp_name = $_FILES['file']['tmp_name'][$k];
+
+ $ex = explode('.', strtolower($name));
+ $upext = array_pop($ex);
+ $fontName = implode('.', $ex);
+
+ $fontFile = $tmp . '/' . strtolower($name);
+ move_uploaded_file($tmp_name, $fontFile);
+
+ $ext = array('ttf', 'woff', 'eot');
+
+ foreach ($ext as $e) {
+ $out = $tmp . '/' . $fontName . '.' . $e;
+ if ($e != 'eot') {
+
+ $fontforge = new cubeCommandLine('convertrn.pe');
+ $fontforge->setPath(CONVERTER_PATH);
+ $fontforge->setArg(null, $fontFile);
+ $fontforge->setArg(null, $out);
+ if ($rename) {
+ $fontforge->setArg(null, $fontName);
+ }
+ $fontforge->execute();
+
+ fb($fontforge->commande);
+ fb($fontforge->output);
+ } else {
+ $ttf = $tmp . '/' . $fontName . '.ttf';
+ `/usr/local/bin/ttf2eot < $ttf > $out`;
+ }
}
- }
- $css = "@font-face {
+ $css = "@font-face {
font-family: '$fontName';
src: url('$fontName.eot');
src: url('$fontName.eot?#iefix') format('embedded-opentype'),
font-style: normal;
}";
- file_put_contents($tmp . '/' . $fontName . '.css', $css);
+ file_put_contents($tmp . '/' . $fontName . '.css', $css);
+ }
$tmpfile = cubeFiles::tempnam() . '.zip';