").addClass("context-menu-search").append($("
").prop({type:"text",placeholder:d.searchBarPlaceholder})),m=$("
").addClass("option-icon"),h=$("").addClass("option-text"),f=$("
").addClass("option-separator"),x=[],v=null;function l(e,n){e=x[e];return e.search.result&&!n?e.search.result:e.opts}function g(e){return x[e].element.find(".context-menu-options")}function w(e){return g(e).children()}function b(e,n){return g(e).children().eq(n)}function I(n,t){if(null==v||v.cmIndex!=n||v.optIndex!=t){if(null!=v){let e=b(v.cmIndex,v.optIndex);e.hasClass("active")&&e.removeClass("active")}if(-1!=n&&-1!=t){let e=b(n,t);e.hasClass("active")||e.addClass("active"),v={cmIndex:n,optIndex:t}}else v=null}}function C(n,t){var o=x[n].activeSubmenu;if(o!=t){if(-1!=o){let e=b(n,o);e.hasClass("active-submenu")&&e.removeClass("active-submenu")}if(-1!=t){let e=b(n,t);e.hasClass("active-submenu")||e.addClass("active-submenu")}x[n].activeSubmenu=t}}function y(n){void 0===n&&(n=0),null!=v&&n<=v.cmIndex&&I(-1,-1);for(let e=x.length-1;e>=n;e--)x.pop().element.remove()}function u(c){var r=x[c],n=l(c,!1);(n=0==n.length?[{label:"< Empty >",disabled:!0}]:n).forEach(function(n,t){var e=b(c,t),o=void 0!==n.separator,i=void 0!==n.icon&&n.icon,s=void 0!==n.label&&n.label,a=void 0!==n.disabled&&n.disabled,l=void 0!==n.action&&n.action,u=void 0!==n.submenu&&n.submenu;if(e.length?(e.empty(),e.off(),e.removeClass()):(e=p.clone()).appendTo(g(c)),o)return e.hasClass("context-menu-separator")||e.addClass("context-menu-separator"),void e.append(f.clone());i&&e.append(m.clone().addClass(n.icon)),s&&e.append(h.clone().html(n.label)),a?e.hasClass("context-menu-disabled")||e.addClass("context-menu-disabled"):(l&&e.click(function(){d.autoClose?y():(y(c+1),C(c,-1)),n.action(n,c,t)}),u?(e.on("submenu",function(){var e;r.activeSubmenu!=t&&(e=c+1,C(c,t),y(e),M(n.submenu,e,{x:r.position.x+r.element.outerWidth(),y:r.position.y+this.offsetTop-this.parentElement.scrollTop-parseInt(g(c).css("padding-top"))}))}),e.mouseenter(function(){I(c,t),$(this).trigger("submenu")}),e.hasClass("context-menu-submenu")||e.addClass("context-menu-submenu")):(e.mouseenter(function(){I(c,t),C(c,-1),y(c+1)}),e.hasClass("context-menu-option")||e.addClass("context-menu-option")),e.mouseleave(function(){v.cmIndex==c&&v.optIndex==t&&I(-1,-1)}))});var t=w(c);for(let e=t.length-1;e>=n.length;e--)t.eq(e).remove()}function r(e,n,t){void 0===n&&(n=!0),void 0===t&&(t=!0);var o,i,s=x[e];0=$(window).innerWidth()&&(s.position.x-=n,0=$(window).innerHeight()&&(s.position.y-=u,0d.maxHeight&&s.element.css("height",d.maxHeight):s.element.css("max-height",d.maxHeight),null!==d.minWidth&&s.element.css("min-width",d.minWidth),s.element.css("z-index",d.zIndex+e)}function T(e){var n=x[e];if(null!==n.search.input){var t=n.search.input.val().trim();if(""==t)return n.search.result=null,void u(e);I(-1,-1);e=[];!function o(i,e,s){e.forEach(function(e){var n,t=!1;void 0===e.label||!e.label||(n=e.label.toLowerCase())&&-1!=n.indexOf(s)&&(i.push(e),t=!0),!t&&void 0!==e.submenu&&e.submenu.length&&o(i,e.submenu,s)})}(e,n.opts,t.toLowerCase()),n.search.result=e}}function M(e,n,t){var o,i=s.clone();d.searchBar&&0==n&&(o=a.clone()).prependTo(i);e={element:i,position:t,opts:e,activeSubmenu:-1,search:{input:o?o.find("input"):null,result:null}};x.push(e),g(n).scroll(function(){C(n,-1),y(n+1)}),I(-1,-1),v={cmIndex:n,optIndex:-1},i.appendTo(document.body),u(n),r(n),o&&e.search.input.on("input",function(){y(n+1),T(n),u(n),r(n,!0,!1)}).focus()}function o(e,n,t){var o=w(e);n>=o.length?n=0:n<0&&(n=o.length-1);for(var i,s=n;i=s,void 0!==(i=l(e,!1)[i]).separator||void 0!==i.disabled&&i.disabled;){if((s+=t?-1:1)==n)return-1;s>=o.length?s=0:s<0&&(s=o.length-1)}return s}return $(document).on("mousedown.scm contextmenu.scm",".context-menu, .opt-text, .opt-icon, .opt-separator",function(e){e.stopPropagation()}),$(document).on("keydown.scm",function(e){var n,t;"Escape"!=e.key&&27!=e.which||y(),0 http://jaywcjlove.github.io/hotkeys */
2 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).hotkeys=t()}(this,function(){"use strict";var e="undefined"!=typeof navigator&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(m.childNodes),m.childNodes),t[m.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&((e?e.ownerDocument||e:m)!==C&&T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&U.test(t)){(s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=k),o=(l=h(t)).length;while(o--)l[o]="#"+s+" "+xe(l[o]);c=l.join(","),f=ee.test(t)&&ye(e.parentNode)||e}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===k&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[k]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:m;return r!==C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),m!==C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=k,!C.getElementsByName||!C.getElementsByName(k).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+k+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||v.push(".#.+[+~]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",$)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e===C||e.ownerDocument===m&&y(m,e)?-1:t===C||t.ownerDocument===m&&y(m,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===C?-1:t===C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]===m?-1:s[r]===m?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if((e.ownerDocument||e)!==C&&T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=p[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&p(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?k.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?k.grep(e,function(e){return e===n!==r}):"string"!=typeof n?k.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:L.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof k?t[0]:t,k.merge(this,k.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),D.test(r[1])&&k.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(k):k.makeArray(e,this)}).prototype=k.fn,q=k(E);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}k.fn.extend({has:function(e){var t=k(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,""],col:[2,""],tr:[2,""],td:[3,""],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;nx",y.noCloneChecked=!!me.cloneNode(!0).lastChild.defaultValue;var Te=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ee=/^([^.]*)(?:\.(.+)|)/;function ke(){return!0}function Se(){return!1}function Ae(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ne(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ne(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Se;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each(function(){k.event.add(this,t,i,r,n)})}function De(e,i,o){o?(Q.set(e,i,!1),k.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Q.get(this,i);if(1&e.isTrigger&&this[i]){if(r)(k.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Q.set(this,i,r),t=o(this,i),this[i](),r!==(n=Q.get(this,i))||t?Q.set(this,i,!1):n=void 0,r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n}else r&&(Q.set(this,i,k.event.trigger(k.extend(r.shift(),k.Event.prototype),r,this)),e.stopImmediatePropagation())}})):k.event.add(e,i,ke)}k.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.get(t);if(v){n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(ie,i),n.guid||(n.guid=k.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof k&&k.event.triggered!==e.type?k.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(R)||[""]).length;while(l--)d=g=(s=Ee.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=k.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=k.event.special[d]||{},c=k.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),k.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.hasData(e)&&Q.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(R)||[""]).length;while(l--)if(d=g=(s=Ee.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=k.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||k.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)k.event.remove(e,d+t[l],n,r,!0);k.isEmptyObject(u)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=k.event.fix(e),u=new Array(arguments.length),l=(Q.get(this,"events")||{})[s.type]||[],c=k.event.special[s.type]||{};for(u[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,qe=/
164 | //
165 |
166 | wb.go(io.fullpath("/data/embededMarkdeepPreview.html"));
167 | wb.wait("");
168 |
169 |
170 | loadMd = function(path){
171 | if(!path)return;
172 | var str = string.load(path);
173 | if( !..string.isUtf8(str) ) str = string.fromto(str,0,65001);
174 | wb.xcall('initText',str);
175 | }
176 |
177 | import win.ui.menu;
178 | import win.clip.html;
179 | var cbHtml = win.clip.html();
180 |
181 | if(..configMain.openedMDPath && io.exist(..configMain.openedMDPath)){
182 | loadMd(io.exist(..configMain.openedMDPath));
183 | winform.text = "PandaNotes - " + ..configMain.openedMDPath;
184 | }
185 | else {
186 | ..configMain.openedMDPath = null;
187 | winform.text = "PandaNotes - " + "未保存*";
188 | }
189 |
190 |
191 | // 退出程序前让双开的应用退出
192 | import process;
193 | winform.onClose = function(hwnd,message,wParam,lParam){
194 | var result = wb.xcall('saveMD');
195 | saveCall(result);
196 | /*
197 | if(..configMain.openedMDPath){
198 | ..string.save(..configMain.openedMDPath, result);
199 | }
200 | else {
201 | if(winform.msgAsk("是否保存文件?")){
202 | winform.btnSaveMD.oncommand();
203 | }
204 | }
205 | */
206 |
207 | if(..mainForm.enterFromOutside){
208 | if(..mainForm.editPid){
209 | process.kill(..mainForm.editPid);
210 | }
211 | }
212 |
213 | ..mainForm.enterFromDirect = false;
214 | ..mainForm.enterFromOutside = false;
215 | }
216 |
217 | winform.tab.onnotify = function(id,code,ptr){
218 | if(..mainForm.plusleftHwnd){
219 | if(code==0xFFFFFDD9/*_TCN_SELCHANGE*/) {
220 | // 切换tab时触发
221 | winform.tab.redraw();
222 | }
223 | var rect = win.getClientRect(winform.tab.hwnd,true);
224 | win.setRect(..mainForm.plusleftHwnd,rect)
225 | }
226 | }
227 |
228 | winform.wndproc = function(hwnd,message,wParam,lParam){
229 | select( message ) {
230 | case 5/*_WM_SIZE*/{
231 | //调整窗口
232 | if(..mainForm.plusleftHwnd){
233 | var rect = win.getClientRect(winform.tab.hwnd,true)
234 | win.setRect(..mainForm.plusleftHwnd,rect)
235 | winform.tab.redraw();
236 | }
237 | }
238 | else{
239 | }
240 | }
241 | //无返回值则继续调用默认回调函数
242 | }
243 |
244 | winform.onDropFiles = function(files){
245 | import console;
246 | console.log(files[1])
247 |
248 | if(#files = 1){
249 | loadMd(files[1])
250 | }
251 | }
252 |
253 | var markdeepHead = /**
254 |
255 | **/;
256 |
257 | var markdeepHeadJournal = /**
258 |
259 |
260 |
261 | **/;
262 |
263 | var markdeepHeadWebsite = /**
264 |
265 |
266 |
267 | **/;
268 |
269 | var markdeepHeadLatex = /**
270 |
271 |
272 |
273 | **/;
274 |
275 | var markdeepHeadSlide = /**
276 |
277 |
278 |
279 | **/;
280 |
281 | var markdeepTail = /**
282 |
283 |
284 |
285 |
286 | **/;
287 |
288 | var markdeepTailJournal = /**
289 |
290 |
291 |
292 |
293 |
294 | **/;
295 |
296 | var markdeepTailWebsite = /**
297 |
298 |
299 |
300 |
301 |
302 | **/;;
303 |
304 | var markdeepTailLatex = /**
305 |
306 |
307 |
308 | **/;
309 |
310 | var markdeepTailSlide = /**
311 |
312 |
313 |
314 |
315 |
316 | **/;
317 |
318 | var htmlHead = markdeepHead;
319 | var htmlTail = markdeepTail;
320 |
321 | winform.btnSaveHTML.oncommand = function(id,event){
322 | var result = wb.xcall('saveMD');
323 | var sourceCode = string.concat(htmlHead,result,htmlTail);
324 | var path = fsys.dlg.save("HTML文件|*.html||","另存为HTML文件",io.fullpath("/Notes"),winform.hwnd)
325 | if(!path)return;
326 | ..configMain.htmlPath = path;
327 | string.save(path,sourceCode);
328 | var okOrNot = win.msgboxTest("是否查看刚刚保存的网页文件","查看文件");
329 | if(okOrNot){
330 | wb.xcall('exploerHtmls',..configMain.htmlPath);
331 | }
332 | }
333 |
334 | winform.btnSaveMD.oncommand = function(id,event){
335 | var result = wb.xcall('saveMD');
336 | var path = fsys.dlg.save("Markdown文件|*.md|文本文件|*.txt||","另存为Markdown文件|",io.fullpath("/Notes"),winform.hwnd)
337 | if(!path)return;
338 | string.save(path,result);
339 | ..configMain.openedMDPath = path;
340 | winform.text = "PandaNotes - " + ..configMain.openedMDPath;
341 | winform.msgSmile('成功保存markdown文件到'+ path,1000)
342 | }
343 |
344 | // 用户点选菜单项触发此事件,strip参数是点选的控件
345 | menu.onOk = function(strip){
346 | winform.dropdown.setFocus(menu.selText)
347 | select(menu.selText) {
348 | case "默认样式" {
349 | htmlHead = markdeepHead;
350 | htmlTail = markdeepTail;
351 | }
352 | case "日志样式" {
353 | htmlHead = markdeepHeadJournal;
354 | htmlTail = markdeepTailJournal;
355 | }
356 | case "网站样式" {
357 | htmlHead = markdeepHeadWebsite;
358 | htmlTail = markdeepTailWebsite;
359 | }
360 | case "Latex样式" {
361 | htmlHead = markdeepHeadLatex;
362 | htmlTail = markdeepTailLatex;
363 | }
364 | case "幻灯片样式" {
365 | htmlHead = markdeepHeadSlide;
366 | htmlTail = markdeepTailSlide;
367 | }
368 | else {
369 | htmlHead = markdeepHead;
370 | htmlTail = markdeepTail;
371 | }
372 | }
373 | }
374 |
375 | // 切换到弹出列表模式,并使用参数指定的控件处理键盘事件
376 | menu.initPopup(winform.dropdown.editBox)
377 |
378 | // 禁止共享编辑框外观状态(focus状态除外)
379 | winform.dropdown.editState = false
380 | winform.dropdown.skin({
381 | background = { hover = 0xFFF78987 }
382 | checked = {
383 | iconText = '\uF077';
384 | }
385 | })
386 |
387 | // 显示弹出菜单,弹出菜单会自动修改winform.dropdown的checked属性为菜单打开状态
388 | winform.dropdown.oncommand = function(id,event){
389 | if(winform.dropdown.checked ){
390 | menu.selText = winform.dropdown.text
391 | menu.popup(true,winform.dropdown,'up')
392 | }
393 | }
394 |
395 | winform.dropdown.setFocus("默认样式")
396 |
397 |
398 | winform.btnOpenMD.oncommand = function(id,event){
399 | var path = fsys.dlg.open("Markdown文件|*.md|文本文件|*.txt||","打开Markdown文件|",,winform.hwnd)
400 | if(!path)return;
401 | loadMd(path);
402 | ..configMain.openedMDPath = path;
403 | winform.text = "PandaNotes - " + ..configMain.openedMDPath;
404 | winform.msgSmile('已加载markdown文件',1000)
405 | }
406 |
407 | winform.btnOpenHtml.oncommand = function(id,event){
408 | var path = fsys.dlg.open("HTML文件|*.html||","打开HTML文件",,winform.hwnd)
409 | if(!path)return;
410 | wb.xcall('exploerHtmls',path);
411 | }
412 |
413 | import win.ui.tooltip;
414 | //在所有者窗口 winform 上创建 tooltip 提示控件
415 | var tooltipCtrl = win.ui.tooltip( winform );
416 | //添加一个自动模式的控件提示(TOOLINFO 对象,简称 tool )
417 | var toolInfoPlus = tooltipCtrl.addTool(winform.btnSaveHTML,'建议保存在默认的位置,否则格式可能不正确!\n可在打开的html文件中右键,打印为pdf来固定格式' )
418 |
419 | winform.btnNew.oncommand = function(id,event){
420 | var result = wb.xcall('saveMD');
421 | saveCall(result);
422 | ..configMain.openedMDPath = null;
423 | winform.text = "PandaNotes - " + "未保存*";
424 | var str = " ";
425 | wb.xcall('initText',str);
426 | }
427 |
428 | winform.show( 3/*_SW_MAXIMIZE*/ );
429 | win.loopMessage();
430 | return winform;
--------------------------------------------------------------------------------
/dlg/ScreenCapture.aardio:
--------------------------------------------------------------------------------
1 | import fonts.fontAwesome;
2 | import win.ui.tooltip;
3 | import win.ui;
4 | /*DSG{{*/
5 | SCMainForm = win.form(text="PandaNotes";right=959;bottom=639;border="none";clipch=1)
6 | SCMainForm.add(
7 | ColorRevert={cls="plus";left=0;top=264;right=35;bottom=288;align="left";color=3947580;dl=1;dt=1;font=LOGFONT(h=-13);iconStyle={align="left";font=LOGFONT(h=-21;name='FontAwesome');padding={left=8}};iconText='\uF042';notify=1;textPadding={left=25};z=4};
8 | ImgShow={cls="plus";left=40;top=40;right=920;bottom=576;ah=1;aw=1;db=1;dl=1;dr=1;dt=1;notify=1;z=1};
9 | ImgTitle={cls="plus";left=304;top=576;right=656;bottom=618;border={bottom=1;color=-6908266};db=1;dl=0.32;dr=0.32;editable=1;font=LOGFONT(h=-20);textPadding={top=6};z=2};
10 | SelArea={cls="plus";left=0;top=224;right=37;bottom=250;align="left";color=3947580;dl=1;dt=1;font=LOGFONT(h=-13);iconStyle={align="left";font=LOGFONT(h=-20;name='FontAwesome');padding={left=8}};iconText='\uF030';notify=1;textPadding={left=25};z=3};
11 | btnSave={cls="plus";left=0;top=296;right=37;bottom=326;align="left";color=3947580;disabled=1;dl=1;dt=1;font=LOGFONT(h=-13);iconStyle={align="left";font=LOGFONT(h=-21;name='FontAwesome');padding={left=9;top=2}};iconText='\uF0C7';notify=1;z=5};
12 | log={cls="static";text="Ctrl+S即可保存图片并写入剪贴板...";left=8;top=624;right=480;bottom=648;transparent=1;z=6}
13 | )
14 | /*}}*/
15 |
16 | SCMainForm.btnSave.skin({
17 | color={
18 | active=0xFF00FF00;
19 | default=0xFF3C3C3C;
20 | disabled=0xFF6D6D6D;
21 | hover=0xFFFF0000
22 | }
23 | })
24 |
25 | import win.ui.atom
26 | var atom,hwnd = SCMainForm.atom("3C59547B-BD3F-4ED7-9E58-4D0B17EA2D09.ScreenCapture");
27 | if(!atom){
28 | win.show(hwnd)
29 | return win.setForeground(hwnd);
30 | }
31 |
32 | // 应用自绘的窗口标题栏
33 | //import win.ui.simpleWindow3;
34 | //var wndFrame = win.ui.simpleWindow3(SCMainForm,16,38,35,38,0X33000000,0X00000000);
35 | import win.ui.simpleWindow;
36 | var wndFrame = win.ui.simpleWindow(SCMainForm,16,38,35,38);
37 | wndFrame.skin(
38 | background = {
39 | hover = 0xff99ffcc;
40 | active = 0xffff6666;
41 | default = 0x00000000;
42 | }
43 | color = {
44 | hover = 0xff666666;
45 | active = 0xffffffff;
46 | default = 0xff000000;
47 | }
48 | )
49 |
50 | SCMainForm.ColorRevert.skin({
51 | color={
52 | active=0xFF00FF00;
53 | default=0xFF3C3C3C;
54 | disabled=0xFF6D6D6D;
55 | hover=0xFFFF0000
56 | }
57 | })
58 |
59 | SCMainForm.SelArea.skin({
60 | color={
61 | active=0xFF00FF00;
62 | default=0xFF3C3C3C;
63 | disabled=0xFF6D6D6D;
64 | hover=0xFFFF0000
65 | }
66 | })
67 |
68 | SCMainForm.ImgShow.onDrawContent = function(graphics,rc,txtColor,rcContent,foreColor){
69 | if(..tmpBmp){
70 | graphics.drawImageRect(..tmpBmp,SCMainForm.ImgShow.width/2-..tmpBmpWidth/2,SCMainForm.ImgShow.height/2-..tmpBmpHeight/2,..tmpBmpWidth,..tmpBmpHeight)
71 | }
72 | }
73 |
74 | SCMainForm.SelArea.oncommand = function(id,event){
75 | SCMainForm.show(false);
76 | //balloonTipCtrl.trackPopup(false)
77 | //SCMainForm.hitMin();
78 |
79 | //截屏函数
80 | var tmpHwnd = win.getDesktop();
81 | import mouse.screenArea;
82 | var screenArea = mouse.screenArea(tmpHwnd);
83 | screenArea.onSelectionChanged = function(rc){
84 | import gdip.snap;
85 | var bmp = gdip.snap(screenArea.hwnd,rc.xywh());
86 | ..tmpBmp = bmp.clone();
87 | ..tmpBmpWidth = bmp.width;
88 | ..tmpBmpHeight = bmp.height;
89 | SCMainForm.ImgShow.background = 0xFFF0F0F0; //Clear Background
90 | SCMainForm.ImgShow.x = SCMainForm.ImgShow.width/2-..tmpBmpWidth/2;
91 | SCMainForm.ImgShow.y = SCMainForm.ImgShow.height/2-..tmpBmpHeight/2;
92 | SCMainForm.ImgShow.setForeground(bmp);
93 | owner.close();
94 | }
95 | screenArea.doModal();
96 |
97 | SCMainForm.ImgTitle.text = string.random(16);
98 | SCMainForm.btnSave.disabled = false;
99 |
100 | SCMainForm.show(true)
101 | SCMainForm.redraw();
102 | win.setForeground(SCMainForm.hwnd);
103 | win.setActive(SCMainForm.hwnd)
104 | win.setFocus(SCMainForm.ImgTitle.hwnd)
105 | }
106 |
107 | SCMainForm.ColorRevert.oncommand = function(id,event){
108 | import gdip.imageAttributes;
109 | var attr = gdip.imageAttributes();
110 | attr.setColorMatrix({
111 | -1;0;0;0;0;
112 | 0;-1;0;0;0;
113 | 0;0;-1;0;0;
114 | 0;0;0;1;0;
115 | 1;1;1;0;1
116 | })
117 | ..tmpBmp = ..tmpBmp.copy(attr);
118 | SCMainForm.ImgShow.background = 0xFFF0F0F0; //Clear Background
119 | SCMainForm.ImgShow.foreground = null;
120 | SCMainForm.ImgShow.redraw();
121 | }
122 |
123 | SCMainForm.wndproc = function(hwnd,message,wParam,lParam){
124 | select( message ) {
125 | case 0x20A/*_WM_MOUSEWHEEL*/{
126 | //获取鼠标滚轮的方向以改变图片大小
127 | var fwKeys,delta = win.getMessagePos(wParam);
128 | var ratio = (SCMainForm.ImgShow.width*SCMainForm.ImgShow.height)/(SCMainForm.width*SCMainForm.height)*1;
129 | if(..tmpBmp){
130 | if(delta<0){
131 | ..tmpBmpWidth = ..tmpBmpWidth*ratio;
132 | ..tmpBmpHeight = ..tmpBmpHeight*ratio;
133 | }
134 | else {
135 | ..tmpBmpWidth = ..tmpBmpWidth/ratio;
136 | ..tmpBmpHeight = ..tmpBmpHeight/ratio;
137 | }
138 | }
139 | SCMainForm.ImgShow.background = 0xFFF0F0F0; //Clear Background
140 | SCMainForm.ImgShow.foreground = null;
141 | SCMainForm.ImgShow.redraw();
142 | }
143 | case 5/*_WM_SIZE*/{
144 | //窗口尺寸改变后重绘图片
145 | SCMainForm.ImgShow.background = 0xFFF0F0F0; //Clear Background
146 | SCMainForm.ImgShow.foreground = null;
147 | SCMainForm.ImgShow.redraw();
148 | SCMainForm.redraw();
149 | }
150 | else{
151 | }
152 | }
153 | //无返回值则继续调用默认回调函数
154 | }
155 |
156 | SCMainForm.beforeShowWindow = function(shown,status){
157 | if(..tmpBmp){
158 | SCMainForm.ImgShow.background = 0xFFF0F0F0; //Clear Background
159 | SCMainForm.ImgShow.x = SCMainForm.ImgShow.width/2-..tmpBmp.width/2;
160 | SCMainForm.ImgShow.y = SCMainForm.ImgShow.height/2-..tmpBmp.height/2;
161 | SCMainForm.ImgShow.setForeground(bmp);
162 | SCMainForm.ImgShow.redraw();
163 | }
164 | }
165 |
166 | /*
167 | import key.hotkey;
168 | var superHotkey = key.hotkey(SCMainForm);
169 | superHotkey.reg(
170 | "CTRL","ALT","A",
171 | SCMainForm.SelArea.oncommand
172 | )
173 | */
174 |
175 | /*
176 | var hkId;
177 | SCMainForm.settings.oncommand = function(id,event){
178 | //删除之前注册的热键,hkId如果是null空值,此函数可忽略不做任何操
179 | SCMainForm.unreghotkey(hkId);
180 |
181 | //重新注册系统热键;
182 | hkId = SCMainForm.reghotkey(SCMainForm.SelArea.oncommand
183 | //winform.hotkeyShow.gethotkey()刚好返回2个值对应最后两个参数
184 | ,SCMainForm.hotkeyShow.gethotkey()
185 | );
186 | }
187 | */
188 |
189 | // ToolTips设置
190 | import win.ui.tooltip;
191 | SCMainForm.tooltipCtrl = win.ui.tooltip( SCMainForm );//在窗口上创建tooltip控件
192 | SCMainForm.tooltipCtrl.add(
193 | ColorRevert = "点击反色";
194 | SelArea = "点击截图";
195 | )
196 |
197 | SCMainForm.btnSave.oncommand = function(id,event){
198 | var bmp = ..tmpBmp.clone();
199 | var savePath = string.concat("/Notes/Pics/",SCMainForm.ImgTitle.text,".png");
200 | if(io.exist("/Notes/Pics")){
201 | bmp.save(savePath);
202 | }
203 | else {
204 | io.createDir("/Notes/Pics")
205 | bmp.save(savePath);
206 | }
207 |
208 | //var ImgPath = io.fullpath(savePath);
209 | var ImgPath = string.concat("../Notes/Pics/",SCMainForm.ImgTitle.text,".png");
210 | var mdImgPath = string.format("![Figure [states]: %s](%s)",SCMainForm.ImgTitle.text,ImgPath);
211 | import win.clip;
212 | //win.clip.write(mdImgPath,"no");
213 | win.clip.writeBitmap(bmp.copyHandle());
214 | //SCMainForm.msgOk('图片已保存到/Notes/Pics文件夹\n在编辑器中粘贴Ctrl+V即可预览!',1000);
215 | SCMainForm.log.text = string.concat('图片< ',SCMainForm.ImgTitle.text,' >已保存到/Notes/Pics文件夹,剪贴板已写入图像!');
216 | }
217 |
218 | SCMainForm.onClose = function(hwnd,message,wParam,lParam){
219 | SCMainForm.show(false);
220 | return true;
221 | }
222 |
223 | //设置窗口缩放范围
224 | import win.ui.minmax;
225 | win.ui.minmax(SCMainForm);
226 |
227 | import win.ui.accelerator;
228 | var accelerator = win.ui.accelerator({
229 |
230 | {
231 | ctrl = true; vkey = 'S'#;
232 | oncommand = function() SCMainForm.btnSave.oncommand();
233 | };
234 |
235 | },SCMainForm );
236 |
237 | import win.dlg.message;
238 | var msgDlg = win.dlg.message(SCMainForm);
239 |
240 | //SCMainForm.show();
241 | win.loopMessage();
242 | return SCMainForm;
--------------------------------------------------------------------------------
/dlg/markdeepPreview.aardio:
--------------------------------------------------------------------------------
1 | import win.ui;
2 | /*DSG{{*/
3 | var winform = win.form(text="Markdown编辑器";right=759;bottom=469)
4 | winform.add()
5 | /*}}*/
6 |
7 | winform.show();
8 | win.loopMessage();
9 | return winform;
10 |
--------------------------------------------------------------------------------
/lib/config.aardio:
--------------------------------------------------------------------------------
1 | //config 配置文件
2 | import fsys.config;
3 | config = fsys.config("/config/");
4 | //config = fsys.config( io.appData("/软件作者/应用程序名/") );
5 |
6 | //不需要序列化的配置名字前请添加下划线
7 | namespace config {
8 | __appName = "应用程序名";
9 | __website = "http://www.aardio.com/";
10 | }
11 |
12 | /**intellisense(config)
13 | __appName = 应用程序名
14 | __website = 官方网站
15 | saveAll() = 写入所有配置到文件
16 | ? = 获取值时指定不以下划线开始的配置表名称,\n返回一个可自动序列化到同名配置文件的表对象。\n如果此对象名以下划线开始,则可以正常读写值不会序列化为配置文件。\n否则不能对此对象直接赋值,只能对配置表对象的成员赋值。\n\n配置表可自动自文件加载,退出线程前自动序列化并存入文件。\n仅序列化以字符串、数值为键的元素,\n仅序列化值为字符串、数值、buffer 以及定义了 _serialize 元方法的成员。\n循环引用的值转换为 null,序列化时忽略成员函数\n!fsys_table.
17 | end intellisense**/
--------------------------------------------------------------------------------
/main.aardio:
--------------------------------------------------------------------------------
1 | import fonts.fontAwesome;
2 | import win.ui;
3 | /*DSG{{*/
4 | mainForm = win.form(text="PandaNotes";right=183;bottom=175;border="none";clipch=1;edge=1)
5 | mainForm.add(
6 | btnCapture={cls="plus";left=24;top=120;right=56;bottom=152;align="left";bgcolor=-5197169;border={radius=30};font=LOGFONT(h=-16);iconStyle={align="left";font=LOGFONT(h=-21;name='FontAwesome');padding={left=3;top=3}};iconText='\uF0DB';notify=1;textPadding={left=39};z=5};
7 | btnClose={cls="plus";left=152;top=0;right=184;bottom=32;align="left";border={radius=30};font=LOGFONT(h=-13);iconStyle={align="left";font=LOGFONT(h=-21;name='FontAwesome');padding={left=6;top=2}};iconText='\uF00D';notify=1;textPadding={left=39};z=1};
8 | btnDocs={cls="plus";text="按钮";left=80;top=140;right=112;bottom=172;align="left";bgcolor=-5197169;border={radius=30};font=LOGFONT(h=-13);iconStyle={align="left";font=LOGFONT(h=-21;name='FontAwesome');padding={left=3;top=3}};iconText='\uF044';notify=1;textPadding={left=39};z=6};
9 | btnSettings={cls="plus";left=143;top=113;right=175;bottom=145;align="left";bgcolor=-5197169;border={radius=30};font=LOGFONT(h=-16);iconStyle={align="left";font=LOGFONT(h=-23;name='FontAwesome');padding={left=3;top=3}};iconText='\uF013';notify=1;textPadding={left=39};z=3};
10 | btnSnap={cls="plus";left=0;top=72;right=32;bottom=104;align="left";bgcolor=-5197169;border={radius=30};font=LOGFONT(h=-16);iconStyle={align="left";font=LOGFONT(h=-18;name='FontAwesome');padding={left=3;top=3}};iconText='\uF030';notify=1;textPadding={left=39};z=2};
11 | btnTopmost={cls="plus";left=8;top=8;right=40;bottom=40;align="left";bgcolor=-5197169;border={radius=30};font=LOGFONT(h=-16);iconStyle={align="left";font=LOGFONT(h=-21;name='FontAwesome');padding={left=6;top=3}};iconText='\uF08D';notify=1;textPadding={left=39};z=4};
12 | plus={cls="plus";left=32;top=8;right=160;bottom=136;notify=1;z=7}
13 | )
14 | /*}}*/
15 |
16 | import win.ui.atom
17 | var atom,hwnd = mainForm.atom("89CC4142-AFEA-45F4-BA51-797847C63768.CardNote");
18 | if(!atom){
19 | win.show(hwnd)
20 | return win.setForeground(hwnd);
21 | }
22 | /*
23 | 遮罩与对应代码
24 | */
25 | import winex;
26 | import mouse;
27 | import process;
28 | import process.wmi;
29 | import win.ui.mask;
30 | var frmMask = win.ui.mask(mainForm);
31 |
32 | import fsys.table;
33 | configMain = fsys.table("/data/settingMain.table");
34 | if(!io.exist("/Notes/Pics")){
35 | io.createDir("/Notes/Pics")
36 | }
37 | mainForm.editPid = null;
38 | mainForm.enterFromDirect = false;
39 | mainForm.enterFromOutside = false;
40 | if(!configMain.chkHex){
41 | configMain.chkHex = true;
42 | }
43 |
44 | var numberToString = function(num){
45 | if(configMain.chkHex) return string.format("0x%X",num );
46 | return tostring(num)
47 | }
48 |
49 | var getParentHwnd = function(){
50 | return tonumber(configMain.editParenHwnd,configMain.chkHex?16:10)
51 | }
52 |
53 | var getOwnerHwnd = function(){
54 | return tonumber(configMain.editOwnerHwnd,configMain.chkHex?16:10)
55 | }
56 | var validPattern = function(str){
57 | if(!#str) return "";
58 |
59 | var mbs = string.match(str,"[\s\w]*:+[\s\w]*")
60 | if(#mbs)
61 | return mbs;
62 |
63 | str = string.replace(str,"(\p)","\\\1")
64 | str = string.replace(str,"\x+",function(str){
65 | if(..string.find(str,"\d") ) return "\x+"
66 | return str;
67 | } )
68 |
69 | str = string.replace(str,"\d+","\\d+")
70 | return str;
71 | }
72 |
73 | /*
74 | 主窗口图标样式
75 | */
76 | mainForm.btnSnap.skin({
77 | background={
78 | default=0xFF9ACD32;
79 | disabled=0x00CCCCCC;
80 | hover=0xFFFFFFFF;
81 | };
82 | color={
83 | default=0xFF000000;
84 | disabled=0xFF6D6D6D;
85 | hover=0xFFFF0000;
86 | }
87 | })
88 |
89 | mainForm.btnCapture.skin({
90 | background={
91 | default=0xFF9ACD32;
92 | disabled=0x00CCCCCC;
93 | hover=0xFFFFFFFF;
94 | };
95 | color={
96 | default=0xFF000000;
97 | disabled=0xFF6D6D6D;
98 | hover=0xFFFF0000;
99 | }
100 | })
101 |
102 | mainForm.btnTopmost.skin({
103 | background={
104 | default=0xFF9ACD32;
105 | disabled=0x00CCCCCC;
106 | hover=0xFFFFFFFF;
107 | };
108 | color={
109 | default=0xFF000000;
110 | disabled=0xFF6D6D6D;
111 | hover=0xFFFF0000;
112 | }
113 | })
114 |
115 | mainForm.btnSettings.skin({
116 | background={
117 | default=0xFF9ACD32;
118 | disabled=0x00CCCCCC;
119 | hover=0xFFFFFFFF;
120 | };
121 | color={
122 | default=0xFF000000;
123 | disabled=0xFF6D6D6D;
124 | hover=0xFFFF0000;
125 | }
126 | })
127 |
128 | mainForm.btnClose.skin({
129 | background={
130 | default=0xFF9ACD32;
131 | disabled=0x00CCCCCC;
132 | hover=0xFFFF0000;
133 | };
134 | color={
135 | default=0xFF000000;
136 | disabled=0xFF6D6D6D
137 | }
138 | })
139 |
140 | mainForm.btnDocs.skin({
141 | background={
142 | default=0xFF9ACD32;
143 | disabled=0x00CCCCCC;
144 | hover=0xFFFFFFFF;
145 | };
146 | color={
147 | default=0xFF000000;
148 | disabled=0xFF6D6D6D;
149 | hover=0xFFFF0000;
150 | }
151 | })
152 |
153 | import win.ui.layered;
154 | win.ui.layered(mainForm);
155 |
156 | mainForm.plus.skin({
157 | background = {
158 | default = "\res\panda.png";
159 | }
160 | })
161 | //mainForm.btnTopmost.border = {radius=-1}
162 | tmpBmp = null;
163 | tmpBmpWidth= null;
164 | tmpBmpHeight= null;
165 |
166 | mainForm.plus.onMouseDown = function(wParam,lParam){
167 | mainForm.hitCaption(); //允 许点击图标拖动
168 | }
169 |
170 | mainForm.btnClose.oncommand = function(id,event){
171 | mainForm.close();// 点击关闭
172 | }
173 |
174 | mainForm.btnTopmost.onStateChange = function(state){
175 | if(mainForm.btnTopmost.checked){
176 | win.setTopmost(mainForm.hwnd,true)
177 | mainForm.btnTopmost.iconColor = 0xFFFF0000;
178 | }
179 | else {
180 | win.setTopmost(mainForm.hwnd,false)
181 | mainForm.btnTopmost.iconColor = 0xFF000000;
182 | }
183 | }
184 |
185 | /*
186 | ToolTips设置
187 | */
188 | import win.ui.tooltip;
189 | mainForm.tooltipCtrl = win.ui.tooltip( mainForm );//在窗口上创建tooltip控件
190 | mainForm.tooltipCtrl.add(
191 | btnClose = "关闭应用";
192 | btnTopmost = "置顶";
193 | btnSettings = "设置";
194 | btnCapture = "双栏浏览";
195 | btnSnap = "截图";
196 | btnDocs = "记笔记"
197 | )
198 |
199 | var frmChildSC = mainForm.loadForm("\dlg\ScreenCapture.aardio");
200 |
201 | mainForm.btnSnap.oncommand = function(id,event){
202 | // 截屏函数
203 | var tmpHwnd = win.getDesktop();
204 | import mouse.screenArea;
205 | var screenArea = mouse.screenArea(tmpHwnd);
206 | screenArea.onSelectionChanged = function(rc){
207 | import gdip.snap;
208 | var bmp = gdip.snap(screenArea.hwnd,rc.xywh());
209 | ..tmpBmp = bmp.clone();
210 | ..tmpBmpWidth = bmp.width;
211 | ..tmpBmpHeight = bmp.height;
212 | owner.close();
213 | }
214 | screenArea.doModal();
215 | //win.setTopmost(screenArea.hwnd)
216 | frmChildSC.ImgTitle.text = string.random(16);
217 | frmChildSC.btnSave.disabled = false;
218 | frmChildSC.show();
219 | win.setFocus(frmChildSC.ImgTitle.hwnd)
220 | }
221 |
222 |
223 | /*
224 | 鼠标捕获并打开双栏
225 | */
226 |
227 | // 窗口信息获取函数
228 | import process.admin;
229 | import process.cmdline;
230 | import raw.pefile;
231 | function getWindowInfo(hwnd){
232 | configMain.editParenHwnd = numberToString(win.getParent(hwnd));
233 | configMain.editOwnerHwnd = numberToString(win.getOwner(hwnd));
234 | configMain.editHwnd = numberToString(hwnd);
235 | configMain.editClass = win.getClass(hwnd)
236 | configMain.editId = win.getId(hwnd);
237 | configMain.chkUnicodeWindow = winex.isUnicode(hwnd);
238 | configMain.editHwnd = numberToString(win.getRoot(hwnd))
239 |
240 | var tid,pid = win.getThreadProcessId(hwnd)
241 | configMain.editTid,mainForm.editPid = (tid),(pid);
242 | configMain.editPath = process.cmdline(pid);
243 |
244 |
245 | var prcs = process(pid,0x400/*_PROCESS_QUERY_INFORMATION*/|0x10/*_PROCESS_VM_READ*/);
246 | if(prcs){
247 | configMain.lbProcessInfo = ((_WIN_64 && !prcs.isWow64()) ? "64位" : "32位")
248 | + "/" + (process.admin.isRunAs(prcs) ? "管理权限" : "普通权限");
249 |
250 | var pid = prcs.getParentId();
251 | configMain.editParentPid = pid;
252 |
253 | var path = prcs.getPath();
254 |
255 | if(path && io.exist(path) ){
256 | if(path!=mainForm.currentPePath){
257 | var pe = raw.pefile(path);
258 | if(pe && pe.getClrHeader()){
259 | configMain.btnIlSpy = false;
260 | }
261 | else {
262 | configMain.btnIlSpy = true;
263 | }
264 | }
265 | }
266 | else {
267 | configMain.btnIlSpy = true;
268 | }
269 |
270 | mainForm.currentPePath = path;
271 |
272 | prcs.free();
273 | }
274 | else {
275 | configMain.btnIlSpy = true;
276 | }
277 |
278 |
279 | var str = winex.getText(hwnd,50);
280 | if(#str){
281 | configMain.editText = string.replace(str,"[\r\n]","")
282 | }
283 | else {
284 | configMain.editText = "";
285 |
286 | if( hwnd != mainForm.lastSpyHwnd
287 | && configMain.chkPassword
288 | && configMain.editClass == "Edit"
289 | && ..win.getStyle(hwnd,0x40000000/*_WS_CHILD*/)
290 | && !..win.isChild(mainForm.hwnd,hwnd) ){
291 | var tid,pid = win.getThreadProcessId(hwnd)
292 | var tid2,pid2 = win.getThreadProcessId(mainForm.hwnd);
293 | if( pid2 != pid ){
294 | var prcs = process( pid )
295 | if(prcs){
296 | var tid,pid = win.getThreadProcessId(hwnd);
297 | var prcs = process( pid );
298 | var getWindowText = prcs.remoteApi("int(addr hwnd,ustring& lpString,int cch)" ,"User32.dll","GetWindowTextW" )
299 | if(getWindowText){
300 | var len,str = getWindowText(hwnd,100,50);
301 | if(len) configMain.editText = str;
302 | }
303 | prcs.free();
304 | }
305 | }
306 | }
307 | }
308 |
309 | configMain.editStyle = numberToString(win.getStyle(hwnd) );
310 | configMain.editStyleEx = numberToString(win.getStyleEx(hwnd) );
311 |
312 | var x,y = mouse.getPos();
313 | x,y = win.toClient(hwnd,x,y);
314 | configMain.editPoint = ..string.format("%d,%d",x,y)
315 |
316 | //mainForm.showSampleCode();
317 | mainForm.getToplevelWinHwnd();
318 | mainForm.lastSpyHwnd = hwnd;
319 | }
320 |
321 | var validPattern = function(str){
322 | if(!#str) return "";
323 |
324 | var mbs = string.match(str,"[\s\w]*:+[\s\w]*")
325 | if(#mbs)
326 | return mbs;
327 |
328 | str = string.replace(str,"(\p)","\\\1")
329 | str = string.replace(str,"\x+",function(str){
330 | if(..string.find(str,"\d") ) return "\x+"
331 | return str;
332 | } )
333 |
334 | str = string.replace(str,"\d+","\\d+")
335 | return str;
336 | }
337 |
338 | //获取顶层窗口
339 | mainForm.getToplevelWin = function(hwnd){
340 | var tmpHwnd = hwnd;
341 | // 如果本身父窗口是0x0,那么显示本身;否则进行迭代找到父窗口是0x0的窗口
342 | if(win.getParent(tmpHwnd)){
343 | while(win.getParent(tmpHwnd)){
344 | tmpHwnd = win.getParent(tmpHwnd);
345 | getWindowInfo(tmpHwnd);
346 | }
347 | }
348 | else {
349 | getWindowInfo(tmpHwnd);
350 | }
351 | }
352 |
353 | mainForm.getToplevelWinHwnd = function(){
354 | var hwnd = tonumber(configMain.editHwnd);
355 | if(!hwnd) return;
356 |
357 | if( !win.getParent(hwnd) ){
358 | if( win.getOwner(hwnd) ){
359 | configMain.doubleCols = string.format("winex.waitEx(%d,,""%s"",""%s"")",
360 | win.getOwner(hwnd),validPattern(win.getClass(hwnd)),validPattern(winex.getText(hwnd,50)));
361 | }
362 | else {
363 | configMain.doubleCols = string.format("winex.waitVisible(""%s"",,""%s"")",
364 | validPattern(winex.getText(hwnd,50)),validPattern(win.getClass(hwnd)));
365 | }
366 | }
367 | }
368 |
369 |
370 | // 修饰鼠标表现
371 | import win.cur;
372 | var hCursor = win.cur.loadfile("\res\spy.cur") ;
373 | mainForm.btnCapture.onMouseDown = function(wParam,lParam){
374 | win.cur.beginCur();
375 | mainForm.btnCapture.capture = true; //激活全局鼠标捕获
376 | mainForm.lastSpyHwnd = null;
377 | }
378 | // 抬起捕获鼠标
379 |
380 | // 子窗口
381 | var DoubleColsmainForm = win.form(text="CardNotes";right=128;bottom=128;)
382 | DoubleColsmainForm.show(false);
383 |
384 | mainForm.btnCapture.onMouseUp = function(wParam,lParam){
385 | mainForm.enterFromOutside = true;
386 |
387 | mainForm.btnCapture.capture = false;
388 | win.cur.endCur();
389 | frmMask.show(false);
390 | plusleftHwnd = eval(configMain.doubleCols);
391 | mainForm.plusleftHwnd = plusleftHwnd;
392 | var frmDoubleCols = DoubleColsmainForm.loadForm("\dlg\DoubleColsWebview2.aardio");
393 | //var frmDoubleCols = DoubleColsmainForm.loadForm("\dlg\DoubleColsWeblayout.aardio");
394 | frmDoubleCols.show(3/*_SW_MAXIMIZE*/);
395 | }
396 |
397 | // 设置窗口回调,监控鼠标捕获开始事件
398 | var hwndTarget;
399 | tmid = mainForm.setInterval(
400 | function(hwnd,msg,id,tick){
401 | if ( win.cur.beginning ){
402 | var cwp = 0;
403 | cwp = cwp | 0x0001/*_CWP_SKIPINVISIBLE*/ | 0x0004/*_CWP_SKIPTRANSPARENT*/ | 0x0002/*_CWP_SKIPDISABLED*/;
404 | var x,y = mouse.getPos();
405 | hwndTarget = winex.fromPointReal( x,y,cwp );
406 | if( frmMask.moveToWindow(hwndTarget) ){
407 | mainForm.getToplevelWin(hwndTarget);
408 | }
409 | }
410 | },600
411 | )
412 |
413 | mainForm.onClose = function(hwnd,message,wParam,lParam){
414 | DoubleColsmainForm.close();
415 | }
416 | /*
417 | 主窗口开始渲染
418 | */
419 |
420 | mainForm.btnDocs.oncommand = function(id,event){
421 | mainForm.enterFromDirect = true;
422 | var frmDoubleCols = DoubleColsmainForm.loadForm("\dlg\DoubleColsWebview2.aardio");
423 | //var frmDoubleCols = DoubleColsmainForm.loadForm("\dlg\DoubleColsWeblayout.aardio");
424 | frmDoubleCols.show();
425 | }
426 |
427 | mainForm.show();
428 | win.loopMessage();
--------------------------------------------------------------------------------
/res/panda.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YrracOwl/PandaNotes/2637b74b98fb3c64a3384f759f8d44b9ab56d047/res/panda.ico
--------------------------------------------------------------------------------
/res/panda.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YrracOwl/PandaNotes/2637b74b98fb3c64a3384f759f8d44b9ab56d047/res/panda.png
--------------------------------------------------------------------------------
/res/spy.cur:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YrracOwl/PandaNotes/2637b74b98fb3c64a3384f759f8d44b9ab56d047/res/spy.cur
--------------------------------------------------------------------------------