//*************************************************************************// // ModuleName : OpenFlashEBook.js // // // // Last Update : 2006_04_13 by Sevennet // //*************************************************************************// //*************************************************************************// // 2007/08/22 // // SelfOpen Update // //*************************************************************************// // 2009/07/22 // // Google Chrome(Windows版) を 対応 // // sGetBrowserType() 修正 // // sWinResize() 修正 // // FBookSelfOpen() 修正 // //*************************************************************************// function FlashEBookOpener() { this.winLimitWidth = 1024; this.winLimitHeight = 725; //---<<< Default Window Size >>>---// this.winWidth = 1024; this.winHeight = 725; //---<<< GoogleChrome Default Window Size >>>---// this.ChromeWinWidth = 1035; this.ChromeWinHeight = 808; this.winCustomHeight = 0; this.winCustomWidth = 0; this.winStyleCode = "0"; this.winStyle = null; this.winStyleName = null; this.FlashEBookClient = null; this.eBookHost = "http://ebook.webcatalog.jp/fb/fb.dll/getviewer?"; // = "http://main.sevennet.jp/fb/fb.dll/getviewer?"; this.ParameterList = new Array("bc", "co", "separate" , "viewer" , "gp", "sbp", "sep", "ui", "ct"); this.ViewerStyleList = new Array("eBookFlashDefault", "eBookFlashCustomer"); this.OpenFBook = OpenFBook; this.GetQueryForFlash = GetQueryForFlash; this.GetWinStyleForFlash = GetWinStyleForFlash; this.funcSetWinStyleForFlash = funcSetWinStyleForFlash; this.FBookSelfOpen = FBookSelfOpen; this.sWinResize = sWinResize; this.sGetBrowserType = sGetBrowserType; this.sGetBorderSize = sGetBorderSize; } ////////////////////////////////// // // // <<< Open EBook Flash >>> // // // ////////////////////////////////// // Parameter // // [0]bc :BookCode // // [1]co :Corporate // // [2]separate :ShadeType // // [3]viewer :ViewerName // // [4]gp :GotoPage // // [5]sbp :StartPage // // [6]sep :EndPage // // [7]ui :UserLanguage // // [8]ct : ////////////////////////////////// function OpenFBook() { var sQuery = this.GetQueryForFlash(arguments); var sFBookURL = this.eBookHost + sQuery; if(!sQuery) { alert("service fail!!"); return false; } this.GetWinStyleForFlash(); this.FlashEBookClient = window.open(sFBookURL, this.winStyleName + "_" + Math.round(Math.random() * 100), this.winStyle); } ///////////////////////////////////// // // // <<< Get Query For Flash >>> // // Parameter Edit // // // ///////////////////////////////////// function GetQueryForFlash(arg_Param) { var sParam = ""; if(arg_Param.length) { for(var i=0;i>> // // Window Style Set For EBookFlash // // // ///////////////////////////////////////// function GetWinStyleForFlash() { var sScroll = "no"; switch ( this.winStyleCode ){ case "0" : // Digitomi Default window this.winStyleName = this.ViewerStyleList[0]; this.winTop = 0; this.winLeft = 0; this.winWidth = this.winLimitWidth; this.winHeight = this.winLimitHeight; break; case "1" : // corporation customer window this.winStyleName = this.ViewerStyleList[1]; if(this.winCustomWidth < this.winLimitWidth){ this.winWidth = this.winLimitWidth; }else{ this.winWidth = this.winCustomWidth; } if(this.winCustomHeight < this.winLimitHeight){ this.winHeight = this.winLimitHeight; }else{ this.winHeight = this.winCustomHeight; } this.winLeft = (screen.width - this.winWidth) / 2; this.winTop = (screen.height - this.winHeight) / 2; break; default : break; } this.winStyle = "top=" + this.winTop + ", screenY=" + this.winTop + ", left=" + this.winLeft + ", screenX=" + this.winLeft + ", width=" + this.winWidth + ", height=" + this.winHeight + ", directories=no" + ", location=no" + ", menubar=no" + ", resizable=no" + ", scrollbars=" + sScroll + ", status=no" + ", toolbar=no"; } ///////////////////////////////////////// // // // <<< Set Win Style For Flash >>> // // Window Style Code Set // // For EBookFlash // // // ///////////////////////////////////////// function funcSetWinStyleForFlash(pWinStyleCode,pWidth,pHeight){ //---<<< Param Check >>>---// switch(pWinStyleCode){ case "0" : this.winStyleCode = pWinStyleCode; break; case "1" : this.winStyleCode = pWinStyleCode; if (pWidth == ""){ this.winCustomWidth = this.winLimitWidth; }else if (isNaN(pWidth)){ this.winCustomWidth = this.winLimitWidth; }else{ this.winCustomWidth = pWidth; } if (pHeight == ""){ this.winCustomHeight = this.winLimitHeight; }else if (isNaN(pHeight)){ this.winCustomHeight = this.winLimitHeight; }else{ this.winCustomHeight = pHeight; } break; default : this.winStyleCode = "0"; this.winCustomHeight = this.winLimitHeight; this.winCustomWidth = this.winLimitWidth; break; } } /////////////////////////////////////// // // // <<< EBook Flash Self Open >>> // // // /////////////////////////////////////// // Parameter // // [0]bc :BookCode // // [1]co :Corporate // // [2]separate :ShadeType // // [3]viewer :ViewerName // // [4]gp :GotoPage // // [5]sbp :StartPage // // [6]sep :EndPage // // [7]ui :UserLanguage // // [8]ct : /////////////////////////////////////// function FBookSelfOpen() { var iRemovePosTop = 0; var iRemovePosLeft = 0; var sQuery = this.GetQueryForFlash( arguments ); var sFBookURL = this.eBookHost + sQuery; if( !sQuery ) { alert( "service fail!!" ); return false; } //---<<< WinStyleName Set >>>---// switch ( this.winStyleCode ){ case "0" : // Digitomi Default window this.winStyleName = this.ViewerStyleList[0]; break; case "1" : // corporation customer window this.winStyleName = this.ViewerStyleList[1]; break; default : break; } //---<<< Window Resize >>>---// this.sWinResize(); //---<<< Window Move >>>---// if ( ( screen.availWidth <= 1024 ) || ( screen.availHeight <= 768 ) ){ iRemovePosLeft = 0; iRemovePosTop = 0; }else{ var iRemovePosLeft = ( screen.availWidth - this.winWidth ) / 2; var iRemovePosTop = ( screen.availHeight - this.winHeight ) / 2; if( iRemovePosLeft < 0 ){ iRemovePosLeft = 0; } if( iRemovePosTop < 0 ){ iRemovePosTop = 0; } } moveTo( iRemovePosLeft, iRemovePosTop ); this.FlashEBookClient = window.open( sFBookURL,"_self" ); window.name = this.winStyleName + "_" + Math.round( Math.random() * 100 ); } /////////////////////////////// // // // <<< Window Resize >>> // // // /////////////////////////////// function sWinResize(){ var iWidth = 0; var iHeight = 0; var iWidthGap = 0; var iHeightGap = 0; var sBrowserType = this.sGetBrowserType(); //---<<< Window Move >>>---// moveTo(0,0); if ( ( sBrowserType == 'IE7' ) || ( sBrowserType == 'IE8' ) || ( sBrowserType == 'IE' ) ){ var aBorderInfo = this.sGetBorderSize(); iWidth = eval( this.winWidth ) + aBorderInfo[0]; iHeight = eval( this.winHeight ) + aBorderInfo[1]; } else { if( sBrowserType == 'Chrome' ){ iWidth = this.ChromeWinWidth; iHeight = this.ChromeWinHeight; }else{ iWidth = eval( ( window.outerWidth - window.innerWidth ) + this.winWidth ); iHeight = eval( ( window.outerHeight - window.innerHeight ) + this.winHeight ); } } //---<<< Screen Size & Window Size Gap >>>---// if ( ( screen.availWidth <= 1024 ) || ( screen.availHeight <= 768 ) ){ // if( sBrowserType == 'Safari' ){ iWidthGap = 0; iHeightGap = 0; if( screen.availWidth <= iWidth ){ iWidth = screen.availWidth; } if( screen.availHeight <= iHeight ){ iHeight = screen.availHeight; } // }else{ // iWidthGap = iWidth - screen.availWidth; // iHeightGap = iHeight - screen.availHeight; // } } // resizeTo(iWidth - iWidthGap,iHeight - iHeightGap); resizeTo( iWidth, iHeight ); } ////////////////////////////////// // // // <<< Get Browser Type >>> // // // ////////////////////////////////// // ReturnValue // // IE // // Firefox // // Chrome // // Opera // // NN // // Safari // // Mozilla // // Unknows // ////////////////////////////////// function sGetBrowserType() { var ua = navigator.userAgent; if (ua.indexOf("Opera") >= 0) return "Opera"; else if (ua.indexOf("Sleipnir") >= 0) return "Sleipnir"; else if (ua.indexOf("Chrome") >= 0) return "Chrome"; else if (ua.indexOf("MSIE 7") >= 0) return "IE7"; else if (ua.indexOf("MSIE 8") >= 0) return "IE8"; else if (ua.indexOf("MSIE") >= 0) return "IE"; else if (ua.indexOf("Netscape") >= 0) return "NN"; else if (ua.indexOf("Firefox") >= 0) return "Firefox"; else if (ua.indexOf("Safari") >= 0) return "Safari"; else if (ua.indexOf("Gecko") >= 0) return "Mozilla"; else if (ua.indexOf("Mozilla/4") >= 0) return "NN"; else return "Unknown"; } ///////////////////////////////// // // // <<< Get Border Size >>> // // // ///////////////////////////////// function sGetBorderSize(){ var aBorderInfo = new Array(); var iInnerWidth = 0; var iInnerHeight = 0; resizeTo(screen.availWidth,screen.availHeight); if (document.compatMode == "CSS1Compat"){ iInnerWidth = document.documentElement.clientWidth; iInnerHeight = document.documentElement.clientHeight; }else{ iInnerWidth = document.body.clientWidth; iInnerHeight = document.body.clientHeight; } aBorderInfo[0] = screen.availWidth - iInnerWidth; aBorderInfo[1] = screen.availHeight - iInnerHeight; return aBorderInfo; } OpenFlashEBook = new FlashEBookOpener();