How to use which method in root

Best JavaScript code snippet using root

enemy.py

Source:enemy.py Github

copy

Full Screen

1from cards.data.character import Character2import random3import arcade4import time 5class Enemy(Character):6 def __init__(self, file, size):7 super().__init__(file, size)8 self.strength = random.randint(1,3)9 which_enemy = str(random.randint(1, 3))10 self.intents = ["attack", "defend", "heal", "attack", "strengthen"]11 self.health = random.randint(30,50)12 13 self.max_health = self.health + 514 self.idle_animation = [f"z_images/minotaur/Minotaur_0{which_enemy}_Idle_000", f"z_images/minotaur/Minotaur_0{which_enemy}_Idle_001", f"z_images/minotaur/Minotaur_0{which_enemy}_Idle_002", f"z_images/minotaur/Minotaur_0{which_enemy}_Idle_003", f"z_images/minotaur/Minotaur_0{which_enemy}_Idle_004", f"z_images/minotaur/Minotaur_0{which_enemy}_Idle_005", f"z_images/minotaur/Minotaur_0{which_enemy}_Idle_006", f"z_images/minotaur/Minotaur_0{which_enemy}_Idle_007", f"z_images/minotaur/Minotaur_0{which_enemy}_Idle_008", f"z_images/minotaur/Minotaur_0{which_enemy}_Idle_009", f"z_images/minotaur/Minotaur_0{which_enemy}_Idle_010", f"z_images/minotaur/Minotaur_0{which_enemy}_Idle_011"]15 for i in range(0, 12):16 self.idle_animation[i] = arcade.load_texture(self.idle_animation[i] + ".png", flipped_horizontally=True)17 self.attack_animation = [f"z_images/minotaur/Minotaur_0{which_enemy}_Attacking_000", f"z_images/minotaur/Minotaur_0{which_enemy}_Attacking_001", f"z_images/minotaur/Minotaur_0{which_enemy}_Attacking_002", f"z_images/minotaur/Minotaur_0{which_enemy}_Attacking_003", f"z_images/minotaur/Minotaur_0{which_enemy}_Attacking_004", f"z_images/minotaur/Minotaur_0{which_enemy}_Attacking_005", f"z_images/minotaur/Minotaur_0{which_enemy}_Attacking_006", f"z_images/minotaur/Minotaur_0{which_enemy}_Attacking_007", f"z_images/minotaur/Minotaur_0{which_enemy}_Attacking_008", f"z_images/minotaur/Minotaur_0{which_enemy}_Attacking_009", f"z_images/minotaur/Minotaur_0{which_enemy}_Attacking_010", f"z_images/minotaur/Minotaur_0{which_enemy}_Attacking_011"]18 for i in range(0, 12):19 self.attack_animation[i] = arcade.load_texture(self.attack_animation[i] + ".png", flipped_horizontally=True)20 self.take_damage_animation = [f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_000", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_001", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_002", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_003", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_004", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_005", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_006", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_007", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_008", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_009", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_010", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_012", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_013", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_014", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_015", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_015", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_016", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_017"]21 for i in range(0, 18):22 self.take_damage_animation[i] = arcade.load_texture(self.take_damage_animation[i] + ".png", flipped_horizontally=True)23 self.defend_animation = [f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_000", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_001", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_002", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_003", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_004", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_005", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_006", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_007", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_008", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_009", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_010", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_012", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_013", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_014", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_015", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_015", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_016", f"z_images/minotaur/Minotaur_0{which_enemy}_Taunt_017"]24 for i in range(0, 18):25 self.defend_animation[i] = arcade.load_texture(self.defend_animation[i] + ".png", flipped_horizontally=True)26 self.death_animation = [f"z_images/minotaur/Minotaur_0{which_enemy}_Dying_000", f"z_images/minotaur/Minotaur_0{which_enemy}_Dying_001", f"z_images/minotaur/Minotaur_0{which_enemy}_Dying_002", f"z_images/minotaur/Minotaur_0{which_enemy}_Dying_003", f"z_images/minotaur/Minotaur_0{which_enemy}_Dying_004", f"z_images/minotaur/Minotaur_0{which_enemy}_Dying_005", f"z_images/minotaur/Minotaur_0{which_enemy}_Dying_006", f"z_images/minotaur/Minotaur_0{which_enemy}_Dying_007", f"z_images/minotaur/Minotaur_0{which_enemy}_Dying_008", f"z_images/minotaur/Minotaur_0{which_enemy}_Dying_009", f"z_images/minotaur/Minotaur_0{which_enemy}_Dying_010", f"z_images/minotaur/Minotaur_0{which_enemy}_Dying_011", f"z_images/minotaur/Minotaur_0{which_enemy}_Dying_012", f"z_images/minotaur/Minotaur_0{which_enemy}_Dying_013"]27 for i in range(0, 14):28 self.death_animation[i] = arcade.load_texture(self.death_animation[i] + ".png", flipped_horizontally=True)29 self.strengthen_animation = [f"z_images/minotaur/Minotaur_0{which_enemy}_Jump_Start_000", f"z_images/minotaur/Minotaur_0{which_enemy}_Jump_Start_001", f"z_images/minotaur/Minotaur_0{which_enemy}_Jump_Start_002", f"z_images/minotaur/Minotaur_0{which_enemy}_Jump_Start_003", f"z_images/minotaur/Minotaur_0{which_enemy}_Jump_Start_004", f"z_images/minotaur/Minotaur_0{which_enemy}_Jump_Start_005", f"z_images/minotaur/Minotaur_0{which_enemy}_Jump_Start_004", f"z_images/minotaur/Minotaur_0{which_enemy}_Jump_Start_003", f"z_images/minotaur/Minotaur_0{which_enemy}_Jump_Start_002", f"z_images/minotaur/Minotaur_0{which_enemy}_Jump_Start_001", f"z_images/minotaur/Minotaur_0{which_enemy}_Jump_Start_000"]30 for i in range(0, 11):31 self.strengthen_animation[i] = arcade.load_texture(self.strengthen_animation[i] + ".png", flipped_horizontally=True)32 def next_idle(self):33 if self.mode == 0:34 self.texture = self.idle_animation[self.counter]35 if self.turn % 3 == 0:36 if self.counter >= 11:37 self.counter = 038 else:39 self.counter += 140 self.turn += 141 elif self.mode == 1:42 self.texture = self.attack_animation[self.counter]43 if self.turn % 3 == 0:44 if self.counter >= 11:45 self.counter = 046 self.mode = 047 else:48 self.counter += 149 self.turn += 150 elif self.mode == 2:51 self.texture = self.defend_animation[self.counter]52 if self.turn % 3 == 0:53 if self.counter >= 17:54 self.counter = 055 self.mode = 056 else:57 self.counter += 158 self.turn += 159 elif self.mode == 3:60 self.texture = self.defend_animation[self.counter]61 if self.turn % 3 == 0:62 if self.counter >= 17:63 self.counter = 064 self.mode = 065 else:66 self.counter += 167 self.turn += 168 elif self.mode == 4:69 self.texture = self.death_animation[self.counter]70 if self.turn % 1 == 0:71 if self.counter >= len(self.death_animation) - 1:72 self.counter = len(self.death_animation) - 173 self.kill()74 else:75 self.counter += 176 self.turn += 177 elif self.mode == 5:78 self.texture = self.strengthen_animation[self.counter]79 if self.turn % 3 == 0:80 if self.counter >= len(self.strengthen_animation) - 1:81 self.counter = 082 self.mode = 083 else:84 self.counter += 185 self.turn += 186 def set_attack(self):87 if self.health > 0:88 self.counter = 089 self.mode = 190 else: 91 self.set_dead()92 def set_defend(self):93 if self.health > 0:94 self.counter = 095 self.mode = 296 else: 97 self.set_dead()98 def set_heal(self):99 if self.health > 0:100 self.counter = 0101 self.mode = 3102 else: 103 self.set_dead()104 def set_strengthen(self):105 if self.health > 0:106 self.counter = 0107 self.mode = 5108 else:109 self.set_dead()110 def set_dead(self):111 if self.first_time:112 self.counter = 0113 self.first_time = False114 self.mode = 4115 def add_strength(self):116 self.strength += 2117 def is_enemy(self):118 return True119 def get_health(self):120 return self.health121 def get_value(self):122 return random.randint(3, 6) * self.strength123 def get_strength(self):124 return self.strength125 def get_intent(self):126 number = random.randint(0, 4)...

Full Screen

Full Screen

player.py

Source:player.py Github

copy

Full Screen

1from cards.data.character import Character2import arcade3import random4class Player(Character):5 def __init__(self, file, size):6 super().__init__(file, size)7 self.health = 1008 self.strength = 19 which_character = random.randint(1, 3)10 self.idle_animation = [f"z_images/wraith/Wraith_0{which_character}_Idle_000", f"z_images/wraith/Wraith_0{which_character}_Idle_001", f"z_images/wraith/Wraith_0{which_character}_Idle_002", f"z_images/wraith/Wraith_0{which_character}_Idle_003", f"z_images/wraith/Wraith_0{which_character}_Idle_004", f"z_images/wraith/Wraith_0{which_character}_Idle_005", f"z_images/wraith/Wraith_0{which_character}_Idle_006", f"z_images/wraith/Wraith_0{which_character}_Idle_007", f"z_images/wraith/Wraith_0{which_character}_Idle_008", f"z_images/wraith/Wraith_0{which_character}_Idle_009", f"z_images/wraith/Wraith_0{which_character}_Idle_010", f"z_images/wraith/Wraith_0{which_character}_Idle_011"]11 for i in range(0, 12):12 self.idle_animation[i] = arcade.load_texture(self.idle_animation[i] + ".png")13 self.attack_animation = [f"z_images/wraith/Wraith_0{which_character}_Attack_000", f"z_images/wraith/Wraith_0{which_character}_Attack_001", f"z_images/wraith/Wraith_0{which_character}_Attack_002", f"z_images/wraith/Wraith_0{which_character}_Attack_003", f"z_images/wraith/Wraith_0{which_character}_Attack_004", f"z_images/wraith/Wraith_0{which_character}_Attack_005", f"z_images/wraith/Wraith_0{which_character}_Attack_006", f"z_images/wraith/Wraith_0{which_character}_Attack_007", f"z_images/wraith/Wraith_0{which_character}_Attack_008", f"z_images/wraith/Wraith_0{which_character}_Attack_009", f"z_images/wraith/Wraith_0{which_character}_Attack_010", f"z_images/wraith/Wraith_0{which_character}_Attack_011"]14 for i in range(0, 12):15 self.attack_animation[i] = arcade.load_texture(self.attack_animation[i] + ".png")16 self.take_damage_animation = [f"z_images/wraith/Wraith_0{which_character}_Taunt_000", f"z_images/wraith/Wraith_0{which_character}_Taunt_001", f"z_images/wraith/Wraith_0{which_character}_Taunt_002", f"z_images/wraith/Wraith_0{which_character}_Taunt_003", f"z_images/wraith/Wraith_0{which_character}_Taunt_004", f"z_images/wraith/Wraith_0{which_character}_Taunt_005", f"z_images/wraith/Wraith_0{which_character}_Taunt_006", f"z_images/wraith/Wraith_0{which_character}_Taunt_007", f"z_images/wraith/Wraith_0{which_character}_Taunt_008", f"z_images/wraith/Wraith_0{which_character}_Taunt_009", f"z_images/wraith/Wraith_0{which_character}_Taunt_010", f"z_images/wraith/Wraith_0{which_character}_Taunt_012", f"z_images/wraith/Wraith_0{which_character}_Taunt_013", f"z_images/wraith/Wraith_0{which_character}_Taunt_014", f"z_images/wraith/Wraith_0{which_character}_Taunt_015", f"z_images/wraith/Wraith_0{which_character}_Taunt_015", f"z_images/wraith/Wraith_0{which_character}_Taunt_016", f"z_images/wraith/Wraith_0{which_character}_Taunt_017"]17 for i in range(0, 18):18 self.take_damage_animation[i] = arcade.load_texture(self.take_damage_animation[i] + ".png")19 self.defend_animation = [f"z_images/wraith/Wraith_0{which_character}_Taunt_000", f"z_images/wraith/Wraith_0{which_character}_Taunt_001", f"z_images/wraith/Wraith_0{which_character}_Taunt_002", f"z_images/wraith/Wraith_0{which_character}_Taunt_003", f"z_images/wraith/Wraith_0{which_character}_Taunt_004", f"z_images/wraith/Wraith_0{which_character}_Taunt_005", f"z_images/wraith/Wraith_0{which_character}_Taunt_006", f"z_images/wraith/Wraith_0{which_character}_Taunt_007", f"z_images/wraith/Wraith_0{which_character}_Taunt_008", f"z_images/wraith/Wraith_0{which_character}_Taunt_009", f"z_images/wraith/Wraith_0{which_character}_Taunt_010", f"z_images/wraith/Wraith_0{which_character}_Taunt_012", f"z_images/wraith/Wraith_0{which_character}_Taunt_013", f"z_images/wraith/Wraith_0{which_character}_Taunt_014", f"z_images/wraith/Wraith_0{which_character}_Taunt_015", f"z_images/wraith/Wraith_0{which_character}_Taunt_015", f"z_images/wraith/Wraith_0{which_character}_Taunt_016", f"z_images/wraith/Wraith_0{which_character}_Taunt_017"]20 for i in range(0, 18):21 self.defend_animation[i] = arcade.load_texture(self.defend_animation[i] + ".png")22 self.heal_animation = []23 self.death_animation = []24 for i in range(15):25 self.death_animation.append(arcade.load_texture(f"z_images/wraith/Wraith_0{which_character}_Dying_00{i}.png"))26 def get_health(self):27 return self.health28 def next_idle(self):29 if self.mode == 0:30 self.texture = self.idle_animation[self.counter]31 if self.turn % 2 == 0:32 if self.counter >= 11:33 self.counter = 034 else:35 self.counter += 136 self.turn += 137 elif self.mode == 1:38 self.texture = self.attack_animation[self.counter]39 if self.turn % 2 == 0:40 if self.counter >= 11:41 self.counter = 042 self.mode = 043 else:44 self.counter += 145 self.turn += 146 elif self.mode == 2:47 self.texture = self.defend_animation[self.counter]48 if self.turn % 2 == 0:49 if self.counter >= 17:50 self.counter = 051 self.mode = 052 else:53 self.counter += 154 self.turn += 155 elif self.mode == 3:56 self.texture = self.defend_animation[self.counter]57 if self.turn % 2 == 0:58 if self.counter >= 17:59 self.counter = 060 self.mode = 061 else:62 self.counter += 163 self.turn += 164 elif self.mode == 4:65 self.texture = self.death_animation[self.counter]66 if self.turn % 1 == 0:67 if self.counter >= 14:68 self.counter = 1469 else:70 self.counter += 171 self.turn += 172 def add_strength(self, amount):73 self.strength += amount74 def get_strength(self):75 return self.strength76 def reset_strength(self):77 self.strength = 178 def move_right(self):79 self.center_x += 1080 def set_attack(self):81 if self.health > 0:82 self.counter = 083 self.mode = 184 else: 85 self.set_dead86 def set_defend(self):87 if self.health > 0:88 self.counter = 089 self.mode = 290 else: 91 self.set_dead92 def set_heal(self):93 if self.health > 0:94 self.counter = 095 self.mode = 396 else: 97 self.set_dead98 def set_dead(self):99 if self.first_time:100 self.counter = 0101 self.first_time = False...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

...53 })54})55test('which can be curried', function(t) {56 var which = npmWhich(LEVEL[0])('level1')57 which(function(err, level1Bin) {58 t.ifError(err)59 t.equal(level1Bin, join(BINPATH_FOR_LEVEL[0], 'level1'), 'got level1 path')60 t.end()61 })62})63test('which can be curried, options overridden', function(t) {64 var which = npmWhich(LEVEL[1])('level1')65 which({cwd: LEVEL[0]}, function(err, level1Bin) {66 t.ifError(err)67 t.equal(level1Bin, join(BINPATH_FOR_LEVEL[0], 'level1'), 'got level1 path')68 })69 t.end()70})71test('which can be curried with sync', function(t) {72 var which = npmWhich(LEVEL[0])('level1')73 var level1Bin = which.sync()74 t.equal(level1Bin, join(BINPATH_FOR_LEVEL[0], 'level1'), 'got level1 path')75 t.end()76})77test('which can be curried with sync, options overridden', function(t) {78 var which = npmWhich(LEVEL[1])('level1')79 var level1Bin = which.sync({cwd: LEVEL[0]})...

Full Screen

Full Screen

namePart.py

Source:namePart.py Github

copy

Full Screen

1##### main class for getting various parts of a file name ######2class namePart:3 def __init__(self,nChars):4 self.nChars = nChars5nCharsPerType = { 'year2': 2, 'year4':4, 'month':2, 'day':2, 'hour24start0':2, 'hour24start1':2, 'minute':2, 'second':2, 'millisecond':3 }6##### below, lots of classes for dealing with all the parts of a file name #####7class presetString:8 ''' Use this for any preset strings that are part of the file name, same for all times'''9 def __init__(self,whichString):10 namePart.__init__(self,len(whichString))11 self.whichString = whichString12 def __str__(self):13 return self.whichString14class year2(namePart):15 def __init__(self,whichYear):16 namePart.__init__(self,nCharsPerType['year2'])17 self.whichYear = whichYear % 10018 19 def __str__(self):20 secondDig = self.whichYear % 1021 firstDig = ((self.whichYear-secondDig) % 100)/1022 return(str(firstDig)+str(secondDig))23class year4(namePart):24 def __init__(self,whichYear):25 namePart.__init__(self,nCharsPerType['year4'])26 self.whichYear = whichYear27 28 def __str__(self):29 fourthDig = self.whichYear % 1030 thirdDig = ((self.whichYear-fourthDig) % 100)/1031 secondDig = ((self.whichYear-thirdDig*10-fourthDig) % 1000)/10032 firstDig = (self.whichYear-secondDig*100-thirdDig*10-fourthDig)/1000 33 return(str(firstDig)+str(secondDig)+str(thirdDig)+str(fourthDig))34class month(namePart):35 ''' month should be specified as 1 through 12 for January through December'''36 def __init__(self,whichMonth,verbose=False):37 namePart.__init__(self,nCharsPerType['month'])38 if(verbose): 39 if(whichMonth < 1 or whichMonth > 12): print("Warning month shoudl be 1 to 12, but is "+str(whichMonth))40 self.whichMonth = whichMonth41 42 def __str__(self):43 if(self.whichMonth < 10): 44 return "0"+str(self.whichMonth)45 else: 46 return str(self.whichMonth)47class day(namePart):48 def __init__(self,whichDay, whichMonth, whichYear,verbose=False):49 '''The definition of the day actually needs a month and year specification so its next method works'''50 namePart.__init__(self,nCharsPerType['day'])51 self.whichMonth = whichMonth52 self.DaysPerMonth = {1:31,2:28,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31}53 if(whichYear % 4 == 0 and whichYear % 100 != 0): self.DaysPerMonth[2] = 29 # leap years54 if(whichYear % 400 == 0): self.DaysPerMonth[2] = 29 # weird exception55 if(verbose): 56 if(whichDay < 1 or whichDay > self.DaysPerMonth[self.whichMonth]): print("Warning day should be 1 to "+str(self.DaysPerMonth[self.whichMonth])+ "for this month, but it is "+str(whichDay))57 self.whichDay = whichDay58 59 def __str__(self):60 if(self.whichDay < 10): 61 return "0"+str(self.whichDay)62 else: 63 return str(self.whichDay)64class hour24start0(namePart):65 ''' hour should be specified as 0 to 23'''66 def __init__(self,whichHr, verbose=False):67 namePart.__init__(self,nCharsPerType['hour24start0'])68 if(verbose): 69 if(whichHr < 0 or whichHr > 23): print("Warning: hour24start0 should be 0 to 23, but is "+str(whichHr))70 self.whichHr = whichHr71 def __str__(self):72 if(self.whichHr < 10):73 return "0"+str(self.whichHr)74 else:75 return str(self.whichHr)76class hour24start1(namePart):77 ''' hour should be specified as 1 to 24'''78 def __init__(self,whichHr,verbose=False):79 namePart.__init__(self,nCharsPerType['hour24start1'])80 if(verbose): 81 if(whichHr < 1 or whichHr > 24): print("Warning: hour24start1 should be 1 to 24, but is "+str(whichHr))82 self.whichHr = whichHr83 def __str__(self):84 if(self.whichHr < 10):85 return "0"+str(self.whichHr)86 else:87 return str(self.whichHr)88class minute(namePart):89 ''' minute should be specified as 0 through 59'''90 def __init__(self,whichMin,verbose=False):91 namePart.__init__(self,nCharsPerType['minute'])92 if(verbose): 93 if(whichMin < 0 or whichMin > 59): print("Warning minute shoudl be 0 to 59, but is "+str(whichMin))94 self.whichMin = whichMin95 96 def __str__(self):97 if(self.whichMin < 10): 98 return "0"+str(self.whichMin)99 else: 100 return str(self.whichMin)101class second(namePart):102 ''' second should be specified as 0 through 59'''103 def __init__(self,whichSec,verbose=False):104 namePart.__init__(self,nCharsPerType['second'])105 if(verbose): 106 if(whichSec < 0 or whichSec > 59): print("Warning second shoudl be 0 to 59, but is "+str(whichSec))107 self.whichSec = whichSec108 109 def __str__(self):110 if(self.whichSec < 10): 111 return "0"+str(self.whichSec)112 else: 113 return str(self.whichSec)114class millisecond(namePart):115 '''millisecond should be specified as 0 through 999'''116 def __init__(self,whichMillisec,verbose=False):117 namePart.__init__(self,nCharsPerType['millisecond'])118 if(verbose):119 if(whichMillisec < 0 or whichMillisec > 999): print("Warning millisecond should be 0 to 999, but is "+str(whichMillisec))120 self.whichMillisec = whichMillisec121 def __str__(self):122 if(self.whichMillisec < 10):123 return "00"+str(self.whichMillisec)124 else:125 if(self.whichMillisec < 100):126 return "0"+str(self.whichMillisec)127 else: # 100 to 999 milliseconds...

Full Screen

Full Screen

float.js

Source:float.js Github

copy

Full Screen

1/**2 * 3 * @version $Id: float.js 1 22:28 2010年7月20日Z tianya $4 * @package DedeCMS.Administrator5 * @copyright Copyright (c) 2007 - 2010, DesDev, Inc.6 * @license http://help.dedecms.com/usersguide/license.html7 * @link http://www.dedecms.com8 */9 10<!--11self.onError=null; 12currentX = currentY = 0; 13whichIt = null; 14lastScrollX = 0; lastScrollY = 0; 15NS = (document.layers) ? 1 : 0; 16IE = (document.all) ? 1: 0; 17function heartBeat(){ 18 if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; } 19 if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; } 20 if(diffY != lastScrollY) { 21 percent = .1 * (diffY - lastScrollY); 22 if(percent > 0) percent = Math.ceil(percent); 23 else percent = Math.floor(percent); 24 if(IE) document.all.floater.style.pixelTop += percent; 25 if(NS) document.floater.top += percent; 26 lastScrollY = lastScrollY + percent; 27 } if(diffX != lastScrollX){ 28 percent = .1 * (diffX - lastScrollX); 29 if(percent > 0) percent = Math.ceil(percent); 30 else percent = Math.floor(percent); 31 if(IE) document.all.floater.style.pixelLeft += percent; 32 if(NS) document.floater.left += percent; 33 lastScrollX = lastScrollX + percent; 34 } 35} 36function checkFocus(x,y){ 37 stalkerx = document.floater.pageX; 38 stalkery = document.floater.pageY; 39 stalkerwidth = document.floater.clip.width; 40 stalkerheight = document.floater.clip.height; 41 if( (x > stalkerx && x < (stalkerx+stalkerwidth)) && (y > stalkery && y < (stalkery+stalkerheight))) return true; 42 else return false; 43} 44function grabIt(e) { 45 if(IE) { 46 whichIt = event.srcElement; 47 while (whichIt.id.indexOf("floater") == -1){ 48 whichIt = whichIt.parentElement; 49 if (whichIt == null) { return true; } 50 } 51 whichIt.style.pixelLeft = whichIt.offsetLeft; 52 whichIt.style.pixelTop = whichIt.offsetTop; 53 currentX = (event.clientX + document.body.scrollLeft); 54 currentY = (event.clientY + document.body.scrollTop); 55 } else { 56 window.captureEvents(Event.MOUSEMOVE); 57 if(checkFocus (e.pageX,e.pageY)) { 58 whichIt = document.floater; 59 StalkerTouchedX = e.pageX-document.floater.pageX; 60 StalkerTouchedY = e.pageY-document.floater.pageY; 61 } 62 } return true; 63 } 64function moveIt(e) { 65 if (whichIt == null) { return false; } 66 if(IE) { 67 newX = (event.clientX + document.body.scrollLeft); 68 newY = (event.clientY + document.body.scrollTop); 69 distanceX = (newX - currentX); distanceY = (newY - currentY); 70 currentX = newX; currentY = newY; 71 whichIt.style.pixelLeft += distanceX; 72 whichIt.style.pixelTop += distanceY; 73 if(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop; 74 if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft; 75 if(whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20; 76 if(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5; 77 event.returnValue = false; 78 } else { 79 whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY); 80 if(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset; 81 if(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset; 82 if( (whichIt.left + whichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17; 83 if( (whichIt.top + whichIt.clip.height) >= (window.innerHeight+self.pageYOffset+50)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17; 84 return false; 85 } 86 return false; 87} 88function dropIt() { 89 whichIt = null; 90 if(NS) window.releaseEvents (Event.MOUSEMOVE); 91 return true; 92} 93if(NS) { 94 window.captureEvents(Event.MOUSEUPEvent.MOUSEDOWN); 95 window.onmousedown = grabIt; 96 window.onmousemove = moveIt; 97 window.onmouseup = dropIt; 98} 99if(IE) { 100 document.onmousedown = grabIt; 101 document.onmousemove = moveIt; 102 document.onmouseup = dropIt; 103} 104if(NS || IE) action = window.setInterval("heartBeat()",1);...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const root = require('./root');2root.add(2, 3);3root.sub(2, 3);4root.mul(2, 3);5root.div(2, 3);6root.mod(2, 3);7root.pow(2, 3);8root.sqrt(2);9root.cube(2);10root.square(2);11root.fact(2);12root.cubeRoot(2);13root.percentage(2, 3);14root.sin(2);15root.cos(2);16root.tan(2);17root.sinh(2);18root.cosh(2);19root.tanh(2);20root.log(2);21root.log10(2);22root.log2(2);23root.log1p(2);24root.exp(2);25root.expm1(2);26root.acos(2);27root.asin(2);28root.atan(2);29root.acosh(2);30root.asinh(2);31root.atanh(2);32root.hypot(2, 3);33root.cbrt(2);34root.sign(2);35root.round(2);36root.ceil(2);37root.floor(2);38root.trunc(2);39root.max(2, 3);40root.min(2, 3);41root.random(2, 3);42root.PI();43root.E();44root.LN2();45root.LN10();46root.LOG2E();47root.LOG10E();48root.SQRT1_2();49root.SQRT2();50root.abs(2);51root.acos(2);52root.acosh(2);53root.asin(2);54root.asinh(2);55root.atan(2);56root.atanh(2);57root.cbrt(2);58root.ceil(2);59root.clz32(2);60root.cos(2);61root.cosh(2);62root.exp(2);63root.expm1(2);64root.floor(2);65root.fround(2);66root.hypot(2);67root.imul(2);68root.log(2);69root.log1p(2);70root.log10(2);71root.log2(2);72root.max(2);73root.min(2);74root.pow(2);75root.random(2);76root.round(2);77root.sign(2);78root.sin(2);79root.sinh(2);80root.sqrt(2);81root.tan(2);82root.tanh(2);83root.trunc(

Full Screen

Using AI Code Generation

copy

Full Screen

1module.exports = function(app) {2 app.get('/', function(req, res) {3 res.render('index', {4 });5 });6};

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = require('./root');2var a = 4;3var b = 3;4var c = root.quadratic(a,b);5console.log(c);6var root = require('./root');7var a = 4;8var b = 3;9var c = root.quadratic(a,b);10console.log(c);11var root = require('./root');12var a = 4;13var b = 3;14var c = root.quadratic(a,b);15console.log(c);16var root = require('./root');17var a = 4;18var b = 3;19var c = root.quadratic(a,b);20console.log(c);21var root = require('./root');22var a = 4;23var b = 3;24var c = root.quadratic(a,b);25console.log(c);26var root = require('./root');27var a = 4;28var b = 3;29var c = root.quadratic(a,b);30console.log(c);31var root = require('./root');32var a = 4;33var b = 3;34var c = root.quadratic(a,b);35console.log(c);36var root = require('./root');37var a = 4;38var b = 3;39var c = root.quadratic(a,b);40console.log(c);41var root = require('./root');42var a = 4;43var b = 3;44var c = root.quadratic(a,b);45console.log(c);46var root = require('./root');47var a = 4;48var b = 3;49var c = root.quadratic(a,b);50console.log(c);51var root = require('./root');52var a = 4;53var b = 3;54var c = root.quadratic(a,b);55console.log(c);56var root = require('./root');57var a = 4;58var b = 3;59var c = root.quadratic(a,b);60console.log(c);

Full Screen

Using AI Code Generation

copy

Full Screen

1var first = document.getElementById("first");2var second = document.getElementById("second");3var third = document.getElementById("third");4var fourth = document.getElementById("fourth");5var fifth = document.getElementById("fifth");6var first = document.getElementById("first");7var second = document.getElementById("second");8var third = document.getElementById("third");9var fourth = document.getElementById("fourth");10var fifth = document.getElementById("fifth");11var first = document.getElementById("first");12var second = document.getElementById("second");13var third = document.getElementById("third");

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run root 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