📄 util.js
字号:
/*
* Copyright 2001-2007 Hippo (www.hippo.nl)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//Simple Browser sniffert
function jsrsBrowserSniff(){
if (document.layers) return "NS";
if (document.all) {
// But is it really IE?
// convert all characters to lowercase to simplify testing
var agt=navigator.userAgent.toLowerCase();
var is_opera = (agt.indexOf("opera") != -1);
var is_konq = (agt.indexOf("konqueror") != -1);
if(is_opera) {
return "OPR";
} else {
if(is_konq) {
return "KONQ";
} else {
// Really is IE
return "IE";
}
}
}
if (document.getElementById){
if(navigator.userAgent.toLowerCase().indexOf("safari") != -1) {
return "SAFARI";
}
return "MOZ";
}
return "OTHER";
}
/**
* Changes the size of a frame by finding its position in the frameset,
* and modifying the corresponding substring of the rows attribute of that
* frameset.
*
* @param name the name of the frame as defined in the frameset
* @param heighth the desired height of the frame
*/
function setFrameHeight(name, height)
{
var frames = parent.frames;
var rsFrameIndex = -1;
// find the frame
var theFrame = frames[name];
var i = 0;
while (i < frames.length && rsFrameIndex == -1)
{
if (frames[i].name == name || frames[i] == theFrame)
{
rsFrameIndex = i;
}
i++;
}
// if found set frame size
if (rsFrameIndex > -1)
{
var rows = parent.document.getElementById("mainframeset").rows.split(",");
var newRows = "";
for (var i = 0; i < rows.length; i++)
{
if (i == rsFrameIndex)
{
newRows += height; // set the new value for our frame
}
else
{
newRows += rows[i]; // let other values unchanged
}
if (i < rows.length - 1)
{
newRows += ",";
}
}
parent.document.getElementById("mainframeset").rows = newRows;
}
}
/**
* Draws the resourceSelector
* (maybe move it into a better suited .js)
*/
function showResourceSelector()
{
setFrameHeight("resourceselector", 80);
}
/**
* Hides the resourceSelector
* (maybe move it into a better suited .js)
*/
function hideResourceSelector()
{
setFrameHeight("resourceselector", 0);
}
/**
* Draws the clipBoard
* (maybe move it into a better suited .js)
*/
function showClipboard()
{
setFrameHeight("clipboard", 200);
}
/**
* Hides the clipBoard
* (maybe move it into a better suited .js)
*/
function hideClipboard()
{
setFrameHeight("clipboard", 0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -