CN103425775A - Method and device for determining corresponding processing according to event collection correlated with webpages - Google Patents

Method and device for determining corresponding processing according to event collection correlated with webpages Download PDF

Info

Publication number
CN103425775A
CN103425775A CN2013103538524A CN201310353852A CN103425775A CN 103425775 A CN103425775 A CN 103425775A CN 2013103538524 A CN2013103538524 A CN 2013103538524A CN 201310353852 A CN201310353852 A CN 201310353852A CN 103425775 A CN103425775 A CN 103425775A
Authority
CN
China
Prior art keywords
event
mouse
events
processing
html
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2013103538524A
Other languages
Chinese (zh)
Inventor
匡文旺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Netqin Technology Co Ltd
Original Assignee
Beijing Netqin Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Netqin Technology Co Ltd filed Critical Beijing Netqin Technology Co Ltd
Priority to CN2013103538524A priority Critical patent/CN103425775A/en
Publication of CN103425775A publication Critical patent/CN103425775A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention provides a method and a device for determining corresponding processing according to an event collection correlated with webpages. One or more event collections respectively consist of one or more events and are respectively correlated with the corresponding processing. The method comprises the following steps of detecting events happening on the webpages; recording all events which are detected to be started but be not ended until the events meeting at least one item of the following conditions exist (i) existing unique processing correlated with the currently-recorded event collection consisting of one or more events; (ii) detecting that the started events end for the first time; determining whether the processing pre-correlated with the event collection exists or not based on the currently-recorded event collection consisting of the one or more events.

Description

Method and apparatus for the incompatible definite respective handling of event set according to relevant to webpage
Technical field
The present invention relates to the Web Page Processing field, relate more specifically to a kind of method and apparatus for the incompatible definite respective handling of event set according to relevant to webpage.
Background technology
In society, internet has been important component part indispensable in social life, particularly web page browsing, has become people's requisite part in productive life.Therefore, how to facilitate, to the user, provide the webpage with required function just to become pendulum important topic before eyes accurately and quickly.
Particularly, it is more common in webpage, using shortcut (combination) to complete specific function.For example, shortcut combination as known as the Windows user " Ctrl+C " is generally used for copying appointed object (text, file etc.).For example,, in the situation that the part text in choosing current web page is used " Ctrl+C " this part text can be copied in the buffer zone of system, for example, for after a while this part text being pasted to other place, in the input field of search and webpage.Again for example, in Windows operating system, shortcut " F1 " is generally used for guiding " help " interface, and " F2 " is generally used for file rename etc.Again for example, in the webpage provided at number of site, pressing directionkeys " ← " can be so that browser return back to previous webpage, can for example, so that browser (be turned to next webpage and press directionkeys " → ", in the website of reading novel, the last chapter of the normally current reading novel of previous webpage chapters and sections, and next webpage next chapter normally).
At present, for the functions of shortcut key in webpage, usually be all to create some by the webpage development personnel for example, to realize with the corresponding event (, pressing keyboard (keydown) event) of " DOM Document Object Model " (hereinafter, referred to as " DOM ") element temporarily.Below, be given in webpage a simple examples that realizes shortcut (combination).In this example, by following example JavaScript (hereinafter, sometimes referred to as " the JS ") code embedded in webpage, realize ejecting a warning window when pressing " F " key, with the prompting user, supress the F key.
Figure BDA0000366340780000021
Yet the problem that this class shortcut is realized is the following aspects.
If 1 exists a plurality of shortcut combinations, if for example there are " Ctrl+1 " and " Ctrl+1+2 " these two shortcut combinations, the user is actual while pressing " Ctrl+1+2 ", can trigger two functions corresponding with shortcut combination " Ctrl+1 " and " Ctrl+1+2 " difference simultaneously, thereby false triggering occur.In addition, if the user is in the process of pressing " Ctrl+1+2 ", at first supress " Ctrl ", then in the process of pinning " Ctrl ", first supress " 1 " rather than " 2 " or " 1 " and " 2 " does not press simultaneously, the function corresponding with " Ctrl+1 " that likely caused false triggering, and cause browser to finish the detection of shortcut, make shortcut combination " Ctrl+1+2 " not be identified and and then its corresponding function be not triggered.
2, can not in webpage, arrange with the default shortcut of browser and combine identical shortcut combination.For example, if the user wants in webpage the function setting of shortcut combination " Ctrl+C " for the text font in webpage is increased, rather than text is copied, and the user designs webpage according to above-mentioned realization, because the default shortcut combination with in browser is identical, the specific implementation that depends on browser, may cause occurring the uncertain consequences such as shortcut key collision (inefficacy) or the difference in functionality corresponding with shortcut all are performed.
Summary of the invention
Therefore, the invention provides a kind of method and apparatus of determining respective handling for the event according on webpage.
The method of the incompatible definite respective handling of event set that a kind of basis is relevant to webpage is provided according to a first aspect of the invention.One or more event sets consist of one or more events respectively, and described one or more event sets are associated with alignment processing respectively.Described method comprises: detect event on described webpage; Record all detecting and start and unclosed event still, until in meeting the following conditions at least one: the unique processing that (i) exists the event sets that forms with one or more events by current record to be associated; (ii) end of the event started detected first; And the event sets that forms of the one or more events based on by current record, determine whether to exist and the associated processing in advance of described event sets.
In certain embodiments, each event includes two HTML events, and described two HTML events correspond respectively to beginning and the end of corresponding event.
In certain embodiments, described HTML event comprises: KeyEvent, mouse event, window events, list event or media event.
In certain embodiments, starting of described KeyEvent is to push button, and the end of described KeyEvent is to unclamp button.
In certain embodiments, starting of described mouse event is to press mouse button, and the end of described mouse event is to unclamp mouse button.
In certain embodiments, starting of described mouse event is that mouse is moved on designed element, and the end of described mouse event is that mouse is removed from described designed element.
In certain embodiments, starting of described mouse event is the item clicked of pressing on touch-screen, and the end of described mouse event is the item clicked unclamped on described touch-screen.
In certain embodiments, the processing be associated with described event sets comprises at least one item in User Defined processing and browser default process.
In certain embodiments, in described User Defined processing and the simultaneous situation of described browser default process, described User Defined is processed can specify the execution that whether stops described browser default process.
In certain embodiments, for supporting in described webpage, have the one or more processing that are associated with same event sets by one or more DOM elements of event, described one or more processing are corresponding respectively with described one or more DOM elements.
The device of the incompatible definite respective handling of event set that a kind of basis is relevant to webpage is provided according to a second aspect of the invention.One or more event sets consist of one or more events respectively, and described one or more event sets are associated with alignment processing respectively.Described device comprises: detecting unit, for detection of event on described webpage; Record cell, start and unclosed event still for recording all detecting, until in meeting the following conditions at least one: the unique processing that (i) exists the event sets that forms with one or more events by current record to be associated; (ii) end of the event started detected first; And determining unit, the event sets formed for the one or more events based on by current record, determine whether to exist and the associated processing in advance of described event sets.
In certain embodiments, each event includes two HTML events, and described two HTML events correspond respectively to beginning and the end of corresponding event.
In certain embodiments, described HTML event comprises: KeyEvent, mouse event, window events, list event or media event.
In certain embodiments, starting of described KeyEvent is to push button, and the end of described KeyEvent is to unclamp button.
In certain embodiments, starting of described mouse event is to press mouse button, and the end of described mouse event is to unclamp mouse button.
In certain embodiments, starting of described mouse event is that mouse is moved on designed element, and the end of described mouse event is that mouse is removed from described designed element.
In certain embodiments, starting of described mouse event is the item clicked of pressing on touch-screen, and the end of described mouse event is the item clicked unclamped on described touch-screen.
In certain embodiments, the processing be associated with described event sets comprises at least one item in User Defined processing and browser default process.
In certain embodiments, in described User Defined processing and the simultaneous situation of described browser default process, described User Defined is processed can specify the execution that whether stops described browser default process.
In certain embodiments, for supporting in described webpage, have the one or more processing that are associated with same event sets by one or more DOM elements of event, described one or more processing are corresponding respectively with described one or more DOM elements.
Technical scheme provided by the invention makes the Web page maker can facilitate, design accurately and quickly the various shortcuts (combination) in webpage, effectively avoid the unexpected shortcut combination of user's false triggering, and only trigger and input corresponding correct function (processing) with the user.In addition, use technical scheme of the present invention, can avoid user-defined shortcut combination and the afoul uncertain consequence of the default shortcut combination of browser.The present invention has facilitated the use of user to webpage, and has solved the problems referred to above of prior art.
The accompanying drawing explanation
By below in conjunction with accompanying drawing explanation the preferred embodiments of the present invention, will make of the present invention above-mentioned and other objects, features and advantages are clearer, wherein:
Fig. 1 shows the example web page according to example embodiment of the present invention.
Fig. 2 shows the example flow diagram according to the method according to the event set incompatible definite respective handling relevant to webpage of example embodiment of the present invention;
Fig. 3 shows the processing of the respective examples when event starts to finish with event in method shown in Fig. 2 according to an embodiment of the invention; And
Fig. 4 shows the example block diagram according to the configuration of the device for method shown in execution graph 2 of example embodiment of the present invention.
Embodiment
In order to make, the reader is clearer thoroughly understands the present invention, will at first briefly introduce the concepts such as HTML involved in the present invention (HTML (Hypertext Markup Language)), DOM (DOM Document Object Model) and JavaScript.
HTML is for describing a kind of language of webpage.The webpage majority of seeing on the internet at present is for example, to write with HTML or its modification (, XHTML etc.).It is a kind of markup language, but not programming language.Html document comprises html tag and plain text.Html tag is the key word (tag name) of having been drawn together by angle brackets, such as<html >,<head > etc.The general paired appearance of html tag, for example<b > and</b >.First label in pair of tag is to start label, and second label is end-tag.End-tag and beginning labels class seemingly, just are added with forward slash ("/"), for example<b before tag name > and</b >.What in addition, the html element element referred to is in all the elements that comprise these two labels that start between label and end-tag.For example, an example html element element is:
<p > this is a paragraph.</p>
Browser is read, is explained by the webpage to writing with HTML (html document) and shown to process webpage.Current all browsers (comprising common browser Safari, UC etc. on Internet Explorer, Firefox common on desk-top computer, Chrome etc. and mobile device) are all supported the HTML standard.
JavaScript is the script for webpage design.Current nearly all html web page all increases function, checking input, communicates etc. with Web server with JavaScript.It is the programming code in can implanted html page, and can be carried out by current nearly all browser.JavaScript supports case mechanism.The operation produced when user and webpage are mutual can be called as event.Event can trigger by the user, also may trigger because the page changes the event that even also has the user can't see (for example, the mutual progress of Ajax changes).In addition, most common events are triggered by user's action, and for example: the user presses mousebutton, just produce (click) event of click; Chain if mouse pointer moves to, just produce mouse-over (mouseover) event etc.In JavaScript, event often supports the use with button.onrelease.
The HTML event allows the different event processor (event handler) that the JavaScript registration is relevant to element in html document.Event model is in addition standardized in DOM rank 2 by W3C.In the context of the present invention, the event relevant to webpage generally includes following several event: KeyEvent, mouse event, window events, list event or media event etc., these events generally include with beginning and the end of event distinguishes two corresponding HTML events.
In certain embodiments, starting of KeyEvent is to push button, and its end is to unclamp button, and these two actions correspond respectively to HTML event " onkeydown " and " onkeyup ".
In certain embodiments, starting of mouse event is to press mouse button, and its end is to unclamp mouse button, and these two actions correspond respectively to HTML event " onmousedown " and " onmouseup ".In further embodiments, starting of mouse event is that mouse is moved on designed element, with and to finish be that mouse is removed from this designed element, these two actions correspond respectively to HTML event " onmouseover " and " onmouseout ".In addition, the special mouse event as a class, be also referred to as mouse event for the operation of touch-screen.For example, in other embodiment, starting of mouse (touch-screen) event is the item clicked of pressing on touch-screen, with and to finish be the item clicked unclamped on this touch-screen, these two actions also correspond respectively to HTML event " onmousedown " and " onmouseup ".
In certain embodiments, starting of window events is to load document (" document ") etc., and its end is unloading document etc., and these two actions correspond respectively to HTML event " onload " and " onunload ".In certain embodiments, starting of list event is to become current focus, and its end is to lose current focus, and these two actions correspond respectively to HTML event " onfocus " and " onblur ".Certainly, in further embodiments, the list event also can be conversely, and it starts is to lose current focus, and its end is to become current focus, and these two actions correspond respectively to " onblur " and " onfocus ".In certain embodiments, starting of media event is to start to play media, its end is to stop playing media, and these two actions correspond respectively to HTML event " onplay " (or similar incidents such as " onplaying ") and " onabort " (or similar incidents such as " onpause ").
Please note: the above-mentioned event relevant to webpage and the HTML event comprised thereof are only the use of example explanation, do not represent that the present invention is limited to each event listed above and/or HTML event.In fact, can there is the various events relevant to webpage/HTML event and combination thereof.The present invention is applicable to variety of event/HTML event and combination thereof.
DOM is the standard method how a kind of definition conducts interviews and to process html document.As mentioned above, by JavaScript, the user can the whole html document of reconstruct, and can add, removes, changes or reset the element on the page.And to carry out these access and processing to the element on the page, Javascript just needs to obtain the entrance in html document, each element conducts interviews.This entrance, together with the method that the html element element is added, moves, changes or removes and attribute, all obtain by DOM Document Object Model (DOM).In 1998, W3C issued the DOM standard of the first order.This standard allows each independent element in access and operation html page.At present, all browsers are all followed this standard basically.
After simply introducing HTML, JavaScript and DOM, next, how to use the method according to this invention for explanation intuitively event on webpage or event sets are detected and determine corresponding the processing, below in conjunction with Fig. 1, describe a simple example.The part example HTML code of the example web page shown in Fig. 1 and relevant part example JavaScript code have been provided in appendix A, wherein, succinct and readability for code sample, the JavaScript code will be replaced its partial code by concise and to the point text description, with the design of the embodiments of the invention that help reader more easily to understand.Note that the content in appendix A should be regarded as the part of " embodiment " of the present invention part.
In appendix A, two example files are provided, wherein, the file of by name " hotkeyDemo.html " is the html file corresponding with example web page in accompanying drawing 1, and the file that be called " hotkey.js " be in this html file, quote (embedding) realization the JavaScript file that encapsulates of shortcut class hotkey.In this example, used JavaScript and DOM to come the detection of realization event (set) and determining and carrying out of respective handling.But note that this html file and JavaScript file, only as the use of example explanation, do not represent that the present invention is limited to this, in fact can realize various embodiments of the present invention by various appropriate technology.
Particularly, in this webpage, realized the detection of following composition of matter and determining and carrying out of respective handling.In the present embodiment, composition of matter is three KeyEvent combinations: " Ctrl+1 ", " Ctrl+1+2 " and " 1+2+3 ", when pressing this three shortcut combinations, can show corresponding button character string in webpage.For example as shown in Figure 1, successively supress " Ctrl+1 ", " Ctrl+1+2 " and " 1+2+3 ".Yet in other embodiments, composition of matter can be one or more KeyEvents, mouse event, window events, list event, media event or their combination in any.For example, roll mouse roller when pressing " Ctrl " key, can trigger the font on webpage is zoomed in or out etc.In addition, combine corresponding processing with these shortcuts and also be not limited to show the respective symbols string.In actual applications, may give other functions for these shortcut combinations, for example " Ctrl+1 " is corresponding to jumping to first assigned address etc. in webpage.
In the embodiment shown in fig. 1, in example html file " hotkeyDemo.html ", at first by mark "<script src=" hotkey.js " ></script " embed the JS code file " hotkey.js " realized method of the present invention, then can be in this html file self-defined shortcut.For example, in the present embodiment, by for example following manner, define shortcut combination " Ctrl+1 ":
hotkey("Ctrl+1″,function(){document.getElementById("text").innerHTML+=this.keystring+″″;},true);
In this JS statement, by being invoked at the function hotkey realized in " hotkey.js ", define the shortcut corresponding with " Ctrl+1 " and corresponding function thereof.Particularly, as the character string " Ctrl+1 " of first parameter, be the character string corresponding with the shortcut that will define (combination), between each shortcut in combination, use plus sige ("+") to accord with as connecting (separations).Function definition function () { document.getElementById (" text ") .innerHTML+=this.keystring+ " " as second parameter; It is the function (function, processing etc.) of readjustment when judging aforementioned shortcut at browser and be triggered.In the present embodiment, this function is a simple function, its function is that triggered shortcut is added in the text of page elements that carrys out appointment as domId by " text ", thereby realized showing corresponding character string at the page elements place by " text " appointment when triggering shortcut.Certainly, in other embodiments, other call back functions can be used as second parameter.For example, can use and amplify current font, copy the function (function, processing etc.) such as current selected item.Boolean " true " as the 3rd parameter is the parameter that whether allows the browser default process for arranging.When this parameter being set when " true ", forbid browser when this shortcut (combination) being detected the processing (function, function etc.) of default execution.Otherwise, when this parameter being set for " false " or not during this parameter, allow browser when this shortcut (combination) being detected the processing (function, function etc.) of default execution.In addition, in the situation that allow the browser default process, the execution of this default process can be before user's definition process, during, afterwards or any other suitable time.
In addition, in the present embodiment, which the DOM element for html web page is not specified in the setting of above-mentioned shortcut.But can, for different DOM elements, be the identical or different alignment processing of identical shortcut combination definition in other embodiments of the invention.For example,, for example, for DOM element 1 (, text input frame), can close for key-press of shortcut key group the function that font is amplified in " Ctrl+C " definition, for example, for DOM element 2 (, button), can be the function of this shortcut combination " Ctrl+C " definition change button color simultaneously.
In fact, as shown in code in " hotkey.js " in appendix A, function " hotkey " is also supported the input of quadrinomial parameter, comprise: " domId ", " keystring ", " callfun " and " isPreventDefault ", wherein, " domId " be this shortcut combination expection for the ID of DOM element.
" keystring " combines corresponding character string corresponding to above-mentioned with shortcut, " callfun " corresponding to shortcut, combining corresponding call back function, and " isPreventDefault " corresponding to whether forbid the setting that the browser default action is relevant.In the present embodiment, the default value of parameter " isPreventDefault " is " false ", himself the processing that allows browser to carry out to be associated with shortcut combination defaultly.In other embodiments, the default value of this parameter can be also " true ", according to some other factor, carry out the value of appointment or default value is not set.
Next, with reference to Fig. 3 and the appendix A of the part as method shown in Fig. 2, specifically describe how to confirm and whether correctly press the shortcut combination.In addition, note that the present embodiment only paid close attention to determining of the detection of KeyEvent and alignment processing and carried out, but the invention is not restricted to this.Can determine whether correct trigger event or event sets for aforementioned variety of event and combination in any thereof.
In the present embodiment, confirmation for shortcut is exactly briefly: when pressing all expection keys, if can find the unique functions of shortcut key matched, can carry out this corresponding function, if at this moment find two and plural self-defined functions of shortcut key, when unclamping first key (KeyEvent finishes, or more generally, event finishes) and the self-defined functions of shortcut key that is complementary of the key of all records.
For example, for " Ctrl+1 " and " Ctrl+1+2 " two shortcuts, as mentioned in background technology, in the prior art, when pressing " Ctrl+1 " computer-chronograph, do not know to continue to wait for or the shortcut of execution " Ctrl+1 ".But in an embodiment of the present invention, by etc. confirm the key of all pressing during first key to be released.For example, pin " Ctrl+1 ", at this moment unclamp the shortcut that any one key will be carried out " Ctrl+1 "; And unclamp the shortcut that any one key will be carried out " Ctrl+1+2 " after pinning " Ctrl+1+2 ".Thereby can distinguish in this way different shortcuts.
Particularly, referring to Fig. 3 and appendix A.In the first half of Fig. 3, show about the detection (monitoring) of (keydown) event that pushes button and process.In upper left box, each variable is carried out to initialization.In on and in upper right box, to button, set is processed, and find may be corresponding default shortcut combination.In middle boxes, when the number that may preset the shortcut combination found is greater than 1, enter in the latter half of Fig. 3 the processing of unclamping button (keyup) event of being correlated with.If the number that may preset the shortcut combination found equals 1, carry out and should combine corresponding call back function by default shortcut, and emptying corresponding array.
In Fig. 3 the latter half, unclamp in the processing of button (keyup) event, when button being detected first and unclamp event, judge a plurality of the same number of shortcut combinations that whether exist with the button of pressing of may presetting in the shortcut combination before unclamping button first.If exist, illustrate this shortcut combination be the expection of this button operation for shortcut combine, and carry out corresponding call back function, and empty corresponding array.
In addition, if repeatedly defined identical functions of shortcut key due to Web page maker's error, in the present embodiment, only can carry out the functions of shortcut key of definition for the first time.Certainly, in other embodiments, can only carry out functions of shortcut key last or that once define arbitrarily, or carry out the repeatedly combination in any of all or part function of definition, or repeatedly definition has appearred in the prompting deviser.
Next, illustrate in greater detail code sample with reference to appendix A and Fig. 1.Particularly, be used in combination constructed fuction pattern and prototype pattern in JavaScript and create " hotkey " class, extended attribute on its prototype.
The first step: parameter initialization
As shown in code in appendix A, to import parameter into during the hotkey instantiation, can import the many kinds of parameters combination into, the convenient use.
The parameter (rough explanation has been carried out to parameter in front) that can import into during at first, by detailed description instantiation hotkey class:
DomId: bind the Id of dom element, if do not import or import into wrong ID into, the dom element of default correspondence is " document ";
Keystring: the character string corresponding with the shortcut that will set, for example character string " Ctrl+Alt+z ", be necessary;
Callfun: the function that adjust back is necessary; And
IsPreventDefault: whether stop the default action of browser, acquiescence is false, do not stop (that is, allowing), and, when importing three parameters into, the 3rd parameter is it.
At other embodiment, can sequentially realize similar functions with different parameters and/or different parameters.For example, the order of above-mentioned parameter can be changed, or importation parameter only, or replace above-mentioned parameter by other parameters.Particularly, can for example directly by the array of key code value, replace " keystring " parameter, to realize setting to the shortcut set etc.
Next, according to number and the content of the parameter of importing into when the instantiation of hotkey class, respectively above-mentioned value is carried out to initialization, then judge that whether import value into legal.If illegal, directly return, now this shortcut is set unsuccessful.
Second step: create built-in objects initialization
The configuration that has individual hotkeyArray to deposit shortcut on the Hotkey prototype, the shortcut configuration of each DOM element is left in an object (keycfg object in this example).Identify the shortcut array (array) corresponding from different DOM elements according to domId in hotkeyArray, so just can avoid the functions of shortcut key of different DOM elements to mix.
The Hotkey prototype has two public methods.First method is used for the corresponding keyCode (code corresponding with this button, referred to as " key ") according to the shortcut name lookup, for example: the corresponding key 17 of Ctrl.And second method is used for pushing button (keydown) and unclamping button (keyup) event to corresponding DOM element binding.Refer to the concise and to the point description of corresponding JS code in appendix A.
For object keycfg of every group of key-press of shortcut key group credit union initialization, and deposit it in hotkeyArray[domId] the keyObjectArray array in.
The keycfg object description:
Attribute-name Explanation
keystring Parameter keystring
keycode The keycode array that parameter keystring is corresponding
dom Corresponding dom element
callfun The call back function imported into
isPreventDefault Parameter isPreventDefault
The 3rd step: give DOM element binding keydown and keyup event
In the present embodiment, each dom element is only bound keydown and keyup event, when keydown, first preserves temporary variable and is used for buffer memory and has pressed certain key, and judge accordingly.The button pressed if current coupling hotkeyArray[domId] in certain keycfg object in keyObjectArray, call the callfun function of this keycfg object.Can those temporary variables of preserving when keydown of initialization in the Keyup event.
There is no currentTarget (returning to the element that its event sniffer triggers this event) object in event bubbling Event due to the IE version before Internet Explorer (IE) version 9, therefore we will be according to the id of the element that triggers this event in keydown, namely the domId of our storage inside, search hotkeyArray[domId] object.So for browser compatibility, we import the DOM element of binding in event binding.For example:
dom.addEventListener("keydown″,function(event){keydownhandler(event,dom);},false)
Finally when calling call back function, apply mated keycfg object, to facilitate, use the keycfg object in call back function.
As shown in HTML code file in appendix A, the use of packaged hotkey is very simple, and supports the many shortcut keys binding, and is not limited on single DOM element.For example, in the embodiment of appendix A and accompanying drawing 1, by using simply following code, just can define convenient, fast, exactly three shortcuts:
Figure BDA0000366340780000131
Use embodiments of the invention, can improve greatly code and write efficiency, and make code structure clear and simple and clear.
Fig. 2 shows the process flow diagram according to the method 100 according to the event set incompatible definite respective handling relevant to webpage of the embodiment of the present invention.As shown in Figure 2, method 100 can comprise step S110, S120 and S130, and wherein, execution can be carried out separately or combine to part steps, and can executed in parallel or order carry out, be not limited to the concrete operations order shown in Fig. 2.In certain embodiments, the device 200 that method 100 can be as shown in Figure 4 or the browser be arranged in device 200 are carried out.
Fig. 4 shows the block diagram according to the device 200 according to the event set incompatible definite respective handling relevant to webpage of the embodiment of the present invention, wherein, one or more event sets consist of one or more events respectively, and the one or more event sets is associated with alignment processing respectively.As shown in Figure 4, installing 200 can comprise: detecting unit 210, record cell 220 and determining unit 230.
Detecting unit 210 is for detection of event on webpage.In certain embodiments, detecting unit 210 can be CPU (central processing unit) (CPU), digital signal processor (DSP), microprocessor, microcontroller of device 200 etc., it can match with device 200 input equipment etc., detect event on webpage, such as mouse button press and unclamp, keyboard is pressed and unclamp etc.
Record cell 220 starts and unclosed event still for recording all detecting, until in meeting the following conditions at least one: the unique processing that (i) exists the event sets that forms with one or more events by current record to be associated; (ii) end of the event started detected first.In certain embodiments, record cell 220 can be CPU (central processing unit) (CPU), digital signal processor (DSP), microprocessor, microcontroller of device 200 etc., it can match with device 200 storer etc., and record has occurred and unclosed event still.In certain embodiments, storer can be volatile memory, such as the register in device 200 processor, 1 grade or 2 grades of high-speed caches, install 200 RAM etc.In further embodiments, storer can be nonvolatile memory, such as device 200 hard disk, floppy disk, erasable optical disk etc.
The event sets that determining unit 230 forms for the one or more events based on by current record, determine whether to exist and the associated processing in advance of this event sets.Determining unit 230 can be CPU (central processing unit) (CPU), digital signal processor (DSP), microprocessor, microcontroller of device 200 etc., its can according to meet above-mentioned condition (i) and (ii) in one or more events of at least one Xiang Shiyi record, determine whether to exist the alignment processing be associated with this event sets.
Below with reference to Fig. 2 and Fig. 4, the method 100 according to the embodiment of the present invention and device 200 are described in detail.
In step S110, by the detecting unit 210 that installs 200, detect event on webpage.
In step S120, record all detecting by device 200 record cell 220 and start and unclosed event still, until in meeting the following conditions at least one: the unique processing that (i) exists the event sets that forms with one or more events by current record to be associated; (ii) end of the event started detected first.
In step S130, the event sets consisted of device 200 one or more events of determining unit based on by current record, determine whether to exist and the associated processing in advance of this event sets.
In certain embodiments, each event all can comprise two HTML events, and these two HTML events correspond respectively to beginning and the end of corresponding event.
In certain embodiments, the HTML event can comprise: KeyEvent, mouse event, window events, list event or media event.
In certain embodiments, the beginning of KeyEvent can be to push button, and the end of this KeyEvent can be to unclamp button.
In certain embodiments, the beginning of mouse event can be to press mouse button, and the end of this mouse event can be to unclamp mouse button.
In certain embodiments, the beginning of mouse event can be that mouse is moved on designed element, and the end of this mouse event can be that mouse is removed from this designed element.
In certain embodiments, the beginning of mouse event can be the item clicked of pressing on touch-screen, and the end of this mouse event can be the item clicked unclamped on this touch-screen.
In certain embodiments, the processing be associated with event sets can comprise at least one item in User Defined processing and browser default process.
In certain embodiments, in User Defined processing and the simultaneous situation of browser default process, User Defined is processed can specify the execution that whether stops the browser default process.
In certain embodiments, for supporting in webpage, can have the one or more processing that are associated with same event sets by one or more DOM elements of event, these one or more processing can be corresponding respectively with these one or more DOM elements.
So far invention has been described in conjunction with the preferred embodiments.Should be appreciated that, those skilled in the art without departing from the spirit and scope of the present invention, can carry out various other change, replacement and interpolations.Therefore, scope of the present invention is not limited to above-mentioned specific embodiment, and should be limited by claims.
Appendix A
The code of hotkeyDemo.html:
Figure BDA0000366340780000151
Figure BDA0000366340780000161
Configured respectively Ctrl+l, Ctrl+1+2, l+2+3, will show in red block after pressing key below, notices that numerical key is the numerical key in Master Keyboard.
Figure BDA0000366340780000162
The code of the hotkey.js embedded in hotkeyDemo.html:
Figure BDA0000366340780000163
// at first input parameter is carried out to the rationality judgement herein, and according to the input number of parameters to the relevant variable assignment
Figure BDA0000366340780000164
Figure BDA0000366340780000181

Claims (20)

1. the method for the incompatible definite respective handling of event set that a basis is relevant to webpage, wherein, one or more event sets consist of one or more events respectively, and described one or more event sets are associated with alignment processing respectively, and described method comprises:
Detect event on described webpage;
Record all detecting and start and unclosed event still, until in meeting the following conditions at least one:
(i) the unique processing that exists the event sets that forms with one or more events by current record to be associated;
(ii) end of the event started detected first; And
The event sets that one or more events based on by current record form, determine whether to exist and the associated processing in advance of described event sets.
2. method according to claim 1, wherein, each event includes two HTML events, and described two HTML events correspond respectively to beginning and the end of corresponding event.
3. method according to claim 2, wherein, described HTML event comprises: KeyEvent, mouse event, window events, list event or media event.
4. method according to claim 3, wherein, starting of described KeyEvent is to push button, and the end of described KeyEvent is to unclamp button.
5. method according to claim 3, wherein, starting of described mouse event is to press mouse button, and the end of described mouse event is to unclamp mouse button.
6. method according to claim 3, wherein, starting of described mouse event is that mouse is moved on designed element, and the end of described mouse event is that mouse is removed from described designed element.
7. method according to claim 3, wherein, starting of described mouse event is the item clicked of pressing on touch-screen, and the end of described mouse event is the item clicked unclamped on described touch-screen.
8. method according to claim 1, wherein, the processing be associated with described event sets comprise that User Defined is processed and the browser default process at least one item.
9. method according to claim 8, wherein, described User Defined process and the simultaneous situation of described browser default process under, described User Defined processing can be specified the execution that whether stops described browser default process.
10. method according to claim 1, wherein, have the one or more processing that are associated with same event sets by one or more DOM elements of event for supporting in described webpage, described one or more processing are corresponding respectively with described one or more DOM elements.
11. the device of the incompatible definite respective handling of event set that a basis is relevant to webpage, wherein, one or more event sets consist of one or more events respectively, and described one or more event sets are associated with alignment processing respectively, and described device comprises:
Detecting unit, for detection of event on described webpage;
Record cell, start and unclosed event still for recording all detecting, until in meeting the following conditions at least one:
(i) the unique processing that exists the event sets that forms with one or more events by current record to be associated;
(ii) end of the event started detected first; And
Determining unit, the event sets formed for the one or more events based on by current record, determine whether to exist and the associated processing in advance of described event sets.
12. device according to claim 11, wherein, each event includes two HTML events, and described two HTML events correspond respectively to beginning and the end of corresponding event.
13. device according to claim 12, wherein, described HTML event comprises: KeyEvent, mouse event, window events, list event or media event.
14. device according to claim 13, wherein, starting of described KeyEvent is to push button, and the end of described KeyEvent is to unclamp button.
15. device according to claim 13, wherein, starting of described mouse event is to press mouse button, and the end of described mouse event is to unclamp mouse button.
16. device according to claim 13, wherein, starting of described mouse event is that mouse is moved on designed element, and the end of described mouse event is that mouse is removed from described designed element.
17. device according to claim 13, wherein, starting of described mouse event is the item clicked of pressing on touch-screen, and the end of described mouse event is the item clicked unclamped on described touch-screen.
18. device according to claim 11, wherein, the processing be associated with described event sets comprises at least one item in User Defined processing and browser default process.
19. device according to claim 18, wherein, in described User Defined processing and the simultaneous situation of described browser default process, described User Defined is processed can specify the execution that whether stops described browser default process.
20. device according to claim 11, wherein, have the one or more processing that are associated with same event sets by one or more DOM elements of event for supporting in described webpage, described one or more processing are corresponding respectively with described one or more DOM elements.
CN2013103538524A 2013-08-14 2013-08-14 Method and device for determining corresponding processing according to event collection correlated with webpages Pending CN103425775A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2013103538524A CN103425775A (en) 2013-08-14 2013-08-14 Method and device for determining corresponding processing according to event collection correlated with webpages

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2013103538524A CN103425775A (en) 2013-08-14 2013-08-14 Method and device for determining corresponding processing according to event collection correlated with webpages

Publications (1)

Publication Number Publication Date
CN103425775A true CN103425775A (en) 2013-12-04

Family

ID=49650514

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2013103538524A Pending CN103425775A (en) 2013-08-14 2013-08-14 Method and device for determining corresponding processing according to event collection correlated with webpages

Country Status (1)

Country Link
CN (1) CN103425775A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106155647A (en) * 2015-03-31 2016-11-23 北京奇虎科技有限公司 A kind of method and apparatus of key Mus operation playback
US11112944B1 (en) * 2020-05-27 2021-09-07 Sap Se Keyboard navigation menu

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101661332A (en) * 2008-08-28 2010-03-03 纬创资通股份有限公司 Key processing method and computer system
CN101782905A (en) * 2009-01-20 2010-07-21 国际商业机器公司 Method and device for expanding shortcut key
CN102243568A (en) * 2010-05-12 2011-11-16 索尼公司 Terminal apparatus, electronic apparatus, and access key assignment method and program
CN102654831A (en) * 2011-03-04 2012-09-05 百度在线网络技术(北京)有限公司 Device and method for intensively controlling WEB page event and state

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101661332A (en) * 2008-08-28 2010-03-03 纬创资通股份有限公司 Key processing method and computer system
CN101782905A (en) * 2009-01-20 2010-07-21 国际商业机器公司 Method and device for expanding shortcut key
CN102243568A (en) * 2010-05-12 2011-11-16 索尼公司 Terminal apparatus, electronic apparatus, and access key assignment method and program
CN102654831A (en) * 2011-03-04 2012-09-05 百度在线网络技术(北京)有限公司 Device and method for intensively controlling WEB page event and state

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106155647A (en) * 2015-03-31 2016-11-23 北京奇虎科技有限公司 A kind of method and apparatus of key Mus operation playback
US11112944B1 (en) * 2020-05-27 2021-09-07 Sap Se Keyboard navigation menu
US11755175B2 (en) 2020-05-27 2023-09-12 Sap Se Keyboard navigation menu

Similar Documents

Publication Publication Date Title
US10613971B1 (en) Autonomous testing of web-based applications
Scott The unified process explained
CN102081647B (en) The method and apparatus of display pop-up ad
AU2009238294B2 (en) Data transformation based on a technical design document
WO2018082462A1 (en) Application interface traversing method and system, and testing device
US20110191381A1 (en) Interactive System for Extracting Data from a Website
CN101416143A (en) User interface morph based on permissions
Sceppa Microsoft Ado. Net (Core Reference)
Hansen et al. Introduction to Programming using SML
CN102981853B (en) A kind of Text Entry by webpage submits long article method and apparatus originally to
CN103425775A (en) Method and device for determining corresponding processing according to event collection correlated with webpages
CN102981852B (en) This commit method of long article and device
Fahndrich et al. Tracking down exceptions in standard ML programs
WO2017181619A1 (en) Page response method and device
CN111949903B (en) Webpage data acquisition method, device, equipment and readable storage medium
Krasnayová Constructions of APN permutations
Webb Using Excel Visual Basic for Applications (Special Edition)
US9524307B2 (en) Asynchronous error checking in structured documents
Keogh Javascript demystified
Scuglik Relation between UML2 activity diagrams and CSP algebra
Sinclair Typography on the Web
Constantinides et al. Habito news: A research tool to investigate mobile news reading
Sandru The optimal design of the quality management concepts using mathematical modeling techniques
CN114490315A (en) Automatic testing method and device for Web application program
CN111666306A (en) Target data file generation method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20131204