diff --git a/module/api/control.php b/module/api/control.php index 23ab0ca1ee..03968bd159 100755 --- a/module/api/control.php +++ b/module/api/control.php @@ -43,13 +43,12 @@ class api extends control { $this->session->set('spaceType', 'api', 'doc'); $this->setMenu($libID); - - $objectType = $this->objectType; - $objectID = $this->objectID; + $objectType = $this->objectType; + $objectID = $this->objectID; + $isFirstLoad = $libID ? false : true; /* Get all api doc libraries. */ - $loadLib = false; - $libs = $this->doc->getApiLibs($appendLib, $objectType, $objectID); + $libs = $this->doc->getApiLibs($appendLib, $objectType, $objectID); if(empty($libs) and $objectType != 'nolink') { $objectType = 'nolink'; @@ -81,7 +80,6 @@ class api extends control $libID = $lib->id; $objectType = $lib->product ? 'product' : ($lib->project ? 'project' : ''); $objectID = $lib->product ? $lib->product : $lib->project; - if($loadLib) $libs = $this->doc->getApiLibs($appendLib); } /* Get an api doc. */ @@ -115,6 +113,7 @@ class api extends control $this->view->lib = $lib; $this->view->release = $release; + $this->view->isFirstLoad = $isFirstLoad; $this->view->title = $this->lang->api->pageTitle; $this->view->libID = $libID; $this->view->apiID = $apiID; @@ -627,7 +626,7 @@ class api extends control } else { - $this->sendSuccess(array('locate' => $this->createLink('api', 'index', "libID=$api->lib&module=$api->module"))); + return print(js::locate(inlink('index', "libID=$api->lib&module=$api->module"), 'parent')); } } } diff --git a/module/api/css/common.css b/module/api/css/common.css index c0f3690768..5cbde1de73 100644 --- a/module/api/css/common.css +++ b/module/api/css/common.css @@ -119,7 +119,7 @@ form .table-data, #content .table-data {border: 1px solid #e2e2e3;} .main-col .doc-title .info {flex: 1 1 0;} .main-col .doc-title .version a {font-size: 13px; color: #8c8c8c;} .main-col .doc-title .version .dropdown-menu a:hover {color: #ffffff;} -.main-col .doc-title .actions {min-width: 120px; display: inline-block;} +.main-col .doc-title .actions {display: inline-block;} .main-col .doc-title .actions a + a {margin-left: 8px;} .main-col .doc-title .actions i {font-size: 15px; color: #8c8c8c;} #content h2.title {margin: 0; font-size: 17px;} diff --git a/module/api/js/index.js b/module/api/js/index.js deleted file mode 100644 index e4f1642928..0000000000 --- a/module/api/js/index.js +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Ajax delete api doc. - * - * @param string $link - * @param int $replaceID - * @param stirng $notice - * @access public - * @return void - */ -function ajaxDeleteApi(link, replaceID) -{ - if(confirm(confirmDelete)) - { - $.get(link, function(data) - { - location.href = JSON.parse(data).locate; - }); - } -} - -/** - * Display the document in full screen. - * - * @access public - * @return void - */ -function fullScreen() -{ - var element = document.getElementById('content'); - var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen; - if(requestMethod) - { - var afterEnterFullscreen = function() - { - $('#mainActions').removeClass('hidden'); - $('#content').addClass('scrollbar-hover'); - $('#content .actions').addClass('hidden'); - $.cookie('isFullScreen', 1); - }; - - var whenFailEnterFullscreen = function(error) - { - $.cookie('isFullScreen', 0); - }; - - try - { - var result = requestMethod.call(element); - if(result && (typeof result.then === 'function' || result instanceof window.Promise)) - { - result.then(afterEnterFullscreen).catch(whenFailEnterFullscreen); - } - else - { - afterEnterFullscreen(); - } - } - catch (error) - { - whenFailEnterFullscreen(error); - } - } -} - -/** - * Exit full screen. - * - * @access public - * @return void - */ -function exitFullScreen() -{ - $('#mainActions').addClass('hidden'); - $('#content').removeClass('scrollbar-hover'); - $('#content .actions').removeClass('hidden'); - $.cookie('isFullScreen', 0); -} -document.addEventListener('fullscreenchange', function (e) -{ - if(!document.fullscreenElement) exitFullScreen(); -}); - -document.addEventListener('webkitfullscreenchange', function (e) -{ - if(!document.webkitFullscreenElement) exitFullScreen(); -}); - -document.addEventListener('mozfullscreenchange', function (e) -{ - if(!document.mozFullScreenElement) exitFullScreen(); -}); - -document.addEventListener('msfullscreenChange', function (e) -{ - if(!document.msfullscreenElement) exitFullScreen(); -}); diff --git a/module/api/view/apilist.html.php b/module/api/view/apilist.html.php index e7f0ade3cf..897a1c6da9 100644 --- a/module/api/view/apilist.html.php +++ b/module/api/view/apilist.html.php @@ -93,7 +93,7 @@ { if($app->rawModule == 'doc') { - echo html::a($this->createLink('api', 'create', "libID=$libID&moduleID=$moduleID", '', true), ' ' . $lang->api->createApi, '', 'class="btn btn-info iframe" data-width="95%"'); + echo html::a($this->createLink('api', 'create', "libID=$libID&moduleID=$moduleID", '', true), ' ' . $lang->api->createApi, '', 'class="btn btn-info iframe" data-width="95%"'); } else { @@ -115,7 +115,7 @@