├── .gitignore ├── Config └── Config.rb ├── Core ├── CPUser.rb ├── ClubPenguin.rb ├── Game.rb ├── Gaming │ ├── FindFour.rb │ ├── Mancala.rb │ └── TreasureHunt.rb └── Login.rb ├── Database.sql ├── Extensions ├── Crumbs.rb ├── Database.rb ├── PACKETS.json ├── TCP.rb └── XTParser.rb ├── Hooks ├── Commands.rb ├── GameBot.rb ├── LoginNotice.rb └── PacketSpam.rb ├── JSONS ├── furniture_items.json ├── igloo_floors.json ├── igloos.json ├── paper_items.json ├── postcards.json ├── rooms.json └── stamps.json ├── LICENSE ├── README.md ├── Register ├── AddFuncs.php ├── MySQL.php ├── PasswordStrength.php ├── README.md ├── config.php ├── index.html ├── register.js ├── register.php ├── style.css └── sweetalert │ ├── LICENSE │ ├── README.md │ ├── bower.json │ ├── dev │ ├── gulpfile-wrap-template.js │ ├── ie9.css │ ├── loader-animation.css │ ├── modules │ │ ├── default-params.js │ │ ├── handle-click.js │ │ ├── handle-dom.js │ │ ├── handle-key.js │ │ ├── handle-swal-dom.js │ │ ├── injected-html.js │ │ ├── set-params.js │ │ └── utils.js │ ├── sweetalert.es6.js │ └── sweetalert.scss │ ├── dist │ ├── sweetalert-dev.js │ ├── sweetalert.css │ └── sweetalert.min.js │ ├── example │ ├── example.css │ ├── example.scss │ └── images │ │ ├── logo_big.png │ │ ├── logo_big@2x.png │ │ ├── logo_small.png │ │ ├── logo_small@2x.png │ │ ├── te-logo-small.svg │ │ ├── thumbs-up.jpg │ │ ├── vs_icon.png │ │ └── vs_icon@2x.png │ ├── gulpfile.js │ ├── index.html │ ├── lib │ ├── modules │ │ ├── default-params.js │ │ ├── handle-click.js │ │ ├── handle-dom.js │ │ ├── handle-key.js │ │ ├── handle-swal-dom.js │ │ ├── injected-html.js │ │ ├── set-params.js │ │ └── utils.js │ └── sweetalert.js │ ├── package.json │ ├── sweetalert.gif │ ├── test │ ├── index.html │ └── tests.js │ └── themes │ ├── facebook │ ├── facebook.css │ └── facebook.scss │ ├── google │ ├── google.css │ └── google.scss │ └── twitter │ ├── twitter.css │ └── twitter.scss └── Run.rb /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | *.rbc 3 | /.config 4 | /coverage/ 5 | /InstalledFiles 6 | /pkg/ 7 | /spec/reports/ 8 | /spec/examples.txt 9 | /test/tmp/ 10 | /test/version_tmp/ 11 | /tmp/ 12 | 13 | # Used by dotenv library to load environment variables. 14 | # .env 15 | 16 | ## Specific to RubyMotion: 17 | .dat* 18 | .repl_history 19 | build/ 20 | *.bridgesupport 21 | build-iPhoneOS/ 22 | build-iPhoneSimulator/ 23 | 24 | ## Specific to RubyMotion (use of CocoaPods): 25 | # 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 29 | # 30 | # vendor/Pods/ 31 | 32 | ## Documentation cache and generated files: 33 | /.yardoc/ 34 | /_yardoc/ 35 | /doc/ 36 | /rdoc/ 37 | 38 | ## Environment normalization: 39 | /.bundle/ 40 | /vendor/bundle 41 | /lib/bundler/man/ 42 | 43 | # for a library or gem, you might want to ignore these files since the code is 44 | # intended to run in multiple environments; otherwise, check them in: 45 | # Gemfile.lock 46 | # .ruby-version 47 | # .ruby-gemset 48 | 49 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: 50 | .rvmrc 51 | -------------------------------------------------------------------------------- /Config/Config.rb: -------------------------------------------------------------------------------- 1 | def getConfig 2 | config = { 3 | 'server_port' => 6112, 4 | 'database_user' => 'root', 5 | 'database_pass' => '1337h4x0r', 6 | 'database_host' => '127.0.0.1', 7 | 'database_name' => 'cpps' 8 | } 9 | return config 10 | end 11 | -------------------------------------------------------------------------------- /Core/ClubPenguin.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'log4r' 3 | require 'time' 4 | require 'nokogiri' 5 | 6 | class ClubPenguin 7 | 8 | attr_accessor :logger, :crumbs, :server_config, :mysql, :sock, :login_sys, :game_sys, :crypto, :hooks 9 | 10 | def initialize(config_info) 11 | @server_config = config_info 12 | @logger = Log4r::Logger.new('>>> [' + Time.now.strftime("%I:%M%p") + '] ') 13 | @logger.outputters << Log4r::Outputter.stdout 14 | @logger.outputters << Log4r::FileOutputter.new('log', :filename => 'log.log') 15 | @crumbs = Crumbs.new(self) 16 | @mysql = Database.new(self) 17 | @sock = TCP.new(self) 18 | @login_sys = Login.new(self) 19 | @game_sys = Game.new(self) 20 | @hooks = Hash.new 21 | end 22 | 23 | def startEmulator 24 | self.displayASCII 25 | @crumbs.loadCrumbs 26 | @mysql.connectMySQL(@server_config['database_user'], @server_config['database_pass'], @server_config['database_host'], @server_config['database_name']) 27 | @sock.connectServer 28 | self.loadHooks 29 | end 30 | 31 | def displayASCII 32 | puts "\n\r$-----------------------$" 33 | puts "|*****|*****|*****|*****|" 34 | puts "|**R**|**B**|**S**|**E**|" 35 | puts "|*****|*****|*****|*****|" 36 | puts "$-----------------------$\n\r" 37 | @logger.info('Thanks for using RBSE! The most comprehensive CPSE :-)') 38 | @logger.info('Created by: Lynx') 39 | @logger.info('Protocol: Actionscript 2.0') 40 | @logger.info("LICENSE: MIT\n") 41 | end 42 | 43 | def loadHooks 44 | Dir[Dir.pwd + "/Hooks/*.rb"].each { |hook_file| require hook_file } 45 | Dir[Dir.pwd + "/Hooks/*.rb"].each do |hook| 46 | hookName = File.basename(hook, ".rb") 47 | hookClass = hookName.constantize 48 | @hooks[hookName] = hookClass.new(self) 49 | end 50 | @hooks.each do |hookName, hookClass| 51 | if hookClass.enabled == false 52 | @hooks.delete(hookName) 53 | end 54 | if hookClass.dependencies.empty? == true 55 | return @logger.info("Dependencies for hook: #{hookName} is empty!") 56 | elsif hookClass.dependencies.count < 3 57 | return @logger.info("Missing dependencies in hook: #{hookName}") 58 | elsif hookClass.dependencies.count > 3 59 | return @logger.info("Too many dependencies in hook: #{hookName}") 60 | elsif hookClass.dependencies['author'] == '' || hookClass.dependencies['version'] == '' || hookClass.dependencies['plugin_type'] == '' 61 | return @logger.info("One of the dependencies is not defined for hook: #{hookName}") 62 | end 63 | end 64 | hooksLoaded = @hooks.count 65 | if hooksLoaded == 0 66 | @logger.info('No hooks loaded at the moment') 67 | else 68 | @logger.info("Successfully loaded #{hooksLoaded} hooks") 69 | end 70 | end 71 | 72 | def parseXML(data) 73 | doc = Nokogiri::XML(data) 74 | if (doc != nil) 75 | return Hash.from_xml(doc.to_s) 76 | end 77 | return false 78 | end 79 | 80 | def is_num?(str) 81 | !!Integer(str) 82 | rescue ArgumentError, TypeError 83 | false 84 | end 85 | 86 | def genRandString(length) 87 | stringTypes = [*'0'..'9', *'a'..'z', *'A'..'Z'] 88 | randString = Array.new(length){stringTypes.sample}.join 89 | return randString 90 | end 91 | 92 | 93 | end 94 | \ 95 | -------------------------------------------------------------------------------- /Core/Gaming/FindFour.rb: -------------------------------------------------------------------------------- 1 | class FindFour 2 | 3 | attr_accessor :currPlayer 4 | 5 | INVALID_CHIP_PLACEMENT = -1 6 | CHIP_PLACED = 0 7 | FOUND_FOUR = 1 8 | TIE = 2 9 | FOUR_NOT_FOUND = 3 10 | 11 | def initialize 12 | @boardMap = [ 13 | [0, 0, 0, 0, 0, 0, 0], 14 | [0, 0, 0, 0, 0, 0, 0], 15 | [0, 0, 0, 0, 0, 0, 0], 16 | [0, 0, 0, 0, 0, 0, 0], 17 | [0, 0, 0, 0, 0, 0, 0], 18 | [0, 0, 0, 0, 0, 0, 0] 19 | ] 20 | @currPlayer = 1 21 | self.reset 22 | end 23 | 24 | def reset 25 | @boardMap = [ 26 | [0, 0, 0, 0, 0, 0, 0], 27 | [0, 0, 0, 0, 0, 0, 0], 28 | [0, 0, 0, 0, 0, 0, 0], 29 | [0, 0, 0, 0, 0, 0, 0], 30 | [0, 0, 0, 0, 0, 0, 0], 31 | [0, 0, 0, 0, 0, 0, 0] 32 | ] 33 | @currPlayer = 1 34 | end 35 | 36 | def convertToString 37 | return @boardMap.map {|tableIndex, tableValue| @boardMap[tableIndex].join(',')}.join(',') 38 | end 39 | 40 | def changePlayer 41 | if @currPlayer == 1 42 | @currPlayer = 2 43 | else 44 | @currPlayer = 1 45 | end 46 | end 47 | 48 | def chipPlacement(column, row) 49 | if @boardMap[row][column] == 0 50 | @boardMap[row][column] = @currPlayer 51 | return true 52 | end 53 | return false 54 | end 55 | 56 | def isBoardFull 57 | @boardMap.each_with_index do |row, rowIndex| 58 | if row.include?(0) != false 59 | return false 60 | end 61 | end 62 | return true 63 | end 64 | 65 | def determineColumnWin(column) 66 | column_counter = 0 67 | for row in 0...@boardMap.length 68 | if @boardMap[row][column] === @currPlayer 69 | column_counter += 1 70 | if column_counter === 4 71 | return FOUND_FOUR 72 | end 73 | end 74 | end 75 | return FOUR_NOT_FOUND 76 | end 77 | 78 | def determineVerticalWin 79 | for column in 0...@boardMap.length 80 | foundFour = self.determineColumnWin(column) 81 | if foundFour == FOUND_FOUR 82 | return FOUND_FOUR 83 | end 84 | end 85 | return FOUR_NOT_FOUND 86 | end 87 | 88 | def determineHorizontalWin 89 | for row_index in 0...@boardMap.length 90 | row = @boardMap[row_index] 91 | row_counter = 0 92 | for column in 0...row.length 93 | if row[column] === @currPlayer 94 | row_counter += 1 95 | if row_counter === 4 96 | return FOUND_FOUR 97 | end 98 | else 99 | row_counter = 0 100 | end 101 | end 102 | end 103 | return FOUR_NOT_FOUND 104 | end 105 | 106 | def determineDiagonalWin 107 | for diagonal_sum in 0..11 108 | diagonal_counter = 0 109 | for x in 0..diagonal_sum 110 | y = diagonal_sum - x 111 | if (defined?(@boardMap[x][y])).nil? 112 | next 113 | end 114 | if @boardMap[x][y] === @currPlayer 115 | diagonal_counter += 1 116 | if diagonal_counter == 4 117 | return FOUND_FOUR 118 | end 119 | else 120 | diagonal_counter = 0 121 | end 122 | end 123 | end 124 | for diagonal_diff in (6).downto(-5) 125 | y = 0 126 | other_diagonal_counter = 0 127 | for x in 0...7 128 | y = diagonal_diff + x 129 | if (defined?(@boardMap[x][y])).nil? 130 | next 131 | end 132 | if y < 7 133 | if @boardMap[x][y] === @currPlayer 134 | other_diagonal_counter += 1 135 | if other_diagonal_counter == 4 136 | return FOUND_FOUR 137 | end 138 | else 139 | other_diagonal_counter = 0 140 | end 141 | else 142 | break 143 | end 144 | end 145 | end 146 | return FOUR_NOT_FOUND 147 | end 148 | 149 | def processBoard 150 | fullBoard = self.isBoardFull 151 | if fullBoard == true 152 | return TIE 153 | end 154 | horizontalWin = self.determineHorizontalWin 155 | if horizontalWin == FOUND_FOUR 156 | return horizontalWin 157 | end 158 | verticalWin = self.determineVerticalWin 159 | if verticalWin == FOUND_FOUR 160 | return verticalWin 161 | end 162 | diagonalWin = self.determineDiagonalWin 163 | if diagonalWin == FOUND_FOUR 164 | return diagonalWin 165 | end 166 | return CHIP_PLACED 167 | end 168 | 169 | def placeChip(column, row) 170 | if self.chipPlacement(column, row) != false 171 | gameStatus = self.processBoard 172 | if gameStatus == CHIP_PLACED 173 | self.changePlayer 174 | end 175 | return gameStatus 176 | else 177 | return INVALID_CHIP_PLACEMENT 178 | end 179 | end 180 | 181 | end 182 | -------------------------------------------------------------------------------- /Core/Gaming/Mancala.rb: -------------------------------------------------------------------------------- 1 | class Mancala 2 | 3 | attr_accessor :currPlayer, :winner 4 | 5 | INVALID_HOLLOW = -1 6 | MOVE_COMPLETE = 0 7 | WON = 1 8 | TIE = 2 9 | NO_SIDES_EMPTY = 3 10 | FREE_TURN = "f" 11 | CAPTURE = "c" 12 | 13 | def initialize 14 | @boardMap = [ 15 | 4, 4, 4, 4, 4, 4, 0, 16 | 4, 4, 4, 4, 4, 4, 0 17 | ] 18 | @currPlayer = 1 19 | self.reset 20 | @winner = 0 21 | end 22 | 23 | def reset 24 | @boardMap = [ 25 | 4, 4, 4, 4, 4, 4, 0, 26 | 4, 4, 4, 4, 4, 4, 0 27 | ] 28 | @currPlayer = 1 29 | @winner = 0 30 | end 31 | 32 | def convertToString 33 | return @boardMap.join(',') 34 | end 35 | 36 | def changePlayer 37 | if @currPlayer == 1 38 | @currPlayer = 2 39 | else 40 | @currPlayer = 1 41 | end 42 | end 43 | 44 | def validMove(hollow) 45 | if @currPlayer == 1 && hollow.between?(0, 5) == false || @currPlayer == 2 && hollow.between?(7, 12) == false 46 | return false 47 | end 48 | return true 49 | end 50 | 51 | def determineTie 52 | if @boardMap[0, 6].sum == 0 || @boardMap[7, 6].sum == 0 53 | if @boardMap[0, 6].sum == @boardMap[7, 6].sum 54 | return TIE 55 | end 56 | end 57 | return NO_SIDES_EMPTY 58 | end 59 | 60 | def determineWin 61 | if @boardMap[0, 6].sum == 0 || @boardMap[7, 6].sum == 0 62 | if @boardMap[0, 6].sum > @boardMap[7, 6].sum 63 | @winner = 1 64 | else 65 | @winner = 2 66 | end 67 | return WON 68 | end 69 | return NO_SIDES_EMPTY 70 | end 71 | 72 | def processBoard 73 | match_tie = self.determineTie 74 | if match_tie == TIE 75 | return match_tie 76 | end 77 | match_win = self.determineWin 78 | if match_win == WON 79 | return match_win 80 | end 81 | return MOVE_COMPLETE 82 | end 83 | 84 | def makeMove(hollow) 85 | if self.validMove(hollow) != false 86 | capture = false 87 | hand = @boardMap[hollow] 88 | @boardMap[hollow] = 0 89 | while hand > 0 90 | hollow += 1 91 | if @boardMap.include?(hollow) != true 92 | hollow = 0 93 | end 94 | myMancala = @currPlayer == 1 ? 6 : 13 95 | opponentMancala = @currPlayer == 1 ? 13 : 6 96 | if hollow == opponentMancala 97 | next 98 | end 99 | oppositeHollow = 12 - hollow 100 | if @currPlayer == 1 && hollow.between?(0, 5) == true && hand == 1 && @boardMap[hollow] == 0 101 | @boardMap[myMancala] = @boardMap[myMancala] + @boardMap[oppositeHollow] + 1 102 | @boardMap[oppositeHollow] = 0 103 | capture = true 104 | break 105 | end 106 | if @currPlayer == 2 && hollow.between?(7, 12) == true && hand == 1 && @boardMap[hollow] == 0 107 | @boardMap[myMancala] = @boardMap[myMancala] + @boardMap[oppositeHollow] + 1 108 | @boardMap[oppositeHollow] = 0 109 | capture = true 110 | break 111 | end 112 | @boardMap[hollow] += 1 113 | hand -= 1 114 | end 115 | gameStatus = self.processBoard 116 | if gameStatus == MOVE_COMPLETE 117 | if @currPlayer == 1 && hollow != 6 || @currPlayer == 2 && hollow != 13 118 | self.changePlayer 119 | if capture == true 120 | return CAPTURE 121 | end 122 | else 123 | return FREE_TURN 124 | end 125 | end 126 | return gameStatus 127 | else 128 | return INVALID_HOLLOW 129 | end 130 | end 131 | 132 | end 133 | -------------------------------------------------------------------------------- /Core/Gaming/TreasureHunt.rb: -------------------------------------------------------------------------------- 1 | class TreasureHunt 2 | 3 | attr_accessor :boardMap, :currPlayer, :turnAmount, :gemValue, :rareGemValue, :coinValue, :mapWidth, :mapHeight, :coinAmount, :gemAmount, :gemLocations, :gemsFound, :coinsFound, :rareGemFound, :recordNumbers 4 | 5 | NONE = 0 6 | COIN = 1 7 | GEM = 2 8 | GEM_PIECE = 3 9 | RARE_GEM = 4 10 | 11 | def initialize 12 | @boardMap = [ 13 | [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 14 | [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 15 | [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 16 | [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 17 | [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 18 | [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 19 | [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 20 | [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 21 | [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 22 | [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 23 | [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] 24 | ] 25 | 26 | @currPlayer = 1 27 | @turnAmount = 12 28 | @gemValue = 25 29 | @rareGemValue = 100 30 | @coinValue = 1 31 | @mapWidth = 10 32 | @mapHeight = 10 33 | @coinAmount = 0 34 | @gemAmount = 0 35 | @gemLocations = '' 36 | @gemsFound = 0 37 | @coinsFound = 0 38 | @rareGemFound = 'false' 39 | @recordNumbers = '' 40 | self.generateTreasuresToMap 41 | end 42 | 43 | def generateTreasuresToMap 44 | (0..10).each do |xpos| 45 | (0..10).each do |ypos| 46 | if @boardMap[xpos][ypos] == GEM_PIECE 47 | next 48 | end 49 | if rand(0..26) == 13 && xpos < 9 && ypos < 9 50 | @gemAmount += 1 51 | @gemLocations << "#{xpos},#{ypos}," 52 | @boardMap[xpos][ypos] = rand(0..10) == 1 ? RARE_GEM : GEM 53 | @boardMap[xpos][ypos + 1] = @boardMap[xpos + 1][ypos] = @boardMap[xpos + 1][ypos + 1] = GEM_PIECE 54 | elsif rand(0..2) == 1 55 | @coinAmount += 1 56 | @boardMap[xpos][ypos] = COIN 57 | else 58 | @boardMap[xpos][ypos] = NONE 59 | end 60 | end 61 | end 62 | end 63 | 64 | def convertToString 65 | return @boardMap.map {|tableIndex, tableValue| @boardMap[tableIndex].join(',')}.join(',') 66 | end 67 | 68 | def changePlayer 69 | if @currPlayer == 1 70 | @currPlayer = 2 71 | else 72 | @currPlayer = 1 73 | end 74 | end 75 | 76 | def makeMove(buttonMC, digDirection, buttonNum) 77 | @turnAmount -= 1 78 | 79 | if @recordNumbers != '' 80 | @recordNumbers << ',' 81 | end 82 | 83 | rcnumbers = buttonNum.to_s 84 | 85 | @recordNumbers << rcnumbers 86 | 87 | map = self.convertToString 88 | xpos = @recordNumbers[-1].to_i 89 | ypos = buttonNum.to_i 90 | pos = xpos * 10 + ypos 91 | some_pos = map[pos] 92 | 93 | if some_pos == GEM || some_pos == GEM_PIECE 94 | @gemsFound += 0.25 95 | elsif some_pos == RARE_GEM 96 | @rareGemFound = 'true' 97 | elsif some_pos == COIN 98 | @coinsFound += @coinValue 99 | end 100 | 101 | self.changePlayer 102 | 103 | if @turnAmount == 0 104 | totalAmount = @coinsFound + (@gemsFound.round * @gemValue) 105 | if @rareGemFound == 'true' 106 | totalAmount += @rareGemValue 107 | end 108 | return ['we_done_bruh', totalAmount] 109 | else 110 | return ['not_done_bruh'] 111 | end 112 | end 113 | 114 | end 115 | -------------------------------------------------------------------------------- /Core/Login.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'bcrypt' 3 | require 'digest' 4 | require 'to_bool' 5 | 6 | class Login 7 | 8 | include BCrypt 9 | 10 | attr_accessor :xml_handlers 11 | 12 | def initialize(main_class) 13 | @parent = main_class 14 | @xml_handlers = {'verChk' => 'handleVersionCheck', 'login' => 'handleGameLogin'} 15 | end 16 | 17 | def handleCrossDomainPolicy(client) 18 | client.sendData("") 19 | end 20 | 21 | def handleVersionCheck(data, client) 22 | version = data['msg']['body']['ver']['v'].to_i 23 | return version == 153 ? client.sendData("") : client.sendData("") 24 | end 25 | 26 | def handleGameLogin(data, client) 27 | username = data['msg']['body']['login']['nick'] 28 | password = data['msg']['body']['login']['pword'] 29 | if (username !~ /^[A-Za-z0-9]+$/) 30 | client.sendError(100) 31 | end 32 | if password.length < 64 33 | return client.sendError(101) 34 | end 35 | userExists = @parent.mysql.checkUserExists(username); 36 | if userExists == 0 37 | return client.sendError(100) 38 | end 39 | isLoggedIn = @parent.mysql.getLoggedInStatus(username) 40 | if isLoggedIn.to_bool == true 41 | return client.sendError(150) 42 | end 43 | invalidLogins = @parent.mysql.getInvalidLogins(username) 44 | if invalidLogins >= 5 45 | return client.sendError(150) 46 | end 47 | validPass = @parent.mysql.getCurrentPassword(username) 48 | cryptedPass = BCrypt::Password.new(validPass) 49 | if cryptedPass != password.upcase 50 | currInvalidAttempts = @parent.mysql.getInvalidLogins(username) 51 | currInvalidAttempts += 1 52 | @parent.mysql.updateInvalidLogins(username, currInvalidAttempts) 53 | return client.sendError(101) 54 | end 55 | bannedStatus = @parent.mysql.getBannedStatus(username) 56 | if @parent.is_num?(bannedStatus) == false && bannedStatus == 'PERMBANNED' 57 | return client.sendError(603) 58 | else 59 | currTime = Time.now.to_i 60 | if bannedStatus.to_i > currTime 61 | remainingTime = ((currTime.to_i - bannedStatus.to_i) / 3600).round 62 | return client.sendError("601%" + remainingTime.to_s) 63 | end 64 | end 65 | encryptedRandKey = Digest::SHA256.hexdigest(@parent.genRandString(12)) 66 | bcryptRandKey = BCrypt::Password.create(encryptedRandKey, cost: 12) 67 | @parent.mysql.updateLoginKey(bcryptRandKey, username) 68 | @parent.mysql.updateLoggedIn(1, username) 69 | clientID = @parent.mysql.getClientIDByUsername(username) 70 | client.sendData('%xt%l%-1%' + clientID.to_s + '%' + encryptedRandKey + '%') 71 | client.ID = clientID 72 | client.lkey = encryptedRandKey 73 | client.loadUserInfo 74 | client.loadIglooInfo 75 | client.loadStampsInfo 76 | client.loadEPFInfo 77 | client.handleBuddyOnline 78 | end 79 | 80 | end 81 | -------------------------------------------------------------------------------- /Database.sql: -------------------------------------------------------------------------------- 1 | -- Adminer 4.3.1 MySQL dump 2 | 3 | SET NAMES utf8; 4 | SET time_zone = '+00:00'; 5 | SET foreign_key_checks = 0; 6 | SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; 7 | 8 | DROP DATABASE IF EXISTS `cpps`; 9 | CREATE DATABASE `cpps` /*!40100 DEFAULT CHARACTER SET latin1 */; 10 | USE `cpps`; 11 | 12 | DROP TABLE IF EXISTS `epf`; 13 | CREATE TABLE `epf` ( 14 | `ID` int(11) NOT NULL, 15 | `isagent` tinyint(1) NOT NULL DEFAULT '1', 16 | `status` mediumtext NOT NULL, 17 | `currentpoints` int(10) NOT NULL DEFAULT '20', 18 | `totalpoints` int(10) NOT NULL DEFAULT '100', 19 | PRIMARY KEY (`ID`) 20 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 21 | 22 | 23 | DROP TABLE IF EXISTS `igloos`; 24 | CREATE TABLE `igloos` ( 25 | `ID` int(11) NOT NULL, 26 | `igloo` int(10) NOT NULL DEFAULT '1', 27 | `floor` int(10) NOT NULL DEFAULT '0', 28 | `music` int(10) NOT NULL DEFAULT '0', 29 | `furniture` longtext NOT NULL, 30 | `ownedFurns` longtext NOT NULL, 31 | `ownedIgloos` longtext NOT NULL, 32 | PRIMARY KEY (`ID`) 33 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 34 | 35 | INSERT INTO `igloos` (`ID`, `igloo`, `floor`, `music`, `furniture`, `ownedFurns`, `ownedIgloos`) VALUES 36 | (1, 1, 9, 35, '136|386|230|2|1,649|530|327|1|5,154|298|325|1|1,643|250|172|1|2,', '1|136,1|649,1|643,1|154,', '25|2|6'), 37 | (2, 1, 0, 0, '', '', ''); 38 | 39 | DROP TABLE IF EXISTS `igloo_contest`; 40 | CREATE TABLE `igloo_contest` ( 41 | `ID` int(11) NOT NULL, 42 | `username` longtext NOT NULL, 43 | `signup_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 44 | PRIMARY KEY (`ID`) 45 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 46 | 47 | 48 | DROP TABLE IF EXISTS `postcards`; 49 | CREATE TABLE `postcards` ( 50 | `postcardID` int(10) NOT NULL AUTO_INCREMENT, 51 | `recepient` int(10) NOT NULL, 52 | `mailerName` char(12) NOT NULL, 53 | `mailerID` int(10) NOT NULL, 54 | `notes` char(12) NOT NULL, 55 | `timestamp` int(8) NOT NULL, 56 | `postcardType` int(5) NOT NULL, 57 | `isRead` int(1) NOT NULL DEFAULT '0', 58 | PRIMARY KEY (`postcardID`) 59 | ) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=latin1; 60 | 61 | 62 | DROP TABLE IF EXISTS `puffles`; 63 | CREATE TABLE `puffles` ( 64 | `puffleID` int(11) NOT NULL AUTO_INCREMENT, 65 | `ownerID` int(2) NOT NULL, 66 | `puffleName` char(10) NOT NULL, 67 | `puffleType` int(2) NOT NULL, 68 | `puffleEnergy` int(3) NOT NULL DEFAULT '100', 69 | `puffleHealth` int(3) NOT NULL DEFAULT '100', 70 | `puffleRest` int(3) NOT NULL DEFAULT '100', 71 | `puffleWalking` tinyint(1) NOT NULL DEFAULT '0', 72 | `lastFedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 73 | PRIMARY KEY (`puffleID`) 74 | ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; 75 | 76 | 77 | DROP TABLE IF EXISTS `stamps`; 78 | CREATE TABLE `stamps` ( 79 | `ID` int(11) NOT NULL, 80 | `stamps` longtext NOT NULL, 81 | `stampbook_cover` longtext NOT NULL, 82 | `restamps` longtext NOT NULL, 83 | PRIMARY KEY (`ID`) 84 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 85 | 86 | INSERT INTO `stamps` (`ID`, `stamps`, `stampbook_cover`, `restamps`) VALUES 87 | (1, '201|200|199|198|197|14|20', '4%10%5%6%0|14|193|270|0|3%0|20|330|272|0|5', ''), 88 | (2, '201|200|199|198|197|14', '', '') 89 | ON DUPLICATE KEY UPDATE `ID` = VALUES(`ID`), `stamps` = VALUES(`stamps`), `stampbook_cover` = VALUES(`stampbook_cover`), `restamps` = VALUES(`restamps`); 90 | 91 | DROP TABLE IF EXISTS `users`; 92 | CREATE TABLE `users` ( 93 | `ID` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Penguin ID', 94 | `username` varchar(15) NOT NULL COMMENT 'Penguin Username', 95 | `nickname` varchar(15) NOT NULL COMMENT 'Penguin Nickname', 96 | `password` char(255) NOT NULL COMMENT 'Penguin Password', 97 | `uuid` varchar(50) NOT NULL COMMENT 'Penguin Universal Unique Identification Key', 98 | `lkey` char(255) NOT NULL COMMENT 'Penguin Login Key', 99 | `joindate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Penguin Age', 100 | `coins` int(11) NOT NULL DEFAULT '5000' COMMENT 'Penguin Coins', 101 | `inventory` longtext NOT NULL COMMENT 'Penguin Inventory', 102 | `clothing` longtext NOT NULL COMMENT 'Penguin Clothing', 103 | `ranking` longtext NOT NULL COMMENT 'Staff ranking', 104 | `buddies` longtext NOT NULL COMMENT 'Penguin Buddies', 105 | `ignored` longtext NOT NULL COMMENT 'Penguin Ignored Clients', 106 | `moderation` longtext NOT NULL COMMENT 'Muting and Banning', 107 | `invalid_logins` int(3) NOT NULL DEFAULT '0' COMMENT 'Account Hijacking Lock', 108 | `logged_in` tinyint(1) NOT NULL DEFAULT '0', 109 | PRIMARY KEY (`ID`), 110 | UNIQUE KEY `username` (`username`) 111 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; 112 | 113 | INSERT INTO `users` (`ID`, `username`, `nickname`, `password`, `uuid`, `lkey`, `joindate`, `coins`, `inventory`, `clothing`, `ranking`, `buddies`, `ignored`, `moderation`, `invalid_logins`) VALUES 114 | (1, 'Lynx', 'Lynx', '$2a$15$TkyGq00I32vgJ5zt9bCNRO0VAT2xANcKm9.9why0.YoL/rx7S5uma', 'fc0e6084-08e8-11e6-b512-3e1d05defe78', '', '2016-04-08 00:31:46', 129340, '221|5011', '{\"color\":11,\"head\":0,\"face\":0,\"neck\":0,\"body\":221,\"hands\":0,\"feet\":0,\"flag\":0,\"photo\":0}', '{\"isStaff\": \"1\", \"isMed\": \"0\", \"isMod\": \"0\", \"isAdmin\": \"1\", \"rank\": \"6\"}', '2|Test,', '', '{\"isBanned\": \"0\", \"isMuted\": \"0\"}', 2), 115 | (2, 'Test', 'Test', '$2a$15$rrTaeBdBNMaFWgjaeL/tbuolm0JEcQ83WTxoovXpYYjCa/vwYwXiO', '36e9fbb6-0fb3-11e6-a148-3e1d05defe78', '', '2016-09-07 01:52:32', 5605, '', '{\"color\":0,\"head\":\"429\",\"face\":0,\"neck\":0,\"body\":\"0\",\"hands\":0,\"feet\":0,\"flag\":\"0\",\"photo\":\"0\"}', '{\"isStaff\": \"0\", \"isMed\": \"0\", \"isMod\": \"0\", \"isAdmin\": \"0\", \"rank\": \"1\"}', '1|Lynx,', '', '{\"isBanned\":\"0\",\"isMuted\":\"0\"}', 1) 116 | ON DUPLICATE KEY UPDATE `ID` = VALUES(`ID`), `username` = VALUES(`username`), `nickname` = VALUES(`nickname`), `password` = VALUES(`password`), `uuid` = VALUES(`uuid`), `lkey` = VALUES(`lkey`), `joindate` = VALUES(`joindate`), `coins` = VALUES(`coins`), `inventory` = VALUES(`inventory`), `clothing` = VALUES(`clothing`), `ranking` = VALUES(`ranking`), `buddies` = VALUES(`buddies`), `ignored` = VALUES(`ignored`), `moderation` = VALUES(`moderation`), `invalid_logins` = VALUES(`invalid_logins`); 117 | 118 | -- 2017-05-21 01:13:54 119 | -------------------------------------------------------------------------------- /Extensions/Crumbs.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'json' 3 | require 'typhoeus' 4 | require 'to_bool' 5 | 6 | class Crumbs 7 | 8 | attr_accessor :item_crumbs, :epf_item_crumbs, :floors_crumbs, :stamps_crumbs, :postcard_crumbs, :igloo_crumbs, :furniture_crumbs, :room_crumbs, :game_room_crumbs 9 | 10 | def initialize(main_class) 11 | @parent = main_class 12 | @urls = { 13 | 'rooms' => 'http://127.0.0.1/JSONS/rooms.json', 14 | 'stamps' => 'http://127.0.0.1/JSONS/stamps.json', 15 | 'postcards' => 'http://127.0.0.1/JSONS/postcards.json', 16 | 'items' => 'http://127.0.0.1/JSONS/paper_items.json', 17 | 'igloos' => 'http://127.0.0.1/JSONS/igloos.json', 18 | 'floors' => 'http://127.0.0.1/JSONS/igloo_floors.json', 19 | 'furniture' => 'http://127.0.0.1/JSONS/furniture_items.json' 20 | } 21 | @item_crumbs = Hash.new{ |h,k| h[k] = Hash.new(&h.default_proc) } 22 | @epf_item_crumbs = Hash.new{ |h,k| h[k] = Hash.new(&h.default_proc) } 23 | @floors_crumbs = Hash.new{ |h,k| h[k] = Hash.new(&h.default_proc) } 24 | @stamps_crumbs = Hash.new{ |h,k| h[k] = Hash.new(&h.default_proc) } 25 | @postcard_crumbs = Hash.new{ |h,k| h[k] = Hash.new(&h.default_proc) } 26 | @igloo_crumbs = Hash.new{ |h,k| h[k] = Hash.new(&h.default_proc) } 27 | @furniture_crumbs = Hash.new{ |h,k| h[k] = Hash.new(&h.default_proc) } 28 | @room_crumbs = Hash.new{ |h,k| h[k] = Hash.new(&h.default_proc) } 29 | @game_room_crumbs = Hash.new{ |h,k| h[k] = Hash.new(&h.default_proc) } 30 | end 31 | 32 | def loadCrumbs 33 | crumbs_data = {} 34 | hydra = Typhoeus::Hydra.new 35 | @urls.each do |crumbs_type, crumbs_url| 36 | request = Typhoeus::Request.new(crumbs_url) 37 | request.on_complete do |response| 38 | if response.success? 39 | crumbs_data[crumbs_type] = response.body 40 | else 41 | @parent.logger.error('Failed to get url: ' + crumbs_url) 42 | end 43 | end 44 | hydra.queue(request) 45 | end 46 | hydra.run 47 | crumbs_data.each do |crumbs_name, crumbs_data| 48 | case crumbs_name 49 | when 'items' 50 | self.loadItems(crumbs_data) 51 | when 'floors' 52 | self.loadFloors(crumbs_data) 53 | when 'stamps' 54 | self.loadStamps(crumbs_data) 55 | when 'postcards' 56 | self.loadPostcards(crumbs_data) 57 | when 'igloos' 58 | self.loadIgloos(crumbs_data) 59 | when 'furniture' 60 | self.loadFurnitures(crumbs_data) 61 | when 'rooms' 62 | self.loadRooms(crumbs_data) 63 | end 64 | end 65 | end 66 | 67 | def loadItems(crumbs_data) 68 | decoded_items_data = JSON.parse(crumbs_data) 69 | decoded_items_data.each do |item| 70 | if item['is_epf'].to_bool == true 71 | @epf_item_crumbs[item['paper_item_id'].to_i] = ['points' => item['cost'].to_i] 72 | else 73 | item_type = '' 74 | case item['type'] 75 | when 1 76 | item_type = 'color' 77 | when 2 78 | item_type = 'head' 79 | when 3 80 | item_type = 'face' 81 | when 4 82 | item_type = 'neck' 83 | when 5 84 | item_type = 'body' 85 | when 6 86 | item_type = 'hand' 87 | when 7 88 | item_type = 'feet' 89 | when 8 90 | item_type = 'flag' 91 | when 9 92 | item_type = 'photo' 93 | when 10 94 | item_type = 'other' 95 | end 96 | @item_crumbs[item['paper_item_id'].to_i] = ['price' => item['cost'].to_i, 'type' => item_type.to_i] 97 | end 98 | end 99 | @parent.logger.info('Successfully loaded ' + @epf_item_crumbs.count.to_s + ' EPF Items') 100 | @parent.logger.info('Successfully loaded ' + @item_crumbs.count.to_s + ' Items') 101 | end 102 | 103 | def loadFloors(crumbs_data) 104 | decoded_floors_data = JSON.parse(crumbs_data) 105 | decoded_floors_data.each do |floor| 106 | @floors_crumbs[floor['igloo_floor_id'].to_i] = ['price' => floor['cost'].to_i] 107 | end 108 | @parent.logger.info('Successfully loaded ' + @floors_crumbs.count.to_s + ' Floors') 109 | end 110 | 111 | def loadStamps(crumbs_data) 112 | decoded_stamps_data = JSON.parse(crumbs_data) 113 | decoded_stamps_data.each do |first_stamps_index, value_one| 114 | first_stamps_index.each do |value_two, value_three| 115 | if value_three.respond_to?('each') 116 | value_three.each do |stamps| 117 | @stamps_crumbs[stamps['stamp_id'].to_i] = ['rank' => stamps['rank'].to_i] 118 | end 119 | end 120 | end 121 | end 122 | @parent.logger.info('Successfully loaded ' + @stamps_crumbs.count.to_s + ' Stamps') 123 | end 124 | 125 | def loadPostcards(crumbs_data) 126 | decoded_pcards_data = JSON.parse(crumbs_data) 127 | decoded_pcards_data.each do |card_id, card_cost| 128 | @postcard_crumbs[card_id.to_i] = ['cost' => card_cost.to_i] 129 | end 130 | @parent.logger.info('Successfully loaded ' + @postcard_crumbs.count.to_s + ' Postcards') 131 | end 132 | 133 | def loadIgloos(crumbs_data) 134 | decoded_igloos_data = JSON.parse(crumbs_data) 135 | decoded_igloos_data.each do |igloo_index, igloo| 136 | @igloo_crumbs[igloo['igloo_id'].to_i] = ['price' => igloo['cost'].to_i] 137 | end 138 | @parent.logger.info('Successfully loaded ' + @igloo_crumbs.count.to_s + ' Igloos') 139 | end 140 | 141 | def loadFurnitures(crumbs_data) 142 | decoded_furns_data = JSON.parse(crumbs_data) 143 | decoded_furns_data.each do |furn| 144 | @furniture_crumbs[furn['furniture_item_id'].to_i] = ['price' => furn['cost'].to_i] 145 | end 146 | @parent.logger.info('Successfully loaded ' + @furniture_crumbs.count.to_s + ' Furnitures') 147 | end 148 | 149 | def loadRooms(crumbs_data) 150 | decoded_rooms_data = JSON.parse(crumbs_data) 151 | decoded_rooms_data.each do |room_index| 152 | room_index.each do |room| 153 | if room['room_key'] != '' 154 | @room_crumbs[room['room_id'].to_i] = ['name' => room['room_key'], 'max' => room['max_users'].to_i] 155 | else 156 | @game_room_crumbs[room['room_id'].to_i] = ['max' => room['max_users'].to_i] 157 | end 158 | end 159 | end 160 | @parent.logger.info('Successfully loaded ' + @room_crumbs.count.to_s + ' Rooms') 161 | @parent.logger.info('Successfully loaded ' + @game_room_crumbs.count.to_s + ' Game Rooms') 162 | end 163 | 164 | end 165 | -------------------------------------------------------------------------------- /Extensions/TCP.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'socket' 3 | require 'to_bool' 4 | 5 | class TCP 6 | 7 | attr_accessor :clients, :server 8 | 9 | def initialize(main_class) 10 | @parent = main_class 11 | @clients = Array.new 12 | @server 13 | end 14 | 15 | def connectServer 16 | @server = TCPServer.open(@parent.server_config['server_port']) 17 | if @server != nil 18 | @parent.logger.info('Successfully connected to the Game server') 19 | else 20 | @parent.logger.info('Failed to connect to the Game server') 21 | end 22 | end 23 | 24 | def listenServer 25 | Thread.new(@server.accept) do |connection| 26 | @parent.logger.info("Accepting connection from #{connection.peeraddr[2]}") 27 | client = CPUser.new(@parent, connection) 28 | @clients << client 29 | begin 30 | while (data = connection.gets("\0")) 31 | if data != nil 32 | data = data.chomp 33 | end 34 | self.handleIncomingData(data, client) 35 | end 36 | rescue Exception => err 37 | @parent.logger.error("#{err} (#{err.class}) - #{err.backtrace.join("\n\t")}") 38 | raise 39 | ensure 40 | if @parent.game_sys.iglooMap.has_key?(client.ID) 41 | @parent.game_sys.iglooMap.delete(client.ID) 42 | end 43 | client.handleBuddyOffline 44 | client.removePlayerFromRoom 45 | @parent.game_sys.handleLeaveTable([], client) 46 | self.handleRemoveClient(connection) 47 | end 48 | end 49 | end 50 | 51 | def handleIncomingData(data, client) 52 | @parent.logger.debug('Incoming data: ' + data.to_s) 53 | packet_type = data[0,1] 54 | case packet_type 55 | when '<' 56 | self.handleXMLData(data, client) 57 | when '%' 58 | self.handleXTData(data, client) 59 | else 60 | self.handleRemoveClient(client.sock) 61 | end 62 | end 63 | 64 | def handleXMLData(data, client) 65 | if data.include?('policy-file-request') 66 | return @parent.login_sys.handleCrossDomainPolicy(client) 67 | end 68 | hash_data = @parent.parseXML(data) 69 | if hash_data == false 70 | return self.handleRemoveClient(client.sock) 71 | end 72 | if @parent.login_sys.xml_handlers.has_key?('policy-file-request') 73 | return @parent.login_sys.handleCrossDomainPolicy(client) 74 | end 75 | if hash_data['msg']['t'] == 'sys' 76 | action = hash_data['msg']['body']['action'] 77 | if @parent.login_sys.xml_handlers.has_key?(action) 78 | handler = @parent.login_sys.xml_handlers[action] 79 | @parent.hooks.each do |hook, hookClass| 80 | if @parent.hooks[hook].dependencies['hook_type'] == 'login' 81 | if @parent.hooks[hook].respond_to?(handler) == true && @parent.hooks[hook].callBefore == true && @parent.hooks[hook].callAfter == false 82 | hookClass.send(handler, hash_data, client) 83 | end 84 | end 85 | end 86 | if @parent.login_sys.respond_to?(handler) == true 87 | @parent.login_sys.send(handler, hash_data, client) 88 | end 89 | @parent.hooks.each do |hook, hookClass| 90 | if @parent.hooks[hook].dependencies['hook_type'] == 'login' 91 | if @parent.hooks[hook].respond_to?(handler) == true && @parent.hooks[hook].callAfter == true && @parent.hooks[hook].callBefore == false 92 | hookClass.send(handler, hash_data, client) 93 | end 94 | end 95 | end 96 | end 97 | end 98 | end 99 | 100 | def handleXTData(data, client) 101 | @parent.game_sys.handleData(data, client) 102 | end 103 | 104 | def getClientBySock(socket) 105 | @clients.each_with_index do |client, key| 106 | if @clients[key].sock == socket 107 | return @clients[key] 108 | end 109 | end 110 | end 111 | 112 | def handleRemoveClient(socket) 113 | @clients.each_with_index do |client, key| 114 | if @clients[key].sock == socket 115 | @clients[key].sock.close 116 | @clients.delete(client) 117 | @parent.logger.info('A client disconnected from the server') 118 | end 119 | end 120 | end 121 | 122 | end 123 | -------------------------------------------------------------------------------- /Extensions/XTParser.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'json' 3 | 4 | class XTParser 5 | 6 | def handleLoadPackets 7 | packet_file = File.read(__dir__ + '/PACKETS.json') 8 | packets = JSON.parse(packet_file) 9 | @xtPackets = packets 10 | end 11 | 12 | def parseData(data) 13 | if data.respond_to?(:to_str) 14 | packets = data.split('%') 15 | if packets.count < 3 16 | @parent.logger.warn('Client is trying to send a packet with very less arguments') 17 | return false 18 | end 19 | if @xtPackets.has_key?(packets[1]) != true 20 | @parent.logger.warn('Client is trying to send an invalid packet') 21 | return false 22 | end 23 | if @xtPackets[packets[1]][0].include?(packets[2]) != true 24 | @parent.logger.warn('Client is trying to send invalid packet type') 25 | return false 26 | end 27 | gamePacket = packets[3] 28 | existsDelimeter = @xtPackets[packets[1]][0][packets[2]][0]['delimeter'] 29 | if gamePacket !~ /#{existsDelimeter}/ 30 | @parent.logger.warn('Client is trying to use an invalid delimeter') 31 | return false 32 | end 33 | if @xtPackets[packets[1]][0][packets[2]][0].include?(gamePacket) != true 34 | @parent.logger.warn('Client is trying to send an invalid game packet') 35 | return false 36 | end 37 | packets.each do |packet| 38 | if packet.include?('|') && @xtPackets[packets[1]][0][packets[2]][0][gamePacket][0]['hasException'] != true 39 | @parent.logger.warn('Client is trying to send a malformed packet') 40 | return false 41 | end 42 | end 43 | realArgs = packets.drop(5) 44 | if realArgs.empty? != true && realArgs.count < @xtPackets[packets[1]][0][packets[2]][0][gamePacket][0]['length'].to_i 45 | @parent.logger.warn('Client is sending invalid amount of Arguments') 46 | return false 47 | end 48 | if @xtPackets[packets[1]][0][packets[2]][0][gamePacket][0]['length'].to_i < 0 49 | if gamePacket == 'st#ssbcd' || gamePacket == 'g#ur' || gamePacket == 'm#sm' #because stampbook cover is a pain 50 | handlingInfo = ['handler' => @xtPackets[packets[1]][0][packets[2]][0][gamePacket][0]['method'], 'arguments' => realArgs] 51 | return handlingInfo 52 | end 53 | handlingInfo = ['handler' => @xtPackets[packets[1]][0][packets[2]][0][gamePacket][0]['method'], 'arguments' => realArgs] 54 | return handlingInfo 55 | elsif @xtPackets[packets[1]][0][packets[2]][0][gamePacket][0]['length'].to_i >= 0 56 | packLength = @xtPackets[packets[1]][0][packets[2]][0][gamePacket][0]['length'].to_i 57 | newArgs = Array.new 58 | (0..packLength).each do |pack_index| 59 | type = @xtPackets[packets[1]][0][packets[2]][0][gamePacket][0]['type'][pack_index] 60 | item = realArgs[pack_index] 61 | item_type = '' 62 | if @parent.is_num?(item) == true 63 | item_type = 'Fixnum' 64 | item = item.to_i 65 | else 66 | item_type = 'String' 67 | item = item.to_s 68 | end 69 | if item_type != type 70 | @parent.logger.warn('Client is sending invalid Arguments') 71 | return false 72 | end 73 | newArgs.push(item) 74 | end 75 | handlingInfo = ['handler' => @xtPackets[packets[1]][0][packets[2]][0][gamePacket][0]['method'], 'arguments' => newArgs] 76 | return handlingInfo 77 | end 78 | end 79 | end 80 | 81 | end 82 | -------------------------------------------------------------------------------- /Hooks/Commands.rb: -------------------------------------------------------------------------------- 1 | require 'htmlentities' 2 | 3 | class Commands 4 | 5 | attr_accessor :enabled, :callAfter, :callBefore, :dependencies 6 | 7 | def initialize(mother) 8 | @parent = mother 9 | @enabled = true 10 | @callAfter = true 11 | @callBefore = false 12 | @dependencies = { 13 | 'author' => 'Lynx', 14 | 'version' => '1.0', 15 | 'hook_type' => 'game' 16 | } 17 | @commands = { 18 | 'ping' => 'handlePong', 19 | 'global' => 'handleGlobalMessage', 20 | 'users' => 'handleUserCount', 21 | 'ai' => 'handleAddItem', 22 | 'ac' => 'handleAddCoins', 23 | 'addall' => 'handleAddAllItems', 24 | 'summon' => 'handleSummonPenguin', 25 | 'teleport' => 'handleTeleportPenguin', 26 | 'find' => 'handleFindPenguin', 27 | 'jr' => 'handleJoinRoom', 28 | 'nick' => 'handleChangeNickname' 29 | } 30 | @prefix = '!' 31 | end 32 | 33 | def handleSendMessage(data, client) 34 | userID = data[0] 35 | userMessage = data[1] 36 | decodedMessage = HTMLEntities.new.decode(userMessage) 37 | cmdPrefix = decodedMessage[0,1] 38 | if cmdPrefix == @prefix 39 | messageArgs = decodedMessage[1..-1] 40 | msgArgs = messageArgs.split(' ', 2) 41 | userCMD = msgArgs[0].downcase 42 | cmdArgs = msgArgs[1] 43 | if @commands.has_key?(userCMD) 44 | cmdHandler = @commands[userCMD] 45 | self.send(cmdHandler, cmdArgs, client) 46 | end 47 | end 48 | end 49 | 50 | def handlePong(cmdArgs, client) 51 | client.sendData('%xt%sm%-1%0%Pong%') 52 | end 53 | 54 | def handleGlobalMessage(cmdArgs, client) 55 | @parent.sock.clients.each_with_index do |client, key| 56 | @parent.sock.clients[key].sendData('%xt%sm%-1%0%' + cmdArgs + '%') 57 | end 58 | end 59 | 60 | def handleUserCount(cmdArgs, client) 61 | userCount = @parent.sock.clients.count 62 | if userCount == 1 63 | client.sendRoom('%xt%sm%-1%0%I guess its just you and me baby ;)%') 64 | else 65 | client.sendRoom("%xt%sm%-1%0%Currently there are " + userCount.to_s + " users online%") 66 | end 67 | end 68 | 69 | def handleAddCoins(cmdArgs, client) 70 | msgArgs = cmdArgs.split(' ') 71 | amount = msgArgs[0] 72 | if @parent.is_num?(amount) == true && amount.to_i < 5000 73 | client.addCoins(amount.to_i) 74 | end 75 | end 76 | 77 | def handleAddAllItems(cmdArgs, client) 78 | allItems = @parent.crumbs.item_crumbs.keys 79 | items = allItems.join('|') 80 | @parent.mysql.updatePenguinInventory(items, client.ID) 81 | client.sendData('%xt%sm%-1%0%Kindly re-login to the server to get all your items%') 82 | end 83 | 84 | def handleAddItem(cmdArgs, client) 85 | argsToSend = [] 86 | msgArgs = cmdArgs.split(' ') 87 | item = msgArgs[0] 88 | if @parent.is_num?(item) == true 89 | argsToSend.push(item.to_i) 90 | end 91 | @parent.game_sys.handleAddInventory(argsToSend, client) 92 | end 93 | 94 | def handleSummonPenguin(cmdArgs, client) 95 | if client.ranking['isStaff'] == 1 96 | msgArgs = cmdArgs.split(' ') 97 | name = msgArgs[0] 98 | if @parent.is_num?(name) != true && name != client.username 99 | oclient = client.getClientByName(name) 100 | oclient.joinRoom(client.room) 101 | @parent.hooks['GameBot'].handleJoinRoom([client.room], client) 102 | end 103 | end 104 | end 105 | 106 | def handleTeleportPenguin(cmdArgs, client) 107 | msgArgs = cmdArgs.split(' ') 108 | name = msgArgs[0] 109 | if @parent.is_num?(name) != true && name != client.username 110 | oclient = client.getClientByName(name) 111 | client.joinRoom(oclient.room) 112 | @parent.hooks['GameBot'].handleJoinRoom([oclient.room], client) 113 | end 114 | end 115 | 116 | def handleFindPenguin(cmdArgs, client) 117 | msgArgs = cmdArgs.split(' ') 118 | name = msgArgs[0] 119 | if @parent.is_num?(name) != true && name != client.username 120 | oclient = client.getClientByName(name) 121 | room_name = @parent.crumbs.room_crumbs[oclient.room][0]['name'] 122 | client.sendData('%xt%sm%-1%0%' + oclient.username + ' is at the ' + room_name + '%') 123 | end 124 | end 125 | 126 | def handleChangeNickname(cmdArgs, client) 127 | msgArgs = cmdArgs.split(' ') 128 | name = msgArgs[0] 129 | if @parent.is_num?(name) != true 130 | if (name !~ /^[A-Za-z0-9]+$/) 131 | return client.sendData('%xt%sm%-1%0%Nickname should be alpha numeric!%') 132 | end 133 | isExistsNick = @parent.mysql.checkNicknameExists(name) 134 | if isExistsNick >= 1 135 | return client.sendData('%xt%sm%-1%0%Nickname already exists!%') 136 | end 137 | @parent.mysql.updatePlayerNickname(name, client.username) 138 | client.nickname = name 139 | client.joinRoom(client.room) 140 | @parent.hooks['GameBot'].handleJoinRoom([client.room], client) 141 | end 142 | end 143 | 144 | def handleJoinRoom(cmdArgs, client) 145 | msgArgs = cmdArgs.split(' ') 146 | room = msgArgs[0] 147 | if @parent.is_num?(room) != false 148 | room = room.to_i 149 | if room > 0 && room < 1000 150 | client.joinRoom(room) 151 | @parent.hooks['GameBot'].handleJoinRoom([room], client) 152 | end 153 | end 154 | end 155 | 156 | end 157 | -------------------------------------------------------------------------------- /Hooks/GameBot.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | class GameBot 4 | 5 | attr_accessor :enabled, :callAfter, :callBefore, :dependencies 6 | 7 | def initialize(mother) 8 | @parent = mother 9 | @enabled = true 10 | @callAfter = true 11 | @callBefore = false 12 | @dependencies = { 13 | 'author' => 'Lynx', 14 | 'version' => '0.1', 15 | 'hook_type' => 'game' 16 | } 17 | @botInfo = { 18 | 'botID' => 0, 19 | 'botName' => 'Bot' 20 | } 21 | end 22 | 23 | def generateClothing(type) 24 | @randItems = Array.new 25 | @parent.crumbs.item_crumbs.keys.each do |itemID| 26 | item_type = @parent.crumbs.item_crumbs[itemID][0]['type'] 27 | if item_type.downcase == type 28 | @randItems.push(itemID) 29 | end 30 | end 31 | return @randItems.sample 32 | end 33 | 34 | def buildBotString 35 | clientInfo = [ 36 | @botInfo['botID'], 37 | @botInfo['botName'], 1, 38 | self.generateClothing('color'), 39 | self.generateClothing('head'), 40 | self.generateClothing('face'), 41 | self.generateClothing('neck'), 42 | self.generateClothing('body'), 43 | self.generateClothing('hand'), 44 | self.generateClothing('feet'), 45 | self.generateClothing('flag'), 46 | self.generateClothing('photo'), 0, 0, 0, 1, 876 47 | ] 48 | return clientInfo.join('|') 49 | end 50 | 51 | def handleJoinRoom(data, client) 52 | roomID = data[0] 53 | if @parent.crumbs.game_room_crumbs.has_key?(roomID) != true 54 | client.sendRoom('%xt%ap%-1%' + self.buildBotString + '%') 55 | end 56 | end 57 | 58 | def handleJoinServer(data, client) 59 | client.sendRoom('%xt%ap%-1%' + self.buildBotString + '%') 60 | end 61 | 62 | def handleJoinPlayer(data, client) 63 | roomID = data[0] 64 | if @parent.crumbs.game_room_crumbs.has_key?(roomID) != true 65 | client.sendRoom('%xt%ap%-1%' + self.buildBotString + '%') 66 | end 67 | end 68 | 69 | end 70 | -------------------------------------------------------------------------------- /Hooks/LoginNotice.rb: -------------------------------------------------------------------------------- 1 | class LoginNotice 2 | 3 | attr_accessor :enabled, :callAfter, :callBefore, :dependencies 4 | 5 | def initialize(mother) 6 | @parent = mother 7 | @enabled = true 8 | @callAfter = false 9 | @callBefore = true 10 | @dependencies = { 11 | 'author' => 'Lynx', 12 | 'version' => '0.1', 13 | 'hook_type' => 'login' 14 | } 15 | end 16 | 17 | def handleGameLogin(data, client) 18 | username = data['msg']['body']['login']['nick'] 19 | @parent.logger.info("#{username.upcase_first} is attempting to log in to the server") 20 | end 21 | 22 | end 23 | -------------------------------------------------------------------------------- /Hooks/PacketSpam.rb: -------------------------------------------------------------------------------- 1 | class PacketSpam 2 | 3 | attr_accessor :enabled, :callAfter, :callBefore, :dependencies 4 | 5 | def initialize(mother) 6 | @parent = mother 7 | @enabled = true 8 | @callAfter = false 9 | @callBefore = true 10 | @dependencies = { 11 | 'author' => 'Lynx', 12 | 'version' => '1.0', 13 | 'hook_type' => 'game' 14 | } 15 | @packets = [ 16 | 'u#sp', 's#upc', 's#uph', 's#upf', 's#upn', 17 | 's#upb', 's#upa', 's#upe', 's#upp', 's#upl', 18 | 'l#ms', 'b#br', 'j#jr', 'u#se', 'u#sa', 'u#sg', 19 | 'sma', 'u#sb', 'u#gp', 'u#ss', 'u#sq', 20 | 'u#sj', 'u#sl', 'u#sg', 'm#sm', 'u#sf' 21 | ] 22 | end 23 | 24 | def handleSendJoke(data, client) 25 | self.checkPacketSpam(client, 'u#sj') 26 | end 27 | 28 | def handleJoinRoom(data, client) 29 | self.checkPacketSpam(client, 'j#jr') 30 | end 31 | 32 | def handleUserHeartbeat(data, client) 33 | self.checkPacketSpam(client, 'u#h') 34 | end 35 | 36 | def handleSendPosition(data, client) 37 | self.checkPacketSpam(client, 'u#sp') 38 | end 39 | 40 | def handleSendFrame(data, client) 41 | self.checkPacketSpam(client, 'u#sf') 42 | end 43 | 44 | def handleSendEmote(data, client) 45 | self.checkPacketSpam(client, 'u#se') 46 | end 47 | 48 | def handleSendQuickMessage(data, client) 49 | self.checkPacketSpam(client, 'u#sq') 50 | end 51 | 52 | def handleSendAction(data, client) 53 | self.checkPacketSpam(client, 'u#sa') 54 | end 55 | 56 | def handleSendSafeMessage(data, client) 57 | self.checkPacketSpam(client, 'u#ss') 58 | end 59 | 60 | def handleSendGuideMessage(data, client) 61 | self.checkPacketSpam(client, 'u#sg') 62 | end 63 | 64 | def handleSendMascotMessage(data, client) 65 | self.checkPacketSpam(client, 'u#sma') 66 | end 67 | 68 | def handleUpdatePlayerColor(data, client) 69 | self.checkPacketSpam(client, 's#upc') 70 | end 71 | 72 | def handleUpdatePlayerHead(data, client) 73 | self.checkPacketSpam(client, 's#uph') 74 | end 75 | 76 | def handleUpdatePlayerFace(data, client) 77 | self.checkPacketSpam(client, 's#upf') 78 | end 79 | 80 | def handleUpdatePlayerNeck(data, client) 81 | self.checkPacketSpam(client, 's#upn') 82 | end 83 | 84 | def handleUpdatePlayerBody(data, client) 85 | self.checkPacketSpam(client, 's#upb') 86 | end 87 | 88 | def handleUpdatePlayerHand(data, client) 89 | self.checkPacketSpam(client, 's#upa') 90 | end 91 | 92 | def handleUpdatePlayerFeet(data, client) 93 | self.checkPacketSpam(client, 's#upe') 94 | end 95 | 96 | def handleUpdatePlayerPhoto(data, client) 97 | self.checkPacketSpam(client, 's#upp') 98 | end 99 | 100 | def handleUpdatePlayerPin(data, client) 101 | self.checkPacketSpam(client, 's#upl') 102 | end 103 | 104 | def handleSendMessage(data, client) 105 | self.checkPacketSpam(client, 'm#sm') 106 | end 107 | 108 | def handleMailSend(data, client) 109 | self.checkPacketSpam(client, 'l#ms') 110 | end 111 | 112 | def handleBuddyRequest(data, client) 113 | self.checkPacketSpam(client, 'b#br') 114 | end 115 | 116 | def handleGetPlayer(data, client) 117 | self.checkPacketSpam(client, 'u#gp') 118 | end 119 | 120 | def checkPacketSpam(client, packetType) 121 | if @packets.include?(packetType) != false 122 | if client.spamFilter.has_key?(packetType) != true 123 | client.spamFilter[packetType] = 0 124 | end 125 | currTime = Time.now 126 | timeStamp = currTime 127 | if client.lastPacket.has_key?(packetType) != true 128 | client.lastPacket[packetType] = timeStamp 129 | end 130 | timeDiff = (TimeDifference.between(Time.parse(client.lastPacket[packetType].to_s), Time.now).in_seconds).round 131 | if timeDiff < 6 132 | if client.spamFilter[packetType] < 10 133 | client.spamFilter[packetType] += 1 134 | end 135 | if client.spamFilter[packetType] >= 10 136 | return @parent.sock.handleRemoveClient(client.sock) 137 | end 138 | else 139 | client.spamFilter[packetType] = 1 140 | end 141 | client.lastPacket[packetType] = timeStamp 142 | end 143 | end 144 | 145 | end 146 | -------------------------------------------------------------------------------- /JSONS/igloo_floors.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "igloo_floor_id": "0", 3 | "label": "Floor Removal", 4 | "prompt": "Floor Removal", 5 | "cost": "20" 6 | }, { 7 | "igloo_floor_id": "1", 8 | "label": "Terracotta Tile", 9 | "prompt": "Terracotta Tile", 10 | "cost": "680" 11 | }, { 12 | "igloo_floor_id": "2", 13 | "label": "Maple Hardwood", 14 | "prompt": "Maple Hardwood", 15 | "cost": "620" 16 | }, { 17 | "igloo_floor_id": "3", 18 | "label": "Green Carpet", 19 | "prompt": "Green Carpet", 20 | "cost": "530" 21 | }, { 22 | "igloo_floor_id": "4", 23 | "label": "Burgundy Carpet", 24 | "prompt": "Burgundy Carpet", 25 | "cost": "530" 26 | }, { 27 | "igloo_floor_id": "5", 28 | "label": "Black & White Tile", 29 | "prompt": "Black & White Tile", 30 | "cost": "510" 31 | }, { 32 | "igloo_floor_id": "6", 33 | "label": "Linoleum", 34 | "prompt": "Linoleum", 35 | "cost": "540" 36 | }, { 37 | "igloo_floor_id": "7", 38 | "label": "Dance Floor", 39 | "prompt": "Dance Floor", 40 | "cost": "1000" 41 | }, { 42 | "igloo_floor_id": "8", 43 | "label": "Painted Dance Steps", 44 | "prompt": "Painted Dance Steps", 45 | "cost": "280" 46 | }, { 47 | "igloo_floor_id": "9", 48 | "label": "Bamboo Floor", 49 | "prompt": "Bamboo Floor", 50 | "cost": "370" 51 | }, { 52 | "igloo_floor_id": "10", 53 | "label": "Dirt & Leaves", 54 | "prompt": "Dirt & Leaves", 55 | "cost": "400" 56 | }, { 57 | "igloo_floor_id": "11", 58 | "label": "Blue Turf", 59 | "prompt": "Blue Turf", 60 | "cost": "530" 61 | }, { 62 | "igloo_floor_id": "12", 63 | "label": "Whirlpool", 64 | "prompt": "Whirlpool", 65 | "cost": "750" 66 | }, { 67 | "igloo_floor_id": "13", 68 | "label": "Cherry Hardwood", 69 | "prompt": "Cherry Hardwood", 70 | "cost": "620" 71 | }, { 72 | "igloo_floor_id": "14", 73 | "label": "Phony Lawn", 74 | "prompt": "Phony Lawn", 75 | "cost": "700" 76 | }, { 77 | "igloo_floor_id": "15", 78 | "label": "Black Carpet", 79 | "prompt": "Black Carpet", 80 | "cost": "530" 81 | }, { 82 | "igloo_floor_id": "16", 83 | "label": "Dark Stone Tile", 84 | "prompt": "Dark Stone Tile", 85 | "cost": "800" 86 | }, { 87 | "igloo_floor_id": "17", 88 | "label": "Pink Carpet", 89 | "prompt": "Pink Carpet", 90 | "cost": "530" 91 | }, { 92 | "igloo_floor_id": "18", 93 | "label": "Sand Floor", 94 | "prompt": "Sand Floor", 95 | "cost": "400" 96 | }, { 97 | "igloo_floor_id": "19", 98 | "label": "Sunny Sky Floor", 99 | "prompt": "Sunny Sky Floor", 100 | "cost": "530" 101 | }, { 102 | "igloo_floor_id": "20", 103 | "label": "Cobblestone", 104 | "prompt": "Cobblestone", 105 | "cost": "1200" 106 | }, { 107 | "igloo_floor_id": "21", 108 | "label": "Snowy Floor", 109 | "prompt": "Snowy Floor", 110 | "cost": "400" 111 | }, { 112 | "igloo_floor_id": "22", 113 | "label": "Lime Green Carpet", 114 | "prompt": "Lime Green Carpet", 115 | "cost": "530" 116 | }, { 117 | "igloo_floor_id": "23", 118 | "label": "Woven Rice Mat", 119 | "prompt": "Woven Rice Mat", 120 | "cost": "750" 121 | }] 122 | -------------------------------------------------------------------------------- /JSONS/igloos.json: -------------------------------------------------------------------------------- 1 | { 2 | "0": { 3 | "igloo_id": "0", 4 | "name": "Igloo Removal", 5 | "cost": "0" 6 | }, 7 | "1": { 8 | "igloo_id": "1", 9 | "name": "Basic Igloo", 10 | "cost": "1500" 11 | }, 12 | "2": { 13 | "igloo_id": "2", 14 | "name": "Candy Igloo", 15 | "cost": "1500" 16 | }, 17 | "3": { 18 | "igloo_id": "3", 19 | "name": "Deluxe Blue Igloo", 20 | "cost": "4000" 21 | }, 22 | "4": { 23 | "igloo_id": "4", 24 | "name": "Big Candy Igloo", 25 | "cost": "4000" 26 | }, 27 | "5": { 28 | "igloo_id": "5", 29 | "name": "Secret Stone Igloo", 30 | "cost": "2000" 31 | }, 32 | "6": { 33 | "igloo_id": "6", 34 | "name": "Snow Igloo", 35 | "cost": "1000" 36 | }, 37 | "8": { 38 | "igloo_id": "8", 39 | "name": "Secret Deluxe Stone Igloo", 40 | "cost": "5000" 41 | }, 42 | "9": { 43 | "igloo_id": "9", 44 | "name": "Deluxe Snow Igloo", 45 | "cost": "3000" 46 | }, 47 | "10": { 48 | "igloo_id": "10", 49 | "name": "Bamboo Hut", 50 | "cost": "3200" 51 | }, 52 | "11": { 53 | "igloo_id": "11", 54 | "name": "Log Cabin", 55 | "cost": "4100" 56 | }, 57 | "12": { 58 | "igloo_id": "12", 59 | "name": "Gym", 60 | "cost": "4800" 61 | }, 62 | "13": { 63 | "igloo_id": "13", 64 | "name": "Split Level Igloo", 65 | "cost": "4600" 66 | }, 67 | "14": { 68 | "igloo_id": "14", 69 | "name": "Candy Split Level Igloo", 70 | "cost": "4600" 71 | }, 72 | "15": { 73 | "igloo_id": "15", 74 | "name": "Snowglobe", 75 | "cost": "3700" 76 | }, 77 | "16": { 78 | "igloo_id": "16", 79 | "name": "Ice Castle", 80 | "cost": "2400" 81 | }, 82 | "17": { 83 | "igloo_id": "17", 84 | "name": "Split Level Snow Igloo", 85 | "cost": "4600" 86 | }, 87 | "18": { 88 | "igloo_id": "18", 89 | "name": "Fish Bowl", 90 | "cost": "2400" 91 | }, 92 | "19": { 93 | "igloo_id": "19", 94 | "name": "Tent", 95 | "cost": "2700" 96 | }, 97 | "20": { 98 | "igloo_id": "20", 99 | "name": "Jack O' Lantern", 100 | "cost": "2700" 101 | }, 102 | "21": { 103 | "igloo_id": "21", 104 | "name": "Backyard Igloo", 105 | "cost": "4200" 106 | }, 107 | "22": { 108 | "igloo_id": "22", 109 | "name": "Pink Ice Palace", 110 | "cost": "2400" 111 | }, 112 | "23": { 113 | "igloo_id": "23", 114 | "name": "Ship Igloo", 115 | "cost": "4300" 116 | }, 117 | "24": { 118 | "igloo_id": "24", 119 | "name": "Dojo Igloo", 120 | "cost": "1300" 121 | }, 122 | "25": { 123 | "igloo_id": "25", 124 | "name": "Gingerbread House", 125 | "cost": "2100" 126 | }, 127 | "26": { 128 | "igloo_id": "26", 129 | "name": "Restaurant Igloo", 130 | "cost": "4800" 131 | }, 132 | "27": { 133 | "igloo_id": "27", 134 | "name": "Tree House Igloo", 135 | "cost": "4500" 136 | }, 137 | "28": { 138 | "igloo_id": "28", 139 | "name": "Theatre Igloo", 140 | "cost": "4600" 141 | }, 142 | "29": { 143 | "igloo_id": "29", 144 | "name": "Circus Tent", 145 | "cost": "0" 146 | }, 147 | "30": { 148 | "igloo_id": "30", 149 | "name": "Snowy Backyard Igloo", 150 | "cost": "3000" 151 | }, 152 | "31": { 153 | "igloo_id": "31", 154 | "name": "Cave Igloo", 155 | "cost": "1500" 156 | }, 157 | "32": { 158 | "igloo_id": "32", 159 | "name": "Green Clover Igloo", 160 | "cost": "2050" 161 | }, 162 | "33": { 163 | "igloo_id": "33", 164 | "name": "Grey Ice Castle", 165 | "cost": "2400" 166 | }, 167 | "35": { 168 | "igloo_id": "35", 169 | "name": "Cozy Cottage Igloo", 170 | "cost": "2500" 171 | }, 172 | "36": { 173 | "igloo_id": "36", 174 | "name": "Estate Igloo", 175 | "cost": "2500" 176 | }, 177 | "37": { 178 | "igloo_id": "37", 179 | "name": "In Half Igloo", 180 | "cost": "2300" 181 | }, 182 | "38": { 183 | "igloo_id": "38", 184 | "name": "Shadowy Keep", 185 | "cost": "1800" 186 | }, 187 | "39": { 188 | "igloo_id": "39", 189 | "name": "Dragon's Lair", 190 | "cost": "3000" 191 | }, 192 | "40": { 193 | "igloo_id": "40", 194 | "name": "Mermaid Cove", 195 | "cost": "3030" 196 | }, 197 | "41": { 198 | "igloo_id": "41", 199 | "name": "Whale's Mouth", 200 | "cost": "2700" 201 | }, 202 | "42": { 203 | "igloo_id": "42", 204 | "name": "Trick-or-Treat Igloo", 205 | "cost": "2000" 206 | }, 207 | "43": { 208 | "igloo_id": "43", 209 | "name": "Deluxe Gingerbread House", 210 | "cost": "0" 211 | }, 212 | "45": { 213 | "igloo_id": "45", 214 | "name": "Invisible Snowy", 215 | "cost": "0" 216 | }, 217 | "46": { 218 | "igloo_id": "46", 219 | "name": "Invisible Beach", 220 | "cost": "0" 221 | }, 222 | "47": { 223 | "igloo_id": "47", 224 | "name": "Invisible Forest", 225 | "cost": "0" 226 | }, 227 | "48": { 228 | "igloo_id": "48", 229 | "name": "Invisible Mountain", 230 | "cost": "0" 231 | }, 232 | "49": { 233 | "igloo_id": "49", 234 | "name": "Shipwreck Igloo", 235 | "cost": "900" 236 | }, 237 | "50": { 238 | "igloo_id": "50", 239 | "name": "Wildlife Den", 240 | "cost": "900" 241 | }, 242 | "51": { 243 | "igloo_id": "51", 244 | "name": "Medieval Manor", 245 | "cost": "1200" 246 | }, 247 | "52": { 248 | "igloo_id": "52", 249 | "name": "Warehouse", 250 | "cost": "950" 251 | }, 252 | "53": { 253 | "igloo_id": "53", 254 | "name": "Pineapple Igloo", 255 | "cost": "0" 256 | }, 257 | "54": { 258 | "igloo_id": "54", 259 | "name": "Creepy Cavern", 260 | "cost": "1500" 261 | }, 262 | "55": { 263 | "igloo_id": "55", 264 | "name": "Frost Bite Palace", 265 | "cost": "0" 266 | }, 267 | "56": { 268 | "igloo_id": "56", 269 | "name": "Fresh Baked Gingerbread House", 270 | "cost": "2500" 271 | }, 272 | "57": { 273 | "igloo_id": "57", 274 | "name": "Penthouse", 275 | "cost": "4000" 276 | }, 277 | "58": { 278 | "igloo_id": "58", 279 | "name": "VIP Penthouse", 280 | "cost": "4500" 281 | }, 282 | "59": { 283 | "igloo_id": "59", 284 | "name": "Invisible Age of Dinosaurs", 285 | "cost": "0" 286 | }, 287 | "60": { 288 | "igloo_id": "60", 289 | "name": "Puffle Tree Fort", 290 | "cost": "0" 291 | }, 292 | "61": { 293 | "igloo_id": "61", 294 | "name": "Secret Base", 295 | "cost": "1600" 296 | }, 297 | "62": { 298 | "igloo_id": "62", 299 | "name": "Imperial Base Igloo", 300 | "cost": "1000" 301 | }, 302 | "63": { 303 | "igloo_id": "63", 304 | "name": "Beach Party Igloo", 305 | "cost": "1500" 306 | }, 307 | "64": { 308 | "igloo_id": "64", 309 | "name": "Gymnasium Igloo", 310 | "cost": "0" 311 | }, 312 | "65": { 313 | "igloo_id": "65", 314 | "name": "Magical Hideout", 315 | "cost": "1500" 316 | }, 317 | "66": { 318 | "igloo_id": "66", 319 | "name": "Eerie Castle", 320 | "cost": "2000" 321 | }, 322 | "67": { 323 | "igloo_id": "67", 324 | "name": "Sweet Swirl Igloo", 325 | "cost": "0" 326 | }, 327 | "68": { 328 | "igloo_id": "68", 329 | "name": "Train Station Igloo", 330 | "cost": "1100" 331 | }, 332 | "69": { 333 | "igloo_id": "69", 334 | "name": "Main Event Igloo", 335 | "cost": "1000" 336 | }, 337 | "70": { 338 | "igloo_id": "70", 339 | "name": "CP Airliner", 340 | "cost": "1200" 341 | }, 342 | "71": { 343 | "igloo_id": "71", 344 | "name": "Puffle Tree House", 345 | "cost": "1500" 346 | }, 347 | "72": { 348 | "igloo_id": "72", 349 | "name": "Invisible Distant Planet", 350 | "cost": "0" 351 | }, 352 | "73": { 353 | "igloo_id": "73", 354 | "name": "Space Dome Igloo", 355 | "cost": "2000" 356 | }, 357 | "74": { 358 | "igloo_id": "74", 359 | "name": "Invisible Soccer Pitch", 360 | "cost": "0" 361 | }, 362 | "75": { 363 | "igloo_id": "75", 364 | "name": "Tour Bus Igloo", 365 | "cost": "1800" 366 | }, 367 | "76": { 368 | "igloo_id": "76", 369 | "name": "Ice Palace Igloo", 370 | "cost": "0" 371 | }, 372 | "77": { 373 | "igloo_id": "77", 374 | "name": "Sharks Gym", 375 | "cost": "1500" 376 | }, 377 | "78": { 378 | "igloo_id": "78", 379 | "name": "Schoolhouse Igloo", 380 | "cost": "0" 381 | }, 382 | "79": { 383 | "igloo_id": "79", 384 | "name": "Ghostly Cavern Igloo", 385 | "cost": "1800" 386 | }, 387 | "80": { 388 | "igloo_id": "80", 389 | "name": "Invisible Undersea", 390 | "cost": "0" 391 | }, 392 | "81": { 393 | "igloo_id": "81", 394 | "name": "Invisible Merry Walrus Iceberg", 395 | "cost": "0" 396 | }, 397 | "82": { 398 | "igloo_id": "82", 399 | "name": "Ezra's Hideout", 400 | "cost": "1800" 401 | }, 402 | "83": { 403 | "igloo_id": "83", 404 | "name": "Starship Igloo", 405 | "cost": "0" 406 | }, 407 | "84": { 408 | "igloo_id": "84", 409 | "name": "Talent Show Stage", 410 | "cost": "1500" 411 | }, 412 | "85": { 413 | "igloo_id": "85", 414 | "name": "Red Puffle Tree House", 415 | "cost": "1000" 416 | }, 417 | "86": { 418 | "igloo_id": "86", 419 | "name": "Orange Puffle Tree House", 420 | "cost": "1000" 421 | }, 422 | "87": { 423 | "igloo_id": "87", 424 | "name": "Yellow Puffle Tree House", 425 | "cost": "1000" 426 | }, 427 | "88": { 428 | "igloo_id": "88", 429 | "name": "Green Puffle Tree House", 430 | "cost": "1000" 431 | }, 432 | "89": { 433 | "igloo_id": "89", 434 | "name": "Blue Puffle Tree House", 435 | "cost": "1000" 436 | }, 437 | "90": { 438 | "igloo_id": "90", 439 | "name": "Purple Puffle Tree House", 440 | "cost": "1000" 441 | }, 442 | "91": { 443 | "igloo_id": "91", 444 | "name": "Black Puffle Tree House", 445 | "cost": "1000" 446 | }, 447 | "92": { 448 | "igloo_id": "92", 449 | "name": "White Puffle Tree House", 450 | "cost": "1000" 451 | }, 452 | "93": { 453 | "igloo_id": "93", 454 | "name": "Brown Puffle Tree House", 455 | "cost": "1000" 456 | }, 457 | "94": { 458 | "igloo_id": "94", 459 | "name": "Pink Puffle Tree House", 460 | "cost": "1000" 461 | }, 462 | "95": { 463 | "igloo_id": "95", 464 | "name": "Gold Puffle Tree House", 465 | "cost": "1000" 466 | }, 467 | "96": { 468 | "igloo_id": "96", 469 | "name": "Rainbow Puffle Tree House", 470 | "cost": "1000" 471 | }, 472 | "97": { 473 | "igloo_id": "97", 474 | "name": "Spring Palace Igloo", 475 | "cost": "0" 476 | }, 477 | "98": { 478 | "igloo_id": "98", 479 | "name": "Stage Igloo", 480 | "cost": "1500" 481 | } 482 | } 483 | -------------------------------------------------------------------------------- /JSONS/postcards.json: -------------------------------------------------------------------------------- 1 | { 2 | "14": 10, 3 | "94": 10, 4 | "22": 10, 5 | "219": 10, 6 | "98": 10, 7 | "80": 10, 8 | "77": 10, 9 | "165": 10, 10 | "47": 10, 11 | "70": 10, 12 | "161": 10, 13 | "79": 10, 14 | "170": 10, 15 | "209": 10, 16 | "11": 10, 17 | "239": 10, 18 | "177": 10, 19 | "230": 10, 20 | "91": 10, 21 | "48": 10, 22 | "5": 10, 23 | "34": 10, 24 | "84": 10, 25 | "44": 10, 26 | "104": 10, 27 | "121": 10, 28 | "25": 10, 29 | "60": 10, 30 | "61": 10, 31 | "109": 10, 32 | "172": 10, 33 | "1": 10, 34 | "30": 10, 35 | "220": 10, 36 | "192": 10, 37 | "31": 10, 38 | "225": 10, 39 | "72": 10, 40 | "210": 10, 41 | "78": 10, 42 | "163": 10, 43 | "28": 10, 44 | "205": 10, 45 | "218": 10, 46 | "62": 10, 47 | "185": 10, 48 | "13": 10, 49 | "204": 10, 50 | "7": 10, 51 | "75": 10, 52 | "92": 10, 53 | "16": 10, 54 | "238": 10, 55 | "125": 10, 56 | "101": 10, 57 | "203": 10, 58 | "200": 10, 59 | "38": 10, 60 | "59": 10, 61 | "236": 10, 62 | "168": 10, 63 | "178": 10, 64 | "107": 10, 65 | "27": 10, 66 | "56": 10, 67 | "102": 10, 68 | "99": 10, 69 | "57": 10, 70 | "169": 10, 71 | "65": 10, 72 | "235": 10, 73 | "100": 10, 74 | "112": 10, 75 | "222": 10, 76 | "95": 10, 77 | "29": 10, 78 | "124": 10, 79 | "221": 10, 80 | "226": 10, 81 | "81": 10, 82 | "217": 10, 83 | "53": 10, 84 | "240": 10, 85 | "223": 10, 86 | "166": 10, 87 | "19": 10, 88 | "58": 10, 89 | "33": 10, 90 | "106": 10, 91 | "49": 10, 92 | "105": 10, 93 | "184": 10, 94 | "173": 10, 95 | "51": 10, 96 | "45": 10, 97 | "211": 10, 98 | "130": 10, 99 | "157": 10, 100 | "42": 10, 101 | "66": 10, 102 | "227": 10, 103 | "213": 10, 104 | "128": 10, 105 | "4": 10, 106 | "208": 10, 107 | "108": 10, 108 | "127": 10, 109 | "83": 10, 110 | "228": 10, 111 | "162": 10, 112 | "181": 10, 113 | "123": 10, 114 | "6": 10, 115 | "32": 10, 116 | "188": 10, 117 | "160": 10, 118 | "23": 10, 119 | "216": 10, 120 | "111": 10, 121 | "68": 10, 122 | "233": 10, 123 | "110": 10, 124 | "191": 10, 125 | "159": 10, 126 | "67": 10, 127 | "73": 10, 128 | "120": 10, 129 | "12": 10, 130 | "126": 10, 131 | "132": 10, 132 | "186": 10, 133 | "131": 10, 134 | "52": 10, 135 | "206": 10, 136 | "26": 10, 137 | "241": 10, 138 | "8": 10, 139 | "167": 10, 140 | "207": 10, 141 | "82": 10, 142 | "46": 10, 143 | "50": 10, 144 | "176": 10, 145 | "37": 10, 146 | "190": 10, 147 | "174": 10, 148 | "171": 10, 149 | "90": 10, 150 | "71": 10, 151 | "96": 10, 152 | "187": 10, 153 | "234": 10, 154 | "133": 10, 155 | "183": 10, 156 | "86": 10, 157 | "24": 10, 158 | "63": 10, 159 | "212": 10, 160 | "35": 10, 161 | "43": 10, 162 | "232": 10, 163 | "39": 10, 164 | "135": 10, 165 | "69": 10, 166 | "55": 10, 167 | "229": 10, 168 | "129": 10, 169 | "3": 10, 170 | "2": 10, 171 | "158": 10, 172 | "156": 10, 173 | "134": 10, 174 | "20": 10, 175 | "85": 10, 176 | "74": 10, 177 | "9": 10, 178 | "175": 10, 179 | "189": 10, 180 | "93": 10, 181 | "97": 10, 182 | "88": 10, 183 | "76": 10, 184 | "41": 10, 185 | "182": 10, 186 | "237": 10, 187 | "122": 10, 188 | "15": 10, 189 | "201": 10, 190 | "64": 10, 191 | "164": 10, 192 | "89": 10, 193 | "36": 10, 194 | "40": 10, 195 | "103": 10, 196 | "87": 10, 197 | "180": 10, 198 | "21": 10, 199 | "224": 10, 200 | "179": 10, 201 | "10": 10, 202 | "17": 10, 203 | "231": 10, 204 | "202": 10, 205 | "54": 10 206 | } 207 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Lynx 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RBSE - DISCONTINUED 2 | Club Penguin Server Emulator - AS2 Protocol 3 | 4 |
5 | Screenshots 6 | 7 | ![Console](https://s28.postimg.org/ajbfini1p/Screenshot_from_2017-05-18_12_23_24.png) 8 | ![Buddy_Online](https://s17.postimg.org/za24gnon3/Screenshot_from_2017-05-15_03_50_12.png) 9 | ![Buddy_Accept](https://s17.postimg.org/5w6e12lxb/Screenshot_from_2017-05-15_03_49_40.png) 10 | ![Postcards](https://s12.postimg.org/ibs3lkwb1/Screenshot_from_2017-05-15_15_05_53.png) 11 | ![Igloos](https://s12.postimg.org/dom1jt8y5/Screenshot_from_2017-05-15_15_06_17.png) 12 | ![Stampbook](https://s27.postimg.org/7nev46o5v/Screenshot_from_2017-05-15_15_21_07.png) 13 | ![ConnectFour](https://s14.postimg.org/62gjrhmxd/Screenshot_from_2017-06-04_17_57_00.png) 14 | ![Mancala](https://s17.postimg.org/ij1qx3ljz/Screenshot_from_2017-06-05_00_02_52.png) 15 | ![TreasureHunt](https://s4.postimg.org/gbkughcvh/Screenshot_from_2017-06-20_12_55_45.png) 16 | 17 |
18 | 19 |
20 | Requirements 21 | 31 |
32 | 33 |
34 | Gems List 35 |

Kindly note that most of these gems come installed by default

36 | 56 |
57 | 58 | 59 |
60 | Default Users 61 | Username: Lynx
62 | Password: passwordtest 63 |

64 | Username: Test
65 | Password: passwordtest 66 |
67 | -------------------------------------------------------------------------------- /Register/AddFuncs.php: -------------------------------------------------------------------------------- 1 | $strMessage, 'status' => ($blnKill ? true : false))); 11 | } 12 | 13 | public function encryptedPassword($strPassword) { 14 | $strSHA256 = hash('sha256', $strPassword); 15 | $strBcrypt = password_hash($strSHA256, PASSWORD_BCRYPT, array('cost' => 12, 'salt' => bin2hex(openssl_random_pseudo_bytes(12)))); 16 | return $strBcrypt; 17 | } 18 | 19 | public function generateRandUUID() { 20 | $data = openssl_random_pseudo_bytes(16); 21 | assert(strlen($data) == 16); 22 | $data[6] = chr(ord($data[6]) & 0x0f | 0x40); 23 | $data[8] = chr(ord($data[8]) & 0x3f | 0x80); 24 | return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); 25 | } 26 | 27 | public function getRecaptchaResponse($arrDetails) { 28 | $resCURL = curl_init(); 29 | curl_setopt($resCURL, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify"); 30 | curl_setopt($resCURL, CURLOPT_HEADER, 0); 31 | curl_setopt($resCURL, CURLOPT_RETURNTRANSFER, 1); 32 | curl_setopt($resCURL, CURLOPT_POST, 1); 33 | curl_setopt($resCURL, CURLOPT_POSTFIELDS, $arrDetails); 34 | $arrResp = json_decode(curl_exec($resCURL)); 35 | curl_close($resCURL); 36 | return $arrResp; 37 | } 38 | 39 | } 40 | 41 | ?> 42 | -------------------------------------------------------------------------------- /Register/MySQL.php: -------------------------------------------------------------------------------- 1 | config = $arrDatabaseConfig; 7 | $this->connection = new mysqli($arrDatabaseConfig['host'], $arrDatabaseConfig['username'], $arrDatabaseConfig['password'], $arrDatabaseConfig['database']); 8 | } 9 | 10 | public function checkUsernameExists($strUsername) { 11 | $resStmt = $this->connection->prepare("SELECT username FROM users WHERE username = ?"); 12 | $resStmt->bind_param('s', $strUsername); 13 | $resStmt->execute(); 14 | $resStmt->bind_result($existingUsername); 15 | $resStmt->fetch(); 16 | $resStmt->close(); 17 | if (strtoupper($strUsername) == strtoupper($existingUsername)) { 18 | return true; 19 | } 20 | else { 21 | return false; 22 | } 23 | } 24 | 25 | public function registerPenguin($strUsername, $strPassword, $strUUID) { 26 | $strClothing = json_encode(array( 27 | "color" => 1, 28 | "head" => 0, 29 | "face" => 0, 30 | "neck" => 0, 31 | "body" => 0, 32 | "hands" => 0, 33 | "feet" => 0, 34 | "flag" => 0, 35 | "photo" => 0 36 | )); 37 | $strRanking = json_encode(array( 38 | "isStaff" => 0, 39 | "isMed" => 0, 40 | "isMod" => 0, 41 | "isAdmin" => 0, 42 | "rank" => 1 43 | )); 44 | $strModeration = json_encode(array( 45 | "isBanned" => 0, 46 | "isMuted" => 0 47 | )); 48 | $strBasicStamps = join('|', array( 49 | 201, 50 | 200, 51 | 199, 52 | 198, 53 | 197, 54 | 14 55 | )); 56 | $strInventory = join('|', array( 57 | 221, 58 | 10123, 59 | 16009, 60 | 7004, 61 | 193 62 | )); 63 | 64 | $resStmt = $this->connection->prepare("INSERT INTO " . $this->config['tables'][1] . " (username, nickname, password, uuid, clothing, ranking, moderation, inventory) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); 65 | $resStmt->bind_param('ssssssss', $strUsername, $strUsername, $strPassword, $strUUID, $strClothing, $strRanking, $strModeration, $strInventory); 66 | $resStmt->execute(); 67 | $resStmt->close(); 68 | 69 | $intPengID = $resStmt->insert_id; 70 | 71 | $resStmtTwo = $this->connection->prepare("INSERT INTO " . $this->config['tables'][2] . " (ID) VALUES (?)"); 72 | $resStmtTwo->bind_param('i', $intPengID); 73 | $resStmtTwo->execute(); 74 | $resStmtTwo->close(); 75 | 76 | $resStmtThree = $this->connection->prepare("INSERT INTO " . $this->config['tables'][3] . " (recepient, mailerName, mailerID, timestamp, postcardType) VALUES (?, ?, ?, ?, ?)"); 77 | $mailerName = 'sys'; 78 | $mailerID = 0; 79 | $timeStamp = time(); 80 | $postcardID = 125; 81 | $resStmtThree->bind_param('isiii', $intPengID, $mailerName, $mailerID, $timeStamp, $postcardID); 82 | $resStmtThree->execute(); 83 | $resStmtThree->close(); 84 | 85 | $resStmtFour = $this->connection->prepare("INSERT INTO " . $this->config['tables'][4] . " (ID, stamps, restamps) VALUES (?, ?, ?)"); 86 | $resStmtFour->bind_param('iss', $intPengID, $strBasicStamps, $strBasicStamps); 87 | $resStmtFour->execute(); 88 | $resStmtFour->close(); 89 | 90 | $resStmtFive = $this->connection->prepare("INSERT INTO " . $this->config['tables'][5] . " (ID) VALUES (?)"); 91 | $resStmtFive->bind_param('i', $intPengID); 92 | $resStmtFive->execute(); 93 | $resStmtFive->close(); 94 | 95 | } 96 | 97 | } 98 | 99 | ?> 100 | -------------------------------------------------------------------------------- /Register/PasswordStrength.php: -------------------------------------------------------------------------------- 1 | classifyScore($this->calculate($pw)); 29 | } 30 | 31 | /** 32 | * Calculate score for a password 33 | * 34 | * @param string $pw the password to work on 35 | * @return int score 36 | */ 37 | public function calculate($pw) { 38 | $length = strlen($pw); 39 | $score = $length * 4; 40 | $nUpper = 0; 41 | $nLower = 0; 42 | $nNum = 0; 43 | $nSymbol = 0; 44 | $locUpper = array(); 45 | $locLower = array(); 46 | $locNum = array(); 47 | $locSymbol = array(); 48 | $charDict = array(); 49 | 50 | // count character classes 51 | for ($i = 0; $i < $length; ++$i) { 52 | $ch = $pw[$i]; 53 | $code = ord($ch); 54 | 55 | /* [0-9] */ if ($code >= 48 && $code <= 57) { $nNum++; $locNum[] = $i; } 56 | /* [A-Z] */ elseif ($code >= 65 && $code <= 90) { $nUpper++; $locUpper[] = $i; } 57 | /* [a-z] */ elseif ($code >= 97 && $code <= 122) { $nLower++; $locLower[] = $i; } 58 | /* . */ else { $nSymbol++; $locSymbol[] = $i; } 59 | 60 | if (!isset($charDict[$ch])) { 61 | $charDict[$ch] = 1; 62 | } 63 | else { 64 | $charDict[$ch]++; 65 | } 66 | } 67 | 68 | // reward upper/lower characters if pw is not made up of only either one 69 | if ($nUpper !== $length && $nLower !== $length) { 70 | if ($nUpper !== 0) { 71 | $score += ($length - $nUpper) * 2; 72 | } 73 | 74 | if ($nLower !== 0) { 75 | $score += ($length - $nLower) * 2; 76 | } 77 | } 78 | 79 | // reward numbers if pw is not made up of only numbers 80 | if ($nNum !== $length) { 81 | $score += $nNum * 4; 82 | } 83 | 84 | // reward symbols 85 | $score += $nSymbol * 6; 86 | 87 | // middle number or symbol 88 | foreach (array($locNum, $locSymbol) as $list) { 89 | $reward = 0; 90 | 91 | foreach ($list as $i) { 92 | $reward += ($i !== 0 && $i !== $length -1) ? 1 : 0; 93 | } 94 | 95 | $score += $reward * 2; 96 | } 97 | 98 | // chars only 99 | if ($nUpper + $nLower === $length) { 100 | $score -= $length; 101 | } 102 | 103 | // numbers only 104 | if ($nNum === $length) { 105 | $score -= $length; 106 | } 107 | 108 | // repeating chars 109 | $repeats = 0; 110 | 111 | foreach ($charDict as $count) { 112 | if ($count > 1) { 113 | $repeats += $count - 1; 114 | } 115 | } 116 | 117 | if ($repeats > 0) { 118 | $score -= (int) (floor($repeats / ($length-$repeats)) + 1); 119 | } 120 | 121 | if ($length > 2) { 122 | // consecutive letters and numbers 123 | foreach (array('/[a-z]{2,}/', '/[A-Z]{2,}/', '/[0-9]{2,}/') as $re) { 124 | preg_match_all($re, $pw, $matches, PREG_SET_ORDER); 125 | 126 | if (!empty($matches)) { 127 | foreach ($matches as $match) { 128 | $score -= (strlen($match[0]) - 1) * 2; 129 | } 130 | } 131 | } 132 | 133 | // sequential letters 134 | $locLetters = array_merge($locUpper, $locLower); 135 | sort($locLetters); 136 | 137 | foreach ($this->findSequence($locLetters, mb_strtolower($pw)) as $seq) { 138 | if (count($seq) > 2) { 139 | $score -= (count($seq) - 2) * 2; 140 | } 141 | } 142 | 143 | // sequential numbers 144 | foreach ($this->findSequence($locNum, mb_strtolower($pw)) as $seq) { 145 | if (count($seq) > 2) { 146 | $score -= (count($seq) - 2) * 2; 147 | } 148 | } 149 | } 150 | 151 | return $score; 152 | } 153 | 154 | /** 155 | * Find all sequential chars in string $src 156 | * 157 | * Only chars in $charLocs are considered. $charLocs is a list of numbers. 158 | * For example if $charLocs is [0,2,3], then only $src[2:3] is a possible 159 | * substring with sequential chars. 160 | * 161 | * @param array $charLocs 162 | * @param string $src 163 | * @return array [[c,c,c,c], [a,a,a], ...] 164 | */ 165 | private function findSequence($charLocs, $src) { 166 | $sequences = array(); 167 | $sequence = array(); 168 | 169 | for ($i = 0; $i < count($charLocs)-1; ++$i) { 170 | $here = $charLocs[$i]; 171 | $next = $charLocs[$i+1]; 172 | $charHere = $src[$charLocs[$i]]; 173 | $charNext = $src[$charLocs[$i+1]]; 174 | $distance = $next - $here; 175 | $charDistance = ord($charNext) - ord($charHere); 176 | 177 | if ($distance === 1 && $charDistance === 1) { 178 | // We find a pair of sequential chars! 179 | if (empty($sequence)) { 180 | $sequence = array($charHere, $charNext); 181 | } 182 | else { 183 | $sequence[] = $charNext; 184 | } 185 | } 186 | elseif (!empty($sequence)) { 187 | $sequences[] = $sequence; 188 | $sequence = array(); 189 | } 190 | } 191 | 192 | if (!empty($sequence)) { 193 | $sequences[] = $sequence; 194 | } 195 | 196 | return $sequences; 197 | } 198 | } 199 | 200 | -------------------------------------------------------------------------------- /Register/README.md: -------------------------------------------------------------------------------- 1 | ![Register](https://s14.postimg.org/ah6cl5hg1/Screenshot_from_2017-05-30_05_48_54.png) 2 | -------------------------------------------------------------------------------- /Register/config.php: -------------------------------------------------------------------------------- 1 | '6LcelR8TAAAAAAQ8wBgZSlrcd4hNI2sQ2FrUhQRl', 5 | 'database' => 'purecp', 6 | 'username' => 'root', 7 | 'password' => '1337h4x0r', 8 | 'host' => '127.0.0.1', #This always remains localhost 9 | 'tables' => array( 10 | 1 => 'users', 11 | 2 => 'igloos', 12 | 3 => 'postcards', 13 | 4 => 'stamps', 14 | 5 => 'epf' 15 | ) 16 | ); 17 | 18 | ?> 19 | -------------------------------------------------------------------------------- /Register/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | RBSE :: Register 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |

Create

15 |
16 | 17 | 18 |

19 | 20 |
21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /Register/register.js: -------------------------------------------------------------------------------- 1 | function createAccount() { 2 | var username = $("#username").val(); 3 | var password = $("#password").val(); 4 | var captcha_response = grecaptcha.getResponse(); 5 | var dataString = {"username": username, "password": password, "g-recaptcha-response": captcha_response}; 6 | $.ajax({ 7 | type: "POST", 8 | url: "http://127.0.0.1/register/register.php", 9 | data: dataString, 10 | dataType: 'text', 11 | success: function(returnedData) { 12 | console.log(returnedData); 13 | var data = $.parseJSON(returnedData); 14 | if (data.status == true) { 15 | swal("Atta boi!", data.message, "success") 16 | } else { 17 | sweetAlert("Yikes..", data.message, "error"); 18 | } 19 | } 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /Register/register.php: -------------------------------------------------------------------------------- 1 | sanitizeData(filter_input(INPUT_POST, 'username')); 13 | $strPassword = $resFuncs->sanitizeData(filter_input(INPUT_POST, 'password')); 14 | $strGCaptcha = $resFuncs->sanitizeData(filter_input(INPUT_POST, 'g-recaptcha-response')); 15 | 16 | $strIP = $_SERVER['REMOTE_ADDR']; 17 | 18 | if (!isset($strUsername) || !isset($strPassword) || !isset($strGCaptcha)) { 19 | $resFuncs->sendMessage('Kindly fill in all the fields'); 20 | exit(); 21 | } 22 | if (strlen($strUsername) < 4 || strlen($strUsername) > 10) { 23 | $resFuncs->sendMessage('Username is either too short or too long'); 24 | exit(); 25 | } 26 | if (!ctype_alnum($strUsername)) { 27 | $resFuncs->sendMessage('Username should be alphanumeric'); 28 | exit(); 29 | } 30 | $isExistsUsername = $resMySQL->checkUsernameExists($strUsername); 31 | if ($isExistsUsername != false) { 32 | $resFuncs->sendMessage('Username already exists'); 33 | exit(); 34 | } 35 | 36 | if (strlen($strPassword) < 5 || strlen($strPassword) > 20) { 37 | $resFuncs->sendMessage('Password is either too short or too long'); 38 | exit(); 39 | } 40 | 41 | $strPasswordStrength = $resPWDChecker->classify($strPassword); 42 | 43 | if ($strPasswordStrength == 0) { 44 | $resFuncs->sendMessage('Password is extremely weak'); 45 | exit(); 46 | } 47 | if ($strPasswordStrength == 1) { 48 | $resFuncs->sendMessage('Password is weak asf bruh'); 49 | exit(); 50 | } 51 | 52 | $arrResponse = $resFuncs->getRecaptchaResponse(array('secret' => $arrConfig['secret_key'], 'response' => $strGCaptcha, 'remoteip' => $strIP)); 53 | 54 | if (!$arrResponse->success) { 55 | $resFuncs->sendMessage('Stop tryna hack nigguh'); 56 | exit(); 57 | } 58 | 59 | 60 | if ($strPasswordStrength >= 2) { 61 | $encryptedPassword = $resFuncs->encryptedPassword($strPassword); 62 | $strUUID = $resFuncs->generateRandUUID(); 63 | $resMySQL->registerPenguin($strUsername, $encryptedPassword, $strUUID); 64 | $resFuncs->sendMessage("Thanks for signing up with RBSE, {$strUsername} your UUID is {$strUUID}", 1); 65 | } 66 | 67 | ?> 68 | -------------------------------------------------------------------------------- /Register/style.css: -------------------------------------------------------------------------------- 1 | * { /* credits to https://codepen.io/ianpirro */ 2 | box-sizing: border-box; 3 | margin: 0; 4 | padding: 0; 5 | } 6 | 7 | html { 8 | background: #95a5a6; 9 | background-image: url(http://cdn.wallpapersafari.com/95/42/gXDSk5.jpg); 10 | -webkit-background-size: cover; 11 | -moz-background-size: cover; 12 | -o-background-size: cover; 13 | background-size: cover; 14 | font-family: 'Helvetica Neue', Arial, Sans-Serif; 15 | } 16 | html .login-wrap { 17 | position: absolute; 18 | margin: 150 auto; 19 | background: #ecf0f1; 20 | width: 350px; 21 | border-radius: 5px; 22 | box-shadow: 3px 3px 10px #333; 23 | padding: 15px; 24 | margin: -100px 0 0 -200px; 25 | top: 35%; 26 | left: 50%; 27 | } 28 | html .login-wrap h2 { 29 | text-align: center; 30 | font-weight: 200; 31 | font-size: 2em; 32 | margin-top:20px; 33 | color: #34495e; 34 | } 35 | html .login-wrap .form { 36 | padding-top: 20px; 37 | } 38 | html .login-wrap .form input[type="text"], 39 | html .login-wrap .form input[type="password"], 40 | html .login-wrap .form input[type="button"] { 41 | width: 80%; 42 | margin-left: 10%; 43 | margin-bottom: 25px; 44 | height: 40px; 45 | border-radius: 5px; 46 | outline: 0; 47 | -moz-outline-style: none; 48 | } 49 | html .login-wrap .form input[type="text"], 50 | html .login-wrap .form input[type="password"] { 51 | border: 1px solid #bbb; 52 | padding: 0 0 0 10px; 53 | font-size: 14px; 54 | } 55 | html .login-wrap .form input[type="text"]:focus, 56 | html .login-wrap .form input[type="password"]:focus { 57 | border: 1px solid #3498db; 58 | } 59 | html .login-wrap .form a { 60 | text-align: center; 61 | font-size: 10px; 62 | color: #3498db; 63 | } 64 | html .login-wrap .form a p { 65 | padding-bottom: 10px; 66 | } 67 | html .login-wrap .form input[type="button"] { 68 | background: #e74c3c; 69 | border: none; 70 | color: white; 71 | font-size: 18px; 72 | font-weight: 200; 73 | cursor: pointer; 74 | transition: box-shadow .4s ease; 75 | } 76 | html .login-wrap .form input[type="button"]:hover { 77 | box-shadow: 1px 1px 5px #555; 78 | } 79 | html .login-wrap .form input[type="button"]:active { 80 | box-shadow: 1px 1px 7px #222; 81 | } 82 | html .login-wrap:after { 83 | content: ''; 84 | position: absolute; 85 | top: 0; 86 | left: 0; 87 | right: 0; 88 | background: -webkit-linear-gradient(left, #27ae60 0%, #27ae60 20%, #8e44ad 20%, #8e44ad 40%, #3498db 40%, #3498db 60%, #e74c3c 60%, #e74c3c 80%, #f1c40f 80%, #f1c40f 100%); 89 | background: -moz-linear-gradient(left, #27ae60 0%, #27ae60 20%, #8e44ad 20%, #8e44ad 40%, #3498db 40%, #3498db 60%, #e74c3c 60%, #e74c3c 80%, #f1c40f 80%, #f1c40f 100%); 90 | height: 5px; 91 | border-radius: 5px 5px 0 0; 92 | } 93 | -------------------------------------------------------------------------------- /Register/sweetalert/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Tristan Edwards 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Register/sweetalert/README.md: -------------------------------------------------------------------------------- 1 | SweetAlert [![Build Status](https://travis-ci.org/t4t5/sweetalert.svg?branch=master)](https://travis-ci.org/t4t5/sweetalert) 2 | ========== 3 | 4 | An awesome replacement for JavaScript's alert. 5 | 6 | ![A success modal](https://raw.github.com/t4t5/sweetalert/master/sweetalert.gif) 7 | 8 | [See it in action!](http://t4t5.github.io/sweetalert) 9 | 10 | [Learn how to use it!](https://www.ludu.co/lesson/how-to-use-sweetalert) 11 | 12 | 13 | Usage 14 | ----- 15 | 16 | You can install SweetAlert through bower: 17 | 18 | ```bash 19 | bower install sweetalert 20 | ``` 21 | 22 | Or through npm: 23 | 24 | ```bash 25 | npm install sweetalert 26 | ``` 27 | 28 | Alternatively, download the package and reference the JavaScript and CSS files manually: 29 | 30 | ```html 31 | 32 | 33 | ``` 34 | **Note:** If you're using an older version than v1.0.0, the files are `lib/sweet-alert.min.js` and `lib/sweet-alert.css` 35 | 36 | 37 | Tutorial 38 | -------- 39 | 40 | The easiest way to get started is follow the [SweetAlert tutorial on Ludu](https://www.ludu.co/lesson/how-to-use-sweetalert)! 41 | 42 | 43 | Examples 44 | -------- 45 | 46 | The most basic message: 47 | 48 | ```javascript 49 | swal("Hello world!"); 50 | ``` 51 | 52 | A message signaling an error: 53 | 54 | ```javascript 55 | swal("Oops...", "Something went wrong!", "error"); 56 | ``` 57 | 58 | A warning message, with a function attached to the "Confirm"-button: 59 | 60 | ```javascript 61 | swal({ 62 | title: "Are you sure?", 63 | text: "You will not be able to recover this imaginary file!", 64 | type: "warning", 65 | showCancelButton: true, 66 | confirmButtonColor: "#DD6B55", 67 | confirmButtonText: "Yes, delete it!", 68 | closeOnConfirm: false, 69 | html: false 70 | }, function(){ 71 | swal("Deleted!", 72 | "Your imaginary file has been deleted.", 73 | "success"); 74 | }); 75 | ``` 76 | 77 | A prompt modal where the user's input is logged: 78 | 79 | ```javascript 80 | swal({ 81 | title: "An input!", 82 | text: 'Write something interesting:', 83 | type: 'input', 84 | showCancelButton: true, 85 | closeOnConfirm: false, 86 | animation: "slide-from-top" 87 | }, function(inputValue){ 88 | console.log("You wrote", inputValue); 89 | }); 90 | ``` 91 | 92 | Ajax request example: 93 | 94 | ```javascript 95 | swal({ 96 | title: 'Ajax request example', 97 | text: 'Submit to run ajax request', 98 | type: 'info', 99 | showCancelButton: true, 100 | closeOnConfirm: false, 101 | disableButtonsOnConfirm: true, 102 | confirmLoadingButtonColor: '#DD6B55' 103 | }, function(inputValue){ 104 | setTimeout(function() { 105 | swal('Ajax request finished!'); 106 | }, 2000); 107 | }); 108 | ``` 109 | 110 | [View more examples](http://t4t5.github.io/sweetalert) 111 | 112 | 113 | Themes 114 | ------ 115 | 116 | SweetAlert can easily be themed to fit your site's design. SweetAlert comes with three example themes that you can try out: **facebook**, **twitter** and **google**. They can be referenced right after the intial sweetalert-CSS: 117 | ```html 118 | 119 | 120 | ``` 121 | 122 | 123 | Browser compatibility 124 | --------------------- 125 | 126 | SweetAlert works in most major browsers (yes, even IE). Some details: 127 | 128 | - **IE8**: (Dropped since v1.0.0-beta) 129 | - **IE9**: Works, but icons are not animated. 130 | - **IE10+**: Works! 131 | - **Safari 4+**: Works! 132 | - **Firefox 3+**: Works! 133 | - **Chrome 14+**: Works! 134 | - **Opera 15+**: Works! 135 | 136 | 137 | Contributing 138 | ------------ 139 | 140 | If you want to contribute: 141 | 142 | - Fork the repo 143 | 144 | - Make sure you have [Node](http://nodejs.org/), [NPM](https://www.npmjs.com/) and [Gulp](http://gulpjs.com/) installed. When in the SweetAlert directory, run `npm install` to install the dependencies. Then run `gulp` while working to automatically minify the SCSS and JS-files. 145 | 146 | - Keep in mind that SweetAlert uses Browserify in order to compile ES6-files. For easy debugging, make sure you reference the file `dist/sweetalert-dev.js` instead of `sweetalert.js`. 147 | 148 | - After you're done, make a pull request and wait for approval! :) 149 | 150 | 151 | Related projects 152 | ---------------- 153 | 154 | * [SweetAlert for Android](https://github.com/pedant/sweet-alert-dialog) 155 | * [SweetAlert for Bootstrap](https://github.com/lipis/bootstrap-sweetalert) 156 | * [SweetAlert for AngularJS](https://github.com/oitozero/ngSweetAlert) 157 | * [SweetAlert for RubyOnRails](https://github.com/sharshenov/sweetalert-rails) 158 | -------------------------------------------------------------------------------- /Register/sweetalert/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sweetalert", 3 | "homepage": "http://tristanedwards.me/sweetalert", 4 | "authors": [ 5 | "Tristan Edwards (http://tristanedwards.me)" 6 | ], 7 | "description": "A beautiful replacement for JavaScript's alert.", 8 | "main": [ 9 | "dist/sweetalert.min.js", 10 | "dist/sweetalert.css" 11 | ], 12 | "keywords": [ 13 | "alert", 14 | "modal" 15 | ], 16 | "repository": { 17 | "type": "git", 18 | "url": "git@github.com:t4t5/sweetalert.git" 19 | }, 20 | "license": "MIT", 21 | "devDependencies": { 22 | "qunit": "~1.18.0", 23 | "jquery": "~2.1.4" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Register/sweetalert/dev/gulpfile-wrap-template.js: -------------------------------------------------------------------------------- 1 | ;(function(window, document, undefined) { 2 | "use strict"; 3 | 4 | <%= contents %> 5 | 6 | /* 7 | * Use SweetAlert with RequireJS 8 | */ 9 | 10 | if (typeof define === 'function' && define.amd) { 11 | define(function () { 12 | return sweetAlert; 13 | }); 14 | } else if (typeof module !== 'undefined' && module.exports) { 15 | module.exports = sweetAlert; 16 | } 17 | 18 | })(window, document); -------------------------------------------------------------------------------- /Register/sweetalert/dev/ie9.css: -------------------------------------------------------------------------------- 1 | /* Internet Explorer 9 has some special quirks that are fixed here */ 2 | /* The icons are not animated. */ 3 | /* This file is automatically merged into sweet-alert.min.js through Gulp */ 4 | 5 | /* Error icon */ 6 | .sweet-alert .sa-icon.sa-error .sa-line.sa-left { 7 | -ms-transform: rotate(45deg)\9; 8 | } 9 | .sweet-alert .sa-icon.sa-error .sa-line.sa-right { 10 | -ms-transform: rotate(-45deg)\9; 11 | } 12 | 13 | 14 | /* Success icon */ 15 | .sweet-alert .sa-icon.sa-success { 16 | border-color: transparent\9; 17 | } 18 | .sweet-alert .sa-icon.sa-success .sa-line.sa-tip { 19 | -ms-transform: rotate(45deg)\9; 20 | } 21 | .sweet-alert .sa-icon.sa-success .sa-line.sa-long { 22 | -ms-transform: rotate(-45deg)\9; 23 | } -------------------------------------------------------------------------------- /Register/sweetalert/dev/loader-animation.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Load Awesome v1.1.0 (http://github.danielcardoso.net/load-awesome/) 3 | * Copyright 2015 Daniel Cardoso <@DanielCardoso> 4 | * Licensed under MIT 5 | */ 6 | .la-ball-fall, 7 | .la-ball-fall > div { 8 | position: relative; 9 | -webkit-box-sizing: border-box; 10 | -moz-box-sizing: border-box; 11 | box-sizing: border-box; 12 | } 13 | .la-ball-fall { 14 | display: block; 15 | font-size: 0; 16 | color: #fff; 17 | } 18 | .la-ball-fall.la-dark { 19 | color: #333; 20 | } 21 | .la-ball-fall > div { 22 | display: inline-block; 23 | float: none; 24 | background-color: currentColor; 25 | border: 0 solid currentColor; 26 | } 27 | .la-ball-fall { 28 | width: 54px; 29 | height: 18px; 30 | } 31 | .la-ball-fall > div { 32 | width: 10px; 33 | height: 10px; 34 | margin: 4px; 35 | border-radius: 100%; 36 | opacity: 0; 37 | -webkit-animation: ball-fall 1s ease-in-out infinite; 38 | -moz-animation: ball-fall 1s ease-in-out infinite; 39 | -o-animation: ball-fall 1s ease-in-out infinite; 40 | animation: ball-fall 1s ease-in-out infinite; 41 | } 42 | .la-ball-fall > div:nth-child(1) { 43 | -webkit-animation-delay: -200ms; 44 | -moz-animation-delay: -200ms; 45 | -o-animation-delay: -200ms; 46 | animation-delay: -200ms; 47 | } 48 | .la-ball-fall > div:nth-child(2) { 49 | -webkit-animation-delay: -100ms; 50 | -moz-animation-delay: -100ms; 51 | -o-animation-delay: -100ms; 52 | animation-delay: -100ms; 53 | } 54 | .la-ball-fall > div:nth-child(3) { 55 | -webkit-animation-delay: 0ms; 56 | -moz-animation-delay: 0ms; 57 | -o-animation-delay: 0ms; 58 | animation-delay: 0ms; 59 | } 60 | .la-ball-fall.la-sm { 61 | width: 26px; 62 | height: 8px; 63 | } 64 | .la-ball-fall.la-sm > div { 65 | width: 4px; 66 | height: 4px; 67 | margin: 2px; 68 | } 69 | .la-ball-fall.la-2x { 70 | width: 108px; 71 | height: 36px; 72 | } 73 | .la-ball-fall.la-2x > div { 74 | width: 20px; 75 | height: 20px; 76 | margin: 8px; 77 | } 78 | .la-ball-fall.la-3x { 79 | width: 162px; 80 | height: 54px; 81 | } 82 | .la-ball-fall.la-3x > div { 83 | width: 30px; 84 | height: 30px; 85 | margin: 12px; 86 | } 87 | /* 88 | * Animation 89 | */ 90 | @-webkit-keyframes ball-fall { 91 | 0% { 92 | opacity: 0; 93 | -webkit-transform: translateY(-145%); 94 | transform: translateY(-145%); 95 | } 96 | 10% { 97 | opacity: .5; 98 | } 99 | 20% { 100 | opacity: 1; 101 | -webkit-transform: translateY(0); 102 | transform: translateY(0); 103 | } 104 | 80% { 105 | opacity: 1; 106 | -webkit-transform: translateY(0); 107 | transform: translateY(0); 108 | } 109 | 90% { 110 | opacity: .5; 111 | } 112 | 100% { 113 | opacity: 0; 114 | -webkit-transform: translateY(145%); 115 | transform: translateY(145%); 116 | } 117 | } 118 | @-moz-keyframes ball-fall { 119 | 0% { 120 | opacity: 0; 121 | -moz-transform: translateY(-145%); 122 | transform: translateY(-145%); 123 | } 124 | 10% { 125 | opacity: .5; 126 | } 127 | 20% { 128 | opacity: 1; 129 | -moz-transform: translateY(0); 130 | transform: translateY(0); 131 | } 132 | 80% { 133 | opacity: 1; 134 | -moz-transform: translateY(0); 135 | transform: translateY(0); 136 | } 137 | 90% { 138 | opacity: .5; 139 | } 140 | 100% { 141 | opacity: 0; 142 | -moz-transform: translateY(145%); 143 | transform: translateY(145%); 144 | } 145 | } 146 | @-o-keyframes ball-fall { 147 | 0% { 148 | opacity: 0; 149 | -o-transform: translateY(-145%); 150 | transform: translateY(-145%); 151 | } 152 | 10% { 153 | opacity: .5; 154 | } 155 | 20% { 156 | opacity: 1; 157 | -o-transform: translateY(0); 158 | transform: translateY(0); 159 | } 160 | 80% { 161 | opacity: 1; 162 | -o-transform: translateY(0); 163 | transform: translateY(0); 164 | } 165 | 90% { 166 | opacity: .5; 167 | } 168 | 100% { 169 | opacity: 0; 170 | -o-transform: translateY(145%); 171 | transform: translateY(145%); 172 | } 173 | } 174 | @keyframes ball-fall { 175 | 0% { 176 | opacity: 0; 177 | -webkit-transform: translateY(-145%); 178 | -moz-transform: translateY(-145%); 179 | -o-transform: translateY(-145%); 180 | transform: translateY(-145%); 181 | } 182 | 10% { 183 | opacity: .5; 184 | } 185 | 20% { 186 | opacity: 1; 187 | -webkit-transform: translateY(0); 188 | -moz-transform: translateY(0); 189 | -o-transform: translateY(0); 190 | transform: translateY(0); 191 | } 192 | 80% { 193 | opacity: 1; 194 | -webkit-transform: translateY(0); 195 | -moz-transform: translateY(0); 196 | -o-transform: translateY(0); 197 | transform: translateY(0); 198 | } 199 | 90% { 200 | opacity: .5; 201 | } 202 | 100% { 203 | opacity: 0; 204 | -webkit-transform: translateY(145%); 205 | -moz-transform: translateY(145%); 206 | -o-transform: translateY(145%); 207 | transform: translateY(145%); 208 | } 209 | } 210 | -------------------------------------------------------------------------------- /Register/sweetalert/dev/modules/default-params.js: -------------------------------------------------------------------------------- 1 | var defaultParams = { 2 | title: '', 3 | text: '', 4 | type: null, 5 | allowOutsideClick: false, 6 | showConfirmButton: true, 7 | showCancelButton: false, 8 | closeOnConfirm: true, 9 | closeOnCancel: true, 10 | confirmButtonText: 'OK', 11 | confirmButtonColor: '#8CD4F5', 12 | cancelButtonText: 'Cancel', 13 | imageUrl: null, 14 | imageSize: null, 15 | timer: null, 16 | customClass: '', 17 | html: false, 18 | animation: true, 19 | allowEscapeKey: true, 20 | inputType: 'text', 21 | inputPlaceholder: '', 22 | inputValue: '', 23 | showLoaderOnConfirm: false 24 | }; 25 | 26 | export default defaultParams; 27 | -------------------------------------------------------------------------------- /Register/sweetalert/dev/modules/handle-click.js: -------------------------------------------------------------------------------- 1 | import { colorLuminance } from './utils'; 2 | import { getModal } from './handle-swal-dom'; 3 | import { hasClass, isDescendant } from './handle-dom'; 4 | 5 | 6 | /* 7 | * User clicked on "Confirm"/"OK" or "Cancel" 8 | */ 9 | var handleButton = function(event, params, modal) { 10 | var e = event || window.event; 11 | var target = e.target || e.srcElement; 12 | 13 | var targetedConfirm = target.className.indexOf('confirm') !== -1; 14 | var targetedOverlay = target.className.indexOf('sweet-overlay') !== -1; 15 | var modalIsVisible = hasClass(modal, 'visible'); 16 | var doneFunctionExists = (params.doneFunction && modal.getAttribute('data-has-done-function') === 'true'); 17 | 18 | // Since the user can change the background-color of the confirm button programmatically, 19 | // we must calculate what the color should be on hover/active 20 | var normalColor, hoverColor, activeColor; 21 | if (targetedConfirm && params.confirmButtonColor) { 22 | normalColor = params.confirmButtonColor; 23 | hoverColor = colorLuminance(normalColor, -0.04); 24 | activeColor = colorLuminance(normalColor, -0.14); 25 | } 26 | 27 | function shouldSetConfirmButtonColor(color) { 28 | if (targetedConfirm && params.confirmButtonColor) { 29 | target.style.backgroundColor = color; 30 | } 31 | } 32 | 33 | switch (e.type) { 34 | case 'mouseover': 35 | shouldSetConfirmButtonColor(hoverColor); 36 | break; 37 | 38 | case 'mouseout': 39 | shouldSetConfirmButtonColor(normalColor); 40 | break; 41 | 42 | case 'mousedown': 43 | shouldSetConfirmButtonColor(activeColor); 44 | break; 45 | 46 | case 'mouseup': 47 | shouldSetConfirmButtonColor(hoverColor); 48 | break; 49 | 50 | case 'focus': 51 | let $confirmButton = modal.querySelector('button.confirm'); 52 | let $cancelButton = modal.querySelector('button.cancel'); 53 | 54 | if (targetedConfirm) { 55 | $cancelButton.style.boxShadow = 'none'; 56 | } else { 57 | $confirmButton.style.boxShadow = 'none'; 58 | } 59 | break; 60 | 61 | case 'click': 62 | let clickedOnModal = (modal === target); 63 | let clickedOnModalChild = isDescendant(modal, target); 64 | 65 | // Ignore click outside if allowOutsideClick is false 66 | if (!clickedOnModal && !clickedOnModalChild && modalIsVisible && !params.allowOutsideClick) { 67 | break; 68 | } 69 | 70 | if (targetedConfirm && doneFunctionExists && modalIsVisible) { 71 | handleConfirm(modal, params); 72 | } else if (doneFunctionExists && modalIsVisible || targetedOverlay) { 73 | handleCancel(modal, params); 74 | } else if (isDescendant(modal, target) && target.tagName === 'BUTTON') { 75 | sweetAlert.close(); 76 | } 77 | break; 78 | } 79 | }; 80 | 81 | /* 82 | * User clicked on "Confirm"/"OK" 83 | */ 84 | var handleConfirm = function(modal, params) { 85 | var callbackValue = true; 86 | 87 | if (hasClass(modal, 'show-input')) { 88 | callbackValue = modal.querySelector('input').value; 89 | 90 | if (!callbackValue) { 91 | callbackValue = ''; 92 | } 93 | } 94 | 95 | params.doneFunction(callbackValue); 96 | 97 | if (params.closeOnConfirm) { 98 | sweetAlert.close(); 99 | } 100 | // Disable cancel and confirm button if the parameter is true 101 | if (params.showLoaderOnConfirm) { 102 | sweetAlert.disableButtons(); 103 | } 104 | }; 105 | 106 | /* 107 | * User clicked on "Cancel" 108 | */ 109 | var handleCancel = function(modal, params) { 110 | // If the length is greater than 0, there is a method. 111 | var hasArgumentsInDoneFunction = params.doneFunction.length; 112 | 113 | if (hasArgumentsInDoneFunction) { 114 | params.doneFunction(false); 115 | } 116 | 117 | if (params.closeOnCancel) { 118 | sweetAlert.close(); 119 | } 120 | }; 121 | 122 | 123 | export { 124 | handleButton, 125 | handleConfirm, 126 | handleCancel 127 | }; 128 | -------------------------------------------------------------------------------- /Register/sweetalert/dev/modules/handle-dom.js: -------------------------------------------------------------------------------- 1 | var hasClass = function(elem, className) { 2 | return new RegExp(' ' + className + ' ').test(' ' + elem.className + ' '); 3 | }; 4 | 5 | var addClass = function(elem, className) { 6 | if (!hasClass(elem, className)) { 7 | elem.className += ' ' + className; 8 | } 9 | }; 10 | 11 | var removeClass = function(elem, className) { 12 | var newClass = ' ' + elem.className.replace(/[\t\r\n]/g, ' ') + ' '; 13 | if (hasClass(elem, className)) { 14 | while (newClass.indexOf(' ' + className + ' ') >= 0) { 15 | newClass = newClass.replace(' ' + className + ' ', ' '); 16 | } 17 | elem.className = newClass.replace(/^\s+|\s+$/g, ''); 18 | } 19 | }; 20 | 21 | var escapeHtml = function(str) { 22 | var div = document.createElement('div'); 23 | div.appendChild(document.createTextNode(str)); 24 | return div.innerHTML; 25 | }; 26 | 27 | var _show = function(elem) { 28 | elem.style.opacity = ''; 29 | elem.style.display = 'block'; 30 | }; 31 | 32 | var show = function(elems) { 33 | if (elems && !elems.length) { 34 | return _show(elems); 35 | } 36 | for (var i = 0; i < elems.length; ++i) { 37 | _show(elems[i]); 38 | } 39 | }; 40 | 41 | var _hide = function(elem) { 42 | elem.style.opacity = ''; 43 | elem.style.display = 'none'; 44 | }; 45 | 46 | var hide = function(elems) { 47 | if (elems && !elems.length) { 48 | return _hide(elems); 49 | } 50 | for (var i = 0; i < elems.length; ++i) { 51 | _hide(elems[i]); 52 | } 53 | }; 54 | 55 | var isDescendant = function(parent, child) { 56 | var node = child.parentNode; 57 | while (node !== null) { 58 | if (node === parent) { 59 | return true; 60 | } 61 | node = node.parentNode; 62 | } 63 | return false; 64 | }; 65 | 66 | var getTopMargin = function(elem) { 67 | elem.style.left = '-9999px'; 68 | elem.style.display = 'block'; 69 | 70 | var height = elem.clientHeight, 71 | padding; 72 | if (typeof getComputedStyle !== "undefined") { // IE 8 73 | padding = parseInt(getComputedStyle(elem).getPropertyValue('padding-top'), 10); 74 | } else { 75 | padding = parseInt(elem.currentStyle.padding); 76 | } 77 | 78 | elem.style.left = ''; 79 | elem.style.display = 'none'; 80 | return ('-' + parseInt((height + padding) / 2) + 'px'); 81 | }; 82 | 83 | var fadeIn = function(elem, interval) { 84 | if (+elem.style.opacity < 1) { 85 | interval = interval || 16; 86 | elem.style.opacity = 0; 87 | elem.style.display = 'block'; 88 | var last = +new Date(); 89 | var tick = function() { 90 | elem.style.opacity = +elem.style.opacity + (new Date() - last) / 100; 91 | last = +new Date(); 92 | 93 | if (+elem.style.opacity < 1) { 94 | setTimeout(tick, interval); 95 | } 96 | }; 97 | tick(); 98 | } 99 | elem.style.display = 'block'; //fallback IE8 100 | }; 101 | 102 | var fadeOut = function(elem, interval) { 103 | interval = interval || 16; 104 | elem.style.opacity = 1; 105 | var last = +new Date(); 106 | var tick = function() { 107 | elem.style.opacity = +elem.style.opacity - (new Date() - last) / 100; 108 | last = +new Date(); 109 | 110 | if (+elem.style.opacity > 0) { 111 | setTimeout(tick, interval); 112 | } else { 113 | elem.style.display = 'none'; 114 | } 115 | }; 116 | tick(); 117 | }; 118 | 119 | var fireClick = function(node) { 120 | // Taken from http://www.nonobtrusive.com/2011/11/29/programatically-fire-crossbrowser-click-event-with-javascript/ 121 | // Then fixed for today's Chrome browser. 122 | if (typeof MouseEvent === 'function') { 123 | // Up-to-date approach 124 | var mevt = new MouseEvent('click', { 125 | view: window, 126 | bubbles: false, 127 | cancelable: true 128 | }); 129 | node.dispatchEvent(mevt); 130 | } else if ( document.createEvent ) { 131 | // Fallback 132 | var evt = document.createEvent('MouseEvents'); 133 | evt.initEvent('click', false, false); 134 | node.dispatchEvent(evt); 135 | } else if (document.createEventObject) { 136 | node.fireEvent('onclick') ; 137 | } else if (typeof node.onclick === 'function' ) { 138 | node.onclick(); 139 | } 140 | }; 141 | 142 | var stopEventPropagation = function(e) { 143 | // In particular, make sure the space bar doesn't scroll the main window. 144 | if (typeof e.stopPropagation === 'function') { 145 | e.stopPropagation(); 146 | e.preventDefault(); 147 | } else if (window.event && window.event.hasOwnProperty('cancelBubble')) { 148 | window.event.cancelBubble = true; 149 | } 150 | }; 151 | 152 | export { 153 | hasClass, addClass, removeClass, 154 | escapeHtml, 155 | _show, show, _hide, hide, 156 | isDescendant, 157 | getTopMargin, 158 | fadeIn, fadeOut, 159 | fireClick, 160 | stopEventPropagation 161 | }; 162 | -------------------------------------------------------------------------------- /Register/sweetalert/dev/modules/handle-key.js: -------------------------------------------------------------------------------- 1 | import { stopEventPropagation, fireClick } from './handle-dom'; 2 | import { setFocusStyle } from './handle-swal-dom'; 3 | 4 | 5 | var handleKeyDown = function(event, params, modal) { 6 | var e = event || window.event; 7 | var keyCode = e.keyCode || e.which; 8 | 9 | var $okButton = modal.querySelector('button.confirm'); 10 | var $cancelButton = modal.querySelector('button.cancel'); 11 | var $modalButtons = modal.querySelectorAll('button[tabindex]'); 12 | 13 | 14 | if ([9, 13, 32, 27].indexOf(keyCode) === -1) { 15 | // Don't do work on keys we don't care about. 16 | return; 17 | } 18 | 19 | var $targetElement = e.target || e.srcElement; 20 | 21 | var btnIndex = -1; // Find the button - note, this is a nodelist, not an array. 22 | for (var i = 0; i < $modalButtons.length; i++) { 23 | if ($targetElement === $modalButtons[i]) { 24 | btnIndex = i; 25 | break; 26 | } 27 | } 28 | 29 | if (keyCode === 9) { 30 | // TAB 31 | if (btnIndex === -1) { 32 | // No button focused. Jump to the confirm button. 33 | $targetElement = $okButton; 34 | } else { 35 | // Cycle to the next button 36 | if (btnIndex === $modalButtons.length - 1) { 37 | $targetElement = $modalButtons[0]; 38 | } else { 39 | $targetElement = $modalButtons[btnIndex + 1]; 40 | } 41 | } 42 | 43 | stopEventPropagation(e); 44 | $targetElement.focus(); 45 | 46 | if (params.confirmButtonColor) { 47 | setFocusStyle($targetElement, params.confirmButtonColor); 48 | } 49 | } else { 50 | if (keyCode === 13) { 51 | if ($targetElement.tagName === 'INPUT') { 52 | $targetElement = $okButton; 53 | $okButton.focus(); 54 | } 55 | 56 | if (btnIndex === -1) { 57 | // ENTER/SPACE clicked outside of a button. 58 | $targetElement = $okButton; 59 | } else { 60 | // Do nothing - let the browser handle it. 61 | $targetElement = undefined; 62 | } 63 | } else if (keyCode === 27 && params.allowEscapeKey === true) { 64 | $targetElement = $cancelButton; 65 | fireClick($targetElement, e); 66 | } else { 67 | // Fallback - let the browser handle it. 68 | $targetElement = undefined; 69 | } 70 | } 71 | }; 72 | 73 | export default handleKeyDown; 74 | -------------------------------------------------------------------------------- /Register/sweetalert/dev/modules/handle-swal-dom.js: -------------------------------------------------------------------------------- 1 | import { hexToRgb } from './utils'; 2 | import { removeClass, getTopMargin, fadeIn, show, addClass } from './handle-dom'; 3 | import defaultParams from './default-params'; 4 | 5 | var modalClass = '.sweet-alert'; 6 | var overlayClass = '.sweet-overlay'; 7 | 8 | /* 9 | * Add modal + overlay to DOM 10 | */ 11 | import injectedHTML from './injected-html'; 12 | 13 | var sweetAlertInitialize = function() { 14 | var sweetWrap = document.createElement('div'); 15 | sweetWrap.innerHTML = injectedHTML; 16 | 17 | // Append elements to body 18 | while (sweetWrap.firstChild) { 19 | document.body.appendChild(sweetWrap.firstChild); 20 | } 21 | }; 22 | 23 | /* 24 | * Get DOM element of modal 25 | */ 26 | var getModal = function() { 27 | var $modal = document.querySelector(modalClass); 28 | 29 | if (!$modal) { 30 | sweetAlertInitialize(); 31 | $modal = getModal(); 32 | } 33 | 34 | return $modal; 35 | }; 36 | 37 | /* 38 | * Get DOM element of input (in modal) 39 | */ 40 | var getInput = function() { 41 | var $modal = getModal(); 42 | if ($modal) { 43 | return $modal.querySelector('input'); 44 | } 45 | }; 46 | 47 | /* 48 | * Get DOM element of overlay 49 | */ 50 | var getOverlay = function() { 51 | return document.querySelector(overlayClass); 52 | }; 53 | 54 | /* 55 | * Add box-shadow style to button (depending on its chosen bg-color) 56 | */ 57 | var setFocusStyle = function($button, bgColor) { 58 | var rgbColor = hexToRgb(bgColor); 59 | $button.style.boxShadow = '0 0 2px rgba(' + rgbColor + ', 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.05)'; 60 | }; 61 | 62 | /* 63 | * Animation when opening modal 64 | */ 65 | var openModal = function(callback) { 66 | var $modal = getModal(); 67 | fadeIn(getOverlay(), 10); 68 | show($modal); 69 | addClass($modal, 'showSweetAlert'); 70 | removeClass($modal, 'hideSweetAlert'); 71 | 72 | window.previousActiveElement = document.activeElement; 73 | var $okButton = $modal.querySelector('button.confirm'); 74 | $okButton.focus(); 75 | 76 | setTimeout(function () { 77 | addClass($modal, 'visible'); 78 | }, 500); 79 | 80 | var timer = $modal.getAttribute('data-timer'); 81 | 82 | if (timer !== 'null' && timer !== '') { 83 | var timerCallback = callback; 84 | $modal.timeout = setTimeout(function() { 85 | var doneFunctionExists = ((timerCallback || null) && $modal.getAttribute('data-has-done-function') === 'true'); 86 | if (doneFunctionExists) { 87 | timerCallback(null); 88 | } 89 | else { 90 | sweetAlert.close(); 91 | } 92 | }, timer); 93 | } 94 | }; 95 | 96 | /* 97 | * Reset the styling of the input 98 | * (for example if errors have been shown) 99 | */ 100 | var resetInput = function() { 101 | var $modal = getModal(); 102 | var $input = getInput(); 103 | 104 | removeClass($modal, 'show-input'); 105 | $input.value = defaultParams.inputValue; 106 | $input.setAttribute('type', defaultParams.inputType); 107 | $input.setAttribute('placeholder', defaultParams.inputPlaceholder); 108 | 109 | resetInputError(); 110 | }; 111 | 112 | 113 | var resetInputError = function(event) { 114 | // If press enter => ignore 115 | if (event && event.keyCode === 13) { 116 | return false; 117 | } 118 | 119 | var $modal = getModal(); 120 | 121 | var $errorIcon = $modal.querySelector('.sa-input-error'); 122 | removeClass($errorIcon, 'show'); 123 | 124 | var $errorContainer = $modal.querySelector('.sa-error-container'); 125 | removeClass($errorContainer, 'show'); 126 | }; 127 | 128 | 129 | /* 130 | * Set "margin-top"-property on modal based on its computed height 131 | */ 132 | var fixVerticalPosition = function() { 133 | var $modal = getModal(); 134 | $modal.style.marginTop = getTopMargin(getModal()); 135 | }; 136 | 137 | 138 | export { 139 | sweetAlertInitialize, 140 | getModal, 141 | getOverlay, 142 | getInput, 143 | setFocusStyle, 144 | openModal, 145 | resetInput, 146 | resetInputError, 147 | fixVerticalPosition 148 | }; 149 | -------------------------------------------------------------------------------- /Register/sweetalert/dev/modules/injected-html.js: -------------------------------------------------------------------------------- 1 | var injectedHTML = 2 | 3 | // Dark overlay 4 | `
` + 5 | 6 | // Modal 7 | `
` + 8 | 9 | // Error icon 10 | `
11 | 12 | 13 | 14 | 15 |
` + 16 | 17 | // Warning icon 18 | `
19 | 20 | 21 |
` + 22 | 23 | // Info icon 24 | `
` + 25 | 26 | // Success icon 27 | `
28 | 29 | 30 | 31 |
32 |
33 |
` + 34 | 35 | `
` + 36 | 37 | // Title, text and input 38 | `

Title

39 |

Text

40 |
41 | 42 |
43 |
` + 44 | 45 | // Input errors 46 | `
47 |
!
48 |

Not valid!

49 |
` + 50 | 51 | // Cancel and confirm buttons 52 | `
53 | 54 |
55 | ` + 56 | 57 | // Loading animation 58 | `
59 |
60 |
61 |
62 |
63 |
64 |
` + 65 | 66 | // End of modal 67 | `
`; 68 | 69 | export default injectedHTML; 70 | -------------------------------------------------------------------------------- /Register/sweetalert/dev/modules/set-params.js: -------------------------------------------------------------------------------- 1 | var alertTypes = ['error', 'warning', 'info', 'success', 'input', 'prompt']; 2 | 3 | import { 4 | isIE8 5 | } from './utils'; 6 | 7 | import { 8 | getModal, 9 | getInput, 10 | setFocusStyle 11 | } from './handle-swal-dom'; 12 | 13 | import { 14 | hasClass, addClass, removeClass, 15 | escapeHtml, 16 | _show, show, _hide, hide 17 | } from './handle-dom'; 18 | 19 | 20 | /* 21 | * Set type, text and actions on modal 22 | */ 23 | var setParameters = function(params) { 24 | var modal = getModal(); 25 | 26 | var $title = modal.querySelector('h2'); 27 | var $text = modal.querySelector('p'); 28 | var $cancelBtn = modal.querySelector('button.cancel'); 29 | var $confirmBtn = modal.querySelector('button.confirm'); 30 | 31 | /* 32 | * Title 33 | */ 34 | $title.innerHTML = params.html ? params.title : escapeHtml(params.title).split('\n').join('
'); 35 | 36 | /* 37 | * Text 38 | */ 39 | $text.innerHTML = params.html ? params.text : escapeHtml(params.text || '').split('\n').join('
'); 40 | if (params.text) show($text); 41 | 42 | /* 43 | * Custom class 44 | */ 45 | if (params.customClass) { 46 | addClass(modal, params.customClass); 47 | modal.setAttribute('data-custom-class', params.customClass); 48 | } else { 49 | // Find previously set classes and remove them 50 | let customClass = modal.getAttribute('data-custom-class'); 51 | removeClass(modal, customClass); 52 | modal.setAttribute('data-custom-class', ''); 53 | } 54 | 55 | /* 56 | * Icon 57 | */ 58 | hide(modal.querySelectorAll('.sa-icon')); 59 | 60 | if (params.type && !isIE8()) { 61 | 62 | let validType = false; 63 | 64 | for (let i = 0; i < alertTypes.length; i++) { 65 | if (params.type === alertTypes[i]) { 66 | validType = true; 67 | break; 68 | } 69 | } 70 | 71 | if (!validType) { 72 | logStr('Unknown alert type: ' + params.type); 73 | return false; 74 | } 75 | 76 | let typesWithIcons = ['success', 'error', 'warning', 'info']; 77 | let $icon; 78 | 79 | if (typesWithIcons.indexOf(params.type) !== -1) { 80 | $icon = modal.querySelector('.sa-icon.' + 'sa-' + params.type); 81 | show($icon); 82 | } 83 | 84 | let $input = getInput(); 85 | 86 | // Animate icon 87 | switch (params.type) { 88 | 89 | case 'success': 90 | addClass($icon, 'animate'); 91 | addClass($icon.querySelector('.sa-tip'), 'animateSuccessTip'); 92 | addClass($icon.querySelector('.sa-long'), 'animateSuccessLong'); 93 | break; 94 | 95 | case 'error': 96 | addClass($icon, 'animateErrorIcon'); 97 | addClass($icon.querySelector('.sa-x-mark'), 'animateXMark'); 98 | break; 99 | 100 | case 'warning': 101 | addClass($icon, 'pulseWarning'); 102 | addClass($icon.querySelector('.sa-body'), 'pulseWarningIns'); 103 | addClass($icon.querySelector('.sa-dot'), 'pulseWarningIns'); 104 | break; 105 | 106 | case 'input': 107 | case 'prompt': 108 | $input.setAttribute('type', params.inputType); 109 | $input.value = params.inputValue; 110 | $input.setAttribute('placeholder', params.inputPlaceholder); 111 | addClass(modal, 'show-input'); 112 | setTimeout(function () { 113 | $input.focus(); 114 | $input.addEventListener('keyup', swal.resetInputError); 115 | }, 400); 116 | break; 117 | } 118 | } 119 | 120 | /* 121 | * Custom image 122 | */ 123 | if (params.imageUrl) { 124 | let $customIcon = modal.querySelector('.sa-icon.sa-custom'); 125 | 126 | $customIcon.style.backgroundImage = 'url(' + params.imageUrl + ')'; 127 | show($customIcon); 128 | 129 | let _imgWidth = 80; 130 | let _imgHeight = 80; 131 | 132 | if (params.imageSize) { 133 | let dimensions = params.imageSize.toString().split('x'); 134 | let imgWidth = dimensions[0]; 135 | let imgHeight = dimensions[1]; 136 | 137 | if (!imgWidth || !imgHeight) { 138 | logStr('Parameter imageSize expects value with format WIDTHxHEIGHT, got ' + params.imageSize); 139 | } else { 140 | _imgWidth = imgWidth; 141 | _imgHeight = imgHeight; 142 | } 143 | } 144 | 145 | $customIcon.setAttribute('style', $customIcon.getAttribute('style') + 'width:' + _imgWidth + 'px; height:' + _imgHeight + 'px'); 146 | } 147 | 148 | /* 149 | * Show cancel button? 150 | */ 151 | modal.setAttribute('data-has-cancel-button', params.showCancelButton); 152 | if (params.showCancelButton) { 153 | $cancelBtn.style.display = 'inline-block'; 154 | } else { 155 | hide($cancelBtn); 156 | } 157 | 158 | /* 159 | * Show confirm button? 160 | */ 161 | modal.setAttribute('data-has-confirm-button', params.showConfirmButton); 162 | if (params.showConfirmButton) { 163 | $confirmBtn.style.display = 'inline-block'; 164 | } else { 165 | hide($confirmBtn); 166 | } 167 | 168 | /* 169 | * Custom text on cancel/confirm buttons 170 | */ 171 | if (params.cancelButtonText) { 172 | $cancelBtn.innerHTML = escapeHtml(params.cancelButtonText); 173 | } 174 | if (params.confirmButtonText) { 175 | $confirmBtn.innerHTML = escapeHtml(params.confirmButtonText); 176 | } 177 | 178 | /* 179 | * Custom color on confirm button 180 | */ 181 | if (params.confirmButtonColor) { 182 | // Set confirm button to selected background color 183 | $confirmBtn.style.backgroundColor = params.confirmButtonColor; 184 | 185 | // Set the confirm button color to the loading ring 186 | $confirmBtn.style.borderLeftColor = params.confirmLoadingButtonColor; 187 | $confirmBtn.style.borderRightColor = params.confirmLoadingButtonColor; 188 | 189 | // Set box-shadow to default focused button 190 | setFocusStyle($confirmBtn, params.confirmButtonColor); 191 | } 192 | 193 | /* 194 | * Allow outside click 195 | */ 196 | modal.setAttribute('data-allow-outside-click', params.allowOutsideClick); 197 | 198 | /* 199 | * Callback function 200 | */ 201 | var hasDoneFunction = params.doneFunction ? true : false; 202 | modal.setAttribute('data-has-done-function', hasDoneFunction); 203 | 204 | /* 205 | * Animation 206 | */ 207 | if (!params.animation) { 208 | modal.setAttribute('data-animation', 'none'); 209 | } else if (typeof params.animation === 'string') { 210 | modal.setAttribute('data-animation', params.animation); // Custom animation 211 | } else { 212 | modal.setAttribute('data-animation', 'pop'); 213 | } 214 | 215 | /* 216 | * Timer 217 | */ 218 | modal.setAttribute('data-timer', params.timer); 219 | }; 220 | 221 | export default setParameters; 222 | -------------------------------------------------------------------------------- /Register/sweetalert/dev/modules/utils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Allow user to pass their own params 3 | */ 4 | var extend = function(a, b) { 5 | for (var key in b) { 6 | if (b.hasOwnProperty(key)) { 7 | a[key] = b[key]; 8 | } 9 | } 10 | return a; 11 | }; 12 | 13 | /* 14 | * Convert HEX codes to RGB values (#000000 -> rgb(0,0,0)) 15 | */ 16 | var hexToRgb = function(hex) { 17 | var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); 18 | return result ? parseInt(result[1], 16) + ', ' + parseInt(result[2], 16) + ', ' + parseInt(result[3], 16) : null; 19 | }; 20 | 21 | /* 22 | * Check if the user is using Internet Explorer 8 (for fallbacks) 23 | */ 24 | var isIE8 = function() { 25 | return (window.attachEvent && !window.addEventListener); 26 | }; 27 | 28 | /* 29 | * IE compatible logging for developers 30 | */ 31 | var logStr = function(string) { 32 | if (typeof(window) !== 'undefined' && window.console) { 33 | // IE... 34 | window.console.log('SweetAlert: ' + string); 35 | } 36 | }; 37 | 38 | /* 39 | * Set hover, active and focus-states for buttons 40 | * (source: http://www.sitepoint.com/javascript-generate-lighter-darker-color) 41 | */ 42 | var colorLuminance = function(hex, lum) { 43 | // Validate hex string 44 | hex = String(hex).replace(/[^0-9a-f]/gi, ''); 45 | if (hex.length < 6) { 46 | hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; 47 | } 48 | lum = lum || 0; 49 | 50 | // Convert to decimal and change luminosity 51 | var rgb = '#'; 52 | var c; 53 | var i; 54 | 55 | for (i = 0; i < 3; i++) { 56 | c = parseInt(hex.substr(i * 2, 2), 16); 57 | c = Math.round(Math.min(Math.max(0, c + c * lum), 255)).toString(16); 58 | rgb += ('00' + c).substr(c.length); 59 | } 60 | 61 | return rgb; 62 | }; 63 | 64 | 65 | export { 66 | extend, 67 | hexToRgb, 68 | isIE8, 69 | logStr, 70 | colorLuminance 71 | }; 72 | -------------------------------------------------------------------------------- /Register/sweetalert/dev/sweetalert.es6.js: -------------------------------------------------------------------------------- 1 | // SweetAlert 2 | // 2014-2015 (c) - Tristan Edwards 3 | // github.com/t4t5/sweetalert 4 | 5 | /* 6 | * jQuery-like functions for manipulating the DOM 7 | */ 8 | import { 9 | hasClass, addClass, removeClass, 10 | escapeHtml, 11 | _show, show, _hide, hide, 12 | isDescendant, 13 | getTopMargin, 14 | fadeIn, fadeOut, 15 | fireClick, 16 | stopEventPropagation 17 | } from './modules/handle-dom'; 18 | 19 | /* 20 | * Handy utilities 21 | */ 22 | import { 23 | extend, 24 | hexToRgb, 25 | isIE8, 26 | logStr, 27 | colorLuminance 28 | } from './modules/utils'; 29 | 30 | /* 31 | * Handle sweetAlert's DOM elements 32 | */ 33 | import { 34 | sweetAlertInitialize, 35 | getModal, 36 | getOverlay, 37 | getInput, 38 | setFocusStyle, 39 | openModal, 40 | resetInput, 41 | fixVerticalPosition 42 | } from './modules/handle-swal-dom'; 43 | 44 | 45 | // Handle button events and keyboard events 46 | import { handleButton, handleConfirm, handleCancel } from './modules/handle-click'; 47 | import handleKeyDown from './modules/handle-key'; 48 | 49 | 50 | // Default values 51 | import defaultParams from './modules/default-params'; 52 | import setParameters from './modules/set-params'; 53 | 54 | /* 55 | * Remember state in cases where opening and handling a modal will fiddle with it. 56 | * (We also use window.previousActiveElement as a global variable) 57 | */ 58 | var previousWindowKeyDown; 59 | var lastFocusedButton; 60 | 61 | 62 | /* 63 | * Global sweetAlert function 64 | * (this is what the user calls) 65 | */ 66 | var sweetAlert, swal; 67 | 68 | export default sweetAlert = swal = function() { 69 | var customizations = arguments[0]; 70 | 71 | addClass(document.body, 'stop-scrolling'); 72 | resetInput(); 73 | 74 | /* 75 | * Use argument if defined or default value from params object otherwise. 76 | * Supports the case where a default value is boolean true and should be 77 | * overridden by a corresponding explicit argument which is boolean false. 78 | */ 79 | function argumentOrDefault(key) { 80 | var args = customizations; 81 | return (args[key] === undefined) ? defaultParams[key] : args[key]; 82 | } 83 | 84 | if (customizations === undefined) { 85 | logStr('SweetAlert expects at least 1 attribute!'); 86 | return false; 87 | } 88 | 89 | var params = extend({}, defaultParams); 90 | 91 | switch (typeof customizations) { 92 | 93 | // Ex: swal("Hello", "Just testing", "info"); 94 | case 'string': 95 | params.title = customizations; 96 | params.text = arguments[1] || ''; 97 | params.type = arguments[2] || ''; 98 | break; 99 | 100 | // Ex: swal({ title:"Hello", text: "Just testing", type: "info" }); 101 | case 'object': 102 | if (customizations.title === undefined) { 103 | logStr('Missing "title" argument!'); 104 | return false; 105 | } 106 | 107 | params.title = customizations.title; 108 | 109 | for (let customName in defaultParams) { 110 | params[customName] = argumentOrDefault(customName); 111 | } 112 | 113 | // Show "Confirm" instead of "OK" if cancel button is visible 114 | params.confirmButtonText = params.showCancelButton ? 'Confirm' : defaultParams.confirmButtonText; 115 | params.confirmButtonText = argumentOrDefault('confirmButtonText'); 116 | 117 | // Callback function when clicking on "OK"/"Cancel" 118 | params.doneFunction = arguments[1] || null; 119 | 120 | break; 121 | 122 | default: 123 | logStr('Unexpected type of argument! Expected "string" or "object", got ' + typeof customizations); 124 | return false; 125 | 126 | } 127 | 128 | setParameters(params); 129 | fixVerticalPosition(); 130 | openModal(arguments[1]); 131 | 132 | // Modal interactions 133 | var modal = getModal(); 134 | 135 | 136 | /* 137 | * Make sure all modal buttons respond to all events 138 | */ 139 | var $buttons = modal.querySelectorAll('button'); 140 | var buttonEvents = ['onclick', 'onmouseover', 'onmouseout', 'onmousedown', 'onmouseup', 'onfocus']; 141 | var onButtonEvent = (e) => handleButton(e, params, modal); 142 | 143 | for (let btnIndex = 0; btnIndex < $buttons.length; btnIndex++) { 144 | for (let evtIndex = 0; evtIndex < buttonEvents.length; evtIndex++) { 145 | let btnEvt = buttonEvents[evtIndex]; 146 | $buttons[btnIndex][btnEvt] = onButtonEvent; 147 | } 148 | } 149 | 150 | // Clicking outside the modal dismisses it (if allowed by user) 151 | getOverlay().onclick = onButtonEvent; 152 | 153 | previousWindowKeyDown = window.onkeydown; 154 | 155 | var onKeyEvent = (e) => handleKeyDown(e, params, modal); 156 | window.onkeydown = onKeyEvent; 157 | 158 | window.onfocus = function () { 159 | // When the user has focused away and focused back from the whole window. 160 | setTimeout(function () { 161 | // Put in a timeout to jump out of the event sequence. 162 | // Calling focus() in the event sequence confuses things. 163 | if (lastFocusedButton !== undefined) { 164 | lastFocusedButton.focus(); 165 | lastFocusedButton = undefined; 166 | } 167 | }, 0); 168 | }; 169 | 170 | // Show alert with enabled buttons always 171 | swal.enableButtons(); 172 | }; 173 | 174 | 175 | 176 | /* 177 | * Set default params for each popup 178 | * @param {Object} userParams 179 | */ 180 | sweetAlert.setDefaults = swal.setDefaults = function(userParams) { 181 | if (!userParams) { 182 | throw new Error('userParams is required'); 183 | } 184 | if (typeof userParams !== 'object') { 185 | throw new Error('userParams has to be a object'); 186 | } 187 | 188 | extend(defaultParams, userParams); 189 | }; 190 | 191 | 192 | /* 193 | * Animation when closing modal 194 | */ 195 | sweetAlert.close = swal.close = function() { 196 | var modal = getModal(); 197 | 198 | fadeOut(getOverlay(), 5); 199 | fadeOut(modal, 5); 200 | removeClass(modal, 'showSweetAlert'); 201 | addClass(modal, 'hideSweetAlert'); 202 | removeClass(modal, 'visible'); 203 | 204 | /* 205 | * Reset icon animations 206 | */ 207 | var $successIcon = modal.querySelector('.sa-icon.sa-success'); 208 | removeClass($successIcon, 'animate'); 209 | removeClass($successIcon.querySelector('.sa-tip'), 'animateSuccessTip'); 210 | removeClass($successIcon.querySelector('.sa-long'), 'animateSuccessLong'); 211 | 212 | var $errorIcon = modal.querySelector('.sa-icon.sa-error'); 213 | removeClass($errorIcon, 'animateErrorIcon'); 214 | removeClass($errorIcon.querySelector('.sa-x-mark'), 'animateXMark'); 215 | 216 | var $warningIcon = modal.querySelector('.sa-icon.sa-warning'); 217 | removeClass($warningIcon, 'pulseWarning'); 218 | removeClass($warningIcon.querySelector('.sa-body'), 'pulseWarningIns'); 219 | removeClass($warningIcon.querySelector('.sa-dot'), 'pulseWarningIns'); 220 | 221 | // Reset custom class (delay so that UI changes aren't visible) 222 | setTimeout(function() { 223 | var customClass = modal.getAttribute('data-custom-class'); 224 | removeClass(modal, customClass); 225 | }, 300); 226 | 227 | // Make page scrollable again 228 | removeClass(document.body, 'stop-scrolling'); 229 | 230 | // Reset the page to its previous state 231 | window.onkeydown = previousWindowKeyDown; 232 | if (window.previousActiveElement) { 233 | window.previousActiveElement.focus(); 234 | } 235 | lastFocusedButton = undefined; 236 | clearTimeout(modal.timeout); 237 | 238 | return true; 239 | }; 240 | 241 | 242 | /* 243 | * Validation of the input field is done by user 244 | * If something is wrong => call showInputError with errorMessage 245 | */ 246 | sweetAlert.showInputError = swal.showInputError = function(errorMessage) { 247 | var modal = getModal(); 248 | 249 | var $errorIcon = modal.querySelector('.sa-input-error'); 250 | addClass($errorIcon, 'show'); 251 | 252 | var $errorContainer = modal.querySelector('.sa-error-container'); 253 | addClass($errorContainer, 'show'); 254 | 255 | $errorContainer.querySelector('p').innerHTML = errorMessage; 256 | 257 | setTimeout(function() { 258 | sweetAlert.enableButtons(); 259 | }, 1); 260 | 261 | modal.querySelector('input').focus(); 262 | }; 263 | 264 | 265 | /* 266 | * Reset input error DOM elements 267 | */ 268 | sweetAlert.resetInputError = swal.resetInputError = function(event) { 269 | // If press enter => ignore 270 | if (event && event.keyCode === 13) { 271 | return false; 272 | } 273 | 274 | var $modal = getModal(); 275 | 276 | var $errorIcon = $modal.querySelector('.sa-input-error'); 277 | removeClass($errorIcon, 'show'); 278 | 279 | var $errorContainer = $modal.querySelector('.sa-error-container'); 280 | removeClass($errorContainer, 'show'); 281 | }; 282 | 283 | /* 284 | * Disable confirm and cancel buttons 285 | */ 286 | sweetAlert.disableButtons = swal.disableButtons = function(event) { 287 | var modal = getModal(); 288 | var $confirmButton = modal.querySelector('button.confirm'); 289 | var $cancelButton = modal.querySelector('button.cancel'); 290 | $confirmButton.disabled = true; 291 | $cancelButton.disabled = true; 292 | }; 293 | 294 | /* 295 | * Enable confirm and cancel buttons 296 | */ 297 | sweetAlert.enableButtons = swal.enableButtons = function(event) { 298 | var modal = getModal(); 299 | var $confirmButton = modal.querySelector('button.confirm'); 300 | var $cancelButton = modal.querySelector('button.cancel'); 301 | $confirmButton.disabled = false; 302 | $cancelButton.disabled = false; 303 | }; 304 | 305 | if (typeof window !== 'undefined') { 306 | // The 'handle-click' module requires 307 | // that 'sweetAlert' was set as global. 308 | window.sweetAlert = window.swal = sweetAlert; 309 | } else { 310 | logStr('SweetAlert is a frontend module!'); 311 | } 312 | -------------------------------------------------------------------------------- /Register/sweetalert/example/example.scss: -------------------------------------------------------------------------------- 1 | @import url(http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,300); // Open Sans font 2 | @import url(http://fonts.googleapis.com/css?family=Open+Sans+Condensed:700); // Condensed 3 | 4 | @mixin retina-background($url, $type:png) { 5 | background-image: url("#{$url}.#{$type}"); 6 | background-image: -webkit-image-set(url("#{$url}.#{$type}") 1x, 7 | url("#{$url}@2x.#{$type}") 2x); 8 | } 9 | 10 | body { 11 | background-color: #f2f4f6; 12 | font-family: 'Open Sans', sans-serif; 13 | text-align: center; 14 | } 15 | 16 | h1 { 17 | @include retina-background("images/logo_big"); 18 | width: 385px; 19 | height: 81px; 20 | text-indent: -9999px; 21 | white-space: nowrap; 22 | margin: 50px auto; 23 | @media all and (max-width: 420px) { 24 | width: 300px; 25 | background-size: contain; 26 | background-repeat: no-repeat; 27 | background-position: center; 28 | } 29 | @media all and (max-width: 330px) { 30 | width: 250px; 31 | } 32 | } 33 | h2 { 34 | font-size: 20px; 35 | color: #A9B2BC; 36 | line-height: 25px; 37 | text-transform: uppercase; 38 | font-weight: 300; 39 | text-align: center; 40 | display: block; 41 | } 42 | h3 { 43 | font-size: 28px; 44 | color: #C7CCD1; 45 | text-transform: uppercase; 46 | font-family: 'Open Sans Condensed', sans-serif; 47 | margin-top: 100px; 48 | text-align: center; 49 | position: relative; 50 | &#download-section { 51 | margin-top: 50px; 52 | padding-top: 40px; 53 | } 54 | &::after { 55 | content: ""; 56 | background-color: #e2e5e8; 57 | height: 4px; 58 | width: 700px; 59 | left: 50%; 60 | margin-left: -350px; 61 | position: absolute; 62 | margin-top: -50px; 63 | border-radius: 2px; 64 | 65 | @media all and (max-width: 740px) { 66 | width: auto; 67 | left: 20px; 68 | right: 20px; 69 | margin-left: 0; 70 | } 71 | } 72 | } 73 | 74 | a { 75 | text-decoration: none; 76 | } 77 | 78 | p { 79 | max-width: 826px; 80 | margin: 30px auto; 81 | font-size: 17px; 82 | font-weight: 300; 83 | color: #848D94; 84 | line-height: 25px; 85 | text-align: left; 86 | &.center { 87 | text-align: center; 88 | } 89 | 90 | strong { 91 | color: #8A8F94; 92 | font-weight: 600; 93 | } 94 | a { 95 | color: #9ECADF; 96 | font-weight: 600; 97 | &:hover { 98 | text-decoration: underline; 99 | } 100 | &.twitter { 101 | color: #5eaade; 102 | } 103 | &.dribbble { 104 | color: #f26798; 105 | } 106 | &.github { 107 | color: #323131; 108 | } 109 | } 110 | } 111 | 112 | button, .button { 113 | $btnBlue: #AEDEF4; 114 | $btnGray: #D0D0D0; 115 | 116 | background-color: $btnBlue; 117 | color: white; 118 | border: none; 119 | box-shadow: none; 120 | font-size: 17px; 121 | font-weight: 500; 122 | font-weight: 600; 123 | border-radius: 3px; 124 | padding: 15px 35px; 125 | margin: 26px 5px 0 5px; 126 | cursor: pointer; 127 | &:focus { 128 | outline: none; 129 | } 130 | &:hover { 131 | background-color: darken($btnBlue, 3%); 132 | } 133 | &:active { 134 | background-color: darken($btnBlue, 10%); 135 | } 136 | &.cancel { 137 | background-color: $btnGray; 138 | &:hover { 139 | background-color: darken($btnGray, 3%); 140 | } 141 | &:active { 142 | background-color: darken($btnGray, 10%); 143 | } 144 | } 145 | &.download { 146 | position: fixed; 147 | right: 30px; 148 | top: 0; 149 | background-color: rgba(white, 0.9); 150 | color: #ABCADA; 151 | font-weight: 500; 152 | text-transform: uppercase; 153 | z-index: 3; 154 | 155 | @media all and (max-width: 1278px) { 156 | display: none; 157 | } 158 | } 159 | } 160 | 161 | .center-container { 162 | max-width: 700px; 163 | margin: 70px auto; 164 | } 165 | 166 | pre { 167 | background-color: #49483e; 168 | color: #f8f8f2; 169 | padding: 10px; 170 | border-radius: 5px; 171 | white-space: pre-line; 172 | text-align: left; 173 | font-size: 14px; 174 | max-width: 600px; 175 | 176 | .str { 177 | color: #e6db74; 178 | } 179 | .func { 180 | color: #66d9ef; 181 | } 182 | .val { 183 | color: #a381ff; 184 | } 185 | .tag { 186 | color: #e92772; 187 | } 188 | .attr { 189 | color: #a6e22d; 190 | } 191 | .arg { 192 | color: #fd9720; 193 | } 194 | } 195 | 196 | .showcase { 197 | background-color: #eceef0; 198 | padding: 20px; 199 | display: inline-block; 200 | width: 383px; 201 | vertical-align: top; 202 | position: relative; 203 | 204 | @media all and (max-width: 865px) { 205 | margin: 5px auto; 206 | padding: 46px 20px; 207 | } 208 | @media all and (max-width: 440px) { 209 | width: auto; 210 | } 211 | 212 | h4 { 213 | font-size: 16px; 214 | color: #BCBCBC; 215 | line-height: 22px; 216 | margin: 0 auto; 217 | font-weight: 400; 218 | } 219 | &.sweet h4 { 220 | width: 117px; 221 | height: 25px; 222 | margin-top: -3px; 223 | text-indent: -9999px; 224 | @include retina-background("images/logo_small"); 225 | } 226 | h5 { 227 | margin-bottom: -7px; 228 | text-align: left; 229 | font-weight: 500; 230 | text-transform: uppercase; 231 | color: rgb(194, 194, 194); 232 | } 233 | 234 | button { 235 | margin-bottom: 10px; 236 | } 237 | 238 | .vs-icon { 239 | @include retina-background("images/vs_icon"); 240 | width: 69px; 241 | height: 69px; 242 | position: absolute; 243 | right: -34px; 244 | top: 60px; 245 | z-index: 2; 246 | 247 | @media all and (max-width: 865px) { 248 | margin: 5px auto; 249 | right: auto; 250 | left: 50%; 251 | margin-left: -35px; 252 | top: auto; 253 | bottom: -35px; 254 | } 255 | } 256 | } 257 | 258 | 259 | ul.examples { 260 | list-style-type: none; 261 | width: 700px; 262 | margin: 0 auto; 263 | text-align: left; 264 | padding-left: 0; 265 | @media all and (max-width: 758px) { 266 | width: auto; 267 | } 268 | 269 | li { 270 | padding-left: 0; 271 | } 272 | 273 | .ui, pre { 274 | display: inline-block; 275 | vertical-align: top; 276 | 277 | @media all and (max-width: 758px) { 278 | display: block; 279 | max-width: none; 280 | margin: 0 auto; 281 | } 282 | } 283 | .ui { 284 | width: 300px; 285 | text-align: center; 286 | 287 | button { 288 | margin-top: 12px; 289 | } 290 | 291 | p { 292 | text-align: center; 293 | margin-bottom: 0; 294 | } 295 | } 296 | 297 | pre { 298 | max-width: 370px; 299 | margin-top: 67px; 300 | 301 | @media all and (max-width: 758px) { 302 | margin-top: 16px !important; 303 | margin-bottom: 60px; 304 | } 305 | } 306 | .warning pre { 307 | margin-top: 93px; 308 | } 309 | } 310 | 311 | 312 | ol { 313 | max-width: 700px; 314 | margin: 70px auto; 315 | list-style-position: inside; 316 | padding-left: 0; 317 | 318 | li { 319 | color: #A7ADB2; 320 | 321 | p { 322 | margin-bottom: 10px; 323 | } 324 | } 325 | } 326 | 327 | 328 | table { 329 | width: 700px; 330 | font-size: 14px; 331 | color: #8a8f94; 332 | margin: 10px auto; 333 | text-align: left; 334 | border-collapse: collapse; 335 | @media all and (max-width: 750px) { 336 | width: auto; 337 | margin: 10px 20px; 338 | } 339 | 340 | th { 341 | background-color: white; 342 | padding: 9px; 343 | color: rgb(172, 185, 190); 344 | font-weight: 400; 345 | text-align: center; 346 | position: relative; 347 | .border-left, .border-right { 348 | position: absolute; 349 | background-color: white; 350 | border-radius: 50%; 351 | top: 0; 352 | left: -17px; 353 | width: 37px; 354 | height: 37px; 355 | } 356 | .border-right { 357 | left: auto; 358 | right: -17px; 359 | } 360 | @media all and (max-width: 750px) { 361 | &:nth-child(2) { 362 | display: none; 363 | } 364 | } 365 | } 366 | 367 | td { 368 | padding: 10px 20px; 369 | vertical-align: top; 370 | &:first-child { 371 | padding-left: 0px; 372 | } 373 | &:last-child { 374 | padding-right: 0px; 375 | } 376 | @media all and (max-width: 750px) { 377 | &:nth-child(2) { 378 | display: none; 379 | } 380 | } 381 | @media all and (max-width: 360px) { 382 | padding: 10px 4px; 383 | b { 384 | font-size: 13px; 385 | } 386 | } 387 | } 388 | } 389 | 390 | footer { 391 | margin-top: 100px; 392 | padding-bottom: 30px; 393 | color: #9A999F; 394 | display: inline-block; 395 | position: relative; 396 | color: gray; 397 | font-weight: 400; 398 | color: rgb(147, 161, 170); 399 | font-weight: 300; 400 | 401 | .te-logo { 402 | text-indent: -99999px; 403 | background-size: contain; 404 | background-repeat: no-repeat; 405 | background-position: center center; 406 | height: 16px; 407 | width: 16px; 408 | display: inline-block; 409 | margin-right: 5px; 410 | background-image: url("images/te-logo-small.svg"); 411 | position: absolute; 412 | left: -22px; 413 | top: 3px; 414 | } 415 | } 416 | 417 | 418 | // Theme example (Twitter) 419 | // Twitter Theme for SweetAlert 420 | // By Tristan Edwards 421 | 422 | .sweet-alert.twitter { 423 | $header-height: 40px; 424 | $footer-height: 66px; 425 | $text-color: #66757f; 426 | $padding: 15px; 427 | 428 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 429 | padding: $padding; 430 | padding-top: $header-height + $padding; 431 | text-align: right; // Align buttons 432 | border-radius: 6px; 433 | box-shadow: 0px 0px 0px 1px rgba(black, 0.11), 0px 6px 30px rgba(black, 0.14); 434 | 435 | ~ .sweet-overlay { 436 | background: rgba(41,47,51,0.9); 437 | } 438 | 439 | h2 { 440 | position: absolute; 441 | top: 0; 442 | left: 0; 443 | right: 0; 444 | height: $header-height; 445 | line-height: $header-height; 446 | font-size: 16px; 447 | font-weight: 400; 448 | color: #8899a6; 449 | margin: 0; 450 | color: $text-color; 451 | border-bottom: 1px solid #e1e8ed; 452 | } 453 | 454 | p { 455 | display: block; 456 | text-align: center; 457 | color: #66757f; 458 | font-weight: 400; 459 | font-size: 13px; 460 | margin-top: 7px; 461 | } 462 | 463 | .sa-button-container { 464 | background-color: #f5f8fa; 465 | border-top: 1px solid #e1e8ed; 466 | box-shadow: 0px -1px 0px white; 467 | margin: -$padding; 468 | margin-top: 0; 469 | } 470 | &[data-has-confirm-button=false][data-has-cancel-button=false] { 471 | padding-bottom: 10px; 472 | .sa-button-container { 473 | display: none; 474 | } 475 | } 476 | 477 | button { 478 | border-radius: 2px; 479 | box-shadow: none !important; 480 | text-shadow: 0px -1px 0px rgba(black, 0.3); 481 | margin: 17px 0px; 482 | border-radius: 4px; 483 | font-size: 14px; 484 | font-weight: 600; 485 | padding: 8px 16px; 486 | position: relative; 487 | &:focus, &.cancel:focus { 488 | box-shadow: none !important; 489 | &::before { 490 | content: ""; 491 | position: absolute; 492 | left: -5px; 493 | top: -5px; 494 | right: -5px; 495 | bottom: -5px; 496 | border: 2px solid #a5b0b4; 497 | border-radius: 8px; 498 | } 499 | } 500 | 501 | &.confirm { 502 | background-color: #55acee !important; 503 | background-image: linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.05)); 504 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000, endColorstr=#0C000000)"; 505 | border: 1px solid #3b88c3; 506 | box-shadow: inset 0 1px 0 rgba(255,255,255,0.15); 507 | margin-right: $padding; 508 | &:hover { 509 | background-color: #55acee; 510 | background-image: linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.15)); 511 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000, endColorstr=#26000000)"; 512 | border-color: #3b88c3; 513 | } 514 | } 515 | &.cancel { 516 | color: #66757e; 517 | background-color: #f5f8fa; 518 | background-image: linear-gradient(#fff,#f5f8fa); 519 | text-shadow: 0px -1px 0px white; 520 | margin-right: 9px; 521 | border: 1px solid #e1e8ed; 522 | &:hover, &:focus:hover { 523 | background-color: #e1e8ed; 524 | background-image: linear-gradient(#fff,#e1e8ed); 525 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(enabled=false)"; 526 | border-color: #e1e8ed; 527 | } 528 | &:focus { 529 | background: #fff; 530 | border-color: #fff; 531 | } 532 | } 533 | } 534 | 535 | .sa-icon { 536 | transform: scale(0.72); 537 | margin-bottom: -2px; 538 | margin-top: -10px; 539 | } 540 | 541 | input { 542 | border: 1px solid #e1e8ed; 543 | border-radius: 3px; 544 | padding: 10px 7px; 545 | height: auto; 546 | box-shadow: none; 547 | font-size: 13px; 548 | margin: 10px 0; 549 | &:focus { 550 | border-color: #94A1A6; 551 | box-shadow: inset 0 0 0 1px rgba(77, 99, 107, 0.7); 552 | } 553 | } 554 | 555 | fieldset .sa-input-error { 556 | display: none; 557 | } 558 | 559 | .sa-error-container { 560 | text-align: center; 561 | border: none; 562 | background-color: #fbedc0; 563 | margin-bottom: 6px; 564 | &.show { 565 | border: 1px solid #f0e1b9; 566 | } 567 | 568 | .icon { 569 | display: none; 570 | } 571 | p { 572 | color: #292f33; 573 | font-weight: 600; 574 | margin-top: 0; 575 | } 576 | } 577 | } 578 | 579 | 580 | 581 | -------------------------------------------------------------------------------- /Register/sweetalert/example/images/logo_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fantasyhacking/RBSE/c59b35ff453bf56e3b3fe6dd74c284b7c70c69ea/Register/sweetalert/example/images/logo_big.png -------------------------------------------------------------------------------- /Register/sweetalert/example/images/logo_big@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fantasyhacking/RBSE/c59b35ff453bf56e3b3fe6dd74c284b7c70c69ea/Register/sweetalert/example/images/logo_big@2x.png -------------------------------------------------------------------------------- /Register/sweetalert/example/images/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fantasyhacking/RBSE/c59b35ff453bf56e3b3fe6dd74c284b7c70c69ea/Register/sweetalert/example/images/logo_small.png -------------------------------------------------------------------------------- /Register/sweetalert/example/images/logo_small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fantasyhacking/RBSE/c59b35ff453bf56e3b3fe6dd74c284b7c70c69ea/Register/sweetalert/example/images/logo_small@2x.png -------------------------------------------------------------------------------- /Register/sweetalert/example/images/te-logo-small.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | te-logo-small 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Register/sweetalert/example/images/thumbs-up.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fantasyhacking/RBSE/c59b35ff453bf56e3b3fe6dd74c284b7c70c69ea/Register/sweetalert/example/images/thumbs-up.jpg -------------------------------------------------------------------------------- /Register/sweetalert/example/images/vs_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fantasyhacking/RBSE/c59b35ff453bf56e3b3fe6dd74c284b7c70c69ea/Register/sweetalert/example/images/vs_icon.png -------------------------------------------------------------------------------- /Register/sweetalert/example/images/vs_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fantasyhacking/RBSE/c59b35ff453bf56e3b3fe6dd74c284b7c70c69ea/Register/sweetalert/example/images/vs_icon@2x.png -------------------------------------------------------------------------------- /Register/sweetalert/gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | 3 | var glob = require('glob'); 4 | var path = require('path'); 5 | var jshint = require('gulp-jshint'); 6 | var sass = require('gulp-sass'); 7 | var concat = require('gulp-concat'); 8 | var uglify = require('gulp-uglify'); 9 | var rename = require('gulp-rename'); 10 | var minifyCSS = require('gulp-minify-css'); 11 | var babelify = require('babelify'); 12 | var browserify = require('browserify'); 13 | var source = require('vinyl-source-stream'); 14 | var buffer = require('vinyl-buffer'); 15 | var wrap = require('gulp-wrap'); 16 | var qunit = require('gulp-qunit'); 17 | var babel = require('gulp-babel'); 18 | 19 | // Lint Task 20 | gulp.task('lint', function() { 21 | gulp.src('dev/sweetalert.es6.js') 22 | .pipe(jshint()) 23 | .pipe(jshint.reporter('default')); 24 | 25 | return gulp.src('dev/*/*.js') 26 | .pipe(jshint()) 27 | .pipe(jshint.reporter('default')); 28 | }); 29 | 30 | // Compile Our Sass 31 | gulp.task('sass', function() { 32 | 33 | gulp.src('example/example.scss') 34 | .pipe(sass()) 35 | .pipe(rename('example.css')) 36 | .pipe(gulp.dest('example')); 37 | 38 | // (We don't use minifyCSS since it breaks the ie9 file for some reason) 39 | gulp.src(['dev/sweetalert.scss', 'dev/ie9.css', 'dev/loader-animation.css']) 40 | .pipe(sass()) 41 | .pipe(concat('sweetalert.css')) 42 | .pipe(gulp.dest('dist')); 43 | }); 44 | 45 | 46 | // Compile theme CSS 47 | var themes = glob.sync('themes/*').map(function(themeDir) { 48 | return path.basename(themeDir); 49 | }); 50 | 51 | themes.forEach(function(name) { 52 | gulp.task(name + '-theme', function() { 53 | return gulp.src('themes/' + name + '/' + name + '.scss') 54 | .pipe(sass()) // etc 55 | .pipe(rename(name + '.css')) 56 | .pipe(gulp.dest('themes/' + name)) 57 | }); 58 | }); 59 | 60 | gulp.task('themes', themes.map(function(name){ return name + '-theme'; })); 61 | 62 | // Compile ES5 CommonJS entry point 63 | gulp.task('commonjs', function() { 64 | gulp.src('./dev/sweetalert.es6.js') 65 | .pipe(babel()) 66 | .pipe(rename('sweetalert.js')) 67 | .pipe(gulp.dest('lib')); 68 | gulp.src('./dev/modules/*.js') 69 | .pipe(babel()) 70 | .pipe(gulp.dest('lib/modules')); 71 | }); 72 | 73 | // Concatenate & Minify JS 74 | gulp.task('scripts', function() { 75 | return browserify({ 76 | entries: './dev/sweetalert.es6.js', 77 | debug: true 78 | }) 79 | .transform(babelify) 80 | .bundle() 81 | .pipe(source('sweetalert-dev.js')) 82 | .pipe(wrap({ 83 | src: './dev/gulpfile-wrap-template.js' 84 | })) 85 | .pipe(gulp.dest('dist')) // Developer version 86 | 87 | .pipe(rename('sweetalert.min.js')) 88 | .pipe(buffer()) 89 | .pipe(uglify()) 90 | .pipe(gulp.dest('dist')); // User version 91 | }); 92 | 93 | gulp.task('test', function() { 94 | return gulp.src('./test/index.html') 95 | .pipe(qunit({ 96 | timeout: 20 97 | })); 98 | }); 99 | 100 | // Watch Files For Changes 101 | gulp.task('watch', function() { 102 | gulp.watch(['dev/*.js', 'dev/*/*.js'], ['lint', 'scripts']); 103 | gulp.watch(['dev/*.scss', 'dev/*.css'], ['sass']); 104 | gulp.watch('themes/*/*.scss', ['themes']); 105 | }); 106 | 107 | // Default Task 108 | gulp.task('default', ['lint', 'sass', 'scripts', 'commonjs', 'watch', 'test']); 109 | -------------------------------------------------------------------------------- /Register/sweetalert/lib/modules/default-params.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, '__esModule', { 4 | value: true 5 | }); 6 | var defaultParams = { 7 | title: '', 8 | text: '', 9 | type: null, 10 | allowOutsideClick: false, 11 | showConfirmButton: true, 12 | showCancelButton: false, 13 | closeOnConfirm: true, 14 | closeOnCancel: true, 15 | confirmButtonText: 'OK', 16 | confirmButtonColor: '#8CD4F5', 17 | cancelButtonText: 'Cancel', 18 | imageUrl: null, 19 | imageSize: null, 20 | timer: null, 21 | customClass: '', 22 | html: false, 23 | animation: true, 24 | allowEscapeKey: true, 25 | inputType: 'text', 26 | inputPlaceholder: '', 27 | inputValue: '', 28 | showLoaderOnConfirm: false 29 | }; 30 | 31 | exports['default'] = defaultParams; 32 | module.exports = exports['default']; -------------------------------------------------------------------------------- /Register/sweetalert/lib/modules/handle-click.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, '__esModule', { 4 | value: true 5 | }); 6 | 7 | var _colorLuminance = require('./utils'); 8 | 9 | var _getModal = require('./handle-swal-dom'); 10 | 11 | var _hasClass$isDescendant = require('./handle-dom'); 12 | 13 | /* 14 | * User clicked on "Confirm"/"OK" or "Cancel" 15 | */ 16 | var handleButton = function handleButton(event, params, modal) { 17 | var e = event || window.event; 18 | var target = e.target || e.srcElement; 19 | 20 | var targetedConfirm = target.className.indexOf('confirm') !== -1; 21 | var targetedOverlay = target.className.indexOf('sweet-overlay') !== -1; 22 | var modalIsVisible = _hasClass$isDescendant.hasClass(modal, 'visible'); 23 | var doneFunctionExists = params.doneFunction && modal.getAttribute('data-has-done-function') === 'true'; 24 | 25 | // Since the user can change the background-color of the confirm button programmatically, 26 | // we must calculate what the color should be on hover/active 27 | var normalColor, hoverColor, activeColor; 28 | if (targetedConfirm && params.confirmButtonColor) { 29 | normalColor = params.confirmButtonColor; 30 | hoverColor = _colorLuminance.colorLuminance(normalColor, -0.04); 31 | activeColor = _colorLuminance.colorLuminance(normalColor, -0.14); 32 | } 33 | 34 | function shouldSetConfirmButtonColor(color) { 35 | if (targetedConfirm && params.confirmButtonColor) { 36 | target.style.backgroundColor = color; 37 | } 38 | } 39 | 40 | switch (e.type) { 41 | case 'mouseover': 42 | shouldSetConfirmButtonColor(hoverColor); 43 | break; 44 | 45 | case 'mouseout': 46 | shouldSetConfirmButtonColor(normalColor); 47 | break; 48 | 49 | case 'mousedown': 50 | shouldSetConfirmButtonColor(activeColor); 51 | break; 52 | 53 | case 'mouseup': 54 | shouldSetConfirmButtonColor(hoverColor); 55 | break; 56 | 57 | case 'focus': 58 | var $confirmButton = modal.querySelector('button.confirm'); 59 | var $cancelButton = modal.querySelector('button.cancel'); 60 | 61 | if (targetedConfirm) { 62 | $cancelButton.style.boxShadow = 'none'; 63 | } else { 64 | $confirmButton.style.boxShadow = 'none'; 65 | } 66 | break; 67 | 68 | case 'click': 69 | var clickedOnModal = modal === target; 70 | var clickedOnModalChild = _hasClass$isDescendant.isDescendant(modal, target); 71 | 72 | // Ignore click outside if allowOutsideClick is false 73 | if (!clickedOnModal && !clickedOnModalChild && modalIsVisible && !params.allowOutsideClick) { 74 | break; 75 | } 76 | 77 | if (targetedConfirm && doneFunctionExists && modalIsVisible) { 78 | handleConfirm(modal, params); 79 | } else if (doneFunctionExists && modalIsVisible || targetedOverlay) { 80 | handleCancel(modal, params); 81 | } else if (_hasClass$isDescendant.isDescendant(modal, target) && target.tagName === 'BUTTON') { 82 | sweetAlert.close(); 83 | } 84 | break; 85 | } 86 | }; 87 | 88 | /* 89 | * User clicked on "Confirm"/"OK" 90 | */ 91 | var handleConfirm = function handleConfirm(modal, params) { 92 | var callbackValue = true; 93 | 94 | if (_hasClass$isDescendant.hasClass(modal, 'show-input')) { 95 | callbackValue = modal.querySelector('input').value; 96 | 97 | if (!callbackValue) { 98 | callbackValue = ''; 99 | } 100 | } 101 | 102 | params.doneFunction(callbackValue); 103 | 104 | if (params.closeOnConfirm) { 105 | sweetAlert.close(); 106 | } 107 | // Disable cancel and confirm button if the parameter is true 108 | if (params.showLoaderOnConfirm) { 109 | sweetAlert.disableButtons(); 110 | } 111 | }; 112 | 113 | /* 114 | * User clicked on "Cancel" 115 | */ 116 | var handleCancel = function handleCancel(modal, params) { 117 | // Check if callback function expects a parameter (to track cancel actions) 118 | var functionAsStr = String(params.doneFunction).replace(/\s/g, ''); 119 | var functionHandlesCancel = functionAsStr.substring(0, 9) === 'function(' && functionAsStr.substring(9, 10) !== ')'; 120 | 121 | if (functionHandlesCancel) { 122 | params.doneFunction(false); 123 | } 124 | 125 | if (params.closeOnCancel) { 126 | sweetAlert.close(); 127 | } 128 | }; 129 | 130 | exports['default'] = { 131 | handleButton: handleButton, 132 | handleConfirm: handleConfirm, 133 | handleCancel: handleCancel 134 | }; 135 | module.exports = exports['default']; -------------------------------------------------------------------------------- /Register/sweetalert/lib/modules/handle-dom.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, '__esModule', { 4 | value: true 5 | }); 6 | var hasClass = function hasClass(elem, className) { 7 | return new RegExp(' ' + className + ' ').test(' ' + elem.className + ' '); 8 | }; 9 | 10 | var addClass = function addClass(elem, className) { 11 | if (!hasClass(elem, className)) { 12 | elem.className += ' ' + className; 13 | } 14 | }; 15 | 16 | var removeClass = function removeClass(elem, className) { 17 | var newClass = ' ' + elem.className.replace(/[\t\r\n]/g, ' ') + ' '; 18 | if (hasClass(elem, className)) { 19 | while (newClass.indexOf(' ' + className + ' ') >= 0) { 20 | newClass = newClass.replace(' ' + className + ' ', ' '); 21 | } 22 | elem.className = newClass.replace(/^\s+|\s+$/g, ''); 23 | } 24 | }; 25 | 26 | var escapeHtml = function escapeHtml(str) { 27 | var div = document.createElement('div'); 28 | div.appendChild(document.createTextNode(str)); 29 | return div.innerHTML; 30 | }; 31 | 32 | var _show = function _show(elem) { 33 | elem.style.opacity = ''; 34 | elem.style.display = 'block'; 35 | }; 36 | 37 | var show = function show(elems) { 38 | if (elems && !elems.length) { 39 | return _show(elems); 40 | } 41 | for (var i = 0; i < elems.length; ++i) { 42 | _show(elems[i]); 43 | } 44 | }; 45 | 46 | var _hide = function _hide(elem) { 47 | elem.style.opacity = ''; 48 | elem.style.display = 'none'; 49 | }; 50 | 51 | var hide = function hide(elems) { 52 | if (elems && !elems.length) { 53 | return _hide(elems); 54 | } 55 | for (var i = 0; i < elems.length; ++i) { 56 | _hide(elems[i]); 57 | } 58 | }; 59 | 60 | var isDescendant = function isDescendant(parent, child) { 61 | var node = child.parentNode; 62 | while (node !== null) { 63 | if (node === parent) { 64 | return true; 65 | } 66 | node = node.parentNode; 67 | } 68 | return false; 69 | }; 70 | 71 | var getTopMargin = function getTopMargin(elem) { 72 | elem.style.left = '-9999px'; 73 | elem.style.display = 'block'; 74 | 75 | var height = elem.clientHeight, 76 | padding; 77 | if (typeof getComputedStyle !== 'undefined') { 78 | // IE 8 79 | padding = parseInt(getComputedStyle(elem).getPropertyValue('padding-top'), 10); 80 | } else { 81 | padding = parseInt(elem.currentStyle.padding); 82 | } 83 | 84 | elem.style.left = ''; 85 | elem.style.display = 'none'; 86 | return '-' + parseInt((height + padding) / 2) + 'px'; 87 | }; 88 | 89 | var fadeIn = function fadeIn(elem, interval) { 90 | if (+elem.style.opacity < 1) { 91 | interval = interval || 16; 92 | elem.style.opacity = 0; 93 | elem.style.display = 'block'; 94 | var last = +new Date(); 95 | var tick = (function (_tick) { 96 | function tick() { 97 | return _tick.apply(this, arguments); 98 | } 99 | 100 | tick.toString = function () { 101 | return _tick.toString(); 102 | }; 103 | 104 | return tick; 105 | })(function () { 106 | elem.style.opacity = +elem.style.opacity + (new Date() - last) / 100; 107 | last = +new Date(); 108 | 109 | if (+elem.style.opacity < 1) { 110 | setTimeout(tick, interval); 111 | } 112 | }); 113 | tick(); 114 | } 115 | elem.style.display = 'block'; //fallback IE8 116 | }; 117 | 118 | var fadeOut = function fadeOut(elem, interval) { 119 | interval = interval || 16; 120 | elem.style.opacity = 1; 121 | var last = +new Date(); 122 | var tick = (function (_tick2) { 123 | function tick() { 124 | return _tick2.apply(this, arguments); 125 | } 126 | 127 | tick.toString = function () { 128 | return _tick2.toString(); 129 | }; 130 | 131 | return tick; 132 | })(function () { 133 | elem.style.opacity = +elem.style.opacity - (new Date() - last) / 100; 134 | last = +new Date(); 135 | 136 | if (+elem.style.opacity > 0) { 137 | setTimeout(tick, interval); 138 | } else { 139 | elem.style.display = 'none'; 140 | } 141 | }); 142 | tick(); 143 | }; 144 | 145 | var fireClick = function fireClick(node) { 146 | // Taken from http://www.nonobtrusive.com/2011/11/29/programatically-fire-crossbrowser-click-event-with-javascript/ 147 | // Then fixed for today's Chrome browser. 148 | if (typeof MouseEvent === 'function') { 149 | // Up-to-date approach 150 | var mevt = new MouseEvent('click', { 151 | view: window, 152 | bubbles: false, 153 | cancelable: true 154 | }); 155 | node.dispatchEvent(mevt); 156 | } else if (document.createEvent) { 157 | // Fallback 158 | var evt = document.createEvent('MouseEvents'); 159 | evt.initEvent('click', false, false); 160 | node.dispatchEvent(evt); 161 | } else if (document.createEventObject) { 162 | node.fireEvent('onclick'); 163 | } else if (typeof node.onclick === 'function') { 164 | node.onclick(); 165 | } 166 | }; 167 | 168 | var stopEventPropagation = function stopEventPropagation(e) { 169 | // In particular, make sure the space bar doesn't scroll the main window. 170 | if (typeof e.stopPropagation === 'function') { 171 | e.stopPropagation(); 172 | e.preventDefault(); 173 | } else if (window.event && window.event.hasOwnProperty('cancelBubble')) { 174 | window.event.cancelBubble = true; 175 | } 176 | }; 177 | 178 | exports.hasClass = hasClass; 179 | exports.addClass = addClass; 180 | exports.removeClass = removeClass; 181 | exports.escapeHtml = escapeHtml; 182 | exports._show = _show; 183 | exports.show = show; 184 | exports._hide = _hide; 185 | exports.hide = hide; 186 | exports.isDescendant = isDescendant; 187 | exports.getTopMargin = getTopMargin; 188 | exports.fadeIn = fadeIn; 189 | exports.fadeOut = fadeOut; 190 | exports.fireClick = fireClick; 191 | exports.stopEventPropagation = stopEventPropagation; -------------------------------------------------------------------------------- /Register/sweetalert/lib/modules/handle-key.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, '__esModule', { 4 | value: true 5 | }); 6 | 7 | var _stopEventPropagation$fireClick = require('./handle-dom'); 8 | 9 | var _setFocusStyle = require('./handle-swal-dom'); 10 | 11 | var handleKeyDown = function handleKeyDown(event, params, modal) { 12 | var e = event || window.event; 13 | var keyCode = e.keyCode || e.which; 14 | 15 | var $okButton = modal.querySelector('button.confirm'); 16 | var $cancelButton = modal.querySelector('button.cancel'); 17 | var $modalButtons = modal.querySelectorAll('button[tabindex]'); 18 | 19 | if ([9, 13, 32, 27].indexOf(keyCode) === -1) { 20 | // Don't do work on keys we don't care about. 21 | return; 22 | } 23 | 24 | var $targetElement = e.target || e.srcElement; 25 | 26 | var btnIndex = -1; // Find the button - note, this is a nodelist, not an array. 27 | for (var i = 0; i < $modalButtons.length; i++) { 28 | if ($targetElement === $modalButtons[i]) { 29 | btnIndex = i; 30 | break; 31 | } 32 | } 33 | 34 | if (keyCode === 9) { 35 | // TAB 36 | if (btnIndex === -1) { 37 | // No button focused. Jump to the confirm button. 38 | $targetElement = $okButton; 39 | } else { 40 | // Cycle to the next button 41 | if (btnIndex === $modalButtons.length - 1) { 42 | $targetElement = $modalButtons[0]; 43 | } else { 44 | $targetElement = $modalButtons[btnIndex + 1]; 45 | } 46 | } 47 | 48 | _stopEventPropagation$fireClick.stopEventPropagation(e); 49 | $targetElement.focus(); 50 | 51 | if (params.confirmButtonColor) { 52 | _setFocusStyle.setFocusStyle($targetElement, params.confirmButtonColor); 53 | } 54 | } else { 55 | if (keyCode === 13) { 56 | if ($targetElement.tagName === 'INPUT') { 57 | $targetElement = $okButton; 58 | $okButton.focus(); 59 | } 60 | 61 | if (btnIndex === -1) { 62 | // ENTER/SPACE clicked outside of a button. 63 | $targetElement = $okButton; 64 | } else { 65 | // Do nothing - let the browser handle it. 66 | $targetElement = undefined; 67 | } 68 | } else if (keyCode === 27 && params.allowEscapeKey === true) { 69 | $targetElement = $cancelButton; 70 | _stopEventPropagation$fireClick.fireClick($targetElement, e); 71 | } else { 72 | // Fallback - let the browser handle it. 73 | $targetElement = undefined; 74 | } 75 | } 76 | }; 77 | 78 | exports['default'] = handleKeyDown; 79 | module.exports = exports['default']; -------------------------------------------------------------------------------- /Register/sweetalert/lib/modules/handle-swal-dom.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }; 4 | 5 | Object.defineProperty(exports, '__esModule', { 6 | value: true 7 | }); 8 | 9 | var _hexToRgb = require('./utils'); 10 | 11 | var _removeClass$getTopMargin$fadeIn$show$addClass = require('./handle-dom'); 12 | 13 | var _defaultParams = require('./default-params'); 14 | 15 | var _defaultParams2 = _interopRequireWildcard(_defaultParams); 16 | 17 | /* 18 | * Add modal + overlay to DOM 19 | */ 20 | 21 | var _injectedHTML = require('./injected-html'); 22 | 23 | var _injectedHTML2 = _interopRequireWildcard(_injectedHTML); 24 | 25 | var modalClass = '.sweet-alert'; 26 | var overlayClass = '.sweet-overlay'; 27 | 28 | var sweetAlertInitialize = function sweetAlertInitialize() { 29 | var sweetWrap = document.createElement('div'); 30 | sweetWrap.innerHTML = _injectedHTML2['default']; 31 | 32 | // Append elements to body 33 | while (sweetWrap.firstChild) { 34 | document.body.appendChild(sweetWrap.firstChild); 35 | } 36 | }; 37 | 38 | /* 39 | * Get DOM element of modal 40 | */ 41 | var getModal = (function (_getModal) { 42 | function getModal() { 43 | return _getModal.apply(this, arguments); 44 | } 45 | 46 | getModal.toString = function () { 47 | return _getModal.toString(); 48 | }; 49 | 50 | return getModal; 51 | })(function () { 52 | var $modal = document.querySelector(modalClass); 53 | 54 | if (!$modal) { 55 | sweetAlertInitialize(); 56 | $modal = getModal(); 57 | } 58 | 59 | return $modal; 60 | }); 61 | 62 | /* 63 | * Get DOM element of input (in modal) 64 | */ 65 | var getInput = function getInput() { 66 | var $modal = getModal(); 67 | if ($modal) { 68 | return $modal.querySelector('input'); 69 | } 70 | }; 71 | 72 | /* 73 | * Get DOM element of overlay 74 | */ 75 | var getOverlay = function getOverlay() { 76 | return document.querySelector(overlayClass); 77 | }; 78 | 79 | /* 80 | * Add box-shadow style to button (depending on its chosen bg-color) 81 | */ 82 | var setFocusStyle = function setFocusStyle($button, bgColor) { 83 | var rgbColor = _hexToRgb.hexToRgb(bgColor); 84 | $button.style.boxShadow = '0 0 2px rgba(' + rgbColor + ', 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.05)'; 85 | }; 86 | 87 | /* 88 | * Animation when opening modal 89 | */ 90 | var openModal = function openModal(callback) { 91 | var $modal = getModal(); 92 | _removeClass$getTopMargin$fadeIn$show$addClass.fadeIn(getOverlay(), 10); 93 | _removeClass$getTopMargin$fadeIn$show$addClass.show($modal); 94 | _removeClass$getTopMargin$fadeIn$show$addClass.addClass($modal, 'showSweetAlert'); 95 | _removeClass$getTopMargin$fadeIn$show$addClass.removeClass($modal, 'hideSweetAlert'); 96 | 97 | window.previousActiveElement = document.activeElement; 98 | var $okButton = $modal.querySelector('button.confirm'); 99 | $okButton.focus(); 100 | 101 | setTimeout(function () { 102 | _removeClass$getTopMargin$fadeIn$show$addClass.addClass($modal, 'visible'); 103 | }, 500); 104 | 105 | var timer = $modal.getAttribute('data-timer'); 106 | 107 | if (timer !== 'null' && timer !== '') { 108 | var timerCallback = callback; 109 | $modal.timeout = setTimeout(function () { 110 | var doneFunctionExists = (timerCallback || null) && $modal.getAttribute('data-has-done-function') === 'true'; 111 | if (doneFunctionExists) { 112 | timerCallback(null); 113 | } else { 114 | sweetAlert.close(); 115 | } 116 | }, timer); 117 | } 118 | }; 119 | 120 | /* 121 | * Reset the styling of the input 122 | * (for example if errors have been shown) 123 | */ 124 | var resetInput = function resetInput() { 125 | var $modal = getModal(); 126 | var $input = getInput(); 127 | 128 | _removeClass$getTopMargin$fadeIn$show$addClass.removeClass($modal, 'show-input'); 129 | $input.value = _defaultParams2['default'].inputValue; 130 | $input.setAttribute('type', _defaultParams2['default'].inputType); 131 | $input.setAttribute('placeholder', _defaultParams2['default'].inputPlaceholder); 132 | 133 | resetInputError(); 134 | }; 135 | 136 | var resetInputError = function resetInputError(event) { 137 | // If press enter => ignore 138 | if (event && event.keyCode === 13) { 139 | return false; 140 | } 141 | 142 | var $modal = getModal(); 143 | 144 | var $errorIcon = $modal.querySelector('.sa-input-error'); 145 | _removeClass$getTopMargin$fadeIn$show$addClass.removeClass($errorIcon, 'show'); 146 | 147 | var $errorContainer = $modal.querySelector('.sa-error-container'); 148 | _removeClass$getTopMargin$fadeIn$show$addClass.removeClass($errorContainer, 'show'); 149 | }; 150 | 151 | /* 152 | * Set "margin-top"-property on modal based on its computed height 153 | */ 154 | var fixVerticalPosition = function fixVerticalPosition() { 155 | var $modal = getModal(); 156 | $modal.style.marginTop = _removeClass$getTopMargin$fadeIn$show$addClass.getTopMargin(getModal()); 157 | }; 158 | 159 | exports.sweetAlertInitialize = sweetAlertInitialize; 160 | exports.getModal = getModal; 161 | exports.getOverlay = getOverlay; 162 | exports.getInput = getInput; 163 | exports.setFocusStyle = setFocusStyle; 164 | exports.openModal = openModal; 165 | exports.resetInput = resetInput; 166 | exports.resetInputError = resetInputError; 167 | exports.fixVerticalPosition = fixVerticalPosition; -------------------------------------------------------------------------------- /Register/sweetalert/lib/modules/injected-html.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var injectedHTML = 7 | 8 | // Dark overlay 9 | "
" + 10 | 11 | // Modal 12 | "
" + 13 | 14 | // Error icon 15 | "
\n \n \n \n \n
" + 16 | 17 | // Warning icon 18 | "
\n \n \n
" + 19 | 20 | // Info icon 21 | "
" + 22 | 23 | // Success icon 24 | "
\n \n \n\n
\n
\n
" + "
" + 25 | 26 | // Title, text and input 27 | "

Title

\n

Text

\n
\n \n
\n
" + 28 | 29 | // Input errors 30 | "
\n
!
\n

Not valid!

\n
" + 31 | 32 | // Cancel and confirm buttons 33 | "
\n \n
\n " + 34 | 35 | // Loading animation 36 | "
\n
\n
\n
\n
\n
\n
" + 37 | 38 | // End of modal 39 | "
"; 40 | 41 | exports["default"] = injectedHTML; 42 | module.exports = exports["default"]; -------------------------------------------------------------------------------- /Register/sweetalert/lib/modules/set-params.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, '__esModule', { 4 | value: true 5 | }); 6 | 7 | var _isIE8 = require('./utils'); 8 | 9 | var _getModal$getInput$setFocusStyle = require('./handle-swal-dom'); 10 | 11 | var _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide = require('./handle-dom'); 12 | 13 | var alertTypes = ['error', 'warning', 'info', 'success', 'input', 'prompt']; 14 | 15 | /* 16 | * Set type, text and actions on modal 17 | */ 18 | var setParameters = function setParameters(params) { 19 | var modal = _getModal$getInput$setFocusStyle.getModal(); 20 | 21 | var $title = modal.querySelector('h2'); 22 | var $text = modal.querySelector('p'); 23 | var $cancelBtn = modal.querySelector('button.cancel'); 24 | var $confirmBtn = modal.querySelector('button.confirm'); 25 | 26 | /* 27 | * Title 28 | */ 29 | $title.innerHTML = params.html ? params.title : _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.escapeHtml(params.title).split('\n').join('
'); 30 | 31 | /* 32 | * Text 33 | */ 34 | $text.innerHTML = params.html ? params.text : _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.escapeHtml(params.text || '').split('\n').join('
'); 35 | if (params.text) _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.show($text); 36 | 37 | /* 38 | * Custom class 39 | */ 40 | if (params.customClass) { 41 | _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass(modal, params.customClass); 42 | modal.setAttribute('data-custom-class', params.customClass); 43 | } else { 44 | // Find previously set classes and remove them 45 | var customClass = modal.getAttribute('data-custom-class'); 46 | _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.removeClass(modal, customClass); 47 | modal.setAttribute('data-custom-class', ''); 48 | } 49 | 50 | /* 51 | * Icon 52 | */ 53 | _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.hide(modal.querySelectorAll('.sa-icon')); 54 | 55 | if (params.type && !_isIE8.isIE8()) { 56 | var _ret = (function () { 57 | 58 | var validType = false; 59 | 60 | for (var i = 0; i < alertTypes.length; i++) { 61 | if (params.type === alertTypes[i]) { 62 | validType = true; 63 | break; 64 | } 65 | } 66 | 67 | if (!validType) { 68 | logStr('Unknown alert type: ' + params.type); 69 | return { 70 | v: false 71 | }; 72 | } 73 | 74 | var typesWithIcons = ['success', 'error', 'warning', 'info']; 75 | var $icon = undefined; 76 | 77 | if (typesWithIcons.indexOf(params.type) !== -1) { 78 | $icon = modal.querySelector('.sa-icon.' + 'sa-' + params.type); 79 | _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.show($icon); 80 | } 81 | 82 | var $input = _getModal$getInput$setFocusStyle.getInput(); 83 | 84 | // Animate icon 85 | switch (params.type) { 86 | 87 | case 'success': 88 | _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass($icon, 'animate'); 89 | _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass($icon.querySelector('.sa-tip'), 'animateSuccessTip'); 90 | _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass($icon.querySelector('.sa-long'), 'animateSuccessLong'); 91 | break; 92 | 93 | case 'error': 94 | _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass($icon, 'animateErrorIcon'); 95 | _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass($icon.querySelector('.sa-x-mark'), 'animateXMark'); 96 | break; 97 | 98 | case 'warning': 99 | _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass($icon, 'pulseWarning'); 100 | _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass($icon.querySelector('.sa-body'), 'pulseWarningIns'); 101 | _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass($icon.querySelector('.sa-dot'), 'pulseWarningIns'); 102 | break; 103 | 104 | case 'input': 105 | case 'prompt': 106 | $input.setAttribute('type', params.inputType); 107 | $input.value = params.inputValue; 108 | $input.setAttribute('placeholder', params.inputPlaceholder); 109 | _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.addClass(modal, 'show-input'); 110 | setTimeout(function () { 111 | $input.focus(); 112 | $input.addEventListener('keyup', swal.resetInputError); 113 | }, 400); 114 | break; 115 | } 116 | })(); 117 | 118 | if (typeof _ret === 'object') { 119 | return _ret.v; 120 | } 121 | } 122 | 123 | /* 124 | * Custom image 125 | */ 126 | if (params.imageUrl) { 127 | var $customIcon = modal.querySelector('.sa-icon.sa-custom'); 128 | 129 | $customIcon.style.backgroundImage = 'url(' + params.imageUrl + ')'; 130 | _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.show($customIcon); 131 | 132 | var _imgWidth = 80; 133 | var _imgHeight = 80; 134 | 135 | if (params.imageSize) { 136 | var dimensions = params.imageSize.toString().split('x'); 137 | var imgWidth = dimensions[0]; 138 | var imgHeight = dimensions[1]; 139 | 140 | if (!imgWidth || !imgHeight) { 141 | logStr('Parameter imageSize expects value with format WIDTHxHEIGHT, got ' + params.imageSize); 142 | } else { 143 | _imgWidth = imgWidth; 144 | _imgHeight = imgHeight; 145 | } 146 | } 147 | 148 | $customIcon.setAttribute('style', $customIcon.getAttribute('style') + 'width:' + _imgWidth + 'px; height:' + _imgHeight + 'px'); 149 | } 150 | 151 | /* 152 | * Show cancel button? 153 | */ 154 | modal.setAttribute('data-has-cancel-button', params.showCancelButton); 155 | if (params.showCancelButton) { 156 | $cancelBtn.style.display = 'inline-block'; 157 | } else { 158 | _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.hide($cancelBtn); 159 | } 160 | 161 | /* 162 | * Show confirm button? 163 | */ 164 | modal.setAttribute('data-has-confirm-button', params.showConfirmButton); 165 | if (params.showConfirmButton) { 166 | $confirmBtn.style.display = 'inline-block'; 167 | } else { 168 | _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.hide($confirmBtn); 169 | } 170 | 171 | /* 172 | * Custom text on cancel/confirm buttons 173 | */ 174 | if (params.cancelButtonText) { 175 | $cancelBtn.innerHTML = _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.escapeHtml(params.cancelButtonText); 176 | } 177 | if (params.confirmButtonText) { 178 | $confirmBtn.innerHTML = _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide.escapeHtml(params.confirmButtonText); 179 | } 180 | 181 | /* 182 | * Custom color on confirm button 183 | */ 184 | if (params.confirmButtonColor) { 185 | // Set confirm button to selected background color 186 | $confirmBtn.style.backgroundColor = params.confirmButtonColor; 187 | 188 | // Set the confirm button color to the loading ring 189 | $confirmBtn.style.borderLeftColor = params.confirmLoadingButtonColor; 190 | $confirmBtn.style.borderRightColor = params.confirmLoadingButtonColor; 191 | 192 | // Set box-shadow to default focused button 193 | _getModal$getInput$setFocusStyle.setFocusStyle($confirmBtn, params.confirmButtonColor); 194 | } 195 | 196 | /* 197 | * Allow outside click 198 | */ 199 | modal.setAttribute('data-allow-outside-click', params.allowOutsideClick); 200 | 201 | /* 202 | * Callback function 203 | */ 204 | var hasDoneFunction = params.doneFunction ? true : false; 205 | modal.setAttribute('data-has-done-function', hasDoneFunction); 206 | 207 | /* 208 | * Animation 209 | */ 210 | if (!params.animation) { 211 | modal.setAttribute('data-animation', 'none'); 212 | } else if (typeof params.animation === 'string') { 213 | modal.setAttribute('data-animation', params.animation); // Custom animation 214 | } else { 215 | modal.setAttribute('data-animation', 'pop'); 216 | } 217 | 218 | /* 219 | * Timer 220 | */ 221 | modal.setAttribute('data-timer', params.timer); 222 | }; 223 | 224 | exports['default'] = setParameters; 225 | module.exports = exports['default']; -------------------------------------------------------------------------------- /Register/sweetalert/lib/modules/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, '__esModule', { 4 | value: true 5 | }); 6 | /* 7 | * Allow user to pass their own params 8 | */ 9 | var extend = function extend(a, b) { 10 | for (var key in b) { 11 | if (b.hasOwnProperty(key)) { 12 | a[key] = b[key]; 13 | } 14 | } 15 | return a; 16 | }; 17 | 18 | /* 19 | * Convert HEX codes to RGB values (#000000 -> rgb(0,0,0)) 20 | */ 21 | var hexToRgb = function hexToRgb(hex) { 22 | var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); 23 | return result ? parseInt(result[1], 16) + ', ' + parseInt(result[2], 16) + ', ' + parseInt(result[3], 16) : null; 24 | }; 25 | 26 | /* 27 | * Check if the user is using Internet Explorer 8 (for fallbacks) 28 | */ 29 | var isIE8 = function isIE8() { 30 | return window.attachEvent && !window.addEventListener; 31 | }; 32 | 33 | /* 34 | * IE compatible logging for developers 35 | */ 36 | var logStr = function logStr(string) { 37 | if (typeof(window) !== 'undefined' && window.console) { 38 | // IE... 39 | window.console.log('SweetAlert: ' + string); 40 | } 41 | }; 42 | 43 | /* 44 | * Set hover, active and focus-states for buttons 45 | * (source: http://www.sitepoint.com/javascript-generate-lighter-darker-color) 46 | */ 47 | var colorLuminance = function colorLuminance(hex, lum) { 48 | // Validate hex string 49 | hex = String(hex).replace(/[^0-9a-f]/gi, ''); 50 | if (hex.length < 6) { 51 | hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; 52 | } 53 | lum = lum || 0; 54 | 55 | // Convert to decimal and change luminosity 56 | var rgb = '#'; 57 | var c; 58 | var i; 59 | 60 | for (i = 0; i < 3; i++) { 61 | c = parseInt(hex.substr(i * 2, 2), 16); 62 | c = Math.round(Math.min(Math.max(0, c + c * lum), 255)).toString(16); 63 | rgb += ('00' + c).substr(c.length); 64 | } 65 | 66 | return rgb; 67 | }; 68 | 69 | exports.extend = extend; 70 | exports.hexToRgb = hexToRgb; 71 | exports.isIE8 = isIE8; 72 | exports.logStr = logStr; 73 | exports.colorLuminance = colorLuminance; 74 | -------------------------------------------------------------------------------- /Register/sweetalert/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sweetalert", 3 | "version": "1.1.3", 4 | "description": "A beautiful replacement for JavaScript's \"alert\"", 5 | "main": "lib/sweetalert.js", 6 | "directories": { 7 | "example": "example" 8 | }, 9 | "scripts": { 10 | "test": "gulp test" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/t4t5/sweetalert" 15 | }, 16 | "keywords": [ 17 | "sweetalert", 18 | "alert", 19 | "modal", 20 | "popup" 21 | ], 22 | "author": "Tristan Edwards (http://tristanedwards.me)", 23 | "license": "MIT", 24 | "bugs": { 25 | "url": "https://github.com/t4t5/sweetalert/issues" 26 | }, 27 | "homepage": "http://tristanedwards.me/sweetalert", 28 | "devDependencies": { 29 | "babelify": "^6.0.2", 30 | "browserify": "^9.0.8", 31 | "glob": "^5.0.3", 32 | "gulp": "^3.9.0", 33 | "gulp-babel": "^5.2.1", 34 | "gulp-concat": "^2.4.3", 35 | "gulp-jshint": "^1.9.0", 36 | "gulp-minify-css": "^0.3.13", 37 | "gulp-qunit": "latest", 38 | "gulp-rename": "^1.2.0", 39 | "gulp-sass": "^2.0.1", 40 | "gulp-uglify": "^1.0.2", 41 | "gulp-wrap": "^0.11.0", 42 | "path": "^0.11.14", 43 | "vinyl-buffer": "^1.0.0", 44 | "vinyl-source-stream": "^1.1.0" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Register/sweetalert/sweetalert.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fantasyhacking/RBSE/c59b35ff453bf56e3b3fe6dd74c284b7c70c69ea/Register/sweetalert/sweetalert.gif -------------------------------------------------------------------------------- /Register/sweetalert/test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Tests 6 | 7 | 8 | 9 | 10 |
11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Register/sweetalert/test/tests.js: -------------------------------------------------------------------------------- 1 | // swal() sould add the modal to the DOM + make it visible 2 | test("modal shows up", function() { 3 | equal($('.sweet-alert').length, 0); 4 | 5 | swal("Hello world!"); 6 | 7 | ok($('.sweet-alert').is(':visible')); 8 | }); 9 | 10 | // Clicking the confirm-button should dismiss the modal 11 | test("dismiss modal with confirm-button", function(assert) { 12 | var done = assert.async(); 13 | swal("Dismiss me"); 14 | 15 | var $modal = $('.sweet-alert'); 16 | $modal.find('button.confirm').click(); 17 | 18 | setTimeout(function() { 19 | assert.ok($modal.is(':hidden')); 20 | done(); 21 | }, 500); 22 | }); 23 | 24 | test("dismiss modal with esc-key", function(assert) { 25 | var done = assert.async(); 26 | swal("Dismiss me"); 27 | 28 | var $modal = $('.sweet-alert'); 29 | $(document).trigger($.Event('keydown', { 30 | keyCode: 27 31 | })); 32 | 33 | setTimeout(function() { 34 | assert.ok($modal.is(':hidden')); 35 | done(); 36 | }, 500); 37 | }); 38 | 39 | test("modals stays on with esc-key if allowEscapeKey is false", function(assert) { 40 | var done = assert.async(); 41 | swal({ 42 | title: "Dismiss me", 43 | allowEscapeKey: false 44 | }); 45 | 46 | var $modal = $('.sweet-alert'); 47 | $(document).trigger($.Event('keydown', { 48 | keyCode: 27 49 | })); 50 | 51 | setTimeout(function() { 52 | assert.ok($modal.is(':visible')); 53 | done(); 54 | }, 500); 55 | }); 56 | 57 | /* 58 | * Make sure that when using { showCancelButton: true }: 59 | * - The cancel-button is visible on the modal 60 | * - Clicking on it dismisses the modal 61 | */ 62 | test("cancel-button works", function(assert) { 63 | var done = assert.async(); 64 | swal({ 65 | title: "Test", 66 | showCancelButton: true 67 | }); 68 | 69 | var $modal = $('.sweet-alert'); 70 | var $cancelBtn = $modal.find('button.cancel'); 71 | ok($cancelBtn.is(':visible')); 72 | 73 | $cancelBtn.click(); 74 | 75 | setTimeout(function() { 76 | assert.ok($modal.is(':hidden')); 77 | done(); 78 | }, 500); 79 | }); 80 | 81 | // Clicking the overlay should not dismiss the modal... 82 | test("clicking the overlay does not dismiss modal", function(assert) { 83 | var done = assert.async(); 84 | swal("Test"); 85 | 86 | var $modal = $('.sweet-alert'); 87 | $('.sweet-overlay').click(); 88 | 89 | setTimeout(function() { 90 | assert.ok($modal.is(':visible')); 91 | done(); 92 | }, 500); 93 | }); 94 | 95 | 96 | // ...except if we pass allowOutsideClick: true 97 | test("clicking the overlay (with allowOutsideClick option) dismisses modal", function(assert) { 98 | var done = assert.async(); 99 | swal({ 100 | title: "Test", 101 | allowOutsideClick: true 102 | }); 103 | 104 | var $modal = $('.sweet-alert'); 105 | $('.sweet-overlay').click(); 106 | 107 | setTimeout(function() { 108 | assert.ok($modal.is(':hidden')); 109 | done(); 110 | }, 500); 111 | }); 112 | 113 | test("timer works", function(assert) { 114 | var done = assert.async(); 115 | swal({ 116 | title: "Timer test", 117 | showConfirmButton: false, 118 | timer: 500 119 | }); 120 | 121 | var $modal = $('.sweet-alert'); 122 | assert.ok($modal.find('button.cancel, button.confirm').is(':hidden')); 123 | 124 | setTimeout(function() { 125 | assert.ok($modal.is(':hidden')); 126 | done(); 127 | }, 1000); 128 | }); 129 | 130 | test("prompt functionality works", function() { 131 | swal({ 132 | title: "Prompt test", 133 | type: "input", 134 | inputPlaceholder: "Placeholder text" 135 | }); 136 | 137 | var $modal = $('.sweet-alert'); 138 | 139 | ok($modal.find('fieldset input').is(':visible')); 140 | equal($modal.find('fieldset input').attr('placeholder'), "Placeholder text"); 141 | }); 142 | -------------------------------------------------------------------------------- /Register/sweetalert/themes/facebook/facebook.css: -------------------------------------------------------------------------------- 1 | .sweet-overlay { 2 | border-radius: 3px; } 3 | 4 | .sweet-alert { 5 | font-family: Helvetica, Arial, 'lucida grande', tahoma, verdana, arial, sans-serif; 6 | padding: 12px; 7 | padding-top: 53px; 8 | text-align: right; 9 | box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.11), 0px 6px 30px rgba(0, 0, 0, 0.14); } 10 | .sweet-alert h2 { 11 | position: absolute; 12 | top: 0; 13 | left: 0; 14 | right: 0; 15 | height: 41px; 16 | background-color: #f6f7f8; 17 | margin: 0; 18 | font-size: 15px; 19 | text-align: left; 20 | padding-left: 12px; 21 | color: #131722; 22 | border-bottom: 1px solid #e5e5e5; } 23 | .sweet-alert p { 24 | display: block; 25 | text-align: center; 26 | color: #131722; 27 | font-weight: 400; 28 | font-size: 15px; 29 | margin-top: 7px; } 30 | .sweet-alert .sa-button-container { 31 | border-top: 1px solid #dcdee3; } 32 | .sweet-alert[data-has-confirm-button=false][data-has-cancel-button=false] { 33 | padding-bottom: 10px; } 34 | .sweet-alert[data-has-confirm-button=false][data-has-cancel-button=false] .sa-button-container { 35 | display: none; } 36 | .sweet-alert button { 37 | font-size: 12px; 38 | padding: 5px 10px; 39 | border-radius: 2px; 40 | box-shadow: none !important; 41 | text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.3); 42 | font-weight: 500; 43 | margin: 0; 44 | margin-top: 12px; } 45 | .sweet-alert button:focus, .sweet-alert button.cancel:focus { 46 | box-shadow: 0 0 1px 2px rgba(88, 144, 255, 0.75), 0 1px 1px rgba(0, 0, 0, 0.15) !important; } 47 | .sweet-alert button.confirm { 48 | border: 1px solid #3d5586; 49 | background-color: #47639c !important; 50 | margin-left: 4px; } 51 | .sweet-alert button.cancel { 52 | color: #4e5664; 53 | background-color: #fafbfb; 54 | text-shadow: 0px -1px 0px white; 55 | border: 1px solid #c5c6c8; 56 | box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.04) !important; 57 | font-weight: 600; } 58 | .sweet-alert button.cancel:hover { 59 | background-color: #fafbfb; } 60 | .sweet-alert .sa-icon:not(.sa-custom) { 61 | transform: scale(0.7); 62 | margin-bottom: -10px; 63 | margin-top: -10px; } 64 | .sweet-alert input { 65 | border: 1px solid #bdc7d8; 66 | padding: 3px; 67 | border-radius: 0; 68 | box-shadow: none; 69 | font-size: 15px; 70 | height: 33px; 71 | margin: 10px 0; } 72 | .sweet-alert input:focus { 73 | box-shadow: 0 0 1px 2px rgba(88, 144, 255, 0.75), 0 1px 1px rgba(0, 0, 0, 0.15) !important; } 74 | .sweet-alert fieldset .sa-input-error { 75 | display: none; } 76 | .sweet-alert .sa-error-container { 77 | text-align: center; 78 | background-color: #fdebe8; 79 | margin: 0; 80 | border: none; } 81 | .sweet-alert .sa-error-container.show { 82 | margin: 14px; 83 | margin-top: 0; 84 | border: 1px solid #d5512d; } 85 | .sweet-alert .sa-error-container .icon { 86 | display: none; } 87 | .sweet-alert .sa-error-container p { 88 | color: #303b44; 89 | margin-top: 3px; } 90 | 91 | @-webkit-keyframes animateErrorIcon { 92 | 0% { 93 | transform: rotateX(100deg), scale(0.5); 94 | -webkit-transform: rotateX(100deg), scale(0.5); 95 | opacity: 0; } 96 | 97 | 100% { 98 | transform: rotateX(0deg), scale(0.5); 99 | -webkit-transform: rotateX(0deg), scale(0.5); 100 | opacity: 1; } } 101 | 102 | @keyframes animateErrorIcon { 103 | 0% { 104 | transform: rotateX(100deg), scale(0.5); 105 | -webkit-transform: rotateX(100deg), scale(0.5); 106 | opacity: 0; } 107 | 108 | 100% { 109 | transform: rotateX(0deg), scale(0.5); 110 | -webkit-transform: rotateX(0deg), scale(0.5); 111 | opacity: 1; } } 112 | -------------------------------------------------------------------------------- /Register/sweetalert/themes/facebook/facebook.scss: -------------------------------------------------------------------------------- 1 | // Facebook Theme for SweetAlert 2 | // By Tristan Edwards 3 | 4 | .sweet-overlay { 5 | border-radius: 3px; 6 | } 7 | 8 | 9 | .sweet-alert { 10 | $header-height: 41px; 11 | $footer-height: 50px; 12 | $text-color: #131722; 13 | $fb-focus: 0 0 1px 2px rgba(88, 144, 255, .75), 0 1px 1px rgba(0, 0, 0, .15) !important; 14 | $padding: 12px; 15 | 16 | font-family: Helvetica, Arial, 'lucida grande', tahoma, verdana, arial, sans-serif; 17 | padding: $padding; 18 | padding-top: $header-height + $padding; 19 | text-align: right; // Align buttons 20 | box-shadow: 0px 0px 0px 1px rgba(black, 0.11), 0px 6px 30px rgba(black, 0.14); 21 | 22 | h2 { 23 | position: absolute; 24 | top: 0; 25 | left: 0; 26 | right: 0; 27 | height: $header-height; 28 | background-color: #f6f7f8; 29 | margin: 0; 30 | font-size: 15px; 31 | text-align: left; 32 | padding-left: 12px; 33 | color: $text-color; 34 | border-bottom: 1px solid #e5e5e5; 35 | } 36 | 37 | p { 38 | display: block; 39 | text-align: center; 40 | color: #131722; 41 | font-weight: 400; 42 | font-size: 15px; 43 | margin-top: 7px; 44 | } 45 | 46 | .sa-button-container { 47 | border-top: 1px solid #dcdee3; 48 | } 49 | &[data-has-confirm-button=false][data-has-cancel-button=false] { 50 | padding-bottom: 10px; 51 | .sa-button-container { 52 | display: none; 53 | } 54 | } 55 | 56 | button { 57 | font-size: 12px; 58 | padding: 5px 10px; 59 | border-radius: 2px; 60 | box-shadow: none !important; 61 | text-shadow: 0px -1px 0px rgba(black, 0.3); 62 | font-weight: 500; 63 | margin: 0; 64 | margin-top: $padding; 65 | &:focus, &.cancel:focus { 66 | box-shadow: $fb-focus; 67 | } 68 | 69 | &.confirm { 70 | border: 1px solid #3d5586; 71 | background-color: #47639c !important; 72 | margin-left: 4px; 73 | } 74 | &.cancel { 75 | color: #4e5664; 76 | background-color: #fafbfb; 77 | text-shadow: 0px -1px 0px white; 78 | border: 1px solid #c5c6c8; 79 | box-shadow: 0px 1px 1px rgba(black, 0.04) !important; 80 | font-weight: 600; 81 | &:hover { 82 | background-color: #fafbfb; 83 | } 84 | } 85 | } 86 | 87 | .sa-icon:not(.sa-custom) { 88 | transform: scale(0.7); 89 | margin-bottom: -10px; 90 | margin-top: -10px; 91 | } 92 | 93 | input { 94 | border: 1px solid #bdc7d8; 95 | padding: 3px; 96 | border-radius: 0; 97 | box-shadow: none; 98 | font-size: 15px; 99 | height: 33px; 100 | margin: 10px 0; 101 | &:focus { 102 | box-shadow: $fb-focus; 103 | } 104 | } 105 | 106 | fieldset .sa-input-error { 107 | display: none; 108 | } 109 | 110 | .sa-error-container { 111 | text-align: center; 112 | background-color: #fdebe8; 113 | margin: 0; 114 | border: none; 115 | &.show { 116 | margin: 14px; 117 | margin-top: 0; 118 | border: 1px solid #d5512d; 119 | } 120 | 121 | .icon { 122 | display: none; 123 | } 124 | p { 125 | color: #303b44; 126 | margin-top: 3px; 127 | } 128 | } 129 | } 130 | 131 | 132 | // Animations 133 | 134 | @mixin keyframes($animation-name) { 135 | @-webkit-keyframes #{$animation-name} { 136 | @content; 137 | } 138 | @keyframes #{$animation-name} { 139 | @content; 140 | } 141 | } 142 | 143 | @include keyframes(animateErrorIcon) { 144 | 0% { transform: rotateX(100deg), scale(0.5); -webkit-transform: rotateX(100deg), scale(0.5); opacity: 0; } 145 | 100% { transform: rotateX(0deg), scale(0.5); -webkit-transform: rotateX(0deg), scale(0.5); opacity: 1; } 146 | } -------------------------------------------------------------------------------- /Register/sweetalert/themes/google/google.css: -------------------------------------------------------------------------------- 1 | .sweet-overlay { 2 | background: rgba(10, 10, 10, 0.6); } 3 | 4 | .sweet-alert { 5 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 6 | padding: 24px; 7 | padding-top: 64px; 8 | padding-bottom: 13px; 9 | text-align: right; 10 | border-radius: 0; 11 | box-shadow: 0 0 14px rgba(0, 0, 0, 0.24), 0 14px 28px rgba(0, 0, 0, 0.48); } 12 | .sweet-alert h2 { 13 | position: absolute; 14 | top: 0; 15 | left: 0; 16 | right: 0; 17 | height: auto; 18 | font-weight: 400; 19 | color: #212121; 20 | margin: 20px 0; 21 | font-size: 1.2em; 22 | line-height: 1.25; 23 | text-align: left; 24 | padding: 0 24px; } 25 | .sweet-alert p { 26 | display: block; 27 | text-align: center; 28 | color: #212121; 29 | font-weight: 400; 30 | font-size: 14px; 31 | margin: 20px 0; } 32 | .sweet-alert button { 33 | border-radius: 2px; 34 | box-shadow: none !important; 35 | background: none !important; 36 | border-radius: 2px; 37 | text-transform: uppercase; 38 | font-size: 14px; 39 | font-weight: 600; 40 | padding: 8px 16px; 41 | position: relative; 42 | margin-top: 0; } 43 | .sweet-alert button:hover, .sweet-alert button:focus { 44 | background-color: #f6f6f6 !important; } 45 | .sweet-alert button.confirm { 46 | color: #3c80f6; } 47 | .sweet-alert button.cancel { 48 | color: #757575; } 49 | .sweet-alert button.cancel:focus { 50 | box-shadow: none !important; } 51 | .sweet-alert .sa-icon:not(.sa-custom) { 52 | transform: scale(0.8); 53 | margin-bottom: -10px; 54 | margin-top: -10px; } 55 | .sweet-alert input { 56 | border: none; 57 | border-radius: 0; 58 | border-bottom: 1px solid #c9c9c9; 59 | color: #212121; 60 | margin-bottom: 8px; 61 | padding: 1px; 62 | padding-bottom: 8px; 63 | height: auto; 64 | box-shadow: none; 65 | font-size: 13px; 66 | margin: 10px 0; } 67 | .sweet-alert input:focus { 68 | border: none; 69 | border-bottom: 1px solid #3c80f6; 70 | box-shadow: inset 0 -1px 0 #3c80f6; } 71 | .sweet-alert fieldset { 72 | padding: 0; } 73 | .sweet-alert fieldset .sa-input-error { 74 | display: none; } 75 | .sweet-alert .sa-error-container { 76 | display: none; 77 | background: none; 78 | height: auto; 79 | padding: 0 24px; 80 | margin: 0 -20px; 81 | text-align: left; } 82 | .sweet-alert .sa-error-container.show { 83 | padding: 0 24px; 84 | display: block; } 85 | .sweet-alert .sa-error-container.show ~ fieldset input { 86 | background: red; 87 | border-bottom: 1px solid #d9453c; 88 | box-shadow: inset 0 -1px 0 #d9453c; } 89 | .sweet-alert .sa-error-container .icon { 90 | display: none; } 91 | .sweet-alert .sa-error-container p { 92 | color: #d9453c; 93 | margin-top: 0; } 94 | 95 | @-webkit-keyframes animateErrorIcon { 96 | 0% { 97 | transform: rotateX(100deg), scale(0.5); 98 | -webkit-transform: rotateX(100deg), scale(0.5); 99 | opacity: 0; } 100 | 101 | 100% { 102 | transform: rotateX(0deg), scale(0.5); 103 | -webkit-transform: rotateX(0deg), scale(0.5); 104 | opacity: 1; } } 105 | 106 | @keyframes animateErrorIcon { 107 | 0% { 108 | transform: rotateX(100deg), scale(0.5); 109 | -webkit-transform: rotateX(100deg), scale(0.5); 110 | opacity: 0; } 111 | 112 | 100% { 113 | transform: rotateX(0deg), scale(0.5); 114 | -webkit-transform: rotateX(0deg), scale(0.5); 115 | opacity: 1; } } 116 | -------------------------------------------------------------------------------- /Register/sweetalert/themes/google/google.scss: -------------------------------------------------------------------------------- 1 | // Google Theme for SweetAlert 2 | // By Tristan Edwards 3 | 4 | .sweet-overlay { 5 | background: rgba(10,10,10,.6); 6 | } 7 | 8 | 9 | .sweet-alert { 10 | $header-height: 40px; 11 | $footer-height: 66px; 12 | $text-color: #212121; 13 | $padding: 24px; 14 | $error-color: #d9453c; 15 | 16 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 17 | padding: $padding; 18 | padding-top: $header-height + $padding; 19 | padding-bottom: 13px; 20 | text-align: right; // Align buttons 21 | border-radius: 0; 22 | box-shadow: 0 0 14px rgba(black, 0.24),0 14px 28px rgba(black, 0.48); 23 | 24 | h2 { 25 | position: absolute; 26 | top: 0; 27 | left: 0; 28 | right: 0; 29 | height: auto; 30 | font-weight: 400; 31 | color: $text-color; 32 | margin: 20px 0; 33 | font-size: 1.2em; 34 | line-height: 1.25; 35 | text-align: left; 36 | padding: 0 $padding; 37 | } 38 | 39 | p { 40 | display: block; 41 | text-align: center; 42 | color: $text-color; 43 | font-weight: 400; 44 | font-size: 14px; 45 | margin: 20px 0; 46 | } 47 | 48 | button { 49 | border-radius: 2px; 50 | box-shadow: none !important; 51 | background: none !important; 52 | border-radius: 2px; 53 | text-transform: uppercase; 54 | font-size: 14px; 55 | font-weight: 600; 56 | padding: 8px 16px; 57 | position: relative; 58 | margin-top: 0; 59 | &:hover, &:focus { 60 | background-color: #f6f6f6 !important; 61 | } 62 | 63 | &.confirm { 64 | color: #3c80f6; 65 | } 66 | &.cancel { 67 | color: #757575; 68 | &:focus { 69 | box-shadow: none !important; 70 | } 71 | } 72 | } 73 | 74 | .sa-icon:not(.sa-custom) { 75 | transform: scale(0.8); 76 | margin-bottom: -10px; 77 | margin-top: -10px; 78 | } 79 | 80 | input { 81 | border: none; 82 | border-radius: 0; 83 | border-bottom: 1px solid #c9c9c9; 84 | color: #212121; 85 | margin-bottom: 8px; 86 | padding: 1px; 87 | padding-bottom: 8px; 88 | height: auto; 89 | box-shadow: none; 90 | font-size: 13px; 91 | margin: 10px 0; 92 | &:focus { 93 | border: none; 94 | border-bottom: 1px solid #3c80f6; 95 | box-shadow: inset 0 -1px 0 #3c80f6; 96 | } 97 | } 98 | 99 | fieldset { 100 | padding: 0; 101 | .sa-input-error { 102 | display: none; 103 | } 104 | } 105 | 106 | .sa-error-container { 107 | display: none; 108 | background: none; 109 | height: auto; 110 | padding: 0 $padding; 111 | margin: 0 -20px; 112 | text-align: left; 113 | &.show { 114 | padding: 0 $padding; 115 | display: block; 116 | ~ fieldset input { 117 | background: red; 118 | border-bottom: 1px solid $error-color; 119 | box-shadow: inset 0 -1px 0 $error-color; 120 | } 121 | } 122 | 123 | .icon { 124 | display: none; 125 | } 126 | p { 127 | color: $error-color; 128 | margin-top: 0; 129 | } 130 | } 131 | } 132 | 133 | 134 | // Animations 135 | 136 | @mixin keyframes($animation-name) { 137 | @-webkit-keyframes #{$animation-name} { 138 | @content; 139 | } 140 | @keyframes #{$animation-name} { 141 | @content; 142 | } 143 | } 144 | 145 | @include keyframes(animateErrorIcon) { 146 | 0% { transform: rotateX(100deg), scale(0.5); -webkit-transform: rotateX(100deg), scale(0.5); opacity: 0; } 147 | 100% { transform: rotateX(0deg), scale(0.5); -webkit-transform: rotateX(0deg), scale(0.5); opacity: 1; } 148 | } -------------------------------------------------------------------------------- /Register/sweetalert/themes/twitter/twitter.css: -------------------------------------------------------------------------------- 1 | .sweet-overlay { 2 | background: rgba(41, 47, 51, 0.9); } 3 | 4 | .sweet-alert { 5 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 6 | padding: 15px; 7 | padding-top: 55px; 8 | text-align: right; 9 | border-radius: 6px; 10 | box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.11), 0px 6px 30px rgba(0, 0, 0, 0.14); } 11 | .sweet-alert h2 { 12 | position: absolute; 13 | top: 0; 14 | left: 0; 15 | right: 0; 16 | height: 40px; 17 | line-height: 40px; 18 | font-size: 16px; 19 | font-weight: 400; 20 | color: #8899a6; 21 | margin: 0; 22 | color: #66757f; 23 | border-bottom: 1px solid #e1e8ed; } 24 | .sweet-alert p { 25 | display: block; 26 | text-align: center; 27 | color: #66757f; 28 | font-weight: 400; 29 | font-size: 13px; 30 | margin-top: 7px; } 31 | .sweet-alert .sa-button-container { 32 | background-color: #f5f8fa; 33 | border-top: 1px solid #e1e8ed; 34 | box-shadow: 0px -1px 0px white; 35 | margin: -15px; 36 | margin-top: 0; } 37 | .sweet-alert[data-has-confirm-button=false][data-has-cancel-button=false] { 38 | padding-bottom: 10px; } 39 | .sweet-alert[data-has-confirm-button=false][data-has-cancel-button=false] .sa-button-container { 40 | display: none; } 41 | .sweet-alert button { 42 | border-radius: 2px; 43 | box-shadow: none !important; 44 | text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.3); 45 | margin: 17px 0px; 46 | border-radius: 4px; 47 | font-size: 14px; 48 | font-weight: 600; 49 | padding: 8px 16px; 50 | position: relative; } 51 | .sweet-alert button:focus, .sweet-alert button.cancel:focus { 52 | box-shadow: none !important; } 53 | .sweet-alert button:focus::before, .sweet-alert button.cancel:focus::before { 54 | content: ""; 55 | position: absolute; 56 | left: -5px; 57 | top: -5px; 58 | right: -5px; 59 | bottom: -5px; 60 | border: 2px solid #a5b0b4; 61 | border-radius: 8px; } 62 | .sweet-alert button.confirm { 63 | background-color: #55acee !important; 64 | background-image: linear-gradient(transparent, rgba(0, 0, 0, 0.05)); 65 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000, endColorstr=#0C000000)"; 66 | border: 1px solid #3b88c3; 67 | box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15); 68 | margin-right: 15px; } 69 | .sweet-alert button.confirm:hover { 70 | background-color: #55acee; 71 | background-image: linear-gradient(transparent, rgba(0, 0, 0, 0.15)); 72 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000, endColorstr=#26000000)"; 73 | border-color: #3b88c3; } 74 | .sweet-alert button.cancel { 75 | color: #66757e; 76 | background-color: #f5f8fa; 77 | background-image: linear-gradient(#fff, #f5f8fa); 78 | text-shadow: 0px -1px 0px white; 79 | margin-right: 9px; 80 | border: 1px solid #e1e8ed; } 81 | .sweet-alert button.cancel:hover, .sweet-alert button.cancel:focus:hover { 82 | background-color: #e1e8ed; 83 | background-image: linear-gradient(#fff, #e1e8ed); 84 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(enabled=false)"; 85 | border-color: #e1e8ed; } 86 | .sweet-alert button.cancel:focus { 87 | background: #fff; 88 | border-color: #fff; } 89 | .sweet-alert .sa-icon:not(.sa-custom) { 90 | transform: scale(0.72); 91 | margin-bottom: -2px; 92 | margin-top: -10px; } 93 | .sweet-alert input { 94 | border: 1px solid #e1e8ed; 95 | border-radius: 3px; 96 | padding: 10px 7px; 97 | height: auto; 98 | box-shadow: none; 99 | font-size: 13px; 100 | margin: 10px 0; } 101 | .sweet-alert input:focus { 102 | border-color: #94A1A6; 103 | box-shadow: inset 0 0 0 1px rgba(77, 99, 107, 0.7); } 104 | .sweet-alert fieldset .sa-input-error { 105 | display: none; } 106 | .sweet-alert .sa-error-container { 107 | text-align: center; 108 | border: none; 109 | background-color: #fbedc0; 110 | margin-bottom: 6px; } 111 | .sweet-alert .sa-error-container.show { 112 | border: 1px solid #f0e1b9; } 113 | .sweet-alert .sa-error-container .icon { 114 | display: none; } 115 | .sweet-alert .sa-error-container p { 116 | color: #292f33; 117 | font-weight: 600; 118 | margin-top: 0; } 119 | 120 | @-webkit-keyframes animateErrorIcon { 121 | 0% { 122 | transform: rotateX(100deg), scale(0.5); 123 | -webkit-transform: rotateX(100deg), scale(0.5); 124 | opacity: 0; } 125 | 126 | 100% { 127 | transform: rotateX(0deg), scale(0.5); 128 | -webkit-transform: rotateX(0deg), scale(0.5); 129 | opacity: 1; } } 130 | 131 | @keyframes animateErrorIcon { 132 | 0% { 133 | transform: rotateX(100deg), scale(0.5); 134 | -webkit-transform: rotateX(100deg), scale(0.5); 135 | opacity: 0; } 136 | 137 | 100% { 138 | transform: rotateX(0deg), scale(0.5); 139 | -webkit-transform: rotateX(0deg), scale(0.5); 140 | opacity: 1; } } 141 | -------------------------------------------------------------------------------- /Register/sweetalert/themes/twitter/twitter.scss: -------------------------------------------------------------------------------- 1 | // Twitter Theme for SweetAlert 2 | // By Tristan Edwards 3 | 4 | .sweet-overlay { 5 | background: rgba(41,47,51,0.9); 6 | } 7 | 8 | 9 | .sweet-alert { 10 | $header-height: 40px; 11 | $footer-height: 66px; 12 | $text-color: #66757f; 13 | $padding: 15px; 14 | 15 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 16 | padding: $padding; 17 | padding-top: $header-height + $padding; 18 | text-align: right; // Align buttons 19 | border-radius: 6px; 20 | box-shadow: 0px 0px 0px 1px rgba(black, 0.11), 0px 6px 30px rgba(black, 0.14); 21 | 22 | h2 { 23 | position: absolute; 24 | top: 0; 25 | left: 0; 26 | right: 0; 27 | height: $header-height; 28 | line-height: $header-height; 29 | font-size: 16px; 30 | font-weight: 400; 31 | color: #8899a6; 32 | margin: 0; 33 | color: $text-color; 34 | border-bottom: 1px solid #e1e8ed; 35 | } 36 | 37 | p { 38 | display: block; 39 | text-align: center; 40 | color: #66757f; 41 | font-weight: 400; 42 | font-size: 13px; 43 | margin-top: 7px; 44 | } 45 | 46 | .sa-button-container { 47 | background-color: #f5f8fa; 48 | border-top: 1px solid #e1e8ed; 49 | box-shadow: 0px -1px 0px white; 50 | margin: -$padding; 51 | margin-top: 0; 52 | } 53 | &[data-has-confirm-button=false][data-has-cancel-button=false] { 54 | padding-bottom: 10px; 55 | .sa-button-container { 56 | display: none; 57 | } 58 | } 59 | 60 | button { 61 | border-radius: 2px; 62 | box-shadow: none !important; 63 | text-shadow: 0px -1px 0px rgba(black, 0.3); 64 | margin: 17px 0px; 65 | border-radius: 4px; 66 | font-size: 14px; 67 | font-weight: 600; 68 | padding: 8px 16px; 69 | position: relative; 70 | &:focus, &.cancel:focus { 71 | box-shadow: none !important; 72 | &::before { 73 | content: ""; 74 | position: absolute; 75 | left: -5px; 76 | top: -5px; 77 | right: -5px; 78 | bottom: -5px; 79 | border: 2px solid #a5b0b4; 80 | border-radius: 8px; 81 | } 82 | } 83 | 84 | &.confirm { 85 | background-color: #55acee !important; 86 | background-image: linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.05)); 87 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000, endColorstr=#0C000000)"; 88 | border: 1px solid #3b88c3; 89 | box-shadow: inset 0 1px 0 rgba(255,255,255,0.15); 90 | margin-right: $padding; 91 | &:hover { 92 | background-color: #55acee; 93 | background-image: linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.15)); 94 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000, endColorstr=#26000000)"; 95 | border-color: #3b88c3; 96 | } 97 | } 98 | &.cancel { 99 | color: #66757e; 100 | background-color: #f5f8fa; 101 | background-image: linear-gradient(#fff,#f5f8fa); 102 | text-shadow: 0px -1px 0px white; 103 | margin-right: 9px; 104 | border: 1px solid #e1e8ed; 105 | &:hover, &:focus:hover { 106 | background-color: #e1e8ed; 107 | background-image: linear-gradient(#fff,#e1e8ed); 108 | -ms-filter: "progid:DXImageTransform.Microsoft.gradient(enabled=false)"; 109 | border-color: #e1e8ed; 110 | } 111 | &:focus { 112 | background: #fff; 113 | border-color: #fff; 114 | } 115 | } 116 | } 117 | 118 | .sa-icon:not(.sa-custom) { 119 | transform: scale(0.72); 120 | margin-bottom: -2px; 121 | margin-top: -10px; 122 | } 123 | 124 | input { 125 | border: 1px solid #e1e8ed; 126 | border-radius: 3px; 127 | padding: 10px 7px; 128 | height: auto; 129 | box-shadow: none; 130 | font-size: 13px; 131 | margin: 10px 0; 132 | &:focus { 133 | border-color: #94A1A6; 134 | box-shadow: inset 0 0 0 1px rgba(77, 99, 107, 0.7); 135 | } 136 | } 137 | 138 | fieldset .sa-input-error { 139 | display: none; 140 | } 141 | 142 | .sa-error-container { 143 | text-align: center; 144 | border: none; 145 | background-color: #fbedc0; 146 | margin-bottom: 6px; 147 | &.show { 148 | border: 1px solid #f0e1b9; 149 | } 150 | 151 | .icon { 152 | display: none; 153 | } 154 | p { 155 | color: #292f33; 156 | font-weight: 600; 157 | margin-top: 0; 158 | } 159 | } 160 | } 161 | 162 | 163 | // Animations 164 | 165 | @mixin keyframes($animation-name) { 166 | @-webkit-keyframes #{$animation-name} { 167 | @content; 168 | } 169 | @keyframes #{$animation-name} { 170 | @content; 171 | } 172 | } 173 | 174 | @include keyframes(animateErrorIcon) { 175 | 0% { transform: rotateX(100deg), scale(0.5); -webkit-transform: rotateX(100deg), scale(0.5); opacity: 0; } 176 | 100% { transform: rotateX(0deg), scale(0.5); -webkit-transform: rotateX(0deg), scale(0.5); opacity: 1; } 177 | } -------------------------------------------------------------------------------- /Run.rb: -------------------------------------------------------------------------------- 1 | require './Config/Config.rb' 2 | require './Extensions/Crumbs.rb' 3 | require './Extensions/Database.rb' 4 | require './Extensions/TCP.rb' 5 | require './Extensions/XTParser.rb' 6 | 7 | require './Core/Gaming/FindFour.rb' 8 | require './Core/Gaming/Mancala.rb' 9 | require './Core/Gaming/TreasureHunt.rb' 10 | 11 | require './Core/Login.rb' 12 | require './Core/Game.rb' 13 | 14 | require './Core/ClubPenguin.rb' 15 | require './Core/CPUser.rb' 16 | 17 | 18 | server = ClubPenguin.new(getConfig) 19 | 20 | server.startEmulator 21 | 22 | while true 23 | server.sock.listenServer 24 | end 25 | --------------------------------------------------------------------------------