From f9251c68f988e874021e054d3eb9f99d5f388a1a Mon Sep 17 00:00:00 2001 From: alexandre-pereira Date: Mon, 16 Mar 2015 14:07:32 +0100 Subject: [PATCH] Co co mit --- .env | 11 ++ SRC/app/Http/Controllers/APIController.php | 2 +- SRC/app/Http/Controllers/GameController.php | 12 ++- SRC/public/css/memory.css | 100 +----------------- SRC/public/js/imagesloaded.pkgd.min.js | 7 ++ SRC/public/js/memory.js | 16 +-- .../views/backend/ref_home.blade.php | 15 ++- .../views/backend/ref_listeoeuvres.blade.php | 4 +- SRC/resources/views/frontend/memo.blade.php | 12 +-- .../views/frontend/memo_level.blade.php | 18 +--- 10 files changed, 51 insertions(+), 146 deletions(-) create mode 100644 .env create mode 100644 SRC/public/js/imagesloaded.pkgd.min.js diff --git a/.env b/.env new file mode 100644 index 0000000..70523de --- /dev/null +++ b/.env @@ -0,0 +1,11 @@ +APP_ENV=local +APP_DEBUG=true +APP_KEY=Z8ORdoQRFFogOAPl8ZmkSWAtNLKW4eku + +DB_HOST=localhost +DB_DATABASE=moduleweb +DB_USERNAME=root +DB_PASSWORD= + +CACHE_DRIVER=file +SESSION_DRIVER=file diff --git a/SRC/app/Http/Controllers/APIController.php b/SRC/app/Http/Controllers/APIController.php index 6554527..6e9b1b3 100644 --- a/SRC/app/Http/Controllers/APIController.php +++ b/SRC/app/Http/Controllers/APIController.php @@ -64,7 +64,7 @@ class APIController extends Controller { ->designationFilter($designations) ->domaineFilter($domaines) ->matiereFilter($matieres) - ->simplePaginate(10); + ->paginate(10); return view('backend/ref_listeoeuvres',['oeuvres' => $listeoeuvres]); diff --git a/SRC/app/Http/Controllers/GameController.php b/SRC/app/Http/Controllers/GameController.php index 7f6b7eb..ce9bea7 100755 --- a/SRC/app/Http/Controllers/GameController.php +++ b/SRC/app/Http/Controllers/GameController.php @@ -26,11 +26,15 @@ class GameController extends Controller { return view('frontend/memo_level'); } - public function playMemo() { + public function playMemo($niveau) { $idRef = Cookie::get('referent'); - $configjeu = Referent::find($idRef)->configjeu()->where('actifPuzzle', '=', '1')->first(); - $oes = $configjeu->oeuvres; - return view('frontend/memo', ['oeuvres' => $oes]); + $configjeu = Referent::find($idRef)->configjeu()->where('actifMemo', '=', '1')->first(); + if($configjeu && count($configjeu->oeuvres) >= 1) { + $oes = $configjeu->oeuvres; + } else { + $oes = Oeuvre::orderByRaw("RAND()")->take(5)->get(); + } + return view('frontend/memo', ['oeuvres' => $oes, 'niveau' => $niveau]); } public function chooseDifPuzzle() { diff --git a/SRC/public/css/memory.css b/SRC/public/css/memory.css index 8943c43..cbf5151 100644 --- a/SRC/public/css/memory.css +++ b/SRC/public/css/memory.css @@ -1,95 +1,3 @@ -/* ============================================================================= - RESET, BOX SIZING, & CLEARFIX -============================================================================= */ -/*#jeu{ - - height: 100%; - width: 100%; - margin: 0; - padding: 0; - - - background-image:url("../pictures/setting_picture/fond.jpg"); - background-attachment:fixed; - background-repeat:no-repeat; - background-position:100% 100%; - background-size:cover; - -}*/ - -body -{ - background-image:url("../pictures/setting_picture/fond.jpg"); - background-attachment:fixed; - background-repeat:no-repeat; - background-position:100% 100%; - background-size:cover; -} - - -*, -*::before, -*::after { - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -.clearfix:after { - content: ""; - display: table; - clear: both; -} - -/* ============================================================================= - BASE -============================================================================= */ - -img { - display: block; - max-width: 100%; - height: auto; -} - -/* ============================================================================= - LAYOUT -============================================================================= */ -/* wrapper */ -.wrapper { - margin: 0 auto; - width: 100%; - /*min-width: 432px;*/ -} - -/* container */ -/* -.container { - padding-top: 50px;*/ -/* margin: 0 auto; - width: 96%; - max-width: 1128px;*/ - -} - -/* ============================================================================= - MEMORY GAME (mg) -============================================================================= */ -/** - * Game container - * - * This is the overall container for the game. Different things get addead and - * removed from this container depending on the game state. - */ -.mg { - /* blank */ -} - -/** - * Game meta - * - * The game meta is the section that displays the level and moves. It's appended - * to the game container at the start, and shows the level the user selected - * and the number of moves the user has played. - */ .mg__meta { margin-bottom: 10px; color: #28aadc; @@ -173,12 +81,7 @@ img { text-align: center; } -.mg__contents { - position: relative; - padding-bottom: 50%; - margin-left: 0%; - margin-right: 0%; -} + /** * Game tiles @@ -482,7 +385,6 @@ img { } .mg__tile--outside { - background: url("/pictures/default/logo-bw.png") 50% 50% no-repeat; background-color: #dcdee1; box-shadow: 0 0 0 1px #787a80; } diff --git a/SRC/public/js/imagesloaded.pkgd.min.js b/SRC/public/js/imagesloaded.pkgd.min.js new file mode 100644 index 0000000..d66f658 --- /dev/null +++ b/SRC/public/js/imagesloaded.pkgd.min.js @@ -0,0 +1,7 @@ +/*! + * imagesLoaded PACKAGED v3.1.8 + * JavaScript is all like "You images are done yet or what?" + * MIT License + */ + +(function(){function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,r=this,o=r.EventEmitter;i.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return r.EventEmitter=o,e},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){function t(t){var n=e.event;return n.target=n.target||n.srcElement||t,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(e,t,n){e.addEventListener(t,n,!1)}:n.attachEvent&&(i=function(e,n,i){e[n+i]=i.handleEvent?function(){var n=t(e);i.handleEvent.call(i,n)}:function(){var n=t(e);i.call(e,n)},e.attachEvent("on"+n,e[n+i])});var r=function(){};n.removeEventListener?r=function(e,t,n){e.removeEventListener(t,n,!1)}:n.detachEvent&&(r=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):e.eventie=o}(this),function(e,t){"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],function(n,i){return t(e,n,i)}):"object"==typeof exports?module.exports=t(e,require("wolfy87-eventemitter"),require("eventie")):e.imagesLoaded=t(e,e.EventEmitter,e.eventie)}(window,function(e,t,n){function i(e,t){for(var n in t)e[n]=t[n];return e}function r(e){return"[object Array]"===d.call(e)}function o(e){var t=[];if(r(e))t=e;else if("number"==typeof e.length)for(var n=0,i=e.length;i>n;n++)t.push(e[n]);else t.push(e);return t}function s(e,t,n){if(!(this instanceof s))return new s(e,t);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=o(e),this.options=i({},this.options),"function"==typeof t?n=t:i(this.options,t),n&&this.on("always",n),this.getImages(),a&&(this.jqDeferred=new a.Deferred);var r=this;setTimeout(function(){r.check()})}function f(e){this.img=e}function c(e){this.src=e,v[e]=this}var a=e.jQuery,u=e.console,h=u!==void 0,d=Object.prototype.toString;s.prototype=new t,s.prototype.options={},s.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);var i=n.nodeType;if(i&&(1===i||9===i||11===i))for(var r=n.querySelectorAll("img"),o=0,s=r.length;s>o;o++){var f=r[o];this.addImage(f)}}},s.prototype.addImage=function(e){var t=new f(e);this.images.push(t)},s.prototype.check=function(){function e(e,r){return t.options.debug&&h&&u.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},s.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify&&t.jqDeferred.notify(t,e)})},s.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},a&&(a.fn.imagesLoaded=function(e,t){var n=new s(this,e,t);return n.jqDeferred.promise(a(this))}),f.prototype=new t,f.prototype.check=function(){var e=v[this.img.src]||new c(this.img.src);if(e.isConfirmed)return this.confirm(e.isLoaded,"cached was confirmed"),void 0;if(this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this;e.on("confirm",function(e,n){return t.confirm(e.isLoaded,n),!0}),e.check()},f.prototype.confirm=function(e,t){this.isLoaded=e,this.emit("confirm",this,t)};var v={};return c.prototype=new t,c.prototype.check=function(){if(!this.isChecked){var e=new Image;n.bind(e,"load",this),n.bind(e,"error",this),e.src=this.src,this.isChecked=!0}},c.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},c.prototype.onload=function(e){this.confirm(!0,"onload"),this.unbindProxyEvents(e)},c.prototype.onerror=function(e){this.confirm(!1,"onerror"),this.unbindProxyEvents(e)},c.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},c.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},s}); \ No newline at end of file diff --git a/SRC/public/js/memory.js b/SRC/public/js/memory.js index be0fd14..6895eae 100644 --- a/SRC/public/js/memory.js +++ b/SRC/public/js/memory.js @@ -31,10 +31,10 @@ * */ - function Memory( options ) { + function Memory( options, level ) { this.options = extend( {}, this.options ); extend( this.options, options ); - this._init(); + this._init(level); } /** @@ -44,7 +44,7 @@ * ready for game setup. */ - Memory.prototype._init = function() { + Memory.prototype._init = function(level) { this.game = document.createElement("div"); this.game.id = "mg"; this.game.className = "mg"; @@ -65,7 +65,7 @@ this.gameMessages.id = "mg__onend"; this.gameMessages.className = "mg__onend"; - this._setupGame(); + this._setupGame(level); }; /** @@ -85,7 +85,7 @@ * 3 : game is finished */ - Memory.prototype._setupGame = function() { + Memory.prototype._setupGame = function(level) { var self = this; this.gameState = 1; this.cards = shuffle(this.options.cards); @@ -98,7 +98,7 @@ this.flippedTiles = 0; this.chosenLevel = ""; this.numMoves = 0; - this._setupGameWrapper(3); + this._setupGameWrapper(level); } /** @@ -155,7 +155,7 @@ this.tilesHTML += '
\
\ \ - '; + '; this.tilesHTML +='
'; @@ -279,7 +279,7 @@ self.card1.classList.remove("flipped"); self.card2.classList.remove("flipped"); self._gameResetVars(); - }, 900 ); + }, 500 ); // plus one on the move counter this._gameCounterPlusOne(); diff --git a/SRC/resources/views/backend/ref_home.blade.php b/SRC/resources/views/backend/ref_home.blade.php index dc163ef..4d7b4b8 100644 --- a/SRC/resources/views/backend/ref_home.blade.php +++ b/SRC/resources/views/backend/ref_home.blade.php @@ -248,8 +248,6 @@ @endsection @section('page-scripts') - - diff --git a/SRC/resources/views/frontend/memo_level.blade.php b/SRC/resources/views/frontend/memo_level.blade.php index 16f3dc7..ca93920 100644 --- a/SRC/resources/views/frontend/memo_level.blade.php +++ b/SRC/resources/views/frontend/memo_level.blade.php @@ -10,21 +10,11 @@

-
-
-
- +
+ +