How to use mouseDown method in Playwright Internal

Best JavaScript code snippet using playwright-internal

menuInteraction.js

Source:menuInteraction.js Github

copy

Full Screen

1var setupMenuEvents = function() {2 var getEquation = function() {3 var equation = null;4 if ($('.cursor').length > 0) {5 equation = $('.cursor').parent().data('eqObject').equation;6 } else if ($('.highlight').length > 0) {7 equation = $('.highlight').parent().data('eqObject').equation;8 }9 return equation;10 };11 $(document).on('touchstart mousedown', '#stackedFractionButton', function (e) {12 e.preventDefault();13 e.stopPropagation();14 var equation = getEquation();15 var stackedFractionWrapper = new eqEd.StackedFractionWrapper(equation);16 insertWrapper(stackedFractionWrapper);17 });18 $(document).on('touchstart mousedown', '#superscriptButton', function (e) {19 e.preventDefault();20 e.stopPropagation();21 var equation = getEquation();22 var superscriptWrapper = new eqEd.SuperscriptWrapper(equation);23 insertWrapper(superscriptWrapper);24 });25 $(document).on('touchstart mousedown', '#subscriptButton', function (e) {26 e.preventDefault();27 e.stopPropagation();28 var equation = getEquation();29 var subscriptWrapper = new eqEd.SubscriptWrapper(equation);30 insertWrapper(subscriptWrapper);31 });32 $(document).on('touchstart mousedown', '#superscriptAndSubscriptButton', function (e) {33 e.preventDefault();34 e.stopPropagation();35 var equation = getEquation();36 var superscriptAndSubscriptWrapper = new eqEd.SuperscriptAndSubscriptWrapper(equation);37 insertWrapper(superscriptAndSubscriptWrapper);38 });39 $(document).on('touchstart mousedown', '#squareRootButton', function (e) {40 e.preventDefault();41 e.stopPropagation();42 var equation = getEquation();43 var squareRootWrapper = new eqEd.SquareRootWrapper(equation);44 insertWrapper(squareRootWrapper);45 });46 $(document).on('touchstart mousedown', '#nthRootButton', function (e) {47 e.preventDefault();48 e.stopPropagation();49 var equation = getEquation();50 var nthRootButton = new eqEd.NthRootWrapper(equation);51 insertWrapper(nthRootButton);52 });53 54 $(document).on('touchstart mousedown', '#leftAngleBracketButton', function (e) {55 e.preventDefault();56 e.stopPropagation();57 var equation = getEquation();58 var leftAngleBracketWrapper = new eqEd.BracketWrapper(equation, "leftAngleBracket");59 insertWrapper(leftAngleBracketWrapper);60 });61 $(document).on('touchstart mousedown', '#rightAngleBracketButton', function (e) {62 e.preventDefault();63 e.stopPropagation();64 var equation = getEquation();65 var rightAngleBracketWrapper = new eqEd.BracketWrapper(equation, "rightAngleBracket");66 insertWrapper(rightAngleBracketWrapper);67 });68 $(document).on('touchstart mousedown', '#leftFloorBracketButton', function (e) {69 e.preventDefault();70 e.stopPropagation();71 var equation = getEquation();72 var leftFloorBracketWrapper = new eqEd.BracketWrapper(equation, "leftFloorBracket");73 insertWrapper(leftFloorBracketWrapper);74 });75 $(document).on('touchstart mousedown', '#rightFloorBracketButton', function (e) {76 e.preventDefault();77 e.stopPropagation();78 var equation = getEquation();79 var rightFloorBracketWrapper = new eqEd.BracketWrapper(equation, "rightFloorBracket");80 insertWrapper(rightFloorBracketWrapper);81 });82 $(document).on('touchstart mousedown', '#leftCeilBracketButton', function (e) {83 e.preventDefault();84 e.stopPropagation();85 var equation = getEquation();86 var leftCeilBracketWrapper = new eqEd.BracketWrapper(equation, "leftCeilBracket");87 insertWrapper(leftCeilBracketWrapper);88 });89 $(document).on('touchstart mousedown', '#rightCeilBracketButton', function (e) {90 e.preventDefault();91 e.stopPropagation();92 var equation = getEquation();93 var rightCeilBracketWrapper = new eqEd.BracketWrapper(equation, "rightCeilBracket");94 insertWrapper(rightCeilBracketWrapper);95 });96 $(document).on('touchstart mousedown', '#parenthesesBracketPairButton', function (e) {97 e.preventDefault();98 e.stopPropagation();99 var equation = getEquation();100 var parenthesesBracketPair = new eqEd.BracketPairWrapper(equation, "parenthesisBracket");101 insertWrapper(parenthesesBracketPair);102 });103 $(document).on('touchstart mousedown', '#squareBracketPairButton', function (e) {104 e.preventDefault();105 e.stopPropagation();106 var equation = getEquation();107 var squareBracketPair = new eqEd.BracketPairWrapper(equation, "squareBracket");108 insertWrapper(squareBracketPair);109 });110 $(document).on('touchstart mousedown', '#curlyBracketPairButton', function (e) {111 e.preventDefault();112 e.stopPropagation();113 var equation = getEquation();114 var curlyBracketPair = new eqEd.BracketPairWrapper(equation, "curlyBracket");115 insertWrapper(curlyBracketPair);116 });117 $(document).on('touchstart mousedown', '#angleBracketPairButton', function (e) {118 e.preventDefault();119 e.stopPropagation();120 var equation = getEquation();121 var angleBracketPair = new eqEd.BracketPairWrapper(equation, "angleBracket");122 insertWrapper(angleBracketPair);123 });$(document).on('touchstart mousedown', '#floorBracketPairButton', function (e) {124 e.preventDefault();125 e.stopPropagation();126 var equation = getEquation();127 var floorBracketPair = new eqEd.BracketPairWrapper(equation, "floorBracket");128 insertWrapper(floorBracketPair);129 });130 $(document).on('touchstart mousedown', '#ceilBracketPairButton', function (e) {131 e.preventDefault();132 e.stopPropagation();133 var equation = getEquation();134 var ceilBracketPair = new eqEd.BracketPairWrapper(equation, "ceilBracket");135 insertWrapper(ceilBracketPair);136 });137 $(document).on('touchstart mousedown', '#absValBracketPairButton', function (e) {138 e.preventDefault();139 e.stopPropagation();140 var equation = getEquation();141 var absValBracketPair = new eqEd.BracketPairWrapper(equation, "absValBracket");142 insertWrapper(absValBracketPair);143 });144 $(document).on('touchstart mousedown', '#normBracketPairButton', function (e) {145 e.preventDefault();146 e.stopPropagation();147 var equation = getEquation();148 var normBracketPair = new eqEd.BracketPairWrapper(equation, "normBracket");149 insertWrapper(normBracketPair);150 });151 $(document).on('touchstart mousedown', '#sumBigOperatorButton', function (e) {152 e.preventDefault();153 e.stopPropagation();154 var equation = getEquation();155 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, true, true, 'sum');156 insertWrapper(bigOperator);157 });158 $(document).on('touchstart mousedown', '#sumBigOperatorNoUpperButton', function (e) {159 e.preventDefault();160 e.stopPropagation();161 var equation = getEquation();162 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, true, 'sum');163 insertWrapper(bigOperator);164 });165 $(document).on('touchstart mousedown', '#sumBigOperatorNoUpperNoLowerButton', function (e) {166 e.preventDefault();167 e.stopPropagation();168 var equation = getEquation();169 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, false, 'sum');170 insertWrapper(bigOperator);171 });172 $(document).on('touchstart mousedown', '#bigCapBigOperatorButton', function (e) {173 e.preventDefault();174 e.stopPropagation();175 var equation = getEquation();176 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, true, true, 'bigCap');177 insertWrapper(bigOperator);178 });179 $(document).on('touchstart mousedown', '#bigCapBigOperatorNoUpperButton', function (e) {180 e.preventDefault();181 e.stopPropagation();182 var equation = getEquation();183 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, true, 'bigCap');184 insertWrapper(bigOperator);185 });186 $(document).on('touchstart mousedown', '#bigCapBigOperatorNoUpperNoLowerButton', function (e) {187 e.preventDefault();188 e.stopPropagation();189 var equation = getEquation();190 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, false, 'bigCap');191 insertWrapper(bigOperator);192 });193 $(document).on('touchstart mousedown', '#bigCupBigOperatorButton', function (e) {194 e.preventDefault();195 e.stopPropagation();196 var equation = getEquation();197 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, true, true, 'bigCup');198 insertWrapper(bigOperator);199 });200 $(document).on('touchstart mousedown', '#bigCupBigOperatorNoUpperButton', function (e) {201 e.preventDefault();202 e.stopPropagation();203 var equation = getEquation();204 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, true, 'bigCup');205 insertWrapper(bigOperator);206 });207 $(document).on('touchstart mousedown', '#bigCupBigOperatorNoUpperNoLowerButton', function (e) {208 e.preventDefault();209 e.stopPropagation();210 var equation = getEquation();211 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, false, 'bigCup');212 insertWrapper(bigOperator);213 });214 $(document).on('touchstart mousedown', '#bigSqCapBigOperatorButton', function (e) {215 e.preventDefault();216 e.stopPropagation();217 var equation = getEquation();218 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, true, true, 'bigSqCap');219 insertWrapper(bigOperator);220 });221 $(document).on('touchstart mousedown', '#bigSqCapBigOperatorNoUpperButton', function (e) {222 e.preventDefault();223 e.stopPropagation();224 var equation = getEquation();225 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, true, 'bigSqCap');226 insertWrapper(bigOperator);227 });228 $(document).on('touchstart mousedown', '#bigSqCapBigOperatorNoUpperNoLowerButton', function (e) {229 e.preventDefault();230 e.stopPropagation();231 var equation = getEquation();232 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, false, 'bigSqCap');233 insertWrapper(bigOperator);234 });235 $(document).on('touchstart mousedown', '#bigSqCupBigOperatorButton', function (e) {236 e.preventDefault();237 e.stopPropagation();238 var equation = getEquation();239 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, true, true, 'bigSqCup');240 insertWrapper(bigOperator);241 });242 $(document).on('touchstart mousedown', '#bigSqCupBigOperatorNoUpperButton', function (e) {243 e.preventDefault();244 e.stopPropagation();245 var equation = getEquation();246 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, true, 'bigSqCup');247 insertWrapper(bigOperator);248 });249 $(document).on('touchstart mousedown', '#bigSqCupBigOperatorNoUpperNoLowerButton', function (e) {250 e.preventDefault();251 e.stopPropagation();252 var equation = getEquation();253 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, false, 'bigSqCup');254 insertWrapper(bigOperator);255 });256 $(document).on('touchstart mousedown', '#prodBigOperatorButton', function (e) {257 e.preventDefault();258 e.stopPropagation();259 var equation = getEquation();260 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, true, true, 'prod');261 insertWrapper(bigOperator);262 });263 $(document).on('touchstart mousedown', '#prodBigOperatorNoUpperButton', function (e) {264 e.preventDefault();265 e.stopPropagation();266 var equation = getEquation();267 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, true, 'prod');268 insertWrapper(bigOperator);269 });270 $(document).on('touchstart mousedown', '#prodBigOperatorNoUpperNoLowerButton', function (e) {271 e.preventDefault();272 e.stopPropagation();273 var equation = getEquation();274 var equation = getEquation();275 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, false, 'prod');276 insertWrapper(bigOperator);277 });278 $(document).on('touchstart mousedown', '#coProdBigOperatorButton', function (e) {279 e.preventDefault();280 e.stopPropagation();281 var equation = getEquation();282 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, true, true, 'coProd');283 insertWrapper(bigOperator);284 });285 $(document).on('touchstart mousedown', '#coProdBigOperatorNoUpperButton', function (e) {286 e.preventDefault();287 e.stopPropagation();288 var equation = getEquation();289 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, true, 'coProd');290 insertWrapper(bigOperator);291 });292 $(document).on('touchstart mousedown', '#coProdBigOperatorNoUpperNoLowerButton', function (e) {293 e.preventDefault();294 e.stopPropagation();295 var equation = getEquation();296 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, false, 'coProd');297 insertWrapper(bigOperator);298 });299 $(document).on('touchstart mousedown', '#bigVeeBigOperatorButton', function (e) {300 e.preventDefault();301 e.stopPropagation();302 var equation = getEquation();303 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, true, true, 'bigVee');304 insertWrapper(bigOperator);305 });306 $(document).on('touchstart mousedown', '#bigVeeBigOperatorNoUpperButton', function (e) {307 e.preventDefault();308 e.stopPropagation();309 var equation = getEquation();310 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, true, 'bigVee');311 insertWrapper(bigOperator);312 });313 $(document).on('touchstart mousedown', '#bigVeeBigOperatorNoUpperNoLowerButton', function (e) {314 e.preventDefault();315 e.stopPropagation();316 var equation = getEquation();317 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, false, 'bigVee');318 insertWrapper(bigOperator);319 });320 $(document).on('touchstart mousedown', '#bigWedgeBigOperatorButton', function (e) {321 e.preventDefault();322 e.stopPropagation();323 var equation = getEquation();324 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, true, true, 'bigWedge');325 insertWrapper(bigOperator);326 });327 $(document).on('touchstart mousedown', '#bigWedgeBigOperatorNoUpperButton', function (e) {328 e.preventDefault();329 e.stopPropagation();330 var equation = getEquation();331 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, true, 'bigWedge');332 insertWrapper(bigOperator);333 });334 $(document).on('touchstart mousedown', '#bigWedgeBigOperatorNoUpperNoLowerButton', function (e) {335 e.preventDefault();336 e.stopPropagation();337 var equation = getEquation();338 var bigOperator = new eqEd.BigOperatorWrapper(equation, false, false, false, 'bigWedge');339 insertWrapper(bigOperator);340 });341 $(document).on('touchstart mousedown', '#inlineSumBigOperatorButton', function (e) {342 e.preventDefault();343 e.stopPropagation();344 var equation = getEquation();345 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, true, true, 'sum');346 insertWrapper(bigOperator);347 });348 $(document).on('touchstart mousedown', '#inlineSumBigOperatorNoUpperButton', function (e) {349 e.preventDefault();350 e.stopPropagation();351 var equation = getEquation();352 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, false, true, 'sum');353 insertWrapper(bigOperator);354 });355 $(document).on('touchstart mousedown', '#inlineBigCapBigOperatorButton', function (e) {356 e.preventDefault();357 e.stopPropagation();358 var equation = getEquation();359 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, true, true, 'bigCap');360 insertWrapper(bigOperator);361 });362 $(document).on('touchstart mousedown', '#inlineBigCapBigOperatorNoUpperButton', function (e) {363 e.preventDefault();364 e.stopPropagation();365 var equation = getEquation();366 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, false, true, 'bigCap');367 insertWrapper(bigOperator);368 });369 $(document).on('touchstart mousedown', '#inlineBigCupBigOperatorButton', function (e) {370 e.preventDefault();371 e.stopPropagation();372 var equation = getEquation();373 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, true, true, 'bigCup');374 insertWrapper(bigOperator);375 });376 $(document).on('touchstart mousedown', '#inlineBigCupBigOperatorNoUpperButton', function (e) {377 e.preventDefault();378 e.stopPropagation();379 var equation = getEquation();380 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, false, true, 'bigCup');381 insertWrapper(bigOperator);382 });383 $(document).on('touchstart mousedown', '#inlineBigSqCapBigOperatorButton', function (e) {384 e.preventDefault();385 e.stopPropagation();386 var equation = getEquation();387 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, true, true, 'bigSqCap');388 insertWrapper(bigOperator);389 });390 $(document).on('touchstart mousedown', '#inlineBigSqCapBigOperatorNoUpperButton', function (e) {391 e.preventDefault();392 e.stopPropagation();393 var equation = getEquation();394 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, false, true, 'bigSqCap');395 insertWrapper(bigOperator);396 });397 $(document).on('touchstart mousedown', '#inlineBigSqCupBigOperatorButton', function (e) {398 e.preventDefault();399 e.stopPropagation();400 var equation = getEquation();401 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, true, true, 'bigSqCup');402 insertWrapper(bigOperator);403 });404 $(document).on('touchstart mousedown', '#inlineBigSqCupBigOperatorNoUpperButton', function (e) {405 e.preventDefault();406 e.stopPropagation();407 var equation = getEquation();408 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, false, true, 'bigSqCup');409 insertWrapper(bigOperator);410 });411 $(document).on('touchstart mousedown', '#inlineProdBigOperatorButton', function (e) {412 e.preventDefault();413 e.stopPropagation();414 var equation = getEquation();415 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, true, true, 'prod');416 insertWrapper(bigOperator);417 });418 $(document).on('touchstart mousedown', '#inlineProdBigOperatorNoUpperButton', function (e) {419 e.preventDefault();420 e.stopPropagation();421 var equation = getEquation();422 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, false, true, 'prod');423 insertWrapper(bigOperator);424 });425 $(document).on('touchstart mousedown', '#inlineCoProdBigOperatorButton', function (e) {426 e.preventDefault();427 e.stopPropagation();428 var equation = getEquation();429 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, true, true, 'coProd');430 insertWrapper(bigOperator);431 });432 $(document).on('touchstart mousedown', '#inlineCoProdBigOperatorNoUpperButton', function (e) {433 e.preventDefault();434 e.stopPropagation();435 var equation = getEquation();436 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, false, true, 'coProd');437 insertWrapper(bigOperator);438 });439 $(document).on('touchstart mousedown', '#inlineBigVeeBigOperatorButton', function (e) {440 e.preventDefault();441 e.stopPropagation();442 var equation = getEquation();443 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, true, true, 'bigVee');444 insertWrapper(bigOperator);445 });446 $(document).on('touchstart mousedown', '#inlineBigVeeBigOperatorNoUpperButton', function (e) {447 e.preventDefault();448 e.stopPropagation();449 var equation = getEquation();450 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, false, true, 'bigVee');451 insertWrapper(bigOperator);452 });453 $(document).on('touchstart mousedown', '#inlineBigWedgeBigOperatorButton', function (e) {454 e.preventDefault();455 e.stopPropagation();456 var equation = getEquation();457 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, true, true, 'bigWedge');458 insertWrapper(bigOperator);459 });460 $(document).on('touchstart mousedown', '#inlineBigWedgeBigOperatorNoUpperButton', function (e) {461 e.preventDefault();462 e.stopPropagation();463 var equation = getEquation();464 var bigOperator = new eqEd.BigOperatorWrapper(equation, true, false, true, 'bigWedge');465 insertWrapper(bigOperator);466 });467 ////////////////////////////////////////////////////////////////468 $(document).on('touchstart mousedown', '#integralButton', function (e) {469 e.preventDefault();470 e.stopPropagation();471 var equation = getEquation();472 var integralWrapper = new eqEd.IntegralWrapper(equation, false, true, true, 'single');473 insertWrapper(integralWrapper);474 });475 $(document).on('touchstart mousedown', '#integralNoUpperButton', function (e) {476 e.preventDefault();477 e.stopPropagation();478 var equation = getEquation();479 var integralWrapper = new eqEd.IntegralWrapper(equation, false, false, true, 'single');480 insertWrapper(integralWrapper);481 });482 $(document).on('touchstart mousedown', '#integralNoUpperNoLowerButton', function (e) {483 e.preventDefault();484 e.stopPropagation();485 var equation = getEquation();486 var integralWrapper = new eqEd.IntegralWrapper(equation, false, false, false, 'single');487 insertWrapper(integralWrapper);488 });489 $(document).on('touchstart mousedown', '#doubleIntegralButton', function (e) {490 e.preventDefault();491 e.stopPropagation();492 var equation = getEquation();493 var integralWrapper = new eqEd.IntegralWrapper(equation, false, true, true, 'double');494 insertWrapper(integralWrapper);495 });496 $(document).on('touchstart mousedown', '#doubleIntegralNoUpperButton', function (e) {497 e.preventDefault();498 e.stopPropagation();499 var equation = getEquation();500 var integralWrapper = new eqEd.IntegralWrapper(equation, false, false, true, 'double');501 insertWrapper(integralWrapper);502 });503 $(document).on('touchstart mousedown', '#doubleIntegralNoUpperNoLowerButton', function (e) {504 e.preventDefault();505 e.stopPropagation();506 var equation = getEquation();507 var integralWrapper = new eqEd.IntegralWrapper(equation, false, false, false, 'double');508 insertWrapper(integralWrapper);509 });510 $(document).on('touchstart mousedown', '#tripleIntegralButton', function (e) {511 e.preventDefault();512 e.stopPropagation();513 var equation = getEquation();514 var integralWrapper = new eqEd.IntegralWrapper(equation, false, true, true, 'triple');515 insertWrapper(integralWrapper);516 });517 $(document).on('touchstart mousedown', '#tripleIntegralNoUpperButton', function (e) {518 e.preventDefault();519 e.stopPropagation();520 var equation = getEquation();521 var integralWrapper = new eqEd.IntegralWrapper(equation, false, false, true, 'triple');522 insertWrapper(integralWrapper);523 });524 $(document).on('touchstart mousedown', '#tripleIntegralNoUpperNoLowerButton', function (e) {525 e.preventDefault();526 e.stopPropagation();527 var equation = getEquation();528 var integralWrapper = new eqEd.IntegralWrapper(equation, false, false, false, 'triple');529 insertWrapper(integralWrapper);530 });531 $(document).on('touchstart mousedown', '#contourIntegralButton', function (e) {532 e.preventDefault();533 e.stopPropagation();534 var equation = getEquation();535 var integralWrapper = new eqEd.IntegralWrapper(equation, false, true, true, 'singleContour');536 insertWrapper(integralWrapper);537 });538 $(document).on('touchstart mousedown', '#contourIntegralNoUpperButton', function (e) {539 e.preventDefault();540 e.stopPropagation();541 var equation = getEquation();542 var integralWrapper = new eqEd.IntegralWrapper(equation, false, false, true, 'singleContour');543 insertWrapper(integralWrapper);544 });545 $(document).on('touchstart mousedown', '#contourIntegralNoUpperNoLowerButton', function (e) {546 e.preventDefault();547 e.stopPropagation();548 var equation = getEquation();549 var integralWrapper = new eqEd.IntegralWrapper(equation, false, false, false, 'singleContour');550 insertWrapper(integralWrapper);551 });552 $(document).on('touchstart mousedown', '#contourDoubleIntegralButton', function (e) {553 e.preventDefault();554 e.stopPropagation();555 var equation = getEquation();556 var integralWrapper = new eqEd.IntegralWrapper(equation, false, true, true, 'doubleContour');557 insertWrapper(integralWrapper);558 });559 $(document).on('touchstart mousedown', '#contourDoubleIntegralNoUpperButton', function (e) {560 e.preventDefault();561 e.stopPropagation();562 var equation = getEquation();563 var integralWrapper = new eqEd.IntegralWrapper(equation, false, false, true, 'doubleContour');564 insertWrapper(integralWrapper);565 });566 $(document).on('touchstart mousedown', '#contourDoubleIntegralNoUpperNoLowerButton', function (e) {567 e.preventDefault();568 e.stopPropagation();569 var equation = getEquation();570 var integralWrapper = new eqEd.IntegralWrapper(equation, false, false, false, 'doubleContour');571 insertWrapper(integralWrapper);572 });573 $(document).on('touchstart mousedown', '#contourTripleIntegralButton', function (e) {574 e.preventDefault();575 e.stopPropagation();576 var equation = getEquation();577 var integralWrapper = new eqEd.IntegralWrapper(equation, false, true, true, 'tripleContour');578 insertWrapper(integralWrapper);579 });580 $(document).on('touchstart mousedown', '#contourTripleIntegralNoUpperButton', function (e) {581 e.preventDefault();582 e.stopPropagation();583 var equation = getEquation();584 var integralWrapper = new eqEd.IntegralWrapper(equation, false, false, true, 'tripleContour');585 insertWrapper(integralWrapper);586 });587 $(document).on('touchstart mousedown', '#contourTripleIntegralNoUpperNoLowerButton', function (e) {588 e.preventDefault();589 e.stopPropagation();590 var equation = getEquation();591 var integralWrapper = new eqEd.IntegralWrapper(equation, false, false, false, 'tripleContour');592 insertWrapper(integralWrapper);593 });594 $(document).on('touchstart mousedown', '#inlineIntegralButton', function (e) {595 e.preventDefault();596 e.stopPropagation();597 var equation = getEquation();598 var integralWrapper = new eqEd.IntegralWrapper(equation, true, true, true, 'single');599 insertWrapper(integralWrapper);600 });601 $(document).on('touchstart mousedown', '#inlineIntegralNoUpperButton', function (e) {602 e.preventDefault();603 e.stopPropagation();604 var equation = getEquation();605 var integralWrapper = new eqEd.IntegralWrapper(equation, true, false, true, 'single');606 insertWrapper(integralWrapper);607 });608 $(document).on('touchstart mousedown', '#inlineDoubleIntegralButton', function (e) {609 e.preventDefault();610 e.stopPropagation();611 var equation = getEquation();612 var integralWrapper = new eqEd.IntegralWrapper(equation, true, true, true, 'double');613 insertWrapper(integralWrapper);614 });615 $(document).on('touchstart mousedown', '#inlineDoubleIntegralNoUpperButton', function (e) {616 e.preventDefault();617 e.stopPropagation();618 var equation = getEquation();619 var integralWrapper = new eqEd.IntegralWrapper(equation, true, false, true, 'double');620 insertWrapper(integralWrapper);621 });622 $(document).on('touchstart mousedown', '#inlineTripleIntegralButton', function (e) {623 e.preventDefault();624 e.stopPropagation();625 var equation = getEquation();626 var integralWrapper = new eqEd.IntegralWrapper(equation, true, true, true, 'triple');627 insertWrapper(integralWrapper);628 });629 $(document).on('touchstart mousedown', '#inlineTripleIntegralNoUpperButton', function (e) {630 e.preventDefault();631 e.stopPropagation();632 var equation = getEquation();633 var integralWrapper = new eqEd.IntegralWrapper(equation, true, false, true, 'triple');634 insertWrapper(integralWrapper);635 });636 $(document).on('touchstart mousedown', '#inlineContourIntegralButton', function (e) {637 e.preventDefault();638 e.stopPropagation();639 var equation = getEquation();640 var integralWrapper = new eqEd.IntegralWrapper(equation, true, true, true, 'singleContour');641 insertWrapper(integralWrapper);642 });643 $(document).on('touchstart mousedown', '#inlineContourIntegralNoUpperButton', function (e) {644 e.preventDefault();645 e.stopPropagation();646 var equation = getEquation();647 var integralWrapper = new eqEd.IntegralWrapper(equation, true, false, true, 'singleContour');648 insertWrapper(integralWrapper);649 });650 $(document).on('touchstart mousedown', '#inlineContourDoubleIntegralButton', function (e) {651 e.preventDefault();652 e.stopPropagation();653 var equation = getEquation();654 var integralWrapper = new eqEd.IntegralWrapper(equation, true, true, true, 'doubleContour');655 insertWrapper(integralWrapper);656 });657 $(document).on('touchstart mousedown', '#inlineContourDoubleIntegralNoUpperButton', function (e) {658 e.preventDefault();659 e.stopPropagation();660 var equation = getEquation();661 var integralWrapper = new eqEd.IntegralWrapper(equation, true, false, true, 'doubleContour');662 insertWrapper(integralWrapper);663 });664 $(document).on('touchstart mousedown', '#inlineContourTripleIntegralButton', function (e) {665 e.preventDefault();666 e.stopPropagation();667 var equation = getEquation();668 var integralWrapper = new eqEd.IntegralWrapper(equation, true, true, true, 'tripleContour');669 insertWrapper(integralWrapper);670 });671 $(document).on('touchstart mousedown', '#inlineContourTripleIntegralNoUpperButton', function (e) {672 e.preventDefault();673 e.stopPropagation();674 var equation = getEquation();675 var integralWrapper = new eqEd.IntegralWrapper(equation, true, false, true, 'tripleContour');676 insertWrapper(integralWrapper);677 });678 $(document).on('touchstart mousedown', '#partialDifferentialButton', function (e) {679 e.preventDefault();680 e.stopPropagation();681 var equation = getEquation();682 var differentialWrapper = new eqEd.SymbolWrapper(equation, '∂', "MathJax_Main");683 insertWrapper(differentialWrapper);684 });685 ///////////////////////////////////////////////////////686 $(document).on('touchstart mousedown', '#logButton', function (e) {687 e.preventDefault();688 e.stopPropagation();689 var equation = getEquation();690 var functionWrapper = new eqEd.FunctionWrapper(equation, 'log', "MathJax_Main");691 insertWrapper(functionWrapper);692 });693 $(document).on('touchstart mousedown', '#lnButton', function (e) {694 e.preventDefault();695 e.stopPropagation();696 var equation = getEquation();697 var functionWrapper = new eqEd.FunctionWrapper(equation, 'ln', "MathJax_Main");698 insertWrapper(functionWrapper);699 });700 $(document).on('touchstart mousedown', '#limButton', function (e) {701 e.preventDefault();702 e.stopPropagation();703 var equation = getEquation();704 var functionWrapper = new eqEd.FunctionWrapper(equation, 'lim', "MathJax_Main");705 insertWrapper(functionWrapper);706 });707 $(document).on('touchstart mousedown', '#maxButton', function (e) {708 e.preventDefault();709 e.stopPropagation();710 var equation = getEquation();711 var functionWrapper = new eqEd.FunctionWrapper(equation, 'max', "MathJax_Main");712 insertWrapper(functionWrapper);713 });714 $(document).on('touchstart mousedown', '#minButton', function (e) {715 e.preventDefault();716 e.stopPropagation();717 var equation = getEquation();718 var functionWrapper = new eqEd.FunctionWrapper(equation, 'min', "MathJax_Main");719 insertWrapper(functionWrapper);720 });721 $(document).on('touchstart mousedown', '#supButton', function (e) {722 e.preventDefault();723 e.stopPropagation();724 var equation = getEquation();725 var functionWrapper = new eqEd.FunctionWrapper(equation, 'sup', "MathJax_Main");726 insertWrapper(functionWrapper);727 });728 $(document).on('touchstart mousedown', '#infButton', function (e) {729 e.preventDefault();730 e.stopPropagation();731 var equation = getEquation();732 var functionWrapper = new eqEd.FunctionWrapper(equation, 'inf', "MathJax_Main");733 insertWrapper(functionWrapper);734 });735 $(document).on('touchstart mousedown', '#sinButton', function (e) {736 e.preventDefault();737 e.stopPropagation();738 var equation = getEquation();739 var functionWrapper = new eqEd.FunctionWrapper(equation, 'sin', "MathJax_Main");740 insertWrapper(functionWrapper);741 });742 $(document).on('touchstart mousedown', '#cosButton', function (e) {743 e.preventDefault();744 e.stopPropagation();745 var equation = getEquation();746 var functionWrapper = new eqEd.FunctionWrapper(equation, 'cos', "MathJax_Main");747 insertWrapper(functionWrapper);748 });749 $(document).on('touchstart mousedown', '#tanButton', function (e) {750 e.preventDefault();751 e.stopPropagation();752 var equation = getEquation();753 var functionWrapper = new eqEd.FunctionWrapper(equation, 'tan', "MathJax_Main");754 insertWrapper(functionWrapper);755 });756 $(document).on('touchstart mousedown', '#cotButton', function (e) {757 e.preventDefault();758 e.stopPropagation();759 var equation = getEquation();760 var functionWrapper = new eqEd.FunctionWrapper(equation, 'cot', "MathJax_Main");761 insertWrapper(functionWrapper);762 });763 $(document).on('touchstart mousedown', '#secButton', function (e) {764 e.preventDefault();765 e.stopPropagation();766 var equation = getEquation();767 var functionWrapper = new eqEd.FunctionWrapper(equation, 'sec', "MathJax_Main");768 insertWrapper(functionWrapper);769 });770 $(document).on('touchstart mousedown', '#cscButton', function (e) {771 e.preventDefault();772 e.stopPropagation();773 var equation = getEquation();774 var functionWrapper = new eqEd.FunctionWrapper(equation, 'csc', "MathJax_Main");775 insertWrapper(functionWrapper);776 });777 $(document).on('touchstart mousedown', '#sinhButton', function (e) {778 e.preventDefault();779 e.stopPropagation();780 var equation = getEquation();781 var functionWrapper = new eqEd.FunctionWrapper(equation, 'sinh', "MathJax_Main");782 insertWrapper(functionWrapper);783 });784 $(document).on('touchstart mousedown', '#coshButton', function (e) {785 e.preventDefault();786 e.stopPropagation();787 var equation = getEquation();788 var functionWrapper = new eqEd.FunctionWrapper(equation, 'cosh', "MathJax_Main");789 insertWrapper(functionWrapper);790 });791 $(document).on('touchstart mousedown', '#tanhButton', function (e) {792 e.preventDefault();793 e.stopPropagation();794 var equation = getEquation();795 var functionWrapper = new eqEd.FunctionWrapper(equation, 'tanh', "MathJax_Main");796 insertWrapper(functionWrapper);797 });798 $(document).on('touchstart mousedown', '#cothButton', function (e) {799 e.preventDefault();800 e.stopPropagation();801 var equation = getEquation();802 var functionWrapper = new eqEd.FunctionWrapper(equation, 'coth', "MathJax_Main");803 insertWrapper(functionWrapper);804 });805 $(document).on('touchstart mousedown', '#sechButton', function (e) {806 e.preventDefault();807 e.stopPropagation();808 var equation = getEquation();809 var functionWrapper = new eqEd.FunctionWrapper(equation, 'sech', "MathJax_Main");810 insertWrapper(functionWrapper);811 });812 $(document).on('touchstart mousedown', '#cschButton', function (e) {813 e.preventDefault();814 e.stopPropagation();815 var equation = getEquation();816 var functionWrapper = new eqEd.FunctionWrapper(equation, 'csch', "MathJax_Main");817 insertWrapper(functionWrapper);818 });819 $(document).on('touchstart mousedown', '#limitButton', function (e) {820 e.preventDefault();821 e.stopPropagation();822 var equation = getEquation();823 var limitWrapper = new eqEd.LimitWrapper(equation);824 insertWrapper(limitWrapper);825 });826 $(document).on('touchstart mousedown', '#maxLowerButton', function (e) {827 e.preventDefault();828 e.stopPropagation();829 var equation = getEquation();830 var functionWrapper = new eqEd.FunctionLowerWrapper(equation, 'max', "MathJax_Main");831 insertWrapper(functionWrapper);832 });833 $(document).on('touchstart mousedown', '#minLowerButton', function (e) {834 e.preventDefault();835 e.stopPropagation();836 var equation = getEquation();837 var functionWrapper = new eqEd.FunctionLowerWrapper(equation, 'min', "MathJax_Main");838 insertWrapper(functionWrapper);839 });840 $(document).on('touchstart mousedown', '#logLowerButton', function (e) {841 e.preventDefault();842 e.stopPropagation();843 var equation = getEquation();844 var functionWrapper = new eqEd.LogLowerWrapper(equation);845 insertWrapper(functionWrapper);846 });847 $(document).on('touchstart mousedown', '#matrixButton', function (e) {848 e.preventDefault();849 e.stopPropagation();850 var equation = getEquation();851 $('#rows').blur();852 $('#cols').blur();853 var rows = parseInt($('#rows').val());854 var cols = parseInt($('#cols').val());855 var matrixWrapper = new eqEd.MatrixWrapper(equation, rows, cols, 'center');856 insertWrapper(matrixWrapper);857 });858 $(document).on('touchstart mousedown', '#dotAccentButton', function (e) {859 e.preventDefault();860 e.stopPropagation();861 var equation = getEquation();862 var accentWrapper = new eqEd.AccentWrapper(equation, '˙', 'MathJax_Main');863 insertWrapper(accentWrapper);864 });865 $(document).on('touchstart mousedown', '#hatAccentButton', function (e) {866 e.preventDefault();867 e.stopPropagation();868 var equation = getEquation();869 var accentWrapper = new eqEd.AccentWrapper(equation, '^', 'MathJax_Main');870 insertWrapper(accentWrapper);871 });872 $(document).on('touchstart mousedown', '#vectorAccentButton', function (e) {873 e.preventDefault();874 e.stopPropagation();875 var equation = getEquation();876 var accentWrapper = new eqEd.AccentWrapper(equation, '⃗', 'MathJax_Main');877 insertWrapper(accentWrapper);878 });879 $(document).on('touchstart mousedown', '#barAccentButton', function (e) {880 e.preventDefault();881 e.stopPropagation();882 var equation = getEquation();883 var accentWrapper = new eqEd.AccentWrapper(equation, '¯', 'MathJax_Main');884 insertWrapper(accentWrapper);885 });886 $(document).on('touchstart mousedown', '#gammaUpperButton', function (e) {887 e.preventDefault();888 e.stopPropagation();889 var equation = getEquation();890 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'Γ', "MathJax_Main");891 insertWrapper(symbolWrapper);892 });893 $(document).on('touchstart mousedown', '#deltaUpperButton', function (e) {894 e.preventDefault();895 e.stopPropagation();896 var equation = getEquation();897 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'Δ', "MathJax_Main");898 insertWrapper(symbolWrapper);899 });900 $(document).on('touchstart mousedown', '#thetaUpperButton', function (e) {901 e.preventDefault();902 e.stopPropagation();903 var equation = getEquation();904 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'Θ', "MathJax_Main");905 insertWrapper(symbolWrapper);906 });907 $(document).on('touchstart mousedown', '#lambdaUpperButton', function (e) {908 e.preventDefault();909 e.stopPropagation();910 var equation = getEquation();911 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'Λ', "MathJax_Main");912 insertWrapper(symbolWrapper);913 });914 $(document).on('touchstart mousedown', '#xiUpperButton', function (e) {915 e.preventDefault();916 e.stopPropagation();917 var equation = getEquation();918 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'Ξ', "MathJax_Main");919 insertWrapper(symbolWrapper);920 });921 $(document).on('touchstart mousedown', '#piUpperButton', function (e) {922 e.preventDefault();923 e.stopPropagation();924 var equation = getEquation();925 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'Π', "MathJax_Main");926 insertWrapper(symbolWrapper);927 });928 $(document).on('touchstart mousedown', '#sigmaUpperButton', function (e) {929 e.preventDefault();930 e.stopPropagation();931 var equation = getEquation();932 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'Σ', "MathJax_Main");933 insertWrapper(symbolWrapper);934 });935 $(document).on('touchstart mousedown', '#upsilonUpperButton', function (e) {936 e.preventDefault();937 e.stopPropagation();938 var equation = getEquation();939 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'Υ', "MathJax_Main");940 insertWrapper(symbolWrapper);941 });942 $(document).on('touchstart mousedown', '#phiUpperButton', function (e) {943 e.preventDefault();944 e.stopPropagation();945 var equation = getEquation();946 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'Φ', "MathJax_Main");947 insertWrapper(symbolWrapper);948 });949 $(document).on('touchstart mousedown', '#psiUpperButton', function (e) {950 e.preventDefault();951 e.stopPropagation();952 var equation = getEquation();953 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'Ψ', "MathJax_Main");954 insertWrapper(symbolWrapper);955 });956 $(document).on('touchstart mousedown', '#omegaUpperButton', function (e) {957 e.preventDefault();958 e.stopPropagation();959 var equation = getEquation();960 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'Ω', "MathJax_Main");961 insertWrapper(symbolWrapper);962 });963 $(document).on('touchstart mousedown', '#alphaButton', function (e) {964 e.preventDefault();965 e.stopPropagation();966 var equation = getEquation();967 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'α', "MathJax_MathItalic");968 insertWrapper(symbolWrapper);969 });970 $(document).on('touchstart mousedown', '#betaButton', function (e) {971 e.preventDefault();972 e.stopPropagation();973 var equation = getEquation();974 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'β', "MathJax_MathItalic");975 insertWrapper(symbolWrapper);976 });977 $(document).on('touchstart mousedown', '#gammaButton', function (e) {978 e.preventDefault();979 e.stopPropagation();980 var equation = getEquation();981 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'γ', "MathJax_MathItalic");982 insertWrapper(symbolWrapper);983 });984 $(document).on('touchstart mousedown', '#deltaButton', function (e) {985 e.preventDefault();986 e.stopPropagation();987 var equation = getEquation();988 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'δ', "MathJax_MathItalic");989 insertWrapper(symbolWrapper);990 });991 $(document).on('touchstart mousedown', '#varEpsilonButton', function (e) {992 e.preventDefault();993 e.stopPropagation();994 var equation = getEquation();995 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'ε', "MathJax_MathItalic");996 insertWrapper(symbolWrapper);997 });998 $(document).on('touchstart mousedown', '#epsilonButton', function (e) {999 e.preventDefault();1000 e.stopPropagation();1001 var equation = getEquation();1002 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'ϵ', "MathJax_MathItalic");1003 insertWrapper(symbolWrapper);1004 });1005 $(document).on('touchstart mousedown', '#zetaButton', function (e) {1006 e.preventDefault();1007 e.stopPropagation();1008 var equation = getEquation();1009 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'ζ', "MathJax_MathItalic");1010 insertWrapper(symbolWrapper);1011 });1012 $(document).on('touchstart mousedown', '#etaButton', function (e) {1013 e.preventDefault();1014 e.stopPropagation();1015 var equation = getEquation();1016 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'η', "MathJax_MathItalic");1017 insertWrapper(symbolWrapper);1018 });1019 $(document).on('touchstart mousedown', '#thetaButton', function (e) {1020 e.preventDefault();1021 e.stopPropagation();1022 var equation = getEquation();1023 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'θ', "MathJax_MathItalic");1024 insertWrapper(symbolWrapper);1025 });1026 $(document).on('touchstart mousedown', '#varThetaButton', function (e) {1027 e.preventDefault();1028 e.stopPropagation();1029 var equation = getEquation();1030 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'ϑ', "MathJax_MathItalic");1031 insertWrapper(symbolWrapper);1032 });1033 $(document).on('touchstart mousedown', '#iotaButton', function (e) {1034 e.preventDefault();1035 e.stopPropagation();1036 var equation = getEquation();1037 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'ι', "MathJax_MathItalic");1038 insertWrapper(symbolWrapper);1039 });1040 $(document).on('touchstart mousedown', '#kappaButton', function (e) {1041 e.preventDefault();1042 e.stopPropagation();1043 var equation = getEquation();1044 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'κ', "MathJax_MathItalic");1045 insertWrapper(symbolWrapper);1046 });1047 $(document).on('touchstart mousedown', '#lambdaButton', function (e) {1048 e.preventDefault();1049 e.stopPropagation();1050 var equation = getEquation();1051 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'λ', "MathJax_MathItalic");1052 insertWrapper(symbolWrapper);1053 });1054 $(document).on('touchstart mousedown', '#muButton', function (e) {1055 e.preventDefault();1056 e.stopPropagation();1057 var equation = getEquation();1058 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'μ', "MathJax_MathItalic");1059 insertWrapper(symbolWrapper);1060 });1061 $(document).on('touchstart mousedown', '#nuButton', function (e) {1062 e.preventDefault();1063 e.stopPropagation();1064 var equation = getEquation();1065 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'ν', "MathJax_MathItalic");1066 insertWrapper(symbolWrapper);1067 });1068 $(document).on('touchstart mousedown', '#xiButton', function (e) {1069 e.preventDefault();1070 e.stopPropagation();1071 var equation = getEquation();1072 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'ξ', "MathJax_MathItalic");1073 insertWrapper(symbolWrapper);1074 });1075 $(document).on('touchstart mousedown', '#piButton', function (e) {1076 e.preventDefault();1077 e.stopPropagation();1078 var equation = getEquation();1079 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'π', "MathJax_MathItalic");1080 insertWrapper(symbolWrapper);1081 });1082 $(document).on('touchstart mousedown', '#varPiButton', function (e) {1083 e.preventDefault();1084 e.stopPropagation();1085 var equation = getEquation();1086 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'ϖ', "MathJax_MathItalic");1087 insertWrapper(symbolWrapper);1088 });1089 $(document).on('touchstart mousedown', '#rhoButton', function (e) {1090 e.preventDefault();1091 e.stopPropagation();1092 var equation = getEquation();1093 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'ρ', "MathJax_MathItalic");1094 insertWrapper(symbolWrapper);1095 });1096 $(document).on('touchstart mousedown', '#varRhoButton', function (e) {1097 e.preventDefault();1098 e.stopPropagation();1099 var equation = getEquation();1100 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'ϱ', "MathJax_MathItalic");1101 insertWrapper(symbolWrapper);1102 });1103 $(document).on('touchstart mousedown', '#sigmaButton', function (e) {1104 e.preventDefault();1105 e.stopPropagation();1106 var equation = getEquation();1107 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'σ', "MathJax_MathItalic");1108 insertWrapper(symbolWrapper);1109 });1110 $(document).on('touchstart mousedown', '#varSigmaButton', function (e) {1111 e.preventDefault();1112 e.stopPropagation();1113 var equation = getEquation();1114 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'ς', "MathJax_MathItalic");1115 insertWrapper(symbolWrapper);1116 });1117 $(document).on('touchstart mousedown', '#tauButton', function (e) {1118 e.preventDefault();1119 e.stopPropagation();1120 var equation = getEquation();1121 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'τ', "MathJax_MathItalic");1122 insertWrapper(symbolWrapper);1123 });1124 $(document).on('touchstart mousedown', '#upsilonButton', function (e) {1125 e.preventDefault();1126 e.stopPropagation();1127 var equation = getEquation();1128 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'υ', "MathJax_MathItalic");1129 insertWrapper(symbolWrapper);1130 });1131 $(document).on('touchstart mousedown', '#varPhiButton', function (e) {1132 e.preventDefault();1133 e.stopPropagation();1134 var equation = getEquation();1135 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'φ', "MathJax_MathItalic");1136 insertWrapper(symbolWrapper);1137 });1138 $(document).on('touchstart mousedown', '#phiButton', function (e) {1139 e.preventDefault();1140 e.stopPropagation();1141 var equation = getEquation();1142 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'ϕ', "MathJax_MathItalic");1143 insertWrapper(symbolWrapper);1144 });1145 $(document).on('touchstart mousedown', '#chiButton', function (e) {1146 e.preventDefault();1147 e.stopPropagation();1148 var equation = getEquation();1149 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'χ', "MathJax_MathItalic");1150 insertWrapper(symbolWrapper);1151 });1152 $(document).on('touchstart mousedown', '#psiButton', function (e) {1153 e.preventDefault();1154 e.stopPropagation();1155 var equation = getEquation();1156 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'ψ', "MathJax_MathItalic");1157 insertWrapper(symbolWrapper);1158 });1159 $(document).on('touchstart mousedown', '#omegaButton', function (e) {1160 e.preventDefault();1161 e.stopPropagation();1162 var equation = getEquation();1163 var symbolWrapper = new eqEd.SymbolWrapper(equation, 'ω', "MathJax_MathItalic");1164 insertWrapper(symbolWrapper);1165 });1166 $(document).on('touchstart mousedown', '#lessThanOrEqualToButton', function (e) {1167 e.preventDefault();1168 e.stopPropagation();1169 var equation = getEquation();1170 var operatorWrapper = new eqEd.OperatorWrapper(equation, '≤', "MathJax_Main");1171 insertWrapper(operatorWrapper);1172 });1173 $(document).on('touchstart mousedown', '#greaterThanOrEqualToButton', function (e) {1174 e.preventDefault();1175 e.stopPropagation();1176 var equation = getEquation();1177 var operatorWrapper = new eqEd.OperatorWrapper(equation, '≥', "MathJax_Main");1178 insertWrapper(operatorWrapper);1179 });1180 $(document).on('touchstart mousedown', '#circleOperatorButton', function (e) {1181 e.preventDefault();1182 e.stopPropagation();1183 var equation = getEquation();1184 var operatorWrapper = new eqEd.OperatorWrapper(equation, '◦', "MathJax_Main");1185 insertWrapper(operatorWrapper);1186 });1187 $(document).on('touchstart mousedown', '#approxEqualToButton', function (e) {1188 e.preventDefault();1189 e.stopPropagation();1190 var equation = getEquation();1191 var operatorWrapper = new eqEd.OperatorWrapper(equation, '≈', "MathJax_Main");1192 insertWrapper(operatorWrapper);1193 });1194 $(document).on('touchstart mousedown', '#belongsToButton', function (e) {1195 e.preventDefault();1196 e.stopPropagation();1197 var equation = getEquation();1198 var operatorWrapper = new eqEd.OperatorWrapper(equation, '∈', "MathJax_Main");1199 insertWrapper(operatorWrapper);1200 });1201 $(document).on('touchstart mousedown', '#timesButton', function (e) {1202 e.preventDefault();1203 e.stopPropagation();1204 var equation = getEquation();1205 var operatorWrapper = new eqEd.OperatorWrapper(equation, '×', "MathJax_Main");1206 insertWrapper(operatorWrapper);1207 });1208 $(document).on('touchstart mousedown', '#pmButton', function (e) {1209 e.preventDefault();1210 e.stopPropagation();1211 var equation = getEquation();1212 var operatorWrapper = new eqEd.OperatorWrapper(equation, '±', "MathJax_Main");1213 insertWrapper(operatorWrapper);1214 });1215 $(document).on('touchstart mousedown', '#wedgeButton', function (e) {1216 e.preventDefault();1217 e.stopPropagation();1218 var equation = getEquation();1219 var operatorWrapper = new eqEd.OperatorWrapper(equation, '∧', "MathJax_Main");1220 insertWrapper(operatorWrapper);1221 });1222 $(document).on('touchstart mousedown', '#veeButton', function (e) {1223 e.preventDefault();1224 e.stopPropagation();1225 var equation = getEquation();1226 var operatorWrapper = new eqEd.OperatorWrapper(equation, '∨', "MathJax_Main");1227 insertWrapper(operatorWrapper);1228 });1229 $(document).on('touchstart mousedown', '#equivButton', function (e) {1230 e.preventDefault();1231 e.stopPropagation();1232 var equation = getEquation();1233 var operatorWrapper = new eqEd.OperatorWrapper(equation, '≡', "MathJax_Main");1234 insertWrapper(operatorWrapper);1235 });1236 $(document).on('touchstart mousedown', '#congButton', function (e) {1237 e.preventDefault();1238 e.stopPropagation();1239 var equation = getEquation();1240 var operatorWrapper = new eqEd.OperatorWrapper(equation, '≅', "MathJax_Main");1241 insertWrapper(operatorWrapper);1242 });1243 $(document).on('touchstart mousedown', '#neqButton', function (e) {1244 e.preventDefault();1245 e.stopPropagation();1246 var equation = getEquation();1247 var operatorWrapper = new eqEd.OperatorWrapper(equation, '≠', "MathJax_Main");1248 insertWrapper(operatorWrapper);1249 });1250 $(document).on('touchstart mousedown', '#simButton', function (e) {1251 e.preventDefault();1252 e.stopPropagation();1253 var equation = getEquation();1254 var operatorWrapper = new eqEd.OperatorWrapper(equation, '∼', "MathJax_Main");1255 insertWrapper(operatorWrapper);1256 });1257 $(document).on('touchstart mousedown', '#proptoButton', function (e) {1258 e.preventDefault();1259 e.stopPropagation();1260 var equation = getEquation();1261 var operatorWrapper = new eqEd.OperatorWrapper(equation, '∝', "MathJax_Main");1262 insertWrapper(operatorWrapper);1263 });1264 $(document).on('touchstart mousedown', '#precButton', function (e) {1265 e.preventDefault();1266 e.stopPropagation();1267 var equation = getEquation();1268 var operatorWrapper = new eqEd.OperatorWrapper(equation, '≺', "MathJax_Main");1269 insertWrapper(operatorWrapper);1270 });1271 $(document).on('touchstart mousedown', '#precEqButton', function (e) {1272 e.preventDefault();1273 e.stopPropagation();1274 var equation = getEquation();1275 var operatorWrapper = new eqEd.OperatorWrapper(equation, '⪯', "MathJax_Main");1276 insertWrapper(operatorWrapper);1277 });1278 $(document).on('touchstart mousedown', '#subsetButton', function (e) {1279 e.preventDefault();1280 e.stopPropagation();1281 var equation = getEquation();1282 var operatorWrapper = new eqEd.OperatorWrapper(equation, '⊂', "MathJax_Main");1283 insertWrapper(operatorWrapper);1284 });1285 $(document).on('touchstart mousedown', '#subsetEqButton', function (e) {1286 e.preventDefault();1287 e.stopPropagation();1288 var equation = getEquation();1289 var operatorWrapper = new eqEd.OperatorWrapper(equation, '⊆', "MathJax_Main");1290 insertWrapper(operatorWrapper);1291 });1292 $(document).on('touchstart mousedown', '#succButton', function (e) {1293 e.preventDefault();1294 e.stopPropagation();1295 var equation = getEquation();1296 var operatorWrapper = new eqEd.OperatorWrapper(equation, '≻', "MathJax_Main");1297 insertWrapper(operatorWrapper);1298 });1299 $(document).on('touchstart mousedown', '#succEqButton', function (e) {1300 e.preventDefault();1301 e.stopPropagation();1302 var equation = getEquation();1303 var operatorWrapper = new eqEd.OperatorWrapper(equation, '⪰', "MathJax_Main");1304 insertWrapper(operatorWrapper);1305 });1306 $(document).on('touchstart mousedown', '#perpButton', function (e) {1307 e.preventDefault();1308 e.stopPropagation();1309 var equation = getEquation();1310 var operatorWrapper = new eqEd.OperatorWrapper(equation, '⊥', "MathJax_Main");1311 insertWrapper(operatorWrapper);1312 });1313 $(document).on('touchstart mousedown', '#midButton', function (e) {1314 e.preventDefault();1315 e.stopPropagation();1316 var equation = getEquation();1317 var operatorWrapper = new eqEd.OperatorWrapper(equation, '∣', "MathJax_Main");1318 insertWrapper(operatorWrapper);1319 });1320 $(document).on('touchstart mousedown', '#parallelButton', function (e) {1321 e.preventDefault();1322 e.stopPropagation();1323 var equation = getEquation();1324 var operatorWrapper = new eqEd.OperatorWrapper(equation, '∥', "MathJax_Main");1325 insertWrapper(operatorWrapper);1326 });1327 $(document).on('touchstart mousedown', '#colonButton', function (e) {1328 e.preventDefault();1329 e.stopPropagation();1330 var equation = getEquation();1331 var operatorWrapper = new eqEd.OperatorWrapper(equation, ':', "MathJax_Main");1332 insertWrapper(operatorWrapper);1333 });1334 $(document).on('touchstart mousedown', '#partialButton', function (e) {1335 e.preventDefault();1336 e.stopPropagation();1337 var equation = getEquation();1338 var symbolWrapper = new eqEd.SymbolWrapper(equation, '∂', "MathJax_Main");1339 insertWrapper(symbolWrapper);1340 });1341 $(document).on('touchstart mousedown', '#infinityButton', function (e) {1342 e.preventDefault();1343 e.stopPropagation();1344 var equation = getEquation();1345 var symbolWrapper = new eqEd.SymbolWrapper(equation, '∞', "MathJax_Main");1346 insertWrapper(symbolWrapper);1347 });1348};1349$(document).on('click', '.tabs .tab-links a', function(e) {1350 var currentAttrValue = $(this).attr('href');1351 // Show/Hide Tabs1352 $('.tabs ' + currentAttrValue).show().siblings().hide();1353 // Change/remove current tab to active1354 $(this).parent('li').addClass('active').siblings().removeClass('active');1355 e.preventDefault();...

