From d231658b6071ee0190cf0e38ebf15bdb3ff08ab8 Mon Sep 17 00:00:00 2001 From: franzz Date: Sat, 15 Aug 2015 15:23:24 +0200 Subject: [PATCH] interface upgrade --- images/logo_ugc.png | Bin 0 -> 2477 bytes inc/functions.php | 81 +++++++++++++++++++++++++++++++++- index.php | 8 +++- masks/index.html | 10 +++-- script/film.js | 35 ++++++++++----- style/style.css | 103 ++++++++++++++++++++++++++++++++++---------- 6 files changed, 197 insertions(+), 40 deletions(-) create mode 100755 images/logo_ugc.png diff --git a/images/logo_ugc.png b/images/logo_ugc.png new file mode 100755 index 0000000000000000000000000000000000000000..2eda1ae861a579f66d6536bc457d0b2d672ffd6d GIT binary patch literal 2477 zcmV;e2~zfnP)6$U%)TF=S>#>J(Qghjg`P`f4GU}l>sV4djuLVk( zn&|JR>kjS8v8Rlw?*007JunUPjX6ub22rV*-RXM8R|VzkQ>^!~BC)mq7H9vj*_Y^Z;4vZ^6~-TY=~yP_O7l zKMdem(T4pze@hT4_E{lkU874qfM=$dN#hJPS*svYyz`8|kMT+eY@Fyx2t;cjE>QYH zR0%g=SK1j!A3qXJ+6eZ^B@Q7=k0lL^K{Y$|GZlBaXZI7b!fe$_yAN4eNzrEx6uF-`2;A1qcPWLr?wL8%Fzof`0-Kt;Uv{f zYXRUM$LnGyDd>YFQW2DM@twnh25{a3ni$k*C~R(wDi9pU1C3+VG>CCmLEH)(a%T}Z zhZr|b4fZEtPD;Yms8rb|ni-rH-iTah@22ZJL*Qag3vV!FogYbUs= zyUfS&Ld$Vx$du!nBs3I^(n%1dXSgu{c*x13#04r(O3XE?Qc)!bLBVie~{}ilFCxj)L%sSk%yI^;YSErZ){N0+IT|aL|p~( z9)Xy{dD%rLv7uu)kfPUFCX*!X^b)fE(7aeQ#{cnavWZhM-_F`ZTI{8RT1jh+=kg?A zCM4j&aXxhr_n@Ep671V@<)Z-52e+hkYLHH;4wr8*-%!}vy)B4qaC}0iMGsawC-VK3 z!}rAo5dDTEtE?36In!PlY(U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}#7{y0=yn46&(ISv zbW*klZuL(Zzf0!{cLGGY$P-J|)ilZT?3+5)pcme$3&l)zdT@T0y${VK)TM;SIa2;E rsI7yc2~4kqv~qBoXg%yb{Ug8tT?eoL{gRG|00000NkvXXu0mjf_WhnJ literal 0 HcmV?d00001 diff --git a/inc/functions.php b/inc/functions.php index f9806d5..28e6160 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -25,7 +25,86 @@ function getPage($sPath, $asVars, $bSavePage=false) function setPageMime($sType='html') { - if($sType!='html') header('Content-type: application/'.$sType); + $asMainTypes = array('json'=>'application', 'jpeg'=>'image', 'png'=>'image', 'gif'=>'image'); + if($sType!='html' && array_key_exists($sType, $asMainTypes)) header('Content-type: '.$asMainTypes[$sType].'/'.$sType); +} + +function getTrimImage($iFilmId, $sinPath, $sImageExt) +{ + $sOutPath = 'images/'.$iFilmId.'.'.$sImageExt; + if(!file_exists($sOutPath)) + { + $oImage = call_user_func('imagecreatefrom'.$sImageExt, $sinPath); + $iImageX = imagesx($oImage); + $iImageY = imagesy($oImage); + $iTop = 0; + $iBottom = 0; + $iLeft = 0; + $iRight = 0; + $iWhiteLimit = 220; + + //Top height to crop: + for(; $iTop < $iImageY; ++$iTop) + { + for($x = 0; $x < $iImageX; ++$x) + { + $hColor = imagecolorat($oImage, $x, $iTop); + $iRed = ($hColor >> 16) & 0xFF; + $iGreen = ($hColor >> 8) & 0xFF; + $iBlue = $hColor & 0xFF; + if($iRed<$iWhiteLimit || $iGreen<$iWhiteLimit || $iBlue<$iWhiteLimit) break 2; //out of the 'top' loop + } + } + + //Bottom height to crop + for(; $iBottom < $iImageY; ++$iBottom) + { + for($x = 0; $x < $iImageX; ++$x) + { + $hColor = imagecolorat($oImage, $x, $iImageY - $iBottom - 1); + $iRed = ($hColor >> 16) & 0xFF; + $iGreen = ($hColor >> 8) & 0xFF; + $iBlue = $hColor & 0xFF; + if($iRed<$iWhiteLimit || $iGreen<$iWhiteLimit || $iBlue<$iWhiteLimit) break 2; //out of the 'bottom' loop + } + } + + //Left width to crop + for(; $iLeft < $iImageX; ++$iLeft) + { + for($y = 0; $y < $iImageY; ++$y) + { + $hColor = imagecolorat($oImage, $iLeft, $y); + $iRed = ($hColor >> 16) & 0xFF; + $iGreen = ($hColor >> 8) & 0xFF; + $iBlue = $hColor & 0xFF; + if($iRed<$iWhiteLimit || $iGreen<$iWhiteLimit || $iBlue<$iWhiteLimit) break 2; //out of the 'left' loop + } + } + + //Right width to crop + for(; $iRight < $iImageX; ++$iRight) + { + for($y = 0; $y < $iImageY; ++$y) + { + $hColor = imagecolorat($oImage, $iImageX - $iRight-1, $y); + $iRed = ($hColor >> 16) & 0xFF; + $iGreen = ($hColor >> 8) & 0xFF; + $iBlue = $hColor & 0xFF; + if($iRed<$iWhiteLimit || $iGreen<$iWhiteLimit || $iBlue<$iWhiteLimit) break 2; //out of the 'right' loop + } + } + + //Creating a image with the new height + $oCropImage = imagecreatetruecolor($iImageX-($iLeft+$iRight), $iImageY-($iTop+$iBottom)); + + //Copy the content, excluding the border + imagecopy($oCropImage, $oImage, 0, 0, $iLeft, $iTop, imagesx($oCropImage), imagesy($oCropImage)); + + call_user_func_array('image'.$sImageExt, array($oCropImage, $sOutPath)); + } + + return file_get_contents($sOutPath); } ?> \ No newline at end of file diff --git a/index.php b/index.php index c283a92..72f3ff1 100755 --- a/index.php +++ b/index.php @@ -1,5 +1,8 @@ - @@ -15,7 +14,7 @@ -
+
-
+
+

Filtered films

+
+
Designed & powered by Franzz, licensed under GPLv3.
\ No newline at end of file diff --git a/script/film.js b/script/film.js index 5cfc38e..fb0b2bc 100755 --- a/script/film.js +++ b/script/film.js @@ -1,7 +1,7 @@ function Film() { var self = this; - this.consts = {'ugc_url':'http://www.ugc.fr/'}; + this.consts = {'ugc_url':'http://www.ugc.fr/', 'process_url':'index.php'}; this._attr = {}; this._anchor = {}; this._ban = {status:false, reason:''}; @@ -36,6 +36,12 @@ function Film() this.poster = function(sPoster) { + if(sPoster) //Set + { + var sExt = sPoster.substr(sPoster.lastIndexOf('.')+1).toLowerCase(); + if(sExt=='jpg') sExt = 'jpeg'; + var sPoster = this.consts.process_url+'?a=get_poster&type='+sExt+'&data[id]='+this.id()+'&data[url]='+encodeURIComponent(sPoster); + } return this.attr('poster', sPoster); }; @@ -68,16 +74,17 @@ function Film() { //Init page this.onPageReady(); - + //Add film to DOM this._anchor = $('
', {'class':'film', 'id':'film_'+this.id()}) + //.append($('', {'class':'bg', 'src':this.poster()})) .append($('', {'class':'poster', 'src':this.poster()})) .append($('
', {'class':'info'}) .append($('

', {'class':'title'}) .append($('', {'class':'name', 'target':'_blank', 'href':this.consts.ugc_url+'film.html?id='+this.id()}) .append($('', {'class':'fa fa-fw fa-icon fa-film'})) .append(this.name())) - .append($('', {'class':'edito'}).text(this.edito()?' ['+this.edito()+']':''))) + .append($('', {'class':'edito'+(this.edito()?' fa fa-edito':'')}).text(this.edito()?' '+this.edito():''))) .append($('

', {'class':'trailer'}) .append($('', {'target':'_blank', 'href':this.trailer()}) .append($('', {'class':'fa fa-fw fa-icon fa-trailer'})) @@ -108,20 +115,24 @@ function Film() this.renderTimetable = function(iCinemaId, asLang) { + var sCinema = asCinemas[iCinemaId]; $.each(asLang, function(iKey, sLang) { - if(sLang=='VF' && ('VOSTF' in self.timetable(iCinemaId))) self.error('Hiding VF version of "'+self.name()+'" (VOSTF available)'); + if(sLang=='VF' && ('VOSTF' in self.timetable(iCinemaId))) self.error('Hiding VF version of "'+self.name()+'" @'+sCinema+' (VOSTF available)'); + else if(sLang=='VFSTF') self.error('Hiding hearing-impaired version ('+sLang+') of "'+self.name()+'" @'+sCinema) else { var $Timetable = $('

') .append($('', {'class':'cinema', 'target':'_blank', 'href':self.consts.ugc_url+'cinemaAction!execute.action?page=7&id='+iCinemaId}) - .append($('', {'class':'fa fa-fw fa-icon fa-cinema'})) - .append(asCinemas[iCinemaId]+' '+sLang)) - .append(' : ') + .append($('', {'class':'fa fa-fw fa-icon fa-cinema'})) + .append($('', {'class':'cinema_name'}).text(sCinema))) + .append($('', {'class':'lang'}).text(sLang)) .appendTo(self.anchor().find('.timetable')); $.each(self.timetable(iCinemaId, sLang).sort(self.timeCompare), function(iKey, oTime){ - $Timetable.append($('', {'class':'time', 'href':oTime.booking, 'target':'_blank'}).text(oTime.time+' ')); + $Timetable + .append($('', {'class':'time', 'href':oTime.booking, 'target':'_blank'}).text(oTime.time)) + .append(' '); //for line break }); } }); @@ -134,7 +145,8 @@ function Film() this.error = function(sMsg) { - $('#feedback').show().append($('

').text(sMsg)); + $('#feedback').show(); + $('#feed_content').append($('

').text(sMsg)); }; } @@ -271,12 +283,13 @@ function Affiche(oDate) this.error = function(sMsg) { - $('#feedback').show().append($('

').text(sMsg)); + $('#feedback').show(); + $('#feed_content').append($('

').text(sMsg)); }; } function getUgcPage(sPath, asData, fOnSuccess, sType) { var asParams = {'a':'get_page', 'type':sType, 'data':{'path':sPath, 'vars':asData}}; - $.get('index.php', asParams, fOnSuccess, sType); + $.get((new Film()).consts.process_url, asParams, fOnSuccess, sType); } \ No newline at end of file diff --git a/style/style.css b/style/style.css index c0ec5d5..f849be2 100755 --- a/style/style.css +++ b/style/style.css @@ -7,28 +7,22 @@ body { padding:1em; font-family: 'Open Sans', sans-serif; font-size: 1em; -} - -header { - margin:1em 0; - font-size: 2em; -} - -footer { - clear:both; - font-size: 0.8em; - margin: 1em 0px; - display: none; + color:#333; + background:#DDD; } a { text-decoration: none; - color:black; + color:#333; } a:hover { color:#08288B; } +h1 { + margin:0 0 1em 0; +} + /* Common Classes */ .fa-icon { @@ -47,7 +41,7 @@ a:hover { content: "\f110"; } .fa-cinema:before { - content: "\f145"; + content: "\f017"; } .fa-date:before { content: "\f133"; @@ -55,11 +49,31 @@ a:hover { .fa-power:before { content: "\f1b0"; } +.fa-edito:before { + content: "\f0e7"; +} +.fa-feedback:before { + content: "\f0b0"; +} /* Sections */ +/* Section - Header */ + +header { + padding:1em 0 1em calc(113px + 0.5em); + background:url(../images/logo_ugc.png) 0 50% no-repeat; + margin:0 0 0 0.5em; + font-size: 2em; + color:#08288B; +} + /* Section - Main */ +main { + margin-top:1em; +} + #buffer { font-size:2em; } @@ -67,19 +81,27 @@ a:hover { /* Section - Film */ .film { - clear:both; + position:relative; background:white; - float:left; margin-bottom:1em; - width:100%; } .film:nth-child(even) { } +.film .bg { + position:absolute; + width:1000%; + opacity:0.3; + z-index: -1; + display:none; +} + .film .info { - margin-left:152px; + position:absolute; + top:0; + left:152px; padding-left:1em; width: calc(100% - 1em - 152px); } @@ -94,11 +116,13 @@ a:hover { .film .title .edito { font-style: italic; + margin-left:1em; + color:#999; } .film img.poster { - vertical-align: middle; - float:left; + width:152px; + display: block; } .film .trailer { @@ -110,8 +134,33 @@ a:hover { font-size: 0.8em; } +.film .timetable p { + line-height: 2.0; + margin: 0; +} + +.film .timetable .cinema { + margin-right:0.5em; +} + +.film .timetable .cinema .fa { + font-size: 1.25em; + line-height: 0.7656249414em; + vertical-align: -14.06250352%; +} + +.film .timetable .lang { + margin-right:0.5em; +} + .film .timetable .time { - + background:#666; + color:white; + padding:0.1em 0.4em; + border-radius:3px; +} +.film .timetable .time:hover { + background:#08288B; } /* Section - Feeback */ @@ -119,11 +168,10 @@ a:hover { #feedback { background:#EEE; padding:1em; - float:left; - clear:both; font-size:0.6em; margin-bottom: 1em; display:none; + color:#999; } #feedback p:FIRST-CHILD { @@ -131,4 +179,13 @@ a:hover { } #feedback p:LAST-CHILD { margin-bottom:0; +} + +/* Section - Footer */ + +footer { + font-size: 0.8em; + margin: 1em 0px; + display: none; + color:#08288B; } \ No newline at end of file