diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f973686 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +nbproject \ No newline at end of file diff --git a/.htaccess b/.htaccess deleted file mode 100644 index 6011244..0000000 --- a/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Header set Access-Control-Allow-Origin "*" \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..436c201 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +SHELL:=/bin/bash + +less-compilation: less-checking ./less/main.less + @ ./node_modules/.bin/lessc ./less/main.less ./public/css/main.min.css --clean-css="-s0" + @ echo "Fichier less/main.less compilé et minifié dans public/css/main.min.css" + +less-checking: ./node_modules/.bin/lessc ./node_modules/less-plugin-clean-css + @ echo "Verification des modules nodes lessc et less-plugin-clean-css" + +npm-install: + @ npm install + +install: ./package.json npm-install less-compilation \ No newline at end of file diff --git a/css/main.css b/css/main.css deleted file mode 100644 index 56b2c0b..0000000 --- a/css/main.css +++ /dev/null @@ -1,7 +0,0 @@ -.srent, .srentss{ - background-color: #fff; -} - -.srent img{ - vertical-align: middle; -} \ No newline at end of file diff --git a/include/.htaccess b/include/.htaccess new file mode 100644 index 0000000..6011244 --- /dev/null +++ b/include/.htaccess @@ -0,0 +1 @@ +Header set Access-Control-Allow-Origin "*" \ No newline at end of file diff --git a/less/main.less b/less/main.less new file mode 100644 index 0000000..f462aa2 --- /dev/null +++ b/less/main.less @@ -0,0 +1,20 @@ +@import "sandbox.less"; +@import "surenteteistex.less"; + +#istex-web-header{ + .srent, .srentss{ + background-color: #fff; + } + .srent{ + margin-top: 5px; + border:1px solid #eaeade; + padding:0; + img{ + vertical-align: middle; + } + } +} + +#dokuwiki__site{ + position: relative; +} \ No newline at end of file diff --git a/less/sandbox.less b/less/sandbox.less new file mode 100644 index 0000000..22fdc2d --- /dev/null +++ b/less/sandbox.less @@ -0,0 +1,47 @@ +.sandbox{ + + html, body, div, span, applet, object, iframe, + h1, h2, h3, h4, h5, h6, p, blockquote, pre, + a, abbr, acronym, address, big, cite, code, + del, dfn, em, img, ins, kbd, q, s, samp, + small, strike, strong, sub, sup, tt, var, + b, u, i, center, + dl, dt, dd, ol, ul, li, + fieldset, form, label, legend, + table, caption, tbody, tfoot, thead, tr, th, td, + article, aside, canvas, details, embed, + figure, figcaption, footer, header, hgroup, + menu, nav, output, ruby, section, summary, + time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; + } + article, aside, details, figcaption, figure, + footer, header, hgroup, menu, nav, section { + display: block; + } + body { + line-height: 1; + } + ol, ul { + list-style: none; + } + blockquote, q { + quotes: none; + } + blockquote:before, blockquote:after, + q:before, q:after { + content: ''; + content: none; + } + table { + border-collapse: collapse; + border-spacing: 0; + } + +} + diff --git a/less/surenteteistex.less b/less/surenteteistex.less new file mode 100644 index 0000000..7cc9b0e --- /dev/null +++ b/less/surenteteistex.less @@ -0,0 +1,23 @@ +#istex-web-header{ + #surentete{ margin:0 auto; padding:0; font-family:Arial, Helvetica, sans-serif; color:#333; height:40px; width:990px;position:relative;z-index:1000} + #barresrent{ border-bottom:1px solid #eaeade;} + .bsbb,.srent li{box-sizing:border-box;} + .clear{clear:both} + .logoistex{position:absolute;margin: 3px 0 0 0;} + .logoistex img,.logoanr img{float:left} + .srent{margin:0 50px 0 0; padding:10px 0 0 0; list-style-type:none; position:relative; background:transparent; float:right} + .srent img{padding:0 7px 0 20px;} + .srent li{float:left; position:relative; display:block;height:30px;line-height:30px;padding-right:10px} + .srent a:link{text-decoration:none;height:30px} + .srent a:active,.srent a:visited,.srent a:hover{text-decoration:underline;} + .srent a:link,.srent a:active, .srent a:visited, .srent a:hover{color:black; display:block;text-align:center; font-size:0.8em;} + .srent li li{background-color:transparent;border-right:1px solid #eaeade;border-bottom:1px solid #eaeade;border-left:1px solid #eaeade;padding-left:10px;color:#fff} + .srent li li, .srent li li a, .srent li li a:hover, .srent li li a:focus{display:block; width:100px;} + .srent li li a:link, .srent li li a:active, .srent li li a:visited, .srent li li a:hover, .srent li li a:focus{text-align:left; } + .srent li li a:hover, .srent li li a:focus{text-align:left; display:block; width:100px; height:30px;} + .srent ul{position:absolute; display:none; padding:0; list-style-type:none;} + .srent li ul a{float:left;} + .srent li:hover ul, .srent li:focus ul {display:block;} + .srent li li img{padding:0 5px 0 3px;} +} + diff --git a/main.js b/main.js index 94da16f..37077a6 100644 --- a/main.js +++ b/main.js @@ -11,33 +11,40 @@ } function init ($) { - var contentDeliveryUrl = "http://demo.istex.fr/web-header/" + var contentDeliveryUrl = "http://content-delivery.istex.fr/web-header/" ; - $.ajax({ - url: contentDeliveryUrl + "include/surenteteistex.html", - converters: {"text html": function (data) { - return data.replace(/(href|src)="(?!http)(.*?)"/img, "$1=\"" + contentDeliveryUrl + "include/$2\""); - }}, - success: function (data, textStatus) { - - $(jQuery.parseHTML(data)).prependTo($("body")) - .find("meta").remove().end() - .find("title").remove().end() - .find("[href*=XX]").click(preventDefaultEvent).end() - .find("[href*='" + window.location.hostname + "']").parent("li").remove().end().end() - ; - } - }); $.ajax({ - url: contentDeliveryUrl + "css/main.css", + url: contentDeliveryUrl + "public/css/main.min.css", success: function (data) { + $("head").append(""); + + $.ajax({ + url: contentDeliveryUrl + "include/surenteteistex.html", + converters: {"text html": function (data) { + return data.replace(/(href|src)="(?!http)(.*?)"/img, "$1=\"" + contentDeliveryUrl + "include/$2\""); + }}, + success: function (data) { + + $(jQuery.parseHTML(data)) + .filter("#surentete") + .prependTo($("body")) + .filter("#surentete").wrap("
") + .find("[href*=XX]").click(preventDefaultEvent).end() + .find("[href*='" + window.location.hostname + "']").parent("li").remove().end().end() + ; + + window.location.hostname === "www.istex.fr" && $("#surentete .logoistex").remove(); + } + + }); } }); + function preventDefaultEvent (e) { e.preventDefault(); } diff --git a/package.json b/package.json new file mode 100644 index 0000000..3254dcb --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "web-header", + "version": "1.0.0", + "description": "Bootstrap, template and assets to display Istex galaxy header.", + "main": "main.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "dependencies": { + "less": "^2.4.0", + "less-plugin-clean-css": "^1.5.0" + }, + "repository": { + "type": "git", + "url": "ssh://istexdepl@vsistex.intra.inist.fr:22222/istex/web-header.git" + }, + "keywords": [ + "Istex", + "header" + ], + "author": "Istex API", + "license": "ISC" +} diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 0000000..6011244 --- /dev/null +++ b/public/.htaccess @@ -0,0 +1 @@ +Header set Access-Control-Allow-Origin "*" \ No newline at end of file diff --git a/public/css/main.min.css b/public/css/main.min.css new file mode 100644 index 0000000..fd5c43b --- /dev/null +++ b/public/css/main.min.css @@ -0,0 +1 @@ +.sandbox a,.sandbox abbr,.sandbox acronym,.sandbox address,.sandbox applet,.sandbox article,.sandbox aside,.sandbox audio,.sandbox b,.sandbox big,.sandbox blockquote,.sandbox body,.sandbox canvas,.sandbox caption,.sandbox center,.sandbox cite,.sandbox code,.sandbox dd,.sandbox del,.sandbox details,.sandbox dfn,.sandbox div,.sandbox dl,.sandbox dt,.sandbox em,.sandbox embed,.sandbox fieldset,.sandbox figcaption,.sandbox figure,.sandbox footer,.sandbox form,.sandbox h1,.sandbox h2,.sandbox h3,.sandbox h4,.sandbox h5,.sandbox h6,.sandbox header,.sandbox hgroup,.sandbox html,.sandbox i,.sandbox iframe,.sandbox img,.sandbox ins,.sandbox kbd,.sandbox label,.sandbox legend,.sandbox li,.sandbox mark,.sandbox menu,.sandbox nav,.sandbox object,.sandbox ol,.sandbox output,.sandbox p,.sandbox pre,.sandbox q,.sandbox ruby,.sandbox s,.sandbox samp,.sandbox section,.sandbox small,.sandbox span,.sandbox strike,.sandbox strong,.sandbox sub,.sandbox summary,.sandbox sup,.sandbox table,.sandbox tbody,.sandbox td,.sandbox tfoot,.sandbox th,.sandbox thead,.sandbox time,.sandbox tr,.sandbox tt,.sandbox u,.sandbox ul,.sandbox var,.sandbox video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}.sandbox article,.sandbox aside,.sandbox details,.sandbox figcaption,.sandbox figure,.sandbox footer,.sandbox header,.sandbox hgroup,.sandbox menu,.sandbox nav,.sandbox section{display:block}.sandbox body{line-height:1}.sandbox ol,.sandbox ul{list-style:none}.sandbox blockquote,.sandbox q{quotes:none}.sandbox blockquote:after,.sandbox blockquote:before,.sandbox q:after,.sandbox q:before{content:'';content:none}.sandbox table{border-collapse:collapse;border-spacing:0}#istex-web-header #surentete{margin:0 auto;padding:0;font-family:Arial,Helvetica,sans-serif;color:#333;height:40px;width:990px;position:relative;z-index:1000}#istex-web-header #barresrent{border-bottom:1px solid #eaeade}#istex-web-header .bsbb,#istex-web-header .srent li{box-sizing:border-box}#istex-web-header .clear{clear:both}#istex-web-header .logoistex{position:absolute;margin:3px 0 0 0}#istex-web-header .logoanr img,#istex-web-header .logoistex img{float:left}#istex-web-header .srent{margin:0 50px 0 0;padding:10px 0 0 0;list-style-type:none;position:relative;background:0 0;float:right}#istex-web-header .srent img{padding:0 7px 0 20px}#istex-web-header .srent li{float:left;position:relative;display:block;height:30px;line-height:30px;padding-right:10px}#istex-web-header .srent a:link{text-decoration:none;height:30px}#istex-web-header .srent a:active,#istex-web-header .srent a:hover,#istex-web-header .srent a:visited{text-decoration:underline}#istex-web-header .srent a:active,#istex-web-header .srent a:hover,#istex-web-header .srent a:link,#istex-web-header .srent a:visited{color:#000;display:block;text-align:center;font-size:.8em}#istex-web-header .srent li li{background-color:transparent;border-right:1px solid #eaeade;border-bottom:1px solid #eaeade;border-left:1px solid #eaeade;padding-left:10px;color:#fff}#istex-web-header .srent li li,#istex-web-header .srent li li a,#istex-web-header .srent li li a:focus,#istex-web-header .srent li li a:hover{display:block;width:100px}#istex-web-header .srent li li a:active,#istex-web-header .srent li li a:focus,#istex-web-header .srent li li a:hover,#istex-web-header .srent li li a:link,#istex-web-header .srent li li a:visited{text-align:left}#istex-web-header .srent li li a:focus,#istex-web-header .srent li li a:hover{text-align:left;display:block;width:100px;height:30px}#istex-web-header .srent ul{position:absolute;display:none;padding:0;list-style-type:none}#istex-web-header .srent li ul a{float:left}#istex-web-header .srent li:focus ul,#istex-web-header .srent li:hover ul{display:block}#istex-web-header .srent li li img{padding:0 5px 0 3px}#istex-web-header .srent,#istex-web-header .srentss{background-color:#fff}#istex-web-header .srent{margin-top:5px;border:1px solid #eaeade;padding:0}#istex-web-header .srent img{vertical-align:middle}#dokuwiki__site{position:relative} \ No newline at end of file