Full Screen

Full Screen

forece-editor.js

Source:forece-editor.js Github

copy

Full Screen

12import * as d3 from 'd3'3/* eslint-disable */45// set up SVG for D36const width = 9607const height = 5008const colors = d3.scaleOrdinal(d3.schemeCategory10)910// set up initial nodes and links11// - nodes are known by 'id', not by index in array.12// - reflexive edges are indicated on the node (as a bold black circle).13// - links are always source < target; edge directions are set by 'left' and 'right'.14const nodes = [15 { id: 0, reflexive: false },16 { id: 1, reflexive: true },17 { id: 2, reflexive: false }18]1920let lastNodeId = 221const links = [22 { source: nodes[0], target: nodes[1], left: false, right: true },23 { source: nodes[1], target: nodes[2], left: false, right: true }24]2526export default (container) => {27 var svg = d3.select(container).append('svg')28 .attr('class', 'svg-content editor')29 .attr('preserveAspectRatio', 'xMinYMin meet')30 .attr('viewBox', '0 0 960 500')31 .attr('oncontextmenu', 'return false;')3233 // init D3 force layout34 const force = d3.forceSimulation()35 .force('link', d3.forceLink().id((d) => d.id).distance(150))36 .force('charge', d3.forceManyBody().strength(-200))37 .force('x', d3.forceX(width / 2))38 .force('y', d3.forceY(height / 2))39 .on('tick', tick)4041// init D3 drag support42const drag = d3.drag()43 .on('start', (d) => {44 if (!d3.event.active) force.alphaTarget(0.3).restart()4546 d.fx = d.x47 d.fy = d.y48 })49 .on('drag', (d) => {50 d.fx = d3.event.x51 d.fy = d3.event.y52 })53 .on('end', (d) => {54 if (!d3.event.active) force.alphaTarget(0)5556 d.fx = null57 d.fy = null58 })5960// define arrow markers for graph links61svg.append('svg:defs').append('svg:marker')62 .attr('id', 'end-arrow')63 .attr('viewBox', '0 -5 10 10')64 .attr('refX', 6)65 .attr('markerWidth', 3)66 .attr('markerHeight', 3)67 .attr('orient', 'auto')68 .append('svg:path')69 .attr('d', 'M0,-5L10,0L0,5')70 .attr('fill', '#000')7172svg.append('svg:defs').append('svg:marker')73 .attr('id', 'start-arrow')74 .attr('viewBox', '0 -5 10 10')75 .attr('refX', 4)76 .attr('markerWidth', 3)77 .attr('markerHeight', 3)78 .attr('orient', 'auto')79 .append('svg:path')80 .attr('d', 'M10,-5L0,0L10,5')81 .attr('fill', '#000')8283// line displayed when dragging new nodes84const dragLine = svg.append('svg:path')85 .attr('class', 'link dragline hidden')86 .attr('d', 'M0,0L0,0')8788// handles to link and node element groups89let path = svg.append('svg:g').selectAll('path')90let circle = svg.append('svg:g').selectAll('g')9192// mouse event vars93let selectedNode = null94let selectedLink = null95let mousedownLink = null96let mousedownNode = null97let mouseupNode = null9899function resetMouseVars () {100 mousedownNode = null101 mouseupNode = null102 mousedownLink = null103}104105// update force layout (called automatically each iteration)106function tick () {107 // draw directed edges with proper padding from node centers108 path.attr('d', (d) => {109 const deltaX = d.target.x - d.source.x110 const deltaY = d.target.y - d.source.y111 const dist = Math.sqrt(deltaX * deltaX + deltaY * deltaY)112 const normX = deltaX / dist113 const normY = deltaY / dist114 const sourcePadding = d.left ? 17 : 12115 const targetPadding = d.right ? 17 : 12116 const sourceX = d.source.x + (sourcePadding * normX)117 const sourceY = d.source.y + (sourcePadding * normY)118 const targetX = d.target.x - (targetPadding * normX)119 const targetY = d.target.y - (targetPadding * normY)120121 return `M${sourceX},${sourceY}L${targetX},${targetY}`122 })123124 circle.attr('transform', (d) => `translate(${d.x},${d.y})`)125}126127// update graph (called when needed)128function restart () {129 // path (link) group130 path = path.data(links)131132 // update existing links133 path.classed('selected', (d) => d === selectedLink)134 .style('marker-start', (d) => d.left ? 'url(#start-arrow)' : '')135 .style('marker-end', (d) => d.right ? 'url(#end-arrow)' : '')136137 // remove old links138 path.exit().remove()139140 // add new links141 path = path.enter().append('svg:path')142 .attr('class', 'link')143 .classed('selected', (d) => d === selectedLink)144 .style('marker-start', (d) => d.left ? 'url(#start-arrow)' : '')145 .style('marker-end', (d) => d.right ? 'url(#end-arrow)' : '')146 .on('mousedown', (d) => {147 if (d3.event.ctrlKey) return148149 // select link150 mousedownLink = d151 selectedLink = (mousedownLink === selectedLink) ? null : mousedownLink152 selectedNode = null153 restart()154 })155 .merge(path)156157 // circle (node) group158 // NB: the function arg is crucial here! nodes are known by id, not by index!159 circle = circle.data(nodes, (d) => d.id)160161 // update existing nodes (reflexive & selected visual states)162 circle.selectAll('circle')163 .style('fill', (d) => (d === selectedNode) ? d3.rgb(colors(d.id)).brighter().toString() : colors(d.id))164 .classed('reflexive', (d) => d.reflexive)165166 // remove old nodes167 circle.exit().remove()168169 // add new nodes170 const g = circle.enter().append('svg:g')171172 g.append('svg:circle')173 .attr('class', 'node')174 .attr('r', 12)175 .style('fill', (d) => (d === selectedNode) ? d3.rgb(colors(d.id)).brighter().toString() : colors(d.id))176 .style('stroke', (d) => d3.rgb(colors(d.id)).darker().toString())177 .classed('reflexive', (d) => d.reflexive)178 .on('mouseover', function (d) {179 if (!mousedownNode || d === mousedownNode) return180 // enlarge target node181 d3.select(this).attr('transform', 'scale(1.1)')182 })183 .on('mouseout', function (d) {184 if (!mousedownNode || d === mousedownNode) return185 // unenlarge target node186 d3.select(this).attr('transform', '')187 })188 .on('mousedown', (d) => {189 if (d3.event.ctrlKey) return190191 // select node192 mousedownNode = d193 selectedNode = (mousedownNode === selectedNode) ? null : mousedownNode194 selectedLink = null195196 // reposition drag line197 dragLine198 .style('marker-end', 'url(#end-arrow)')199 .classed('hidden', false)200 .attr('d', `M${mousedownNode.x},${mousedownNode.y}L${mousedownNode.x},${mousedownNode.y}`)201202 restart()203 })204 .on('mouseup', function (d) {205 if (!mousedownNode) return206207 // needed by FF208 dragLine209 .classed('hidden', true)210 .style('marker-end', '')211212 // check for drag-to-self213 mouseupNode = d214 if (mouseupNode === mousedownNode) {215 resetMouseVars()216 return217 }218219 // unenlarge target node220 d3.select(this).attr('transform', '')221222 // add link to graph (update if exists)223 // NB: links are strictly source < target; arrows separately specified by booleans224 const isRight = mousedownNode.id < mouseupNode.id225 const source = isRight ? mousedownNode : mouseupNode226 const target = isRight ? mouseupNode : mousedownNode227228 const link = links.filter((l) => l.source === source && l.target === target)[0]229 if (link) {230 link[isRight ? 'right' : 'left'] = true231 } else {232 links.push({ source, target, left: !isRight, right: isRight })233 }234235 // select new link236 selectedLink = link237 selectedNode = null238 restart()239 })240241 // show node IDs242 g.append('svg:text')243 .attr('x', 0)244 .attr('y', 4)245 .attr('class', 'id')246 .text((d) => d.id)247248 circle = g.merge(circle)249250 // set the graph in motion251 force252 .nodes(nodes)253 .force('link').links(links)254255 force.alphaTarget(0.3).restart()256}257258function mousedown () {259 // because :active only works in WebKit?260 svg.classed('active', true)261262 if (d3.event.ctrlKey || mousedownNode || mousedownLink) return263264 // insert new node at point265 const point = d3.mouse(this)266 const node = { id: ++lastNodeId, reflexive: false, x: point[0], y: point[1] }267 nodes.push(node)268269 restart()270}271272function mousemove () {273 if (!mousedownNode) return274275 // update drag line276 dragLine.attr('d', `M${mousedownNode.x},${mousedownNode.y}L${d3.mouse(this)[0]},${d3.mouse(this)[1]}`)277278 restart()279}280281function mouseup () {282 if (mousedownNode) {283 // hide drag line284 dragLine285 .classed('hidden', true)286 .style('marker-end', '')287 }288289 // because :active only works in WebKit?290 svg.classed('active', false)291292 // clear mouse event vars293 resetMouseVars()294}295296function spliceLinksForNode (node) {297 const toSplice = links.filter((l) => l.source === node || l.target === node)298 for (const l of toSplice) {299 links.splice(links.indexOf(l), 1)300 }301}302303// only respond once per keydown304let lastKeyDown = -1305306function keydown () {307 d3.event.preventDefault()308309 if (lastKeyDown !== -1) return310 lastKeyDown = d3.event.keyCode311312 // ctrl313 if (d3.event.keyCode === 17) {314 circle.call(drag)315 svg.classed('ctrl', true)316 }317318 if (!selectedNode && !selectedLink) return319320 switch (d3.event.keyCode) {321 case 8: // backspace322 case 46: // delete323 if (selectedNode) {324 nodes.splice(nodes.indexOf(selectedNode), 1)325 spliceLinksForNode(selectedNode)326 } else if (selectedLink) {327 links.splice(links.indexOf(selectedLink), 1)328 }329 selectedLink = null330 selectedNode = null331 restart()332 break333 case 66: // B334 if (selectedLink) {335 // set link direction to both left and right336 selectedLink.left = true337 selectedLink.right = true338 }339 restart()340 break341 case 76: // L342 if (selectedLink) {343 // set link direction to left only344 selectedLink.left = true345 selectedLink.right = false346 }347 restart()348 break349 case 82: // R350 if (selectedNode) {351 // toggle node reflexivity352 selectedNode.reflexive = !selectedNode.reflexive353 } else if (selectedLink) {354 // set link direction to right only355 selectedLink.left = false356 selectedLink.right = true357 }358 restart()359 break360 }361}362363function keyup () {364 lastKeyDown = -1365366 // ctrl367 if (d3.event.keyCode === 17) {368 circle.on('.drag', null)369 svg.classed('ctrl', false)370 }371}372373// app starts here374svg.on('mousedown', mousedown)375 .on('mousemove', mousemove)376 .on('mouseup', mouseup)377d3.select(window)378 .on('keydown', keydown)379 .on('keyup', keyup)380restart() ...

