Changeset 663
- Timestamp:
- 09/29/11 15:03:23 (8 months ago)
- Location:
- trunk/model/sources/dkCore
- Files:
-
- 3 edited
-
genSld/wdt/mgr/scHPS.doss/scHPS.js (modified) (15 diffs)
-
genWeb/wdt/img/scImgMgr.doss/scImgMgr.js (modified) (10 diffs)
-
model/base/screenShot.model (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/model/sources/dkCore/genSld/wdt/mgr/scHPS.doss/scHPS.js
r661 r663 48 48 fUncutableFilter : ".ssUncutable|tr", 49 49 fFixedHeightFilter : ".ssFixedHeight", 50 fKeyMap : {nextStep:["key_right","key_down"," ","n"], 51 previousStep:["\b","key_left","key_up","p"], 52 nextSlide:"key_pageDown", 53 previousSlide:"key_pageUp", 54 home:"key_home", 55 toggleEffects:"f", 56 switchToHtml:"h", 57 closeZoom:"key_escape"}, 50 58 51 59 /* Constantes de stylage. */ … … 76 84 77 85 /* --- Public ------------------------------------------------------------- */ 78 /** scHPS.init */86 /** scHPS.init : MUST be called before any other scHPS interaction */ 79 87 init : function() { 80 88 try{ … … 83 91 if (!("scTiLib" in window)) throw "scTiLib.js not present in presentation window."; 84 92 if (!("scPaLib" in window)) throw "scPaLib.js not present in presentation window."; 85 86 93 if (window.location.search.indexOf("mode=html")<0 && !this.fNavie6) this.fDisabled = false; 94 this.fStore = new scHPS.LocalStore(); 87 95 scOnLoads[scOnLoads.length] = this; 88 96 } catch(e){scCoLib.util.logError("ERROR scHPS.init", e);} … … 94 102 // ie6 warning... 95 103 if (window.location.search.indexOf("mode=html")<0 && this.fNavie6){ 96 if( document.cookie.indexOf("ie6Warn=true")<0) alert(this.xGetStr(7));97 document.cookie = "ie6Warn=true";104 if(this.fStore.get("ie6Warn") != "true") alert(this.xGetStr(7)); 105 this.fStore.set("ie6Warn", "true"); 98 106 } 99 107 // firebug warning... … … 113 121 if(vTitle.indexOf(this.fCssNameHTML) != -1) vCss.disabled = true; 114 122 if(vTitle.indexOf(this.fCssNameSS) != -1) { 123 // vCss.setAttribute("rel","stylesheet"); // Bug Safari 5.1 124 // vCss.removeAttribute("title"); // Bug Safari 5.1 115 125 vCss.disabled = true; // IE bug 116 126 vCss.disabled = false; … … 136 146 } 137 147 return false; 148 }, 149 /** scHPS.xProcessKeyMap : Retrun an interpreted keymap object. */ 150 xProcessKeyMap: function(pMap) { 151 var i, vAction, vKeys, vKey; 152 var vMap = {}; 153 var xKeyCode = function (pStr){ 154 if (!pStr || pStr.length == 0) return 0; 155 switch(pStr){ 156 case "key_right" : return 39; 157 case "key_left" : return 37; 158 case "key_up" : return 38; 159 case "key_down" : return 40; 160 case "key_pageUp" : return 33; 161 case "key_pageDown" : return 34; 162 case "key_home" : return 36; 163 case "key_escape" : return 27; 164 default: return pStr.toUpperCase().charCodeAt(0); 165 } 166 } 167 for (vAction in pMap) { 168 vKeys = pMap[vAction]; 169 if (typeof vKeys == "object"){ 170 for (i = 0; i < vKeys.length; i++){ 171 vMap[String(xKeyCode(vKeys[i]))] = vAction; 172 } 173 } else vMap[String(xKeyCode(vKeys))] = vAction; 174 } 175 return vMap; 138 176 }, 139 177 /* --- Static ------------------------------------------------------------- */ … … 395 433 } 396 434 } 397 /* === Generic tasks ======================================================== */435 /* === Generic Utility Classes ============================================== */ 398 436 /** scHPS.FadeEltTask : TiLib task that fades a given element in or out. 399 437 * @param pElt element to fade. … … 461 499 } 462 500 } 501 /** scHPS.LocalStore : Inits and returns a new local storage object based on localStorage / cookies in that order. 502 * @pId (optional) : id of new local store. */ 503 scHPS.LocalStore = function (pId){ 504 if (pId && !/^[a-z][a-z0-9]+$/.exec(pId)) throw new Error("Invalid store name"); 505 this.fId = pId || ""; 506 this.fRootKey = document.location.pathname.substring(0,document.location.pathname.lastIndexOf("/")) +"/"; 507 if ("localStorage" in window) { 508 this.get = function(pKey) {var vRet = localStorage.getItem(this.fRootKey+this.xKey(pKey));return (typeof vRet == "string" ? unescape(vRet) : null)}; 509 this.set = function(pKey, pVal) {localStorage.setItem(this.fRootKey+this.xKey(pKey), escape(pVal))}; 510 } else { 511 this.get = function(pKey){var vReg=new RegExp(this.xKey(pKey)+"=([^;]*)");var vArr=vReg.exec(document.cookie);if(vArr && vArr.length==2) return(unescape(vArr[1]));else return null}; 512 this.set = function(pKey,pVal){document.cookie = this.xKey(pKey)+"="+escape(pVal)}; 513 } 514 this.xKey = function(pKey){return this.fId + this.xEsc(pKey)}; 515 this.xEsc = function(pStr){return "LS" + pStr.replace(/ /g, "_")}; 516 } 463 517 464 518 /* ============================================================================= … … 479 533 this.fTocLnksPath = pTocLnksPath || null; 480 534 this.fIsMaster = (typeof pIsMaster == "undefined" ? true : pIsMaster); 481 this.fEnableEffects = !(document.cookie.indexOf("enableEffects=false")>=0);482 535 // Init default paths & classes 483 536 this.fCoFilter = scHPS.fCoFilter; … … 489 542 this.fSlideClass = scHPS.fSlideClass; 490 543 this.fSsClassPrefix = scHPS.fSsClassPrefix; 544 // Init default behaviours 545 this.fKeyMap = scHPS.xProcessKeyMap(scHPS.fKeyMap); 491 546 // Init local slide rules 492 547 this.fSldRules = []; … … 577 632 scCoLib.util.log("PresMgr.onLoad"); 578 633 var vPresMgr = this; 634 this.fEnableEffects = !(scHPS.fStore.get("enableEffects") == "false"); 579 635 //Find Slideshow base elements 580 636 this.fSldFra = scPaLib.findNode(this.fSldFraPath); … … 702 758 if (scHPS.fDisabled) return; 703 759 this.fEnableEffects = pEnable; 704 document.cookie = "enableEffects="+this.fEnableEffects;760 scHPS.fStore.set("enableEffects",String(this.fEnableEffects)); 705 761 if (this.fBtnEfcts) this.fBtnEfcts.style.display = (this.fEnableEffects ? "none" : ""); 706 762 if (this.fBtnNoEfcts) this.fBtnNoEfcts.style.display = (this.fEnableEffects ? "" : "none"); … … 709 765 toggleEffects : function() { 710 766 this.enableEffects(!this.fEnableEffects); 767 }, 768 /** PresMgr.setKeyMap : change how the keys are interpreted. 769 @param pKeyMap : object defining the action->mapping (see scHPS.fKeyMap at top of file) */ 770 setKeyMap : function(pKeyMap) { 771 var vAction; 772 for (vAction in scHPS.fKeyMap){ 773 if (typeof pKeyMap[vAction] == "undefined") pKeyMap[vAction] = scHPS.fKeyMap[vAction]; 774 } 775 this.fKeyMap = scHPS.xProcessKeyMap(pKeyMap); 711 776 }, 712 777 /** PresMgr.loadSlide : Load a slide by index id. … … 955 1020 //scCoLib.util.log("PresMgr.xKeyMgr: "+pCharCode); 956 1021 this.xNotifyListeners("onKeyPress", pCharCode); 957 switch(pCharCode){ 958 case 39://right 959 case 40://down 960 case 32://space 961 case 78://n 1022 var vAction; 1023 try{ 1024 vAction = this.fKeyMap[String(pCharCode)]; 1025 } catch(e){}; 1026 if (!vAction) return false; 1027 switch(vAction){ 1028 case "nextStep": 962 1029 this.next(); return false; 963 case 8://bksp 964 case 37://left 965 case 38://up 966 case 80://p 1030 case "previousStep": 967 1031 this.previous(); return false; 968 case 70://f1032 case "toggleEffects": 969 1033 this.toggleEffects(); return false; 970 case 34://pg_dwn1034 case "nextSlide": 971 1035 this.next(true); return false; 972 case 33://pg_up1036 case "previousSlide": 973 1037 this.previous(true); return false; 974 case 36://home1038 case "home": 975 1039 this.loadSlide(-1);return false; 976 case 27://escape1040 case "closeZoom": 977 1041 this.xHideZoom();return false; 978 case 72://h1042 case "switchToHtml": 979 1043 return scHPS.xSwitchToHtmlMode(); 980 1044 } … … 2936 3000 // Call library init function... 2937 3001 scHPS.init(); 3002 -
trunk/model/sources/dkCore/genWeb/wdt/img/scImgMgr.doss/scImgMgr.js
r661 r663 53 53 fTypAnm : "scImgAnm", 54 54 fTypZm : "scImgZm", 55 fTypGal : "scImgGal" 55 fTypGal : "scImgGal", 56 fFocus : true 56 57 } 57 58 /** scImgMgr.init. */ … … 158 159 scImgMgr.setPathPgeFra = function(pPathPgeFra) { 159 160 this.fPathPgeFra = pPathPgeFra; 161 } 162 /** scImgMgr.setFocus. */ 163 scImgMgr.setFocus = function(pFocus) { 164 this.fFocus = pFocus; 160 165 } 161 166 … … 306 311 for(var k in pAnim.fImgs) { 307 312 var vImg = pAnim.fImgs[k]; 313 vImg.style.position = "absolute"; 308 314 vImg.fHeight = vImg.clientHeight; 309 315 vImg.fWidth = scPaLib.findNode("des:img",vImg).width; 310 316 vMaxHeight = Math.max(vMaxHeight,vImg.fHeight); 311 317 vMaxWidth = Math.max(vMaxWidth,vImg.fWidth); 312 vImg.style.position = "absolute";313 318 vImg.style.visibility = "hidden"; 314 319 vImg.style.top = "0"; … … 578 583 this.xNotifyListeners("onZoomOpen", pAnc); 579 584 this.xNotifyListeners("onOverlayOpen", pAnc); 580 t ry{pAnc.fClsBtn.focus();}catch(e){};585 this.xFocus(pAnc.fClsBtn); 581 586 } 582 587 scImgMgr.xClsZm = function(pAnc) { … … 588 593 document.onkeyup = pAnc.fKeyUpOld; 589 594 scImgMgr.fCurrItem = null; 590 try{pAnc.focus();}catch(e){};595 scImgMgr.xFocus(pAnc); 591 596 } 592 597 scImgMgr.sLoadZmImg = function() { … … 705 710 this.xNotifyListeners("onAnimationOpen", pAlbFra); 706 711 this.xNotifyListeners("onOverlayOpen", pAlbFra); 707 t ry{pAlbFra.fSsBtnPly.focus();}catch(e){};712 this.xFocus(pAlbFra.fSsBtnPly); 708 713 709 714 } … … 748 753 pAlbFra.fSsAutoPly = false; 749 754 scImgMgr.fCurrItem = null; 750 try{pAlbFra.fInitAnc.focus();}catch(e){};755 scImgMgr.xFocus(pAlbFra.fInitAnc); 751 756 } 752 757 scImgMgr.xPlySs = function(pAlbFra) { … … 754 759 pAlbFra.fSsBtnPly.style.display="none"; 755 760 pAlbFra.fSsBtnPse.style.display=""; 756 try{pAlbFra.fSsBtnPse.focus();}catch(e){};761 scImgMgr.xFocus(pAlbFra.fSsBtnPse); 757 762 if (! scImgMgr.xNxtSs(pAlbFra)) scImgMgr.xUdtSs(pAlbFra,pAlbFra.fAncs[0]); 758 763 pAlbFra.fNxtSsProc = window.setTimeout(scImgMgr.xAutoSs, pAlbFra.fSsStep); … … 762 767 pAlbFra.fSsBtnPly.style.display=""; 763 768 pAlbFra.fSsBtnPse.style.display="none"; 764 try{pAlbFra.fSsBtnPly.focus();}catch(e){};769 scImgMgr.xFocus(pAlbFra.fSsBtnPly); 765 770 window.clearTimeout(pAlbFra.fNxtSsProc); 766 771 // pAlbFra.fNxtSsProc = -1; … … 1112 1117 return vBtn; 1113 1118 } 1119 /** scImgMgr.xFocus : */ 1120 scImgMgr.xFocus = function(pNode) { 1121 if (this.fFocus) try{pNode.focus();}catch(e){}; 1122 } 1114 1123 /** scImgMgr.xIsVisible : */ 1115 1124 scImgMgr.xIsVisible = function(pNode) { -
trunk/model/sources/dkCore/model/base/screenShot.model
r540 r663 1 <?xml version="1.0" encoding="UTF-8"?><sm:imagePrim xmlns:sm="http://www.utc.fr/ics/scenari/v3/modeling" xmlns:sc="http://www.utc.fr/ics/scenari/v3/core" name=";Copie d'écran" category=";Cœur"> 1 <?xml version="1.0" encoding="UTF-8"?> 2 <sm:imagePrim xmlns:sc="http://www.utc.fr/ics/scenari/v3/core" xmlns:sm="http://www.utc.fr/ics/scenari/v3/modeling" name=";Copie d'écran" category=";Cœur"> 2 3 <sm:help quickHelp=";Copie d'écran de l'application "/> 3 <sm:identification extensions="scr.png scr.gif" mimeTypes="image "/>4 <sm:identification extensions="scr.png scr.gif" mimeTypes="image/gif image/png"/> 4 5 <sm:structure> 5 6 <sm:meta sc:refUri="/dkCore/model/base/screenShotMeta.model" usage="optional"/>
Note: See TracChangeset
for help on using the changeset viewer.