A kind of filter method for internet site front end logic entrance and device
Technical field
The present invention relates to a kind of live field of barrage, the Internet, especially relate to one and enter for internet site front end logic
The filter method of mouth and device.
Background technology
At front end development field, most of websites are directed to some function (such as: log in), complete in script edit
After core function logic, need all of logic entrance is bound event, complicated scene even can by logical overwrite one time,
Ensure the normal of overall logic.This mode greatly adds redundancy and the maintenance cost of code.
Summary of the invention
The present invention mainly solves the technical problem existing for prior art;Provide one and be directed to some merit of website
Can, after script edit completes core function logic, it is not necessary to all of logic entrance is bound event, is greatly reducing
The redundancy of code and a kind of of maintenance cost are for the filter method of internet site front end logic entrance and device.
The above-mentioned technical problem of the present invention is mainly addressed by following technical proposals:
A kind of filter method for internet site front end logic entrance, it is characterised in that including:
Step 1, is pre-configured with interception action by client, and the trigger condition of this interception action is when user triggers page elements
Function time trigger;Then client monitors the click event of page elements on internet site in real time, when user triggers the page
During a certain function of element, start interception action and also intercept this trigger action;
Step 2, the identity type that a certain function of the page elements that client triggers according to user is corresponding is analyzed, and will divide
Analysis result is sent to server, and server calls the execution function event corresponding with this identity type according to analysis result;
Step 3, the execution function event that client executing step 2 is called, and inform user.
Preferably, the function of the described page elements identity type corresponding with the function of page elements is self-defined, mark
Type is stored in identity type storehouse.
Preferably, described execution function event is the execution function event of internet site storage, described execution function thing
Part is corresponding with identity type, and corresponding relation is self-defined.
Preferably, in described step 2, carry out according to the identity type that a certain function of the page elements of user's triggering is corresponding
The concrete grammar analyzed is: whether there is the identity type corresponding with the function of page elements in Search Flags typelib, if depositing
, send and perform recalls information to server.
A kind of defecator for internet site front end logic entrance, including:
Event interception module: be pre-configured with interception action by client, the trigger condition of this interception action is when user triggers
Trigger during the function of page elements;Then client monitors the click event of page elements on internet site in real time, works as user
When triggering a certain function of page elements, start interception action and intercept this trigger action;
Event analysis calling module: the identity type that a certain function of the page elements that client triggers according to user is corresponding is carried out
Analyzing, and by event analysis calling module, analysis result is sent to server, server passes through event according to analysis result
Analyze calling module and call the execution function event corresponding with this identity type;
Perform module: client performs, by performing module, the execution function event that event analysis calling module calls, and informs
User.
Preferably, the function of the described page elements identity type corresponding with the function of page elements is self-defined, mark
Type is stored in identity type storehouse.
Preferably, described execution function event is the execution function event of internet site storage, described execution function thing
Part is corresponding with identity type, and corresponding relation is self-defined.
Preferably, identity type corresponding to a certain function of the page elements that client triggers according to user is analyzed
Concrete grammar is: whether there is the identity type corresponding with the function of page elements in Search Flags typelib, if existing, sends
Perform recalls information to server.
Therefore, present invention have the advantage that and be directed to some function of website, script edit completes core function
After logic, it is not necessary to all of logic entrance is bound event, greatly reducing redundancy and the maintenance cost of code.
Accompanying drawing explanation
Fig. 1 is the method flow schematic diagram of invention.
Fig. 2 is the schematic flow sheet of case 1 in the embodiment of the present invention 1.
Fig. 3 is the schematic flow sheet of case 2 in the embodiment of the present invention 1.
Fig. 4 is the structured flowchart of the present invention.
Detailed description of the invention
Below by embodiment, and combine accompanying drawing, technical scheme is described in further detail.
A kind of filter method for internet site front end logic entrance, including:
Step 1, is pre-configured with interception action by client, and the trigger condition of this interception action is when user triggers page elements
Function time trigger;Then client monitors the click event of page elements on internet site in real time, when user triggers the page
During a certain function of element, start interception action and also intercept this trigger action;Wherein, the function of page elements and page elements
Identity type corresponding to function be self-defined, identity type is stored in identity type storehouse.
Step 2, the identity type that a certain function of the page elements that client triggers according to user is corresponding is analyzed, and
Analysis result is sent to server, and server calls the execution function event corresponding with this identity type according to analysis result;
Performing the execution function event that function event is internet site storage, described execution function event is corresponding with identity type, right
Should be related to for self-defined.Concrete grammar is: whether there is the mark corresponding with the function of page elements in Search Flags typelib
Type, if existing, sending and performing recalls information to server.
Step 3, the execution function event that client executing step 2 is called, and inform user.
A kind of defecator for internet site front end logic entrance, including:
Event interception module: be pre-configured with interception action by client, the trigger condition of this interception action is when user triggers
Trigger during the function of page elements;Then client monitors the click event of page elements on internet site in real time, works as user
When triggering a certain function of page elements, start interception action and intercept this trigger action;Wherein, page elements function and
The identity type that the function of page elements is corresponding is self-defined, and identity type is stored in identity type storehouse.
Event analysis calling module: the identity type that a certain function of the page elements that client triggers according to user is corresponding
Being analyzed, and by event analysis calling module, analysis result is sent to server, server passes through according to analysis result
Event analysis calling module calls the execution function event corresponding with this identity type;Performing function event is that internet site is deposited
The execution function event of storage, described execution function event is corresponding with identity type, and corresponding relation is self-defined.Concrete grammar is:
Whether Search Flags typelib exists the identity type corresponding with the function of page elements, if existing, sending execution and calling letter
Breath is to server.
Perform module: client performs, by performing module, the execution function event that event analysis calling module calls, and
Inform user.
Embodiment 1:
The present invention provides a kind of filter method for internet site front end logic entrance, including:
Step 1, is pre-configured with interception action by client, and the trigger condition of this interception action is when user triggers page elements
Function time trigger;Then client monitors the click event of page elements on internet site in real time, when user triggers the page
During a certain function of element, start interception action and also intercept this trigger action;Wherein, the function of page elements and page elements
Identity type corresponding to function be self-defined, identity type is stored in identity type storehouse.
Step 2, the identity type that a certain function of the page elements that client triggers according to user is corresponding is analyzed, and
Analysis result is sent to server, and server calls the execution function event corresponding with this identity type according to analysis result;
Performing the execution function event that function event is internet site storage, described execution function event is corresponding with identity type, right
Should be related to for self-defined.Concrete grammar is: whether there is the mark corresponding with the function of page elements in Search Flags typelib
Type, if existing, sending and performing recalls information to server.
Step 3, the execution function event that client executing step 2 is called, and inform user.
Case 1
As shown in Figure 2:
Step 1, the page initializes, and client monitors all page elements comprising filtration types.Step 2, page elements " individual
" center " is when initializing, and design filtration types is " login ",
Representing needs checking to log in before this function enters.
Step 3, when user click on " individual " center ", directly intercepted by client, and intercept information be sent to server,
If user is not logged in, server ejects login frame and guides user to log in, and enters individual center after logining successfully;If user
Logging in, server guides user to be directly entered individual center.
Case 2
As shown in Figure 3:
Step 1, the client extension by external business logic, monitor the click event of all hyperlink.
Step 2, when the hyperlink (web sites function) that chained address is "/join " is clicked on by user, client can be from
Dynamic interception, if subscriber data is the most perfect, then server ejection data is filled in frame and guides user's perfect information;If data is
Through perfect, server then guides user to be directly entered the registration page.
Embodiment 2
The present invention provides a kind of defecator for internet site front end logic entrance, with being used in described embodiment 1
The filter method one_to_one corresponding of internet site front end logic entrance, is not repeating at this.
Specific embodiment described herein is only to present invention spirit explanation for example.Technology neck belonging to the present invention
Described specific embodiment can be made various amendment or supplements or use similar mode to replace by the technical staff in territory
Generation, but without departing from the spirit of the present invention or surmount scope defined in appended claims.