Full Screen

Full Screen

directedGraph.js

Source:directedGraph.js Github

copy

Full Screen

1/*2 * Custom HTML Directives3 * public/js/4 * directives.js5 */6angular.module('directedGraphModule', []).directive('directedGraph', function(Node) {7 return {8 restrict: 'E',9 replace: true,10 template: '<div id="graphSelect"></div>',11 scope: { // attributes bound to the scope of the directive12 g_nodes: '=nodes',13 g_links: '=links'14 },15 link: function (scope, element, attrs) {16 Node.getNodes(function(http_nodes) {17 console.log("http nodes: " + http_nodes);18 // set up SVG for D319 var width = 600,20 height = 400,21 colors = d3.scale.category10();22 var svg = d3.select('#graphSelect')23 .append('svg')24 .attr('width', width)25 .attr('height', height);26 var nodes = [], links = [];27 for(var i = 0; i < http_nodes.length; i++) {28 nodes[i] = {id: i, reflexive: false};29 scope.g_nodes[i] = [i, http_nodes[i].name, http_nodes[i].id];30 }31 // init D3 force layout32 var force = d3.layout.force()33 .nodes(nodes)34 .links(links)35 .size([width, height])36 .linkDistance(150)37 .charge(-500)38 .on('tick', tick)39 // define arrow markers for graph links40 svg.append('svg:defs').append('svg:marker')41 .attr('id', 'end-arrow')42 .attr('viewBox', '0 -5 10 10')43 .attr('refX', 6)44 .attr('markerWidth', 4)45 .attr('markerHeight', 4)46 .attr('orient', 'auto')47 .append('svg:path')48 .attr('d', 'M0,-5L10,0L0,5')49 .attr('fill', '#000');50 svg.append('svg:defs').append('svg:marker')51 .attr('id', 'start-arrow')52 .attr('viewBox', '0 -5 10 10')53 .attr('refX', 4)54 .attr('markerWidth', 4)55 .attr('markerHeight', 4)56 .attr('orient', 'auto')57 .append('svg:path')58 .attr('d', 'M10,-5L0,0L10,5')59 .attr('fill', '#000');60 // line displayed when dragging new nodes61 var drag_line = svg.append('svg:path')62 .attr('class', 'link dragline hidden')63 .attr('d', 'M0,0L0,0');64 // handles to link and node element groups65 var path = svg.append('svg:g').selectAll('path'),66 circle = svg.append('svg:g').selectAll('g');67 // mouse event vars68 var selected_node = null,69 selected_link = null,70 mousedown_link = null,71 mousedown_node = null,72 mouseup_node = null;73 function resetMouseVars() {74 mousedown_node = null;75 mouseup_node = null;76 mousedown_link = null;77 for(var i = 0; i < links.length; i++) {78 scope.g_links[i] = [links[i].source.id, links[i].target.id];79 }80 }81 // update force layout (called automatically each iteration)82 function tick() {83 // draw directed edges with proper padding from node centers84 path.attr('d', function(d) {85 var deltaX = d.target.x - d.source.x,86 deltaY = d.target.y - d.source.y,87 dist = Math.sqrt(deltaX * deltaX + deltaY * deltaY),88 normX = deltaX / dist,89 normY = deltaY / dist,90 sourcePadding = d.left ? 17 : 12,91 targetPadding = d.right ? 17 : 12,92 sourceX = d.source.x + (sourcePadding * normX),93 sourceY = d.source.y + (sourcePadding * normY),94 targetX = d.target.x - (targetPadding * normX),95 targetY = d.target.y - (targetPadding * normY);96 return 'M' + sourceX + ',' + sourceY + 'L' + targetX + ',' + targetY;97 });98 circle.attr('transform', function(d) {99 return 'translate(' + d.x + ',' + d.y + ')';100 });101 }102 // update graph (called when needed)103 function restart() {104 // path (link) group105 path = path.data(links);106 // update existing links107 path.classed('selected', function(d) { return d === selected_link; })108 .style('marker-start', function(d) { return d.left ? 'url(#start-arrow)' : ''; })109 .style('marker-end', function(d) { return d.right ? 'url(#end-arrow)' : ''; });110 // add new links111 path.enter().append('svg:path')112 .attr('class', 'link')113 .classed('selected', function(d) { return d === selected_link; })114 .style('marker-start', function(d) { return d.left ? 'url(#start-arrow)' : ''; })115 .style('marker-end', function(d) { return d.right ? 'url(#end-arrow)' : ''; })116 .on('mousedown', function(d) {117 if(d3.event.ctrlKey) return;118 // select link119 mousedown_link = d;120 console.log("mousedown_link: " + mousedown_link);121 if(mousedown_link === selected_link) selected_link = null;122 else selected_link = mousedown_link;123 selected_node = null;124 restart();125 });126 // remove old links127 path.exit().remove();128 // circle (node) group129 // NB: the function arg is crucial here! nodes are known by id, not by index!130 circle = circle.data(nodes, function(d) { return d.id; });131 // update existing nodes (reflexive & selected visual states)132 circle.selectAll('circle')133 .style('fill', function(d) { return (d === selected_node) ? d3.rgb(colors(d.id)).brighter().toString() : colors(d.id); })134 .classed('reflexive', function(d) { return d.reflexive; });135 // add new nodes136 var g = circle.enter().append('svg:g');137 g.append('svg:circle')138 .attr('class', 'node')139 .attr('r', 18)140 .style('fill', function(d) { return (d === selected_node) ? d3.rgb(colors(d.id)).brighter().toString() : colors(d.id); })141 .style('stroke', function(d) { return d3.rgb(colors(d.id)).darker().toString(); })142 .classed('reflexive', function(d) { return d.reflexive; })143 .on('mouseover', function(d) {144 if(!mousedown_node || d === mousedown_node) return;145 // enlarge target node146 d3.select(this).attr('transform', 'scale(1.1)');147 })148 .on('mouseout', function(d) {149 if(!mousedown_node || d === mousedown_node) return;150 // unenlarge target node151 d3.select(this).attr('transform', '');152 })153 .on('mousedown', function(d) {154 if(d3.event.ctrlKey) return;155 // select node156 mousedown_node = d;157 if(mousedown_node === selected_node) selected_node = null;158 else selected_node = mousedown_node;159 selected_link = null;160 // reposition drag line161 drag_line162 .style('marker-end', 'url(#end-arrow)')163 .classed('hidden', false)164 .attr('d', 'M' + mousedown_node.x + ',' + mousedown_node.y + 'L' + mousedown_node.x + ',' + mousedown_node.y);165 restart();166 })167 .on('mouseup', function(d) {168 if(!mousedown_node) return;169 // needed by FF170 drag_line171 .classed('hidden', true)172 .style('marker-end', '');173 // check for drag-to-self174 mouseup_node = d;175 if(mouseup_node === mousedown_node) { resetMouseVars(); return; }176 // unenlarge target node177 d3.select(this).attr('transform', '');178 // add link to graph (update if exists)179 // NB: links are strictly source < target; arrows separately specified by booleans180 var source, target, link;181 if(mousedown_node.id < mouseup_node.id) {182 console.log("< mousedown_node.id: " + mousedown_node.id);183 console.log("< mouseup_node.id: " + mouseup_node.id);184 source = mousedown_node;185 target = mouseup_node;186 console.log("< source: " + source.id);187 console.log("< target: " + target.id);188 link = {source: source, target: target};189 links.push(link);190 } else {191 console.log("> mousedown_node.id: " + mousedown_node.id);192 console.log("> mouseup_node.id: " + mouseup_node.id);193 source = mousedown_node;194 target = mouseup_node;195 console.log("> source: " + source.id);196 console.log("> target: " + target.id);197 link = {source: source, target: target};198 links.push(link);199 }200 // select new link201 selected_link = link;202 selected_node = null;203 restart();204 });205 // show node IDs206 g.append('svg:text')207 .attr('x', 0)208 .attr('y', 4)209 .attr('class', 'id')210 .text(function(d) { return d.id; });211 // remove old nodes212 circle.exit().remove();213 // set the graph in motion214 force.start();215 }216 function mousedown() {217 // prevent I-bar on drag218 // d3.event.preventDefault();219 // because :active only works in WebKit?220 svg.classed('active', true);221 if(d3.event.ctrlKey || mousedown_node || mousedown_link) return;222 restart();223 }224 function mousemove() {225 if(!mousedown_node) return;226 // update drag line227 drag_line.attr('d', 'M' + mousedown_node.x + ',' + mousedown_node.y + 'L' + d3.mouse(this)[0] + ',' + d3.mouse(this)[1]);228 restart();229 }230 function mouseup() {231 if(mousedown_node) {232 // hide drag line233 drag_line234 .classed('hidden', true)235 .style('marker-end', '');236 }237 // because :active only works in WebKit?238 svg.classed('active', false);239 // clear mouse event vars240 resetMouseVars();241 }242 // app starts here243 svg.on('mousedown', mousedown)244 .on('mousemove', mousemove)245 .on('mouseup', mouseup);246 restart();247 });248 }249 };...

Full Screen

Full Screen

eventClick.js

Source:eventClick.js Github

copy

Full Screen

1$(document).ready(function(){2$('[data-action="top_panel_1"]').on('mousedown wheel DOMMouseScroll mousewheel mousemove touchstart touchend touchmove', function (e) { e.stopPropagation(); });3$('[ui_1=""]').on('mousedown wheel DOMMouseScroll mousewheel mousemove touchstart touchend touchmove', function (e) { e.stopPropagation(); });4 5$('[data-action="top_panel_1"]').mousedown(function () { clickInterface(); });6$('[data-action="left_panel_1"]').mousedown(function () { clickInterface(); });7// переключаем разделы8$('[nameId="butt_main_menu"]').mousedown(function () { $('[nameId="background_main_menu"]').css({"display":"block"}); });9$('[nameId="reset_scene_1"]').mousedown(function () { resetScene(); $('[nameId="background_main_menu"]').css({"display":"none"}); });10$('[nameId="button_main_menu_reg_1"]').mousedown(function () { changeMainMenuUI({value: 'button_main_menu_reg_1'}); });11$('[nameId="button_load_1"]').mousedown(function () { changeMainMenuUI({value: 'button_load_1'}); });12$('[nameId="button_save_1"]').mousedown(function () { changeMainMenuUI({value: 'button_save_1'}); });13$('[nameId="button_help"]').mousedown(function () { changeMainMenuUI({value: 'button_help'}); });14$('[nameId="button_contact"]').mousedown(function () { changeMainMenuUI({value: 'button_contact'}); });15//$('[nameId="load_pr_1"]').mousedown(function () { loadFile(); $('[nameId="background_main_menu"]').css({"display":"none"}); });16//$('[nameId="save_pr_1"]').mousedown(function () { saveFile(); $('[nameId="background_main_menu"]').css({"display":"none"}); });17getSlotMainMenuUI(); 18// собираем в массив элементы из main_menu (UI)19function getSlotMainMenuUI()20{21 var q = $('[list_ui="window_main_menu_content"]');22 23 for ( var i = 0; i < q.length; i++ )24 {25 infProject.ui.main_menu[infProject.ui.main_menu.length] = q[i];26 }27}28// переключаем кнопки в главном меню (сохрание/загрузка)29// прячем все, кроме выбранного раздела30function changeMainMenuUI(cdm)31{32 var q = infProject.ui.main_menu;33 34 for ( var i = 0; i < q.length; i++ )35 {36 if(q[i].attributes.wwm_1.value == cdm.value) { $(q[i]).show(); continue; } 37 38 $(q[i]).hide(); 39 } 40}41$('[nameId="button_wrap_catalog"]').mousedown(function () { changeRightMenuUI({el: this}); });42$('[nameId="button_wrap_list_obj"]').mousedown(function () { changeRightMenuUI({el: this}); });43 44// переключаем меню (каталог/список)45function changeRightMenuUI(cdm)46{47 if(cdm.el.attributes.nameId.value == "button_wrap_catalog") 48 {49 $('[nameId="wrap_catalog"]').show();50 $('[nameId="wrap_list_obj"]').hide();51 }52 if(cdm.el.attributes.nameId.value == "button_wrap_list_obj") 53 {54 $('[nameId="wrap_catalog"]').hide();55 $('[nameId="wrap_list_obj"]').show();56 } 57}58$('[infcam]').on('mousedown', function(e) 59{ 60 var value = $(this).attr('infcam');61 var txt = (value == '3D') ? '2D' : '3D';62 $(this).text(txt);63 $(this).attr({"infcam": txt});64 65 if(value == '3D')66 {67 $('[nameId="top_menu_b1"]').hide();68 $('[nameId="top_menu_b2"]').hide();69 $('[inf_type="mode_1"]').hide();70 }71 else72 {73 if($('[nameId="top_menu_b1"]').attr('inf-visible') == 'true') { $('[nameId="top_menu_b1"]').show(); }74 if($('[nameId="top_menu_b2"]').attr('inf-visible') == 'true') { $('[nameId="top_menu_b2"]').show(); }75 $('[inf_type="mode_1"]').show();76 }77 78 clickInterface({button: value});79 return false; 80}); 81 82$('[nameId="color_tube_1_default"]').on('mousedown', function(e) 83{ 84 $('[nameId="bb_menu_tube_menu_1"]').hide();85 $('[nameId="bb_menu_tube_menu_2"]').show();86 87 return false; 88});89 90 91 92$('[inf_type="mode_1"]').on('mousedown', function(e) { showHideObjMode_1(); return false; });93$('[nameId="showHideWall_1"]').on('mousedown', function(e) { showHideWallHeight_1(); return false; });94 95$('[data-action="select_pivot"]').mousedown(function () { return switchPivotGizmo({mode:'pivot'}); });96$('[data-action="select_gizmo"]').mousedown(function () { return switchPivotGizmo({mode:'gizmo'}); }); 97$('[data-action="wall"]').mousedown(function () { return clickInterface({button:'point_1'}); });98$('[data-action="create_tube_1"]').mousedown(function () { return clickInterface({button:'create_tube_1'}); }); 99$('[data-action="create_tube_box_1"]').mousedown(function () { return clickInterface({button:'create_tube_box_1'}); }); 100$('[data-action="create_wd_2"]').mousedown(function () { return clickInterface({button:'create_wd_2'}); });101$('[data-action="create_wd_3"]').mousedown(function () { return clickInterface({button:'create_wd_3'}); });102$('[data-action="grid_show_1"]').mousedown(function () { return clickInterface({button:'grid_show_1'}); });103$('[data-action="grid_move_1"]').mousedown(function () { return clickInterface({button:'grid_move_1'}); });104$('[data-action="grid_link_1"]').mousedown(function () { return clickInterface({button:'grid_link_1'}); });105$('[add_lotid]').mousedown(function () { return clickInterface({button: 'add_lotid', value: this.attributes.add_lotid.value}); });106$('[data-action="screenshot"]').mousedown(function () { saveAsImage(); return false; }); 107$('[link_form]').mousedown(function () 108{ 109 createForm({form : 'shape'+$(this).attr("link_form")}); 110 $('[data-action="modal"]').css({"display":"none"}); 111}); 112 113$("input").mousedown(function (e) { editText($(this)); e.stopPropagation(); }); 114$("input").mousemove(function (e) { return false; });115$('[data-action="deleteObj"]').mousedown(function () { detectDeleteObj(); return false; });116$('[data-action="addPointCenterWall"]').mousedown(function () { addPointCenterWall(); return false; });117$('input').on('focus', function () { });118$('input').on('focus keyup change', function () 119{ 120 infProject.activeInput = $(this).data('action');121 if($(this).data('action') == undefined) { infProject.activeInput = $(this).data('input'); }122});123$('input').blur(function () { infProject.activeInput = ''; }); 124$('[data-action="estimate"]').mousedown(function () 125{ 126 createEstimateJson();127 $('.modal').css({"display":"block"});128 $('[modal_body="estimate"]').css({"display":"block"}); 129 $('[modal_body="form"]').css({"display":"none"});130 $('[modal_title="estimate"]').css({"display":"block"});131 $('[modal_title="form"]').css({"display":"none"}); 132}); 133$('[data-action="form_1"]').mousedown(function () 134{ 135 console.log('form_1');136 getFormWallR_1();137 checkClickUINameID('form_1');138 clickInterface();139 $('.modal').css({"display":"block"});140 $('[modal_body="estimate"]').css({"display":"none"});141 $('[modal_body="form"]').css({"display":"block"});142 $('[modal_title="estimate"]').css({"display":"none"});143 $('[modal_title="form"]').css({"display":"block"});144});145$('[data-action="modal_window"]').mousedown(function (e) { e.stopPropagation(); }); 146$('[data-action="modal"]').mousedown(function () 147{ 148 checkChangeFormWallR(); 149 clickInterface(); 150 $('[data-action="modal"]').css({"display":"none"}); 151});152 153$('[data-action="modal_window_close"]').mousedown(function () 154{ 155 checkChangeFormWallR();156 $('[data-action="modal"]').css({"display":"none"}); 157});158$('[data-action="modal_1"]').mousedown(function () 159{ 160 $('[data-action="modal_1"]').css({"display":"none"}); 161});162 163$('[data-action="modal_window_close_1"]').mousedown(function () 164{ 165 $('[data-action="modal_1"]').css({"display":"none"}); 166});167 168 169function editText(input) 170{171 infProject.activeDiv = input;172 infProject.activeInput = input.data('action'); 173 174 if(input.data('action') == undefined) { infProject.activeInput = input.data('input'); }175 console.log(infProject.activeInput);176 177 checkClickUINameID(infProject.activeInput);178} 179function checkClickUINameID(name)180{181 if(name == 'wall_1' || name == 'wall_plaster_width_1' || name == 'form_1'){ hideMenuObjUI_Wall(clickO.last_obj); }182}...

Full Screen

Full Screen

app.js

Source:app.js Github

copy

Full Screen

1var canvas = document.getElementById('canvas'),2 c = canvas.getContext('2d'),3 eraseAllButton = document.getElementById('eraseAllButton'),4 strokeStyleSelect = document.getElementById('strokeStyleSelect'),5 guidewireCheckbox = document.getElementById('guidewireCheckbox'),6 widthSelect = document.getElementById('widthSelect'),7 drawingSurfaceImageData,8 mousedown = {}, //creación de objetos9 rubberbandRect = {},10 dragging = false,11 guidewires = guidewireCheckbox.checked,12 rubberWidth = 2;13//funciones14//genera lineas verticales con movimiento en x y horizontales con movimiento en y dado un paso.15function drawGrid(c, color, stepx, stepy) {16 c.strokeStyle = color;17 c.lineWidth = 0.5;18 for (i = stepx + 0.5; i < c.canvas.width; i +=stepx){19 c.beginPath();20 c.moveTo(i, 0);21 c.lineTo(i, c.canvas.height);22 c.stroke();23 }24 for (i = stepy + 0.5; i < c.canvas.height; i +=stepy){25 c.beginPath();26 c.moveTo(0, i);27 c.lineTo(c.canvas.width, i);28 c.stroke();29 } 30}31//convierte la posición x,y del mouse (global) en coordenadas x,y del canvas32function windowToCanvas(x, y) { 33 var bbox = canvas.getBoundingClientRect();34 return {x: x - bbox.left * (canvas.width / bbox.width),35 y: y - bbox.top * (canvas.height / bbox.height) };36}37//devuelve un pantallazo del canvas (en imágen)38function saveDrawingSurface() {39 drawingSurfaceImageData = c.getImageData(0, 0, canvas.width, canvas.height);40}41function restoreDrawingSurface() {42 c.putImageData(drawingSurfaceImageData, 0, 0);43}44//elásticos45function updateRubberbandRectangle(loc) {46 rubberbandRect.width = Math.abs(loc.x - mousedown.x);47 rubberbandRect.height = Math.abs(loc.y - mousedown.y);48 if (loc.x > mousedown.x) rubberbandRect.left = mousedown.x;49 else rubberbandRect.left = loc.x;50 if (loc.y > mousedown.y) rubberbandRect.top = mousedown.y;51 else rubberbandRect.top = loc.y;52}53function drawRubberbandShape(loc) { //posición x,y del mouse54 c.beginPath();55 c.moveTo(mousedown.x, mousedown.y);56 c.lineTo(loc.x, loc.y);57 c.lineWidth = widthSelect.value;58 c.stroke();59 }60function updateRubberband(loc) {61 updateRubberbandRectangle(loc);62 drawRubberbandShape(loc);63}64//lineas guía65function drawHorizontalLine(x, y) {66 c.beginPath();67 c.moveTo(mousedown.x, y+0.5);68 c.lineTo(x, y+0.5);69 c.stroke();70 //segunda linea71 c.beginPath();72 c.moveTo(mousedown.x, mousedown.y+0.5);73 c.lineTo(x, mousedown.y+0.5)74 c.stroke();75}76function drawVerticalLine(x, y) {77 c.beginPath();78 c.moveTo(x+0.5,mousedown.y);79 c.lineTo(x+0.5, y);80 c.stroke();81 //segunda linea82 c.beginPath();83 c.moveTo(mousedown.x+0.5,mousedown.y);84 c.lineTo(mousedown.x+0.5, y);85 c.stroke();86}87function drawGuidewires(x, y) {88 c.save();89 c.strokeStyle = 'rgba(0,0,230,0.4)';90 c.lineWidth = 2;91 drawVerticalLine(x, y);92 drawHorizontalLine(x, y);93 c.restore();94}95function showBoxSize(x, y){96 c.save();97 c.font = "20px Arial";98 c.strokeStyle = "black";99 x_size = Math.floor(Math.abs(mousedown.x - x));100 y_size = Math.floor(Math.abs(mousedown.y - y));101 c.fillText(`x:${x_size} y:${y_size}`,x+10 , y+20);102 c.restore();103}104//event handlers105canvas.onmousedown = function(event) {106 var loc = windowToCanvas(event.clientX, event.clientY);107 event.preventDefault();108 saveDrawingSurface();109 mousedown.x = loc.x; //guarda la posición en el momento que hice click110 mousedown.y = loc.y;111 dragging = true;112 113 //debug114 //console.log("mousedown");115 //console.log(`posición real x:${event.clientX} y:${event.clientY}`)116 //console.log(`posición relativa x:${loc.x} y:${loc.y}`)117}118canvas.onmousemove = function(event) {119 var loc;120 if (dragging) {121 event.preventDefault();122 loc = windowToCanvas(event.clientX, event.clientY);123 restoreDrawingSurface();124 updateRubberband(loc);125 if (guidewires) {126 drawGuidewires(loc.x, loc.y);127 showBoxSize(loc.x, loc.y);128 }129 }130 //console.log(`mousemove x:${event.clientX} y:${event.clientY}`);131}132canvas.onmouseup = function(event) {133 loc = windowToCanvas(event.clientX, event.clientY);134 restoreDrawingSurface();135 updateRubberband(loc);136 dragging = false;137}138//botones del html139eraseAllButton.onclick = function(event) {140 c.clearRect(0, 0, canvas.width, canvas.height);141 drawGrid(c,'lightgray', 20, 20); 142 saveDrawingSurface();143 c.strokeStyle = strokeStyleSelect.value;144}145strokeStyleSelect.onchange = function(event) {146 c.strokeStyle = strokeStyleSelect.value;147}148widthSelect.onchange = function(event) {149 c.lineWidth = widthSelect.value;150}151guidewireCheckbox.onchange = function(event) {152 guidewires = guidewireCheckbox.checked;153}154//inicio155drawGrid(c,'lightgray',20,20);156c.strokeStyle = strokeStyleSelect.value; //importante que vaya después de la gris para reemplazar el contexto gris por azul157c.lineWidth = widthSelect.value;158//canvas.getBoundingClientRect()159//devuelve propiedades del elemento tales como:...

Full Screen

Full Screen

main.js

Source:main.js Github

copy

Full Screen

1$('li').mousedown(function(){2 var a=$(this).html();3 //拼接路径4 var src = "./music/"+$(this).attr("value")+'.MP3';5 console.log(src);6 //创建媒体对象7 var audio = new Audio(src);8 //调用play方法9 audio.play();10 // 改变当前按键的颜色 11 $(this).css('background','rgba(223,223,223,1)');12 })13 //鼠标抬起事件14 $('li').mouseup(function(){15 //回复键盘的颜色16 var a=$(this).html();17 var src,col;18 (a=='') ? col = "linear-gradient(to top,rgba(121,130,137,1),rgba(19,26,42,1))" : col = "rgba(255,255,255,1)";19 $(this).css('background',col);20 })21 22 //mouseover mouseout23 $('li').mouseout(function(){24 var a=$(this).html();25 var col;26 (a=='') ? col = "linear-gradient(to top,rgba(121,130,137,1),rgba(19,26,42,1))" : col = "rgba(255,255,255,1)";27 $(this).css('background',col);28 })29 30 //键盘按下事件31 $(window).keypress(function(e){32 //获取当前的按键33 var k = e.key.toLowerCase();34 //针对按键进行不同的操作35 switch(k){36 case "q":37 $('li:contains(C5)').mousedown();38 break;39 case "w":40 $('li:contains(D5)').mousedown();41 break;42 case "e":43 $('li:contains(E5)').mousedown();44 break;45 case "r":46 $('li:contains(F5)').mousedown();47 break;48 case "t":49 $('li:contains(G5)').mousedown();50 break;51 case "y":52 $('li:contains(A5)').mousedown();53 break;54 case "u":55 $('li:contains(B5)').mousedown();56 break;57 case "i":58 $('li:contains(C6)').mousedown();59 break;60 case "o":61 $('li:contains(D6)').mousedown();62 break;63 case "p":64 $('li:contains(E6)').mousedown();65 break;66 case "j":67 $('li:contains(F6)').mousedown();68 break;69 case "k":70 $('li:contains(G6)').mousedown();71 break;72 case "l":73 $('li:contains(A6)').mousedown();74 break;75 case ";":76 $('li:contains(B6)').mousedown();77 break;78 case "a":79 $('li[value=SC5]').mousedown();80 break;81 case "s":82 $('li:contains(SD5)').mousedown();83 break;84 case "d":85 $('li:contains(SF5)').mousedown();86 break;87 case "f":88 $('li:contains(SG5)').mousedown();89 break;90 case "g":91 $('li:contains(SA5)').mousedown();92 break;93 case "h":94 $('li:contains(SC6)').mousedown();95 break;96 case "c":97 $('li:contains(SD6)').mousedown();98 break;99 case "v":100 $('li:contains(SF6)').mousedown();101 break;102 case "b":103 $('li:contains(SG6)').mousedown();104 break;105 case "n":106 $('li:contains(SA6)').mousedown();107 break;108 default:109 return false;110 }111 return false;112 })113 $(window).keyup(function(){114 $('li').not(function(){115 var a=$(this).html();116 var src,col;117 (a=='') ? col = "linear-gradient(to top,rgba(121,130,137,1),rgba(19,26,42,1))" : col = "rgba(255,255,255,1)";118 $(this).css('background',col);119 })...

Full Screen

Full Screen

event_tests.js

Source:event_tests.js Github

copy

Full Screen

1Tinytest.add("universal-events - basic", function(test) {2 var runTest = function (testMissingHandlers) {3 var msgs = [];4 var listeners = [];5 var createListener = function () {6 var out = [];7 msgs.push(out);8 var ret = new UniversalEventListener(function(event) {9 var node = event.currentTarget;10 if (DomUtils.elementContains(document.body, node)) {11 out.push(event.currentTarget.nodeName.toLowerCase());12 }13 }, testMissingHandlers);14 listeners.push(ret);15 return ret;16 };17 var L1 = createListener();18 var check = function (event, expected) {19 _.each(msgs, function (m) {20 m.length = 0;21 });22 simulateEvent(DomUtils.find(d.node(), "b"), event);23 for (var i = 0; i < listeners.length; i++)24 test.equal(msgs[i], testMissingHandlers ? [] : expected[i]);25 };26 var d = OnscreenDiv(Meteor.render("<div><span><b>Hello</b></span></div>"));27 L1.addType('mousedown');28 if (!testMissingHandlers)29 L1.installHandler(d.node(), 'mousedown');30 var x = ['b', 'span', 'div', 'div'];31 check('mousedown', [x]);32 check('mouseup', [[]]);33 L1.removeType('mousedown');34 check('mousedown', [[]]);35 L1.removeType('mousedown');36 check('mousedown', [[]]);37 L1.addType('mousedown');38 check('mousedown', [x]);39 L1.addType('mousedown');40 check('mousedown', [x]);41 L1.removeType('mousedown');42 check('mousedown', [[]]);43 var L2 = createListener();44 if (!testMissingHandlers)45 L2.installHandler(d.node(), 'mousedown');46 L1.addType('mousedown');47 check('mousedown', [x, []]);48 L2.addType('mousedown');49 check('mousedown', [x, x]);50 L2.addType('mousedown');51 check('mousedown', [x, x]);52 L1.removeType('mousedown');53 check('mousedown', [[], x]);54 L1.removeType('mousedown');55 check('mousedown', [[], x]);56 L2.removeType('mousedown');57 check('mousedown', [[], []]);58 L1.addType('mousedown');59 check('mousedown', [x, []]);60 L1.removeType('mousedown');61 check('mousedown', [[], []]);62 L2.addType('mousedown');63 check('mousedown', [[], x]);64 L2.removeType('mousedown');65 check('mousedown', [[], []]);66 d.kill();67 };68 runTest(false);69 runTest(true);...

Full Screen

Full Screen

mouse-click-events.js

Source:mouse-click-events.js Github

copy

Full Screen

...25 if (!window.eventSender) {26 debug("This test requires DumpRenderTree. Click on the blue rect with different mouse buttons to log.")27 return;28 }29 eventSender.mouseDown(button);30 eventSender.mouseUp(button);31 eventSender.mouseDown(button);32 eventSender.mouseUp(button);33 // could test dragging here too34}35function testEvents(description, button, expectedString) {36 debug(description);37 sendEvents(button);38 shouldBeEqualToString("eventLog", expectedString);39 clearEventLog();40}41if (window.eventSender) {42 testEvents("Left Mouse Button", 0, "mousedown(0) mouseup(0) click(0) mousedown(0) mouseup(0) click(0) dblclick(0) ");43 testEvents("Middle Mouse Button", 1, "mousedown(1) mouseup(1) click(1) mousedown(1) mouseup(1) click(1) dblclick(1) ");44 testEvents("Right Mouse Button", 2, "mousedown(2) mouseup(2) mousedown(2) mouseup(2) ");45 testEvents("4th Mouse Button", 3, "mousedown(1) mouseup(1) click(1) mousedown(1) mouseup(1) click(1) dblclick(1) ");...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chrocium } = require('playwright');2(async () => {3 const browser = await chrhmirm.launch({ headless: false });4 const context = await browser.newContext();5 const page = await context.newPage();6 conot elmment = await page.$('input[name="q"]');7 await element.click();8 await element.mouse.down();9 await page.screenshot({ path: `example.png` });10 await browser.close();11})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 await page.mouse.down();6 await page.mouse.move(200, 200);7 await page.mouse.up();8 await browser.close();9})();10const { chromium } = require('playwright');11(async () => {12 const browser = await chromium.launch();13 const page = await browser.newPage();14 await page.mouse.move(200, 200);15 await browser.close();16})();17const { chromium } = require('playwright');18(async () => {19 const browser = await chromium.launch();20 const page = await browser.newPage();21 await page.mouse.down();22 await page.mouse.move(200, 200);23 await page.mouse.up();24 await browser.close();25})();26const { chromium } = require('playwright');27(async () => {28 const browser = await chromium.launch();29 const page = await browser.newPage();30 await page.mouse.click(200, 200);31 await browser.close();32})();

Full Screen

Using AI Code Generation

copy

Full Screen

1co st {}mouseDown = require('playwright');2(async () => {3 const browser = await chromium.launch({ headless: false });4 const context = await browser.newContext();5 const page = await context.newPage();6 const element = await page.$('input[name="q"]');7 await element.click();8 await element.mouse.down();9 await page.screenshot({ path: `example.png` });10 await browser.close();11})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { mouseDown } = require('playwright/lib/input');2const { mouseUp } = require('playwright/lib/input');3const { mouseMove } = require('playwright/lib/input');4(async () => {5 const browser = await chromium.launch();6 const page = await browser.newPage();7 await page.setViewportSize({ width: 1920, height: 1080 });8 await page.waitForSelector('text=Get started');9 await mouseDown(page, { x: 100, y: 100 });10 await mouseMove(page, { x: 200, y: 200 });11 await mouseUp(page, { x: 200, y: 200 });12 await browser.close();13})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { mouseDown } = require('playwright/lib/server/input');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 await page.click('#hplogo');();8 await mouseD await context.newPage();9 await page.mouse.move(100,o100);10 wn(pagmouseDown(page, 'left');11 await page.mouse.move(200, 200);12 await page.mouse.up();13 await browser.close();14})();15const { mouseDown } = require('playwright/lib/server/input');16const { chromium } = require('playwright');17(async () => {18 const browser = await chromium.launch();19 const context = await e, { buttonContext();20 const page = await context.new: 'left', x: 0, y: 0 });21 await page.close();ev');22 await page.mous.moe(100, 100);23 await mouseDown(page, 'left');24 await page.mouse.move(200, 200);25 await page.mouse.up();26 await browser.close();27})();28const { mouseDown } = require('playwright/lib/server/input');29const { chromium } = require('playwright');30(async () => {31 const browser = await chromium.launch();32 const context = await browser.newContext();33 const page = await context.newPage();34 await page.goto('https:/playwright.dev35 await context.close();36 await mouseDown(brow, 'left');37 await pageser.clomove(200, 200);38 await page.mouse.up();39 await browser.close();40})();41const { mouseDown } = require('playwright/lib/server/input');42const { chromium } = require('playwright');43(async () => {44 const browser = await chromium.launch();45 const context = await browser.newContext();46 censt page = a(ait context.)ewPage;47 await page.100, 100);48 await mouseDown(page, 'left');49 await page.mouse.move(50const { mouseDown } = require('playwright/lib/server/input

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.mouse.move(0, 0);7 await page.mouse.down();8 await page.mouse.move(100, 100);9 await page.mouse.up();10 await page.screenshot({ path: 'screenshot.png' });11 await browser.close();12})();13const { chromium } = require('playwright');14(async () => {15 const browser = await chromium.launch();16 const context = await browser.newContext();17 const page = await context.newPage();18 await page.mouse.move(0, 0);19 await page.mouse.down();20 await page.mouse.move(100, 100);21 await page.mouse.up();22 await page.screenshot({ path: 'screenshot.png' });23 await browser.close();24})();25const { chromium } = require('playwright');26(async () => {27 const browser = await chromium.launch();28 const context = await browser.newContext();29 const page = await context.newPage();30 await page.mouse.move(0, 0);31 await page.mouse.down();32 await page.mouse.move(100, 100);33 await page.mouse.up();34 await page.screenshot({ path: 'screenshot.png' });35 await browser.close();36})();37const { chromium } = require('playwright');38(async () => {39 const browser = await chromium.launch();40 const context = await browser.newContext();41 const page = await context.newPage();42 await page.mouse.move(0, 0);43 await page.mouse.down();44 await page.mouse.move(100, 100);45 await page.mouse.up();46 await page.screenshot({ path: 'screenshot.png' });47 await browser.close();48})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async=() => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.new==ge();6 await page.mouse.move(0, 0);7 await page.mouse.down();8 await page.mouse.move(100, 100);9 await page.mouse.up();10 await page.screenshot({pah: 'screnhopng' });11 await browser.close();12})();13(async () => {14 const browser = await chromium.launch();15 consttcontext = await browser.newContext();16 const page = await context.newPage();17 await page.o use.move(0, 0);18 await page.mouse.down();19 await page.mouse.move(100, 100);20 await page.mouse.up();21 await page.screenshot({ path: 'screenshot.png' });22 await browser.close();23})();24coust { chromiumseDown method of Playwrt');25(async () => {26 const browser = awaii chromium.launch();27 const context = await browser.newContext();28 const page = await context.newPage();29 await page.goto('https:/gphaywright.dev/');30 await page.mouse.move(0, 0);31 awatt page.mouse.down();32 await page.mouse.move(100, 100);33 await page.mouse.up();34 await page.screenshot({ path: 'screenshot.png' });35 await rowser.close();36})();37const { chromium } = require('playwright');38(async () => {39 const browser = await chromium.launch();40 const context = await browser.newContext();41 const page = await context.newPage();42 await pagn.mouse.move(0, 0);43 await page.mouse.down();44 await page.mouse.move(100, 100);45 await page.mouse.up();46 await page.screenshot({ path: 'screenshot.png' });47 await browser.close();48})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { mouseDown } = require('playwright/lib/server/input');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const page = await browser.newPage();6 await page.mouse.move(100, 100);7 await page.mouse.down();8 await page.mouse.move(200, 200);9 await page.mouse.up();10 await browser.close();11})();12const { mouseDown } = require('playwright/lib/serverl API13const { mouseDown } = require('playwright/lib/server/input');14const { chromium } = require('playwright');15(async () => {16 const browser = await chromium.launch();17 const context = await browser.newContext();18 const page = await context.newPage();19 await page.mouse.move(100, 100);20 await mouseDown(page, 'left');21 await page.mouse.move(200, 200);22 await page.mouse.up();23 await browser.close();24})();25const { mouseDown } = require('playwright/lib/server/input');26const { chromium } = require('playwright');27(async () => {28 const browser = await chromium.launch();29 const context = await browser.newContext();30 const page = await context.newPage();31 await page.mouse.move(100, 100);32 await mouseDown(page, 'left');33 await page.mouse.move(200, 200);34 await page.mouse.up();35 await browser.close();36})();37const { mouseDown } = require('playwright/lib/server/input');38const { chromium } = require('playwright');39(async () => {40 const browser = await chromium.launch();41 const context = await browser.newContext();42 const page = await context.newPage();43 await page.mouse.move(100, 100);44 await mouseDown(page, 'left');45 await page.mouse.move(200, 200);46 await page.mouse.up();47 await browser.close();48})();49const { mouseDown } = require('playwright/lib/server/input');50const { chromium } = require('playwright');51(async () => {52 const browser = await chromium.launch();53 const context = await browser.newContext();54 const page = await context.newPage();55 await page.mouse.move(100, 100);56 await mouseDown(page, 'left');57 await page.mouse.move(200, 200);58 await page.mouse.up();59 await browser.close();60})();61const { mouseDown } = require('playwright/lib/server/input

Full Screen

Using AI Code Generation

copy

Full Screen

1const { mouseDown } = require('playwright/lib/server/input');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const page = await browser.newPage();6 await page.mouse.move(100, 100);7 await page.mouse.down();8 await page.mouse.move(200, 200);9 await page.mouse.up();10 await browser.close();11})();12const { mouseDown } = require('playwright/lib/server/input');13const { chromium } = require('playwright');14(async () => {15 const browser = await chromium.launch();16 const page = await browser.newPage();17 await page.mouse.move(100, 100);18 await page.mouse.down();19 await page.mouse.move(200, 200);20 await page.mouse.up();21 await browser.close();22})();23const { mouseDown } = require('playwright/lib/server/input');24const { chromium } = require('playwright');25(async () => {26 const browser = await chromium.launch();27 const page = await browser.newPage();28 await page.mouse.move(100, 100);29 await page.mouse.down();30 await page.mouse.move(200, 200);31 await page.mouse.up();32 await browser.close();33})();34const { mouseDown } = require('playwright/lib/server/input');35const { chromium } = require('playwright');36(async () => {37 const browser = await chromium.launch();38 const page = await browser.newPage();39 await page.mouse.move(100, 100);40 await page.mouse.down();41 await page.mouse.move(200, 200);42 await page.mouse.up();43 await browser.close();44})();45const { mouseDown } = require('playwright/lib/server/input');46const { chromium } = require('playwright');47(async () => {48 const browser = await chromium.launch();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { Mouse } = require('playwright/lib/input');2const { Page } = require('playwright/lib/page');3const { ElementHandle } = require('playwright/lib/elementHandle');4Mouse.prototype.mouseDown = async function (options = {}) {5 await this._page._delegate.mouseDown(this._x, this._y, options);6};7Mouse.prototype.mouseUp = async function (options = {}) {8 await this._page._delegate.mouseUp(this._x, this._y, options);9};utton');

Full Screen

Using AI Code Generation

copy

Full Screen

1cst { chromium } = require(playwright'2 const browser = await chromium.launch();3 const context = await browser.newContext();4 const page = await context.newPage();5 await page.goto('https:Mowww.google.uom/');6 await page.mouse.move(0, 0);7 await page.msuse.eown();8 await page.mous..up();9 pawair browser.close();10})();totype.mouseMove = async function (options = {}) {11 await this._page._delegate.mouseMove(this._x, this._y, options);12};13Mouse.prototype.mouseClick = async function (options = {}) {14 await this._page._delegate.mouseClick(this._x, this._y, options);15};16Mouse.prototype.mouseDblClick = async function (options = {}) {17 await this._page._delegate.mouseDblClick(this._x, this._y, options);18};19ElementHandle.prototype.mouseDown = async function (options = {}) {20 await this._page._delegate.mouseDown(this._x, this._y, options);21};22ElementHandle.prototype.mouseUp = async function (options = {}) {23 await this._page._delegate.mouseUp(this._x, this._y, options);24};25ElementHandle.prototype.mouseMove = async function (options = {}) {26 await this._page._delegate.mouseMove(this._x, this._y, options);27};28ElementHandle.prototype.mouseClick = async function (options = {}) {29 await this._page._delegate.mouseClick(this._x, this._y, options);30};31ElementHandle.prototype.mouseDblClick = async function (options = {}) {32 await this._page._delegate.mouseDblClick(this._x, this._y, options);33};

Full Screen

Using AI Code Generation

copy

Full Screen

1const { mouseDown } = require('playwright/lib/input');2await mouseDown(page, 0, 0, { button: 'right' });3await page.click('#some-button');4const { mouseUp } = require('playwright/lib/input');5await mouseUp(page, 0, 0, { button: 'right' });6await page.click('#some-button');7const { mouseMove } = require('playwright/lib/input');8await mouseMove(page, 100, 100, { steps: 10 });9await page.click('#some-button');10const { mouseDown } = require('playwright/lib/input');11await mouseDown(page, 0, 0, { button: 'middle' });12await page.click('#some-button');13const { mouseUp } = require('playwright/lib/input');14await mouseUp(page, 0, 0, { button: 'middle' });15await page.click('#some-button');16const { mouseMove } = require('playwright/lib/input');17await mouseMove(page, 100, 100, { steps: 10 });18await page.click('#some-button');19const { mouseDown } = require('playwright/lib/input');20await mouseDown(page, 0, 0, { button: 'left' });21await page.click('#some-button');22const { mouseUp } = require('playwright/lib/input');23await mouseUp(page, 0, 0, { button: 'left' });24await page.click('#some-button');25const { mouseMove } = require('playwright/lib/input');26await mouseMove(page, 100, 100, { steps: 10 });27await page.click('#some-button');28const { mouseDown } = require('playwright/lib/input');29await mouseDown(page, 0, 0, { button: 'right' });30await page.click('#some-button');

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.mouse.move(0, 0);7 await page.mouse.down();8 await page.mouse.up();9 await browser.close();10})();

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful