js 代码
- /**
- * Code Syntax Highlighter.
- * Version 1.3.0
- * Copyright (C) 2004 Alex Gorbatchev.
- * http://www.dreamprojections.com/syntaxhighlighter/
- *
- * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
- * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
- * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
- //
- // create namespaces
- //
- var dp = {
- sh :
- {
- Toolbar : {},
- Utils : {},
- RegexLib: {},
- Brushes : {},
- Strings : {},
- Version : '1.4.1'
- }
- };
- dp.sh.Strings = {
- AboutDialog : '<html><head><title>About...</title></head><body class="dp-about"><table cellspacing="0"><tr><td class="copy"><p class="title">dp.SyntaxHighlighter</div><div class="para">Version: {V}</p><p><a href="http://www.dreamprojections.com/syntaxhighlighter/?ref=about" target="_blank">http://www.dreamprojections.com/SyntaxHighlighter</a></p>©2004-2005 Alex Gorbatchev. All right reserved.</td></tr><tr><td class="footer"><input type="button" class="close" value="OK" onClick="window.close()"/></td></tr></table></body></html>'
- };
- dp.SyntaxHighlighter = dp.sh;
- //
- // Toolbar functions
- //
- dp.sh.Toolbar.Commands = {
- ExpandSource: {
- label: '+ expand source',
- check: function(highlighter) { return highlighter.collapse; },
- func: function(sender, highlighter)
- {
- sender.parentNode.removeChild(sender);
- highlighter.div.className = highlighter.div.className.replace('collapsed', '');
- }
- },
- // opens a new windows and puts the original unformatted source code inside.
- ViewSource: {
- label: 'view plain',
- func: function(sender, highlighter)
- {
- var code = highlighter.originalCode.replace(/</g, '<');
- var wnd = window.open('', '_blank', 'width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=1');
- wnd.document.write('<textarea style="width:99%;height:99%">' + code + '</textarea>');
- wnd.document.close();
- }
- },
- // copies the original source code in to the clipboard (IE only)
- CopyToClipboard: {
- label: 'copy to clipboard',
- check: function() { return window.clipboardData != null; },
- func: function(sender, highlighter)
- {
- window.clipboardData.setData('text', highlighter.originalCode);
- alert('The code is in your clipboard now');
- }
- },
- // creates an invisible iframe, puts the original source code inside and prints it
- PrintSource: {
- label: 'print',
- func: function(sender, highlighter)
- {
- var iframe = document.createElement('IFRAME');
- var doc = null;
- // this hides the iframe
- iframe.style.cssText = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;';
- document.body.appendChild(iframe);
- doc = iframe.contentWindow.document;
- dp.sh.Utils.CopyStyles(doc, window.document);
- doc.write('<div class="' + highlighter.div.className.replace('collapsed', '') + ' printing">' + highlighter.div.innerHTML + '</div>');
- doc.close();
- iframe.contentWindow.focus();
- iframe.contentWindow.print();
- alert('Printing...');
- document.body.removeChild(iframe);
- }
- },
- About: {
- label: '?',
- func: function(highlighter)
- {
- var wnd = window.open('', '_blank', 'dialog,width=300,height=150,scrollbars=0');
- var doc = wnd.document;
- dp.sh.Utils.CopyStyles(doc, window.document);
- doc.write(dp.sh.Strings.AboutDialog.replace('{V}', dp.sh.Version));
- doc.close();
- wnd.focus();
- }
- }
- };
- // creates a <div /> with all toolbar links
- dp.sh.Toolbar.Create = function(highlighter)
- {
- var div = document.createElement('DIV');
- div.className = 'tools';
- for(var name in dp.sh.Toolbar.Commands)
- {
- var cmd = dp.sh.Toolbar.Commands[name];
- if(cmd.check != null && !cmd.check(highlighter))
- continue;
- div.innerHTML += '<a href="#" onclick="dp.sh.Toolbar.Command(\'' + name + '\',this);return false;">' + cmd.label + '</a>';
- }
- return div;
- }
- // executes toolbar command by name
- dp.sh.Toolbar.Command = function(name, sender)
- {
- var n = sender;
- while(n != null && n.className.indexOf('dp-highlighter') == -1)
- n = n.parentNode;
- if(n != null)
- dp.sh.Toolbar.Commands[name].func(sender, n.highlighter);
- }
- // copies all <link rel="stylesheet" /> from 'target' window to 'dest'
- dp.sh.Utils.CopyStyles = function(destDoc, sourceDoc)
- {
- var links = sourceDoc.getElementsByTagName('link');
- for(var i = 0; i < links.length; i++)
- if(links[i].rel.toLowerCase() == 'stylesheet')
- destDoc.write('<link type="text/css" rel="stylesheet" href="' + links[i].href + '"></link>');
- }
- //
- // Common reusable regular expressions
- //
- dp.sh.RegexLib = {
- MultiLineCComments : new RegExp('/\\*[\\s\\S]*?\\*/', 'gm'),
- SingleLineCComments : new RegExp('//.*$', 'gm'),
- SingleLinePerlComments : new RegExp('#.*$', 'gm'),
- DoubleQuotedString : new RegExp('"(?:\\.|(\\\\\\")|[^\\""])*"','g'),
- SingleQuotedString : new RegExp("'(?:\\.|(\\\\\\')|[^\\''])*'", 'g')
- };
- //
- // Match object
- //
- dp.sh.Match = function(value, index, css)
- {
- this.value = value;
- this.index = index;
- this.length = value.length;
- this.css = css;
- }
- //
- // Highlighter object
- //
- dp.sh.Highlighter = function()
- {
- this.noGutter = false;
- this.addControls = true;
- this.collapse = false;
- this.tabsToSpaces = true;
- this.wrapColumn = 80;
- this.showColumns = true;
- }
- // static callback for the match sorting
- dp.sh.Highlighter.SortCallback = function(m1, m2)
- {
- // sort matches by index first
- if(m1.index < m2.index)
- return -1;
- else if(m1.index > m2.index)
- return 1;
- else
- {
- // if index is the same, sort by length
- if(m1.length < m2.length)
- return -1;
- else if(m1.length > m2.length)
- return 1;
- }
- return 0;
- }
- dp.sh.Highlighter.prototype.CreateElement = function(name)
- {
- var result = document.createElement(name);
- result.highlighter = this;
- return result;
- }
- // gets a list of all matches for a given regular expression
- dp.sh.Highlighter.prototype.GetMatches = function(regex, css)
- {
- var index = 0;
- var match = null;
- while((match = regex.exec(this.code)) != null)
- this.matches[this.matches.length] = new dp.sh.Match(match[0], match.index, css);
- }
- dp.sh.Highlighter.prototype.AddBit = function(str, css)
- {
- if(str == null || str.length == 0)
- return;
- var span = this.CreateElement('SPAN');
- str = str.replace(/&/g, '&');
- str = str.replace(/ /g, ' ');
- str = str.replace(/</g, '<');
- str = str.replace(/\n/gm, ' <br>');
- // when adding a piece of code, check to see if it has line breaks in it
- // and if it does, wrap individual line breaks with span tags
- if(css != null)
- {
- var regex = new RegExp('<br>', 'gi');
- if(regex.test(str))
- {
- var lines = str.split(' <br>');
- str = '';
- for(var i = 0; i < lines.length; i++)
- {
- span = this.CreateElement('SPAN');
- span.className = css;
- span.innerHTML = lines[i];
- this.div.appendChild(span);
- // don't add a <BR> for the last line
- if(i + 1 < lines.length)
- this.div.appendChild(this.CreateElement('BR'));
- }
- }
- else
- {
- span.className = css;
- span.innerHTML = str;
- this.div.appendChild(span);
- }
- }
- else
- {
- span.innerHTML = str;
- this.div.appendChild(span);
- }
- }
- // checks if one match is inside any other match
- dp.sh.Highlighter.prototype.IsInside = function(match)
- {
- if(match == null || match.length == 0)
- return false;
- for(var i = 0; i < this.matches.length; i++)
- {
- var c = this.matches[i];
- if(c == null)
- continue;
- if((match.index > c.index) && (match.index < c.index + c.length))
- return true;
- }
- return false;
- }
- dp.sh.Highlighter.prototype.ProcessRegexList = function()
- {
- for(var i = 0; i < this.regexList.length; i++)
- this.GetMatches(this.regexList[i].regex, this.regexList[i].css);
- }
- dp.sh.Highlighter.prototype.ProcessSmartTabs = function(code)
- {
- var lines = code.split('\n');
- var result = '';
- var tabSize = 4;
- var tab = '\t';
- // This function inserts specified amount of spaces in the string
- // where a tab is while removing that given tab.
- function InsertSpaces(line, pos, count)
- {
- var left = line.substr(0, pos);
- var right = line.substr(pos + 1, line.length); // pos + 1 will get rid of the tab
- var spaces = '';
- for(var i = 0; i < count; i++)
- spaces += ' ';
- return left + spaces + right;
- }
- // This function process one line for 'smart tabs'
- function ProcessLine(line, tabSize)
- {
- if(line.indexOf(tab) == -1)
- return line;
- var pos = 0;
- while((pos = line.indexOf(tab)) != -1)
- {
- // This is pretty much all there is to the 'smart tabs' logic.
- // Based on the position within the line and size of a tab,
- // calculate the amount of spaces we need to insert.
- var spaces = tabSize - pos % tabSize;
- line = InsertSpaces(line, pos, spaces);
- }
- return line;
- }
- // Go through all the lines and do the 'smart tabs' magic.
- for(var i = 0; i < lines.length; i++)
- result += ProcessLine(lines[i], tabSize) + '\n';
- return result;
- }
- dp.sh.Highlighter.prototype.SwitchToList = function()
- {
- // thanks to Lachlan Donald from SitePoint.com for this <br/> tag fix.
- var html = this.div.innerHTML.replace(/<(br)\/?>/gi, '\n');
- var lines = html.split('\n');
- if(this.addControls == true)
- this.bar.appendChild(dp.sh.Toolbar.Create(this));
- // add columns ruler
- if(this.showColumns)
- {
- var div = this.CreateElement('div');
- var columns = this.CreateElement('div');
- var showEvery = 10;
- var i = 1;
- while(i <= 150)
- {
- if(i % showEvery == 0)
- {
- div.innerHTML += i;
- i += (i + '').length;
- }
- else
- {
- div.innerHTML += '·';
- i++;
- }
- }
- columns.className = 'columns';
- columns.appendChild(div);
- this.bar.appendChild(columns);
- }
- for(var i = 0, lineIndex = this.firstLine; i < lines.length - 1; i++, lineIndex++)
- {
- var li = this.CreateElement('LI');
- var span = this.CreateElement('SPAN');
- // uses .line1 and .line2 css styles for alternating lines
- li.className = (i % 2 == 0) ? 'alt' : '';
- span.innerHTML = lines[i] + ' ';
- li.appendChild(span);
- this.ol.appendChild(li);
- }
- this.div.innerHTML = '';
- }
- dp.sh.Highlighter.prototype.Highlight = function(code)
- {
- function Trim(str)
- {
- return str.replace(/^\s*(.*?)[\s\n]*$/g, '$1');
- }
- function Chop(str)
- {
- return str.replace(/\n*$/, '').replace(/^\n*/, '');
- }
- function Unindent(str)
- {
- var lines = str.split('\n');
- var indents = new Array();
- var regex = new RegExp('^\\s*', 'g');
- var min = 1000;
- // go through every line and check for common number of indents
- for(var i = 0; i < lines.length && min > 0; i++)
- {
- if(Trim(lines[i]).length == 0)
- continue;
- var matches = regex.exec(lines[i]);
- if(matches != null && matches.length > 0)
- min = Math.min(matches[0].length, min);
- }
- // trim minimum common number of white space from the begining of every line
- if(min > 0)
- for(var i = 0; i < lines.length; i++)
- lines[i] = lines[i].substr(min);
- return lines.join('\n');
- }
- // This function returns a portions of the string from pos1 to pos2 inclusive
- function Copy(string, pos1, pos2)
- {
- return string.substr(pos1, pos2 - pos1);
- }
- var pos = 0;
- this.originalCode = code;
- &nb
相关推荐
shell+crontab制作postgresql数据库定期备份脚本;利用pg_dump这个postgresql自带的备份工具
## Usage: sh <Scripts_Path>/db2backup_ctl_tsm.sh //root ## Scenario: 1.[instance:active/passive & db: active] ## 2.[instance:active/active & db: active] ## 3.[hadr: primary/standby] ##############...
防止误删服务器数据库 ,使用Shell脚本备份数据库: ### 1、需求分析: 1)每天凌晨2:10备份数据库atguiguDB到/data...-----》shell脚本写到/usr/sbin/mysql_db_backup.sh---》然后将脚本设置到crond执行 2)代码实现
1. **数据库连接信息**:包括主库和备库的数据库连接字符串(如:DB_SID, DB_SERVICE_NAME, DB_USERNAME, DB_PASSWORD),用于工具与数据库的交互。 2. **ADG实例信息**:定义主库和备库的实例名,以便正确地执行...
GYW-F3-G18-2488-DB-DM001.sh
在系统启动时,通过运行`Sdb start`指令,调用`start_db.sh`脚本启动数据库,并将日志记录在`/home/oracle/db.log`中。而在系统关闭或重启时,运行`Sdb stop`将调用另一个脚本`stop_db.sh`关闭数据库,同样记录日志...
2. **Global Name设置**:每个数据库的global_name参数应分别设置为“db.sh.com”和“db.bj.com”,以标识不同的数据库实例。 3. **检查Advanced Replication支持**:通过查询V$OPTION视图确认当前数据库是否支持...
Dockerfile配置没有问题,为什么执行ENTRYPOINT...最近通过Dockerfile编写镜像,CMD中调用的是sh脚本(start.sh)进行启动容器,通过docker run启动时,启动不成功,进行docker logs 容器ID,发现报错为:未预期的符
6. **upgrade_GAUSSV5.sh、upgrade_config.sh、upgrade_errorcode.sh**:这些脚本专门用于数据库的升级,其中`upgrade_GAUSSV5.sh`可能是用于从旧版本的GaussDB(如V5)升级到5.0版本的脚本;`upgrade_config.sh`...
DB2数据库全备份自动脚本,只需要设置定时任务就可以完成自动备份,文档中有详细的说明,只需要修改db2数据库名,备份路径,用户名和密码等,该备份脚本全备份会保留最近10天数据,10天前数据...都可以修改,有详细说明
3. 使用`chmod +x restoredb.sh`赋予脚本执行权限,然后使用`nohup ./restoredb.sh &`在后台运行恢复脚本。 这个过程涵盖了从暂停归档日志传输、清理备库、备份和恢复控制文件到自动化恢复的整个流程,确保在Oracle...
- 通过SMIT工具配置集群资源,设置`startdb.sh`和`stopdb.sh`脚本以调用`dbstart`和`dbshut`。 接下来,我们转向Linux系统。在Linux上,也有两种主要的启动和关闭方式: 1. **加载rc服务**: - 创建`dbstart.sh`...
防止误删服务器数据库 ,使用Shell脚本备份数据库: ### 1、需求分析: 1)每天凌晨2:10备份数据库atguiguDB到/data...-----》shell脚本写到/usr/sbin/mysql_db_backup.sh---》然后将脚本设置到crond执行 2)代码实现
- 每小时的第 5 分钟、第 15 分钟等执行 `/opt/informix/fm2db.sh` 脚本。 - `9,19,29,39,49,59 * * * * /opt/informix/fm_del_act.sh >> /tmp/fm_del_act.log` - 每小时的第 9 分钟、第 19 分钟等执行 `/opt/...
MySQL Example DB是一个用于教学和演示用途的数据库,通常包含了各种国家、城市、人口等信息,为初学者提供了学习SQL查询和数据库管理的基础数据集。在"world-db.zip"这个压缩包中,我们可以预见到它包含了名为...
MultiSearchChatMsg.db
创建`reduce_db.sh`脚本,包含还原过程的逻辑,如解压备份文件并使用`mysql`命令导入数据。 2. **设置定时还原任务**: 使用`crontab -e`设置定时还原任务,例如每天早晨8点执行还原: ```bash 0 8 * * * /usr/...
sudo ./bin/install/initialize_db.sh ``` 对于Windows系统,打开命令提示符,进入安装目录的`bin`文件夹,然后运行: ``` initialize_db.bat ``` 六、启动ThingsBoard 启动服务: ``` sudo ./bin/platform.sh ...
- `backup_db.sh`: 自动化数据库备份的shell脚本,可能结合RMAN(Recovery Manager)进行冷备份或热备份。 - `restore_db.sh`: 数据库恢复脚本,用于在灾难性故障后恢复数据。 7. 日志管理: - `archive_log_...
- `backupDB.sh`:一般用于数据库的完整备份。 - `crm_sms_stat.sh`:可能与CRM系统中的短信统计相关。 这些脚本可能利用了Linux命令行工具和SQL语句,与`apt-get`命令协同工作,确保系统和数据库的正常运行和维护...