├── screenshot
├── show.png
└── login.png
├── duck.pro
├── robot
├── main.h
├── resources.qrc
├── qml.qrc
├── duckwebenginepage.h
├── duckwebengineurlrequestinterceptor.h
├── robot.pro
├── duckwebenginepage.cpp
├── duckwebcallback.h
├── main.cpp
├── duckwebengineurlrequestinterceptor.cpp
├── duckwebcallback.cpp
├── web.js
├── qwebchannel.js
├── robot.pro.user
└── jquery-3.2.1.min.js
├── scm
├── scm_global.h
├── scm.pro
├── scheme.h
└── scheme.cpp
├── README.md
├── .gitignore
├── LICENSE
└── duck.pro.user
/screenshot/show.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/evilbinary/duck-robot/master/screenshot/show.png
--------------------------------------------------------------------------------
/screenshot/login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/evilbinary/duck-robot/master/screenshot/login.png
--------------------------------------------------------------------------------
/duck.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 |
3 | qtHaveModule(robot):
4 | SUBDIRS += \
5 | robot \
6 | scm
7 |
--------------------------------------------------------------------------------
/robot/main.h:
--------------------------------------------------------------------------------
1 | /**
2 | * 作者:evilbinary on 12/24/16.
3 | * 邮箱:rootdebug@163.com
4 | */
5 |
6 | #ifndef MAIN_H
7 | #define MAIN_H
8 |
9 |
10 |
11 | #endif // MAIN_H
12 |
--------------------------------------------------------------------------------
/robot/resources.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | jquery-3.2.1.min.js
4 | web.js
5 | qwebchannel.js
6 |
7 |
8 |
--------------------------------------------------------------------------------
/scm/scm_global.h:
--------------------------------------------------------------------------------
1 | #ifndef SCM_GLOBAL_H
2 | #define SCM_GLOBAL_H
3 |
4 | #if defined(SCM_LIBRARY)
5 | # define SCMSHARED_EXPORT Q_DECL_EXPORT
6 | #else
7 | # define SCMSHARED_EXPORT Q_DECL_IMPORT
8 | #endif
9 |
10 | #endif // SCM_GLOBAL_H
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # duck-robot
2 | duck-robot 一个基于qq开发的鸭子机器人。
3 |
4 | ## 截图如下
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/robot/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 | images/left-32.png
5 | images/stop-32.png
6 | images/refresh-32.png
7 | LoadProgressStyle.qml
8 | +android/LoadProgressStyle.qml
9 | images/right-32.png
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Compiled Object files
5 | *.slo
6 | *.lo
7 | *.o
8 | *.obj
9 |
10 | # Precompiled Headers
11 | *.gch
12 | *.pch
13 |
14 | # Compiled Dynamic libraries
15 | *.so
16 | *.dylib
17 | *.dll
18 |
19 | # Fortran module files
20 | *.mod
21 | *.smod
22 |
23 | # Compiled Static libraries
24 | *.lai
25 | *.la
26 | *.a
27 | *.lib
28 |
29 | # Executables
30 | *.exe
31 | *.out
32 | *.app
33 |
--------------------------------------------------------------------------------
/robot/duckwebenginepage.h:
--------------------------------------------------------------------------------
1 | #ifndef DUCKWEBENGINEPAGE_H
2 | #define DUCKWEBENGINEPAGE_H
3 |
4 | #include
5 |
6 |
7 | class DuckWebEnginePage : public QWebEnginePage
8 | {
9 | Q_OBJECT
10 | public:
11 | DuckWebEnginePage();
12 | void javaScriptConsoleMessage(QWebEnginePage::JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID);
13 |
14 | signals:
15 |
16 | public slots:
17 | };
18 |
19 | #endif // DUCKWEBENGINEPAGE_H
20 |
--------------------------------------------------------------------------------
/scm/scm.pro:
--------------------------------------------------------------------------------
1 | #-------------------------------------------------
2 | #
3 | # Project created by QtCreator 2017-07-12T21:51:01
4 | #
5 | #-------------------------------------------------
6 |
7 | QT -= core gui
8 | QT +=network
9 |
10 | TARGET = scheme
11 | TEMPLATE = lib
12 |
13 | DEFINES += SCM_LIBRARY
14 |
15 | SOURCES += \
16 | scheme.cpp
17 |
18 | HEADERS +=\
19 | scm_global.h \
20 | scheme.h
21 |
22 | UNAME_S =
23 |
24 | unix {
25 | target.path = /usr/lib
26 | INSTALLS += target
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/robot/duckwebengineurlrequestinterceptor.h:
--------------------------------------------------------------------------------
1 | /**
2 | * 作者:evilbinary on 12/24/16.
3 | * 邮箱:rootdebug@163.com
4 | */
5 |
6 | #ifndef DUCKWEBENGINEURLREQUESTINTERCEPTOR_H
7 | #define DUCKWEBENGINEURLREQUESTINTERCEPTOR_H
8 |
9 |
10 | #include
11 |
12 | class DuckWebUrlRequestInterceptor : public QWebEngineUrlRequestInterceptor
13 | {
14 | Q_OBJECT
15 |
16 | public:
17 | DuckWebUrlRequestInterceptor(QObject *parent = Q_NULLPTR);
18 | void interceptRequest(QWebEngineUrlRequestInfo &info);
19 | };
20 |
21 | #endif // TWEBENGINEURLREQUESTINTERCEPTOR_H
22 |
--------------------------------------------------------------------------------
/robot/robot.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = app
2 | TARGET = duck
3 |
4 | QT += core gui webenginewidgets xml
5 |
6 | SOURCES += main.cpp \
7 | duckwebenginepage.cpp \
8 | duckwebcallback.cpp \
9 | duckwebengineurlrequestinterceptor.cpp
10 |
11 | RESOURCES += \
12 | resources.qrc
13 |
14 |
15 | target.path = $$[QT_INSTALL_EXAMPLES]/duck/duck
16 | INSTALLS += target
17 |
18 | HEADERS += \
19 | main.h \
20 | duckwebenginepage.h \
21 | duckwebcallback.h \
22 | duckwebengineurlrequestinterceptor.h
23 |
24 |
25 | RESOURCES =resources.qrc
26 |
27 |
28 | unix|win32: LIBS += -L$$OUT_PWD/../scm/ -lscheme
29 |
30 | INCLUDEPATH += $$PWD/../scm
31 | DEPENDPATH += $$PWD/../scm
32 |
33 |
34 |
--------------------------------------------------------------------------------
/scm/scheme.h:
--------------------------------------------------------------------------------
1 | #ifndef SCM_H
2 | #define SCM_H
3 |
4 | #include "scm_global.h"
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 |
11 | using namespace std;
12 |
13 | class Scm:public QObject
14 | {
15 | Q_OBJECT
16 | private:
17 | QTcpSocket *client;
18 | bool isConnected=false;
19 | int timeOut=1000;
20 | std::function callback=NULL;
21 |
22 | public:
23 | Scm();
24 | void eval(QString exp,function);
25 | ~Scm();
26 |
27 | public Q_SLOTS:
28 | void connected();
29 | void disconnected();
30 | void readyRead();
31 |
32 |
33 | };
34 |
35 | #endif // SCM_H
36 |
--------------------------------------------------------------------------------
/robot/duckwebenginepage.cpp:
--------------------------------------------------------------------------------
1 | #include "duckwebenginepage.h"
2 |
3 | DuckWebEnginePage::DuckWebEnginePage(){
4 |
5 | }
6 |
7 |
8 | void DuckWebEnginePage::javaScriptConsoleMessage(QWebEnginePage::JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID){
9 | QString levelTip="info";
10 | if(level==JavaScriptConsoleMessageLevel::WarningMessageLevel){
11 | levelTip="warn";
12 | qWarning()<<"["+levelTip+"]"<
9 | #include
10 | #include
11 | #include
12 | #include "scheme.h"
13 |
14 |
15 | class DuckWebCallBack:public QObject
16 | {
17 | Q_OBJECT
18 |
19 | public:
20 | DuckWebCallBack(QWebEngineView *view);
21 |
22 |
23 | public Q_SLOTS:
24 | void finishLoading(bool);
25 | void showMsgBox(QString msg);
26 | void onTimerOut();
27 | void loadFrame();
28 |
29 | void recieveGroupMessage(long gid,long uid,QString groupName,QString nick,QString message);
30 |
31 | // void adjustLocation();
32 | // void changeLocation();
33 | // void adjustTitle();
34 | // void setProgress(int p);
35 |
36 | // void viewSource();
37 |
38 | // void highlightAllLinks();
39 | // void rotateImages(bool invert);
40 | // void removeGifImages();
41 | // void removeInlineFrames();
42 | // void removeObjectElements();
43 | // void removeEmbeddedElements();
44 |
45 |
46 | private:
47 | Scm* scm;
48 | QWebEngineView * webEngineView;
49 | };
50 |
51 | #endif // WEBCALLBACK_H
52 |
--------------------------------------------------------------------------------
/scm/scheme.cpp:
--------------------------------------------------------------------------------
1 | #include "scheme.h"
2 | #include
3 |
4 | #define LINE_LENGTH 1024
5 |
6 |
7 | Scm::Scm()
8 | {
9 |
10 | client = new QTcpSocket();
11 | connect(client,SIGNAL(connected()),SLOT(connected()));
12 | connect(client,SIGNAL(disconnected()),SLOT(disconnected()));
13 | connect(client,SIGNAL(readyRead()),this,SLOT(readyRead()));
14 |
15 | }
16 | void Scm::connected(){
17 | qDebug()<<"connected";
18 | isConnected=true;
19 | }
20 |
21 | void Scm::disconnected(){
22 | qDebug()<<"disconnected";
23 | isConnected=false;
24 | }
25 |
26 | void Scm::eval(QString exp,functionfun){
27 | if(client->state()== QAbstractSocket::UnconnectedState||client->state()==QAbstractSocket::ClosingState){
28 | client->abort();
29 | QSettings *configIniRead = new QSettings("duck.ini", QSettings::IniFormat);
30 | QString ip = configIniRead->value("/scheme/ip","127.0.0.1").toString();
31 | int port = configIniRead->value("/scheme/port",8100).toInt();
32 | timeOut=configIniRead->value("/scheme/port",timeOut).toInt();
33 | client->connectToHost(QHostAddress(ip), port);
34 | }
35 | callback=fun;
36 | qDebug()<<"write="<write(exp.toStdString().c_str())<<" isConnected="<readAll()="<
7 | #include
8 | #include "main.h"
9 | #include "duckwebengineurlrequestinterceptor.h"
10 | #include
11 | #include "duckwebcallback.h"
12 | #include "duckwebenginepage.h"
13 |
14 | #include "scheme.h"
15 | #include
16 |
17 |
18 | int main(int argc, char *argv[]){
19 |
20 |
21 | // QTextCodec *codec = QTextCodec::codecForName("UTF-8");//情况2
22 | // Scm scm;
23 | // std:cout<<"eval=>"<setRequestInterceptor(webInterceptor);
33 | QWebEngineProfile::defaultProfile()->setHttpUserAgent(userAgent);
34 |
35 | // QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
36 | DuckWebEnginePage* duckenginePage=new DuckWebEnginePage();
37 | QWebEngineView *view=new QWebEngineView();
38 | view->setPage(duckenginePage);
39 |
40 | DuckWebCallBack *webCallback=new DuckWebCallBack(view);
41 |
42 | // QWebEngineProfile::defaultProfile()->setProperty("device-width","1280");
43 | // QWebEngineProfile::defaultProfile()->setProperty("width","10280");
44 | // view->page()->settings()->setAttribute(QWebEngineSettings::WebAttribute::LocalContentCanAccessRemoteUrls,true);
45 |
46 | QObject::connect(view, SIGNAL(loadFinished(bool)),webCallback,SLOT(finishLoading(bool)));
47 | view->setUrl(QUrl("http://w.qq.com/"));
48 | view->resize(420, 640);
49 |
50 |
51 | view->show();
52 |
53 | return app.exec();
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/robot/duckwebengineurlrequestinterceptor.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * 作者:evilbinary on 12/24/16.
3 | * 邮箱:rootdebug@163.com
4 | */
5 |
6 | #include "duckwebengineurlrequestinterceptor.h"
7 |
8 | DuckWebUrlRequestInterceptor::DuckWebUrlRequestInterceptor(QObject *parent)
9 | : QWebEngineUrlRequestInterceptor(parent)
10 | {
11 | }
12 |
13 | void DuckWebUrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
14 | {
15 | QString strInfo = "";
16 | switch (info.resourceType())
17 | {
18 | case 0: //Top level page
19 | strInfo = "ResourceTypeMainFrame";
20 | break;
21 |
22 | case 1: //Frame
23 | strInfo = "ResourceTypeSubFrame";
24 | break;
25 |
26 | case 2: //CSS stylesheet
27 | strInfo = "ResourceTypeStylesheet";
28 | break;
29 |
30 | case 3: //External script
31 | strInfo = "ResourceTypeScript";
32 | break;
33 |
34 | case 4: //Image
35 | strInfo = "ResourceTypeImage";
36 | break;
37 |
38 | case 5: //Font
39 | strInfo = "ResourceTypeFontResource";
40 | break;
41 |
42 | case 6: //Sub-resource
43 | strInfo = "ResourceTypeSubResource";
44 | break;
45 |
46 | case 7: //Plugin object
47 | strInfo = "ResourceTypeObject";
48 | break;
49 |
50 | case 8: //Media resource
51 | strInfo = "ResourceTypeMedia";
52 | break;
53 |
54 | case 9: //Resource of dedicated worker
55 | strInfo = "ResourceTypeWorker";
56 | break;
57 |
58 | case 10: //Resource of shared worker
59 | strInfo = "ResourceTypeSharedWorker";
60 | break;
61 |
62 | case 11: //Explicitly requested prefetch
63 | strInfo = "ResourceTypePrefetch";
64 | break;
65 |
66 | case 12: //Favicon
67 | strInfo = "ResourceTypeFavicon";
68 | break;
69 |
70 | case 13: //XML http request
71 | strInfo = "ResourceTypeXhr";
72 | break;
73 |
74 | case 14: //Ping request
75 | strInfo = "ResourceTypePing";
76 | break;
77 |
78 | case 15: //Resource of service worker
79 | strInfo = "ResourceTypeServiceWorker";
80 | break;
81 |
82 | case 16: //Unknown resource
83 | strInfo = "ResourceTypeUnknown";
84 | break;
85 |
86 | default:
87 | strInfo = "Unknown type";
88 | break;
89 | }
90 |
91 | // qDebug()<
8 | #include
9 | #include
10 | #include
11 | #include
12 |
13 |
14 |
15 |
16 | using namespace std;
17 |
18 | DuckWebCallBack::DuckWebCallBack(QWebEngineView *view)
19 | {
20 | this->webEngineView=view;
21 | QWebChannel *channel = new QWebChannel(webEngineView->page());
22 | channel->registerObject(QStringLiteral("bridge"), (QObject*)this);
23 | webEngineView->page()->setWebChannel(channel);
24 |
25 | QFile webChannelFile;
26 | webChannelFile.setFileName(":/qwebchannel.js");
27 | webChannelFile.open(QIODevice::ReadOnly);
28 | QString webChannelJs = webChannelFile.readAll();
29 | webChannelFile.close();
30 |
31 | webChannelJs.append("var webChannel=new QWebChannel(qt.webChannelTransport, function(channel) { \
32 | window.bridge = channel.objects.bridge; \
33 | console.log(channel.objects.bridge);\
34 | });");
35 | webEngineView->page()->runJavaScript(webChannelJs,[=](const QVariant &v){
36 | qDebug()<<"ret webChannelJs===>"<page()->runJavaScript(jQuery,[=](const QVariant &v){
54 | qDebug()<<"ret jQuery===>"<page()->runJavaScript(webJs,[=](const QVariant &v){
64 | qDebug()<<"ret webJs===>"<page()->scripts().insert(script);
75 |
76 |
77 | // webEngineView->page()->runJavaScript("showMessage('abc');",[=](const QVariant &v){
78 | // qDebug()<<"showMessage===>"<page()->runJavaScript(js,[=](const QVariant &v){
84 | // qDebug()<<"jq===>"<setInterval(5000);
89 | // timer->start();
90 | // connect(timer, SIGNAL(timeout()), this, SLOT(onTimerOut()));
91 |
92 |
93 | }
94 |
95 |
96 | void DuckWebCallBack::recieveGroupMessage(long gid,long uid,QString groupName,QString nick,QString message){
97 | qDebug()<0){
100 | QString exp=message.remove("$");
101 | qDebug()<<"exp=>"<eval(exp,[=](QVariant &ret){
103 | QString js=QString("sendGroupMessage(%1,'%2');").arg(gid).arg(ret.toString());
104 | webEngineView->page()->runJavaScript(js,[=](const QVariant &v){
105 | qDebug()<<"sendGroupMessage===>"<page()->toHtml([=](const QVariant &v){
116 | // qDebug()<<"toHtml===>"<page()->toHtml([=](const QVariant &v){
131 | // qDebug()<<"toHtml===>"<]*?>");
136 | // while ((pos = rx.indexIn(str, pos)) != -1) {
137 | // //list << rx.cap(1);
138 | // qDebug()<";
145 | // // QString errorMsg;
146 | // // if(!doc.setContent(v.toString(), false,&errorMsg)){
147 | // // qDebug()<<"errorMsg=>"<";
151 |
152 | // // QDomElement root = doc.documentElement();
153 | // // QDomNodeList nodelist=root.elementsByTagName("img");
154 | // // qDebug()<<"nodelist.size==>"< \
46 | \
47 | ");
48 | jq('#container').bind('DOMNodeInserted', function(e) {
49 | jq('#qrcode').hide();
50 | });
51 |
52 | init();
53 | registerMessage(function(pollMsg){
54 | console.log(pollMsg);
55 | if(pollMsg.poll_type=='discu_message'){
56 | var gid=pollMsg.value.from_uin;
57 | var uid=pollMsg.value.send_uin;
58 | var code=pollMsg.value.group_code;
59 |
60 | var groupName=getGroupNameByGid(pollMsg.value.from_uin);
61 | var nickName=getGroupUserNick(gid,uid,code);
62 | var message=pollMsg.value.content[1]||pollMsg.value.content[0];
63 |
64 | console.log(groupName+'=>'+nickName+' '+ message);
65 | //sendDiscussMessage(pollMsg.from_uin,pollMsg.value.content[1]);
66 | }else if(pollMsg.poll_type=='group_message'){
67 | var gid=pollMsg.value.from_uin;
68 | var uid=pollMsg.value.send_uin;
69 | var code=pollMsg.value.group_code;
70 |
71 | var groupName=getGroupNameByGid(pollMsg.value.from_uin);
72 | var nickName=getGroupUserNick(gid,uid,code);
73 | var message=pollMsg.value.content[1]||pollMsg.value.content[0];
74 | if(bridge.recieveGroupMessage){
75 | bridge.recieveGroupMessage(gid,uid,groupName,nickName,message);
76 | }
77 | console.log(groupName+'=>'+nickName+' '+ message);
78 | //sendGroupMessage(pollMsg.from_uin,pollMsg.value.content[1]);
79 | }
80 | });
81 | }
82 |
83 | var checkQrId;
84 | function checkQr(){
85 | var iframe=jq('iframe');
86 | var qrSrc=iframe.contents().find('#qrlogin_img').attr('src');
87 | console.log(qrSrc);
88 | if(qrSrc!=undefined){
89 | clearInterval(checkQrId);
90 | showQR(qrSrc);
91 | }
92 |
93 | }
94 |
95 |
96 | var isFrameLoad=false;
97 | function frameLoad(frame){
98 | var iframe=jq('iframe');
99 | var qrSrc=iframe.contents().find('#qrlogin_img').attr('src');
100 | iframe.css('width','0');
101 | iframe.css('height','0');
102 |
103 | //showMsgBox(JSON.stringify(jq('img').attr('src')));
104 | // console.log(JSON.stringify(frame.innerHTML) );
105 |
106 |
107 | if(isFrameLoad==false){
108 | console.log('frame is load');
109 | console.log('qrSrc='+qrSrc);
110 |
111 | isFrameLoad=true;
112 | window.bridge.loadFrame();
113 | checkQrId=setInterval("checkQr()",1000);
114 | }
115 | }
116 |
117 | function getGroupUserNick(gid,uid,code){
118 | var user=getGroupUser(gid,uid,code);
119 | if(user){
120 | return user.nick;
121 | }
122 | return '';
123 | }
124 |
125 | function getGroupUser(gid,uid,code){
126 | var from_group=mq.model.chat.m_model.getGroupByGid(gid,uid);
127 | if(from_group.members==undefined ){
128 | mq.model.chat.m_model.getGroupInfoList(from_group.code)
129 | }
130 | var from_group_members = from_group.members || [];
131 | var membersLen = from_group_members.length || 0;
132 | for( var k = 0; k < membersLen; k++){
133 | if( from_group_members[k].uin == uid ){
134 | return from_group_members[k];
135 | }
136 | }
137 | }
138 |
139 | function sendGroupMessage(gid,msg){
140 | var param={"group_uin":gid,
141 | "content":"[\""+msg+" \",[\"font\",{\"name\":\"宋体\",\"size\":10,\"style\":[0,0,0],\"color\":\"000000\"}]]",
142 | "face":0,};
143 | mq.model.chat.sendGroupMsg(param);
144 | }
145 |
146 | function sendDiscussMessage(did,msg){
147 | var param={"did":did,
148 | "content":"[\""+msg+" \",[\"font\",{\"name\":\"宋体\",\"size\":10,\"style\":[0,0,0],\"color\":\"000000\"}]]",
149 | "face":0,};
150 | mq.model.chat.sendDiscussMsg(param);
151 | }
152 |
153 | function sendMessage(toUin,msg){
154 | console.log('sendMessage');
155 | mq.model.chat.sendMsg({to:toUin,
156 | content:'[\"'+msg+'\",[\"font\",{\"name\":\"宋体\",\"size\":10,\"style\":[0,0,0],\"color\":\"000000\"}]]',
157 | face:0
158 | });
159 | //mq.model.buddylist.getSelfUin();
160 | //mq.model.chat
161 | }
162 | function getFriendList(){
163 | return mq.model.buddylist.getFriends();
164 | }
165 | function getFriendByNick(name){
166 | var a=mq.model.buddylist.getFriends();
167 | for(var i=0;i
5 | ** Contact: https://www.qt.io/licensing/
6 | **
7 | ** This file is part of the QtWebChannel module of the Qt Toolkit.
8 | **
9 | ** $QT_BEGIN_LICENSE:BSD$
10 | ** Commercial License Usage
11 | ** Licensees holding valid commercial Qt licenses may use this file in
12 | ** accordance with the commercial license agreement provided with the
13 | ** Software or, alternatively, in accordance with the terms contained in
14 | ** a written agreement between you and The Qt Company. For licensing terms
15 | ** and conditions see https://www.qt.io/terms-conditions. For further
16 | ** information use the contact form at https://www.qt.io/contact-us.
17 | **
18 | ** BSD License Usage
19 | ** Alternatively, you may use this file under the terms of the BSD license
20 | ** as follows:
21 | **
22 | ** "Redistribution and use in source and binary forms, with or without
23 | ** modification, are permitted provided that the following conditions are
24 | ** met:
25 | ** * Redistributions of source code must retain the above copyright
26 | ** notice, this list of conditions and the following disclaimer.
27 | ** * Redistributions in binary form must reproduce the above copyright
28 | ** notice, this list of conditions and the following disclaimer in
29 | ** the documentation and/or other materials provided with the
30 | ** distribution.
31 | ** * Neither the name of The Qt Company Ltd nor the names of its
32 | ** contributors may be used to endorse or promote products derived
33 | ** from this software without specific prior written permission.
34 | **
35 | **
36 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
37 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
38 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
39 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
40 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
43 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
45 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
46 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
47 | **
48 | ** $QT_END_LICENSE$
49 | **
50 | ****************************************************************************/
51 |
52 | "use strict";
53 |
54 | var QWebChannelMessageTypes = {
55 | signal: 1,
56 | propertyUpdate: 2,
57 | init: 3,
58 | idle: 4,
59 | debug: 5,
60 | invokeMethod: 6,
61 | connectToSignal: 7,
62 | disconnectFromSignal: 8,
63 | setProperty: 9,
64 | response: 10,
65 | };
66 |
67 | var QWebChannel = function(transport, initCallback)
68 | {
69 | if (typeof transport !== "object" || typeof transport.send !== "function") {
70 | console.error("The QWebChannel expects a transport object with a send function and onmessage callback property." +
71 | " Given is: transport: " + typeof(transport) + ", transport.send: " + typeof(transport.send));
72 | return;
73 | }
74 |
75 | var channel = this;
76 | this.transport = transport;
77 |
78 | this.send = function(data)
79 | {
80 | if (typeof(data) !== "string") {
81 | data = JSON.stringify(data);
82 | }
83 | channel.transport.send(data);
84 | }
85 |
86 | this.transport.onmessage = function(message)
87 | {
88 | var data = message.data;
89 | if (typeof data === "string") {
90 | data = JSON.parse(data);
91 | }
92 | switch (data.type) {
93 | case QWebChannelMessageTypes.signal:
94 | channel.handleSignal(data);
95 | break;
96 | case QWebChannelMessageTypes.response:
97 | channel.handleResponse(data);
98 | break;
99 | case QWebChannelMessageTypes.propertyUpdate:
100 | channel.handlePropertyUpdate(data);
101 | break;
102 | default:
103 | console.error("invalid message received:", message.data);
104 | break;
105 | }
106 | }
107 |
108 | this.execCallbacks = {};
109 | this.execId = 0;
110 | this.exec = function(data, callback)
111 | {
112 | if (!callback) {
113 | // if no callback is given, send directly
114 | channel.send(data);
115 | return;
116 | }
117 | if (channel.execId === Number.MAX_VALUE) {
118 | // wrap
119 | channel.execId = Number.MIN_VALUE;
120 | }
121 | if (data.hasOwnProperty("id")) {
122 | console.error("Cannot exec message with property id: " + JSON.stringify(data));
123 | return;
124 | }
125 | data.id = channel.execId++;
126 | channel.execCallbacks[data.id] = callback;
127 | channel.send(data);
128 | };
129 |
130 | this.objects = {};
131 |
132 | this.handleSignal = function(message)
133 | {
134 | var object = channel.objects[message.object];
135 | if (object) {
136 | object.signalEmitted(message.signal, message.args);
137 | } else {
138 | console.warn("Unhandled signal: " + message.object + "::" + message.signal);
139 | }
140 | }
141 |
142 | this.handleResponse = function(message)
143 | {
144 | if (!message.hasOwnProperty("id")) {
145 | console.error("Invalid response message received: ", JSON.stringify(message));
146 | return;
147 | }
148 | channel.execCallbacks[message.id](message.data);
149 | delete channel.execCallbacks[message.id];
150 | }
151 |
152 | this.handlePropertyUpdate = function(message)
153 | {
154 | for (var i in message.data) {
155 | var data = message.data[i];
156 | var object = channel.objects[data.object];
157 | if (object) {
158 | object.propertyUpdate(data.signals, data.properties);
159 | } else {
160 | console.warn("Unhandled property update: " + data.object + "::" + data.signal);
161 | }
162 | }
163 | channel.exec({type: QWebChannelMessageTypes.idle});
164 | }
165 |
166 | this.debug = function(message)
167 | {
168 | channel.send({type: QWebChannelMessageTypes.debug, data: message});
169 | };
170 |
171 | channel.exec({type: QWebChannelMessageTypes.init}, function(data) {
172 | for (var objectName in data) {
173 | var object = new QObject(objectName, data[objectName], channel);
174 | }
175 | // now unwrap properties, which might reference other registered objects
176 | for (var objectName in channel.objects) {
177 | channel.objects[objectName].unwrapProperties();
178 | }
179 | if (initCallback) {
180 | initCallback(channel);
181 | }
182 | channel.exec({type: QWebChannelMessageTypes.idle});
183 | });
184 | };
185 |
186 | function QObject(name, data, webChannel)
187 | {
188 | this.__id__ = name;
189 | webChannel.objects[name] = this;
190 |
191 | // List of callbacks that get invoked upon signal emission
192 | this.__objectSignals__ = {};
193 |
194 | // Cache of all properties, updated when a notify signal is emitted
195 | this.__propertyCache__ = {};
196 |
197 | var object = this;
198 |
199 | // ----------------------------------------------------------------------
200 |
201 | this.unwrapQObject = function(response)
202 | {
203 | if (response instanceof Array) {
204 | // support list of objects
205 | var ret = new Array(response.length);
206 | for (var i = 0; i < response.length; ++i) {
207 | ret[i] = object.unwrapQObject(response[i]);
208 | }
209 | return ret;
210 | }
211 | if (!response
212 | || !response["__QObject*__"]
213 | || response.id === undefined) {
214 | return response;
215 | }
216 |
217 | var objectId = response.id;
218 | if (webChannel.objects[objectId])
219 | return webChannel.objects[objectId];
220 |
221 | if (!response.data) {
222 | console.error("Cannot unwrap unknown QObject " + objectId + " without data.");
223 | return;
224 | }
225 |
226 | var qObject = new QObject( objectId, response.data, webChannel );
227 | qObject.destroyed.connect(function() {
228 | if (webChannel.objects[objectId] === qObject) {
229 | delete webChannel.objects[objectId];
230 | // reset the now deleted QObject to an empty {} object
231 | // just assigning {} though would not have the desired effect, but the
232 | // below also ensures all external references will see the empty map
233 | // NOTE: this detour is necessary to workaround QTBUG-40021
234 | var propertyNames = [];
235 | for (var propertyName in qObject) {
236 | propertyNames.push(propertyName);
237 | }
238 | for (var idx in propertyNames) {
239 | delete qObject[propertyNames[idx]];
240 | }
241 | }
242 | });
243 | // here we are already initialized, and thus must directly unwrap the properties
244 | qObject.unwrapProperties();
245 | return qObject;
246 | }
247 |
248 | this.unwrapProperties = function()
249 | {
250 | for (var propertyIdx in object.__propertyCache__) {
251 | object.__propertyCache__[propertyIdx] = object.unwrapQObject(object.__propertyCache__[propertyIdx]);
252 | }
253 | }
254 |
255 | function addSignal(signalData, isPropertyNotifySignal)
256 | {
257 | var signalName = signalData[0];
258 | var signalIndex = signalData[1];
259 | object[signalName] = {
260 | connect: function(callback) {
261 | if (typeof(callback) !== "function") {
262 | console.error("Bad callback given to connect to signal " + signalName);
263 | return;
264 | }
265 |
266 | object.__objectSignals__[signalIndex] = object.__objectSignals__[signalIndex] || [];
267 | object.__objectSignals__[signalIndex].push(callback);
268 |
269 | if (!isPropertyNotifySignal && signalName !== "destroyed") {
270 | // only required for "pure" signals, handled separately for properties in propertyUpdate
271 | // also note that we always get notified about the destroyed signal
272 | webChannel.exec({
273 | type: QWebChannelMessageTypes.connectToSignal,
274 | object: object.__id__,
275 | signal: signalIndex
276 | });
277 | }
278 | },
279 | disconnect: function(callback) {
280 | if (typeof(callback) !== "function") {
281 | console.error("Bad callback given to disconnect from signal " + signalName);
282 | return;
283 | }
284 | object.__objectSignals__[signalIndex] = object.__objectSignals__[signalIndex] || [];
285 | var idx = object.__objectSignals__[signalIndex].indexOf(callback);
286 | if (idx === -1) {
287 | console.error("Cannot find connection of signal " + signalName + " to " + callback.name);
288 | return;
289 | }
290 | object.__objectSignals__[signalIndex].splice(idx, 1);
291 | if (!isPropertyNotifySignal && object.__objectSignals__[signalIndex].length === 0) {
292 | // only required for "pure" signals, handled separately for properties in propertyUpdate
293 | webChannel.exec({
294 | type: QWebChannelMessageTypes.disconnectFromSignal,
295 | object: object.__id__,
296 | signal: signalIndex
297 | });
298 | }
299 | }
300 | };
301 | }
302 |
303 | /**
304 | * Invokes all callbacks for the given signalname. Also works for property notify callbacks.
305 | */
306 | function invokeSignalCallbacks(signalName, signalArgs)
307 | {
308 | var connections = object.__objectSignals__[signalName];
309 | if (connections) {
310 | connections.forEach(function(callback) {
311 | callback.apply(callback, signalArgs);
312 | });
313 | }
314 | }
315 |
316 | this.propertyUpdate = function(signals, propertyMap)
317 | {
318 | // update property cache
319 | for (var propertyIndex in propertyMap) {
320 | var propertyValue = propertyMap[propertyIndex];
321 | object.__propertyCache__[propertyIndex] = propertyValue;
322 | }
323 |
324 | for (var signalName in signals) {
325 | // Invoke all callbacks, as signalEmitted() does not. This ensures the
326 | // property cache is updated before the callbacks are invoked.
327 | invokeSignalCallbacks(signalName, signals[signalName]);
328 | }
329 | }
330 |
331 | this.signalEmitted = function(signalName, signalArgs)
332 | {
333 | invokeSignalCallbacks(signalName, signalArgs);
334 | }
335 |
336 | function addMethod(methodData)
337 | {
338 | var methodName = methodData[0];
339 | var methodIdx = methodData[1];
340 | object[methodName] = function() {
341 | var args = [];
342 | var callback;
343 | for (var i = 0; i < arguments.length; ++i) {
344 | if (typeof arguments[i] === "function")
345 | callback = arguments[i];
346 | else
347 | args.push(arguments[i]);
348 | }
349 |
350 | webChannel.exec({
351 | "type": QWebChannelMessageTypes.invokeMethod,
352 | "object": object.__id__,
353 | "method": methodIdx,
354 | "args": args
355 | }, function(response) {
356 | if (response !== undefined) {
357 | var result = object.unwrapQObject(response);
358 | if (callback) {
359 | (callback)(result);
360 | }
361 | }
362 | });
363 | };
364 | }
365 |
366 | function bindGetterSetter(propertyInfo)
367 | {
368 | var propertyIndex = propertyInfo[0];
369 | var propertyName = propertyInfo[1];
370 | var notifySignalData = propertyInfo[2];
371 | // initialize property cache with current value
372 | // NOTE: if this is an object, it is not directly unwrapped as it might
373 | // reference other QObject that we do not know yet
374 | object.__propertyCache__[propertyIndex] = propertyInfo[3];
375 |
376 | if (notifySignalData) {
377 | if (notifySignalData[0] === 1) {
378 | // signal name is optimized away, reconstruct the actual name
379 | notifySignalData[0] = propertyName + "Changed";
380 | }
381 | addSignal(notifySignalData, true);
382 | }
383 |
384 | Object.defineProperty(object, propertyName, {
385 | configurable: true,
386 | get: function () {
387 | var propertyValue = object.__propertyCache__[propertyIndex];
388 | if (propertyValue === undefined) {
389 | // This shouldn't happen
390 | console.warn("Undefined value in property cache for property \"" + propertyName + "\" in object " + object.__id__);
391 | }
392 |
393 | return propertyValue;
394 | },
395 | set: function(value) {
396 | if (value === undefined) {
397 | console.warn("Property setter for " + propertyName + " called with undefined value!");
398 | return;
399 | }
400 | object.__propertyCache__[propertyIndex] = value;
401 | webChannel.exec({
402 | "type": QWebChannelMessageTypes.setProperty,
403 | "object": object.__id__,
404 | "property": propertyIndex,
405 | "value": value
406 | });
407 | }
408 | });
409 |
410 | }
411 |
412 | // ----------------------------------------------------------------------
413 |
414 | data.methods.forEach(addMethod);
415 |
416 | data.properties.forEach(bindGetterSetter);
417 |
418 | data.signals.forEach(function(signal) { addSignal(signal, false); });
419 |
420 | for (var name in data.enums) {
421 | object[name] = data.enums[name];
422 | }
423 | }
424 |
425 | //required for use with nodejs
426 | if (typeof module === 'object') {
427 | module.exports = {
428 | QWebChannel: QWebChannel
429 | };
430 | }
431 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
--------------------------------------------------------------------------------
/robot/robot.pro.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | EnvironmentId
7 | {95031574-3b63-4a3d-9385-46c91ddfcd0e}
8 |
9 |
10 | ProjectExplorer.Project.ActiveTarget
11 | 0
12 |
13 |
14 | ProjectExplorer.Project.EditorSettings
15 |
16 | true
17 | false
18 | true
19 |
20 | Cpp
21 |
22 | CppGlobal
23 |
24 |
25 |
26 | QmlJS
27 |
28 | QmlJSGlobal
29 |
30 |
31 | 2
32 | UTF-8
33 | false
34 | 4
35 | false
36 | 80
37 | true
38 | true
39 | 1
40 | true
41 | false
42 | 0
43 | true
44 | true
45 | 0
46 | 8
47 | true
48 | 1
49 | true
50 | true
51 | true
52 | false
53 |
54 |
55 |
56 | ProjectExplorer.Project.PluginSettings
57 |
58 |
59 |
60 | ProjectExplorer.Project.Target.0
61 |
62 | Desktop Qt 5.7.0 clang 64bit
63 | Desktop Qt 5.7.0 clang 64bit
64 | qt.57.clang_64_kit
65 | 0
66 | 0
67 | 0
68 |
69 | /Users/evil/Applications/Qt5.7.0/Examples/Qt-5.7/webview/build-minibrowser-Desktop_Qt_5_7_0_clang_64bit-Debug
70 |
71 |
72 | true
73 | qmake
74 |
75 | QtProjectManager.QMakeBuildStep
76 | true
77 |
78 | false
79 | false
80 | false
81 |
82 |
83 | true
84 | Make
85 |
86 | Qt4ProjectManager.MakeStep
87 |
88 | -w
89 | -r
90 |
91 | false
92 |
93 |
94 |
95 | 2
96 | Build
97 |
98 | ProjectExplorer.BuildSteps.Build
99 |
100 |
101 |
102 | true
103 | Make
104 |
105 | Qt4ProjectManager.MakeStep
106 |
107 | -w
108 | -r
109 |
110 | true
111 | clean
112 |
113 |
114 | 1
115 | Clean
116 |
117 | ProjectExplorer.BuildSteps.Clean
118 |
119 | 2
120 | false
121 |
122 | Debug
123 |
124 | Qt4ProjectManager.Qt4BuildConfiguration
125 | 2
126 | true
127 |
128 |
129 | /Users/evil/Applications/Qt5.7.0/Examples/Qt-5.7/webview/build-minibrowser-Desktop_Qt_5_7_0_clang_64bit-Release
130 |
131 |
132 | true
133 | qmake
134 |
135 | QtProjectManager.QMakeBuildStep
136 | false
137 |
138 | false
139 | false
140 | false
141 |
142 |
143 | true
144 | Make
145 |
146 | Qt4ProjectManager.MakeStep
147 |
148 | -w
149 | -r
150 |
151 | false
152 |
153 |
154 |
155 | 2
156 | Build
157 |
158 | ProjectExplorer.BuildSteps.Build
159 |
160 |
161 |
162 | true
163 | Make
164 |
165 | Qt4ProjectManager.MakeStep
166 |
167 | -w
168 | -r
169 |
170 | true
171 | clean
172 |
173 |
174 | 1
175 | Clean
176 |
177 | ProjectExplorer.BuildSteps.Clean
178 |
179 | 2
180 | false
181 |
182 | Release
183 |
184 | Qt4ProjectManager.Qt4BuildConfiguration
185 | 0
186 | true
187 |
188 |
189 | /Users/evil/Applications/Qt5.7.0/Examples/Qt-5.7/webview/build-minibrowser-Desktop_Qt_5_7_0_clang_64bit-Profile
190 |
191 |
192 | true
193 | qmake
194 |
195 | QtProjectManager.QMakeBuildStep
196 | true
197 |
198 | false
199 | true
200 | false
201 |
202 |
203 | true
204 | Make
205 |
206 | Qt4ProjectManager.MakeStep
207 |
208 | -w
209 | -r
210 |
211 | false
212 |
213 |
214 |
215 | 2
216 | Build
217 |
218 | ProjectExplorer.BuildSteps.Build
219 |
220 |
221 |
222 | true
223 | Make
224 |
225 | Qt4ProjectManager.MakeStep
226 |
227 | -w
228 | -r
229 |
230 | true
231 | clean
232 |
233 |
234 | 1
235 | Clean
236 |
237 | ProjectExplorer.BuildSteps.Clean
238 |
239 | 2
240 | false
241 |
242 | Profile
243 |
244 | Qt4ProjectManager.Qt4BuildConfiguration
245 | 0
246 | true
247 |
248 | 3
249 |
250 |
251 | 0
252 | Deploy
253 |
254 | ProjectExplorer.BuildSteps.Deploy
255 |
256 | 1
257 | Deploy locally
258 |
259 | ProjectExplorer.DefaultDeployConfiguration
260 |
261 | 1
262 |
263 |
264 | false
265 | false
266 | 1000
267 |
268 | true
269 |
270 | false
271 | false
272 | false
273 | false
274 | true
275 | 0.01
276 | 10
277 | true
278 | 1
279 | 25
280 |
281 | 1
282 | true
283 | false
284 | true
285 | valgrind
286 |
287 | 0
288 | 1
289 | 2
290 | 3
291 | 4
292 | 5
293 | 6
294 | 7
295 | 8
296 | 9
297 | 10
298 | 11
299 | 12
300 | 13
301 | 14
302 |
303 | 2
304 |
305 | duck-robot
306 |
307 | Qt4ProjectManager.Qt4RunConfiguration:/Users/evil/dev/qtproject/duck-robot/duck/duck-robot.pro
308 | true
309 |
310 | duck-robot.pro
311 | false
312 |
313 | /Users/evil/Applications/Qt5.7.0/Examples/Qt-5.7/webview/build-minibrowser-Desktop_Qt_5_7_0_clang_64bit-Debug/duck.app/Contents/MacOS
314 | 3768
315 | false
316 | true
317 | false
318 | false
319 | true
320 |
321 | 1
322 |
323 |
324 |
325 | ProjectExplorer.Project.TargetCount
326 | 1
327 |
328 |
329 | ProjectExplorer.Project.Updater.FileVersion
330 | 18
331 |
332 |
333 | Version
334 | 18
335 |
336 |
337 |
--------------------------------------------------------------------------------
/duck.pro.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | EnvironmentId
7 | {95031574-3b63-4a3d-9385-46c91ddfcd0e}
8 |
9 |
10 | ProjectExplorer.Project.ActiveTarget
11 | 0
12 |
13 |
14 | ProjectExplorer.Project.EditorSettings
15 |
16 | true
17 | false
18 | true
19 |
20 | Cpp
21 |
22 | CppGlobal
23 |
24 |
25 |
26 | QmlJS
27 |
28 | QmlJSGlobal
29 |
30 |
31 | 2
32 | UTF-8
33 | false
34 | 4
35 | false
36 | 80
37 | true
38 | true
39 | 1
40 | true
41 | false
42 | 0
43 | true
44 | true
45 | 0
46 | 8
47 | true
48 | 1
49 | true
50 | true
51 | true
52 | false
53 |
54 |
55 |
56 | ProjectExplorer.Project.PluginSettings
57 |
58 |
59 |
60 |
61 |
62 | ProjectExplorer.Project.Target.0
63 |
64 | Desktop Qt 5.7.0 clang 64bit
65 | Desktop Qt 5.7.0 clang 64bit
66 | qt.57.clang_64_kit
67 | 0
68 | 0
69 | 0
70 |
71 | /Users/evil/dev/qtproject/build-duck-Desktop_Qt_5_7_0_clang_64bit-Debug
72 |
73 |
74 | true
75 | qmake
76 |
77 | QtProjectManager.QMakeBuildStep
78 | true
79 |
80 | false
81 | false
82 | false
83 |
84 |
85 | true
86 | Make
87 |
88 | Qt4ProjectManager.MakeStep
89 |
90 | -w
91 | -r
92 |
93 | false
94 |
95 |
96 |
97 | 2
98 | Build
99 |
100 | ProjectExplorer.BuildSteps.Build
101 |
102 |
103 |
104 | true
105 | Make
106 |
107 | Qt4ProjectManager.MakeStep
108 |
109 | -w
110 | -r
111 |
112 | true
113 | clean
114 |
115 |
116 | 1
117 | Clean
118 |
119 | ProjectExplorer.BuildSteps.Clean
120 |
121 | 2
122 | false
123 |
124 | Debug
125 |
126 | Qt4ProjectManager.Qt4BuildConfiguration
127 | 2
128 | true
129 |
130 |
131 | /Users/evil/dev/qtproject/build-webview-Desktop_Qt_5_7_0_clang_64bit-Release
132 |
133 |
134 | true
135 | qmake
136 |
137 | QtProjectManager.QMakeBuildStep
138 | false
139 |
140 | false
141 | false
142 | false
143 |
144 |
145 | true
146 | Make
147 |
148 | Qt4ProjectManager.MakeStep
149 |
150 | -w
151 | -r
152 |
153 | false
154 |
155 |
156 |
157 | 2
158 | Build
159 |
160 | ProjectExplorer.BuildSteps.Build
161 |
162 |
163 |
164 | true
165 | Make
166 |
167 | Qt4ProjectManager.MakeStep
168 |
169 | -w
170 | -r
171 |
172 | true
173 | clean
174 |
175 |
176 | 1
177 | Clean
178 |
179 | ProjectExplorer.BuildSteps.Clean
180 |
181 | 2
182 | false
183 |
184 | Release
185 |
186 | Qt4ProjectManager.Qt4BuildConfiguration
187 | 0
188 | true
189 |
190 |
191 | /Users/evil/dev/qtproject/build-webview-Desktop_Qt_5_7_0_clang_64bit-Profile
192 |
193 |
194 | true
195 | qmake
196 |
197 | QtProjectManager.QMakeBuildStep
198 | true
199 |
200 | false
201 | true
202 | false
203 |
204 |
205 | true
206 | Make
207 |
208 | Qt4ProjectManager.MakeStep
209 |
210 | -w
211 | -r
212 |
213 | false
214 |
215 |
216 |
217 | 2
218 | Build
219 |
220 | ProjectExplorer.BuildSteps.Build
221 |
222 |
223 |
224 | true
225 | Make
226 |
227 | Qt4ProjectManager.MakeStep
228 |
229 | -w
230 | -r
231 |
232 | true
233 | clean
234 |
235 |
236 | 1
237 | Clean
238 |
239 | ProjectExplorer.BuildSteps.Clean
240 |
241 | 2
242 | false
243 |
244 | Profile
245 |
246 | Qt4ProjectManager.Qt4BuildConfiguration
247 | 0
248 | true
249 |
250 | 3
251 |
252 |
253 | 0
254 | Deploy
255 |
256 | ProjectExplorer.BuildSteps.Deploy
257 |
258 | 1
259 | Deploy locally
260 |
261 | ProjectExplorer.DefaultDeployConfiguration
262 |
263 | 1
264 |
265 |
266 | false
267 | false
268 | 1000
269 |
270 | true
271 |
272 | false
273 | false
274 | false
275 | false
276 | true
277 | 0.01
278 | 10
279 | true
280 | 1
281 | 25
282 |
283 | 1
284 | true
285 | false
286 | true
287 | valgrind
288 |
289 | 0
290 | 1
291 | 2
292 | 3
293 | 4
294 | 5
295 | 6
296 | 7
297 | 8
298 | 9
299 | 10
300 | 11
301 | 12
302 | 13
303 | 14
304 |
305 | 2
306 |
307 | QTWEBENGINE_REMOTE_DEBUGGING=9000
308 |
309 | robot
310 |
311 | Qt4ProjectManager.Qt4RunConfiguration:/Users/evil/dev/qtproject/duck-robot/robot/robot.pro
312 | true
313 | --disable-web-security
314 | robot/robot.pro
315 | false
316 |
317 | /Users/evil/dev/qtproject/build-duck-Desktop_Qt_5_7_0_clang_64bit-Debug/robot/duck.app/Contents/MacOS
318 | 3768
319 | false
320 | true
321 | false
322 | false
323 | true
324 |
325 | 1
326 |
327 |
328 |
329 | ProjectExplorer.Project.TargetCount
330 | 1
331 |
332 |
333 | ProjectExplorer.Project.Updater.FileVersion
334 | 18
335 |
336 |
337 | Version
338 | 18
339 |
340 |
341 |
--------------------------------------------------------------------------------
/robot/jquery-3.2.1.min.js:
--------------------------------------------------------------------------------
1 | /*! jQuery v3.2.1 | (c) JS Foundation and other contributors | jquery.org/license */
2 | !function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.2.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext;function B(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()}var C=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,D=/^.[^:#\[\.,]*$/;function E(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):D.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(E(this,a||[],!1))},not:function(a){return this.pushStack(E(this,a||[],!0))},is:function(a){return!!E(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var F,G=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,H=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||F,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:G.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),C.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};H.prototype=r.fn,F=r(d);var I=/^(?:parents|prev(?:Until|All))/,J={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function K(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return K(a,"nextSibling")},prev:function(a){return K(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return B(a,"iframe")?a.contentDocument:(B(a,"template")&&(a=a.content||a),r.merge([],a.childNodes))}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(J[a]||r.uniqueSort(e),I.test(a)&&e.reverse()),this.pushStack(e)}});var L=/[^\x20\t\r\n\f]+/g;function M(a){var b={};return r.each(a.match(L)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?M(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=e||a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function N(a){return a}function O(a){throw a}function P(a,b,c,d){var e;try{a&&r.isFunction(e=a.promise)?e.call(a).done(b).fail(c):a&&r.isFunction(e=a.then)?e.call(a,b,c):b.apply(void 0,[a].slice(d))}catch(a){c.apply(void 0,[a])}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b=f&&(d!==O&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:N,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:N)),c[2][3].add(g(0,a,r.isFunction(d)?d:O))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(P(a,g.done(h(c)).resolve,g.reject,!b),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)P(e[c],h(c),g.reject);return g.promise()}});var Q=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&Q.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var R=r.Deferred();r.fn.ready=function(a){return R.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||R.resolveWith(d,[r]))}}),r.ready.then=R.then;function S(){d.removeEventListener("DOMContentLoaded",S),
3 | a.removeEventListener("load",S),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",S),a.addEventListener("load",S));var T=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)T(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h1,null,!0)},removeData:function(a){return this.each(function(){X.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=W.get(a,b),c&&(!d||Array.isArray(c)?d=W.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return W.get(a,c)||W.access(a,c,{empty:r.Callbacks("once memory").add(function(){W.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length\x20\t\r\n\f]+)/i,la=/^$|\/(?:java|ecma)script/i,ma={option:[1,""],thead:[1,"