From ce1c2b6b05c08b669357947e61ae40efce7fc50f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 16 Feb 2015 10:46:28 +0100 Subject: module temp --- pyload/Core.py | 632 --- pyload/__init__.py | 102 - pyload/api/__init__.py | 973 ---- pyload/api/types.py | 381 -- pyload/cli/AddPackage.py | 50 - pyload/cli/Cli.py | 570 -- pyload/cli/Handler.py | 32 - pyload/cli/ManageFiles.py | 178 - pyload/cli/__init__.py | 4 - pyload/config/Parser.py | 353 -- pyload/config/Setup.py | 553 -- pyload/config/__init__.py | 1 - pyload/config/default.conf | 65 - pyload/database/DatabaseBackend.py | 290 - pyload/database/File.py | 875 --- pyload/database/Storage.py | 34 - pyload/database/User.py | 93 - pyload/database/__init__.py | 7 - pyload/datatype/File.py | 270 - pyload/datatype/Package.py | 64 - pyload/datatype/__init__.py | 1 - pyload/manager/Account.py | 191 - pyload/manager/Addon.py | 304 - pyload/manager/Captcha.py | 138 - pyload/manager/Event.py | 104 - pyload/manager/Plugin.py | 404 -- pyload/manager/Remote.py | 76 - pyload/manager/Thread.py | 302 - pyload/manager/__init__.py | 1 - pyload/manager/event/Scheduler.py | 126 - pyload/manager/event/__init__.py | 1 - pyload/manager/thread/Addon.py | 69 - pyload/manager/thread/Decrypter.py | 101 - pyload/manager/thread/Download.py | 213 - pyload/manager/thread/Info.py | 225 - pyload/manager/thread/Plugin.py | 130 - pyload/manager/thread/Server.py | 111 - pyload/manager/thread/__init__.py | 1 - pyload/network/Browser.py | 132 - pyload/network/Bucket.py | 52 - pyload/network/CookieJar.py | 42 - pyload/network/HTTPChunk.py | 294 - pyload/network/HTTPDownload.py | 312 - pyload/network/HTTPRequest.py | 302 - pyload/network/JsEngine.py | 256 - pyload/network/RequestFactory.py | 121 - pyload/network/XDCCRequest.py | 144 - pyload/network/__init__.py | 1 - pyload/plugin/Account.py | 307 - pyload/plugin/Addon.py | 185 - pyload/plugin/Captcha.py | 51 - pyload/plugin/Container.py | 66 - pyload/plugin/Crypter.py | 107 - pyload/plugin/Hoster.py | 21 - pyload/plugin/OCR.py | 315 -- pyload/plugin/Plugin.py | 753 --- pyload/plugin/__init__.py | 1 - pyload/plugin/account/AlldebridCom.py | 59 - pyload/plugin/account/BayfilesCom.py | 37 - pyload/plugin/account/BillionuploadsCom.py | 16 - pyload/plugin/account/BitshareCom.py | 32 - pyload/plugin/account/CatShareNet.py | 56 - pyload/plugin/account/CramitIn.py | 16 - pyload/plugin/account/CzshareCom.py | 44 - pyload/plugin/account/DebridItaliaCom.py | 44 - pyload/plugin/account/DepositfilesCom.py | 35 - pyload/plugin/account/DropboxCom.py | 42 - pyload/plugin/account/EasybytezCom.py | 19 - pyload/plugin/account/EuroshareEu.py | 41 - pyload/plugin/account/FastixRu.py | 38 - pyload/plugin/account/FastshareCz.py | 53 - pyload/plugin/account/File4SafeCom.py | 18 - pyload/plugin/account/FileParadoxIn.py | 16 - pyload/plugin/account/FilecloudIo.py | 59 - pyload/plugin/account/FilefactoryCom.py | 49 - pyload/plugin/account/FilejungleCom.py | 49 - pyload/plugin/account/FileomCom.py | 16 - pyload/plugin/account/FilerNet.py | 50 - pyload/plugin/account/FilerioCom.py | 16 - pyload/plugin/account/FilesMailRu.py | 28 - pyload/plugin/account/FileserveCom.py | 44 - pyload/plugin/account/FourSharedCom.py | 33 - pyload/plugin/account/FreakshareCom.py | 43 - pyload/plugin/account/FreeWayMe.py | 55 - pyload/plugin/account/FshareVn.py | 63 - pyload/plugin/account/Ftp.py | 17 - pyload/plugin/account/HellshareCz.py | 76 - pyload/plugin/account/Http.py | 17 - pyload/plugin/account/HugefilesNet.py | 16 - pyload/plugin/account/HundredEightyUploadCom.py | 16 - pyload/plugin/account/JunocloudMe.py | 16 - pyload/plugin/account/Keep2ShareCc.py | 69 - pyload/plugin/account/LetitbitNet.py | 34 - pyload/plugin/account/LinestorageCom.py | 16 - pyload/plugin/account/LinksnappyCom.py | 50 - pyload/plugin/account/LomafileCom.py | 16 - pyload/plugin/account/MegaDebridEu.py | 39 - pyload/plugin/account/MegaRapidCz.py | 59 - pyload/plugin/account/MegasharesCom.py | 48 - pyload/plugin/account/MovReelCom.py | 19 - pyload/plugin/account/MultishareCz.py | 44 - pyload/plugin/account/MyfastfileCom.py | 35 - pyload/plugin/account/NetloadIn.py | 40 - pyload/plugin/account/NosuploadCom.py | 16 - pyload/plugin/account/NovafileCom.py | 16 - pyload/plugin/account/NowVideoSx.py | 56 - pyload/plugin/account/OboomCom.py | 62 - pyload/plugin/account/OneFichierCom.py | 55 - pyload/plugin/account/OverLoadMe.py | 36 - pyload/plugin/account/PremiumTo.py | 34 - pyload/plugin/account/PremiumizeMe.py | 49 - pyload/plugin/account/QuickshareCz.py | 43 - pyload/plugin/account/RPNetBiz.py | 51 - pyload/plugin/account/RapidfileshareNet.py | 18 - pyload/plugin/account/RapidgatorNet.py | 58 - pyload/plugin/account/RapiduNet.py | 48 - pyload/plugin/account/RarefileNet.py | 16 - pyload/plugin/account/RealdebridCom.py | 36 - pyload/plugin/account/RehostTo.py | 41 - pyload/plugin/account/RyushareCom.py | 25 - pyload/plugin/account/SafesharingEu.py | 16 - pyload/plugin/account/SecureUploadEu.py | 16 - pyload/plugin/account/SendmywayCom.py | 16 - pyload/plugin/account/ShareonlineBiz.py | 45 - pyload/plugin/account/SimplyPremiumCom.py | 46 - pyload/plugin/account/SimplydebridCom.py | 34 - pyload/plugin/account/StahnuTo.py | 34 - pyload/plugin/account/StreamcloudEu.py | 16 - pyload/plugin/account/TurbobitNet.py | 42 - pyload/plugin/account/TusfilesNet.py | 23 - pyload/plugin/account/UlozTo.py | 52 - pyload/plugin/account/UnrestrictLi.py | 44 - pyload/plugin/account/UploadcCom.py | 16 - pyload/plugin/account/UploadedTo.py | 60 - pyload/plugin/account/UploadheroCom.py | 41 - pyload/plugin/account/UploadingCom.py | 63 - pyload/plugin/account/UptoboxCom.py | 17 - pyload/plugin/account/VidPlayNet.py | 16 - pyload/plugin/account/XFileSharingPro.py | 30 - pyload/plugin/account/YibaishiwuCom.py | 40 - pyload/plugin/account/ZeveraCom.py | 56 - pyload/plugin/account/__init__.py | 1 - pyload/plugin/addon/Checksum.py | 186 - pyload/plugin/addon/ClickAndLoad.py | 74 - pyload/plugin/addon/DeleteFinished.py | 79 - pyload/plugin/addon/DownloadScheduler.py | 77 - pyload/plugin/addon/ExternalScripts.py | 145 - pyload/plugin/addon/ExtractArchive.py | 363 -- pyload/plugin/addon/HotFolder.py | 70 - pyload/plugin/addon/IRCInterface.py | 431 -- pyload/plugin/addon/MergeFiles.py | 85 - pyload/plugin/addon/MultiHome.py | 81 - pyload/plugin/addon/RestartFailed.py | 45 - pyload/plugin/addon/RestartSlow.py | 57 - pyload/plugin/addon/SkipRev.py | 77 - pyload/plugin/addon/UnSkipOnFail.py | 87 - pyload/plugin/addon/UpdateManager.py | 305 - pyload/plugin/addon/WindowsPhoneToastNotify.py | 57 - pyload/plugin/addon/XMPPInterface.py | 252 - pyload/plugin/addon/__init__.py | 1 - pyload/plugin/captcha/AdYouLike.py | 107 - pyload/plugin/captcha/AdsCaptcha.py | 77 - pyload/plugin/captcha/ReCaptcha.py | 73 - pyload/plugin/captcha/SolveMedia.py | 50 - pyload/plugin/captcha/__init__.py | 1 - pyload/plugin/container/CCF.py | 43 - pyload/plugin/container/LinkList.py | 71 - pyload/plugin/container/RSDF.py | 56 - pyload/plugin/container/__init__.py | 1 - pyload/plugin/crypter/BitshareCom.py | 21 - pyload/plugin/crypter/C1NeonCom.py | 19 - pyload/plugin/crypter/ChipDe.py | 29 - pyload/plugin/crypter/CrockoCom.py | 20 - pyload/plugin/crypter/CryptItCom.py | 19 - pyload/plugin/crypter/CzshareCom.py | 32 - pyload/plugin/crypter/DDLMusicOrg.py | 51 - pyload/plugin/crypter/DailymotionBatch.py | 106 - pyload/plugin/crypter/DataHu.py | 40 - pyload/plugin/crypter/DdlstorageCom.py | 20 - pyload/plugin/crypter/DepositfilesCom.py | 20 - pyload/plugin/crypter/Dereferer.py | 26 - pyload/plugin/crypter/DevhostStFolder.py | 58 - pyload/plugin/crypter/DlProtectCom.py | 65 - pyload/plugin/crypter/DontKnowMe.py | 29 - pyload/plugin/crypter/DuckCryptInfo.py | 59 - pyload/plugin/crypter/DuploadOrg.py | 19 - pyload/plugin/crypter/EasybytezCom.py | 22 - pyload/plugin/crypter/EmbeduploadCom.py | 60 - pyload/plugin/crypter/FilebeerInfo.py | 19 - pyload/plugin/crypter/FilecloudIo.py | 21 - pyload/plugin/crypter/FilecryptCc.py | 148 - pyload/plugin/crypter/FilefactoryCom.py | 28 - pyload/plugin/crypter/FilerNet.py | 26 - pyload/plugin/crypter/FileserveCom.py | 38 - pyload/plugin/crypter/FilesonicCom.py | 18 - pyload/plugin/crypter/FilestubeCom.py | 21 - pyload/plugin/crypter/FiletramCom.py | 22 - pyload/plugin/crypter/FiredriveCom.py | 19 - pyload/plugin/crypter/FourChanOrg.py | 27 - pyload/plugin/crypter/FreakhareCom.py | 38 - pyload/plugin/crypter/FreetexthostCom.py | 27 - pyload/plugin/crypter/FshareVn.py | 20 - pyload/plugin/crypter/Go4UpCom.py | 49 - pyload/plugin/crypter/GooGl.py | 32 - pyload/plugin/crypter/HoerbuchIn.py | 62 - pyload/plugin/crypter/HotfileCom.py | 19 - pyload/plugin/crypter/ILoadTo.py | 19 - pyload/plugin/crypter/ImgurComAlbum.py | 27 - pyload/plugin/crypter/JunocloudMe.py | 20 - pyload/plugin/crypter/LetitbitNet.py | 33 - pyload/plugin/crypter/LinkCryptWs.py | 327 -- pyload/plugin/crypter/LinkSaveIn.py | 246 - pyload/plugin/crypter/LinkdecrypterCom.py | 92 - pyload/plugin/crypter/LixIn.py | 62 - pyload/plugin/crypter/LofCc.py | 19 - pyload/plugin/crypter/MBLinkInfo.py | 20 - pyload/plugin/crypter/MediafireCom.py | 58 - pyload/plugin/crypter/MegaRapidCz.py | 20 - pyload/plugin/crypter/MegauploadCom.py | 18 - pyload/plugin/crypter/Movie2KTo.py | 19 - pyload/plugin/crypter/MultiUpOrg.py | 38 - pyload/plugin/crypter/MultiloadCz.py | 42 - pyload/plugin/crypter/MultiuploadCom.py | 18 - pyload/plugin/crypter/NCryptIn.py | 315 -- pyload/plugin/crypter/NetfolderIn.py | 70 - pyload/plugin/crypter/NosvideoCom.py | 21 - pyload/plugin/crypter/OneKhDe.py | 40 - pyload/plugin/crypter/OronCom.py | 19 - pyload/plugin/crypter/PastebinCom.py | 21 - pyload/plugin/crypter/QuickshareCz.py | 31 - pyload/plugin/crypter/RSLayerCom.py | 19 - pyload/plugin/crypter/RapidfileshareNet.py | 20 - pyload/plugin/crypter/RelinkUs.py | 293 - pyload/plugin/crypter/SafelinkingNet.py | 79 - pyload/plugin/crypter/SecuredIn.py | 19 - pyload/plugin/crypter/SexuriaCom.py | 94 - pyload/plugin/crypter/ShareLinksBiz.py | 286 - pyload/plugin/crypter/SharingmatrixCom.py | 18 - pyload/plugin/crypter/SpeedLoadOrg.py | 19 - pyload/plugin/crypter/StealthTo.py | 19 - pyload/plugin/crypter/TnyCz.py | 27 - pyload/plugin/crypter/TrailerzoneInfo.py | 19 - pyload/plugin/crypter/TurbobitNet.py | 44 - pyload/plugin/crypter/TusfilesNet.py | 45 - pyload/plugin/crypter/UlozTo.py | 46 - pyload/plugin/crypter/UploadableCh.py | 24 - pyload/plugin/crypter/UploadedTo.py | 34 - pyload/plugin/crypter/WiiReloadedOrg.py | 19 - pyload/plugin/crypter/WuploadCom.py | 18 - pyload/plugin/crypter/XFileSharingPro.py | 47 - pyload/plugin/crypter/XupPl.py | 25 - pyload/plugin/crypter/YoutubeBatch.py | 148 - pyload/plugin/crypter/__init__.py | 1 - pyload/plugin/hook/AlldebridCom.py | 27 - pyload/plugin/hook/BypassCaptcha.py | 133 - pyload/plugin/hook/Captcha9Kw.py | 253 - pyload/plugin/hook/CaptchaBrotherhood.py | 166 - pyload/plugin/hook/DeathByCaptcha.py | 213 - pyload/plugin/hook/DebridItaliaCom.py | 27 - pyload/plugin/hook/EasybytezCom.py | 39 - pyload/plugin/hook/ExpertDecoders.py | 92 - pyload/plugin/hook/FastixRu.py | 28 - pyload/plugin/hook/FreeWayMe.py | 25 - pyload/plugin/hook/ImageTyperz.py | 151 - pyload/plugin/hook/LinkdecrypterCom.py | 60 - pyload/plugin/hook/LinksnappyCom.py | 27 - pyload/plugin/hook/MegaDebridEu.py | 30 - pyload/plugin/hook/MultishareCz.py | 27 - pyload/plugin/hook/MyfastfileCom.py | 30 - pyload/plugin/hook/OverLoadMe.py | 29 - pyload/plugin/hook/PremiumTo.py | 38 - pyload/plugin/hook/PremiumizeMe.py | 54 - pyload/plugin/hook/RPNetBiz.py | 52 - pyload/plugin/hook/RealdebridCom.py | 27 - pyload/plugin/hook/RehostTo.py | 41 - pyload/plugin/hook/SimplyPremiumCom.py | 29 - pyload/plugin/hook/SimplydebridCom.py | 22 - pyload/plugin/hook/UnrestrictLi.py | 30 - pyload/plugin/hook/XFileSharingPro.py | 96 - pyload/plugin/hook/ZeveraCom.py | 22 - pyload/plugin/hook/__init__.py | 1 - pyload/plugin/hoster/AlldebridCom.py | 87 - pyload/plugin/hoster/BayfilesCom.py | 87 - pyload/plugin/hoster/BezvadataCz.py | 94 - pyload/plugin/hoster/BillionuploadsCom.py | 24 - pyload/plugin/hoster/BitshareCom.py | 157 - pyload/plugin/hoster/BoltsharingCom.py | 18 - pyload/plugin/hoster/CatShareNet.py | 67 - pyload/plugin/hoster/CloudzerNet.py | 20 - pyload/plugin/hoster/CramitIn.py | 24 - pyload/plugin/hoster/CrockoCom.py | 70 - pyload/plugin/hoster/CyberlockerCh.py | 18 - pyload/plugin/hoster/CzshareCom.py | 152 - pyload/plugin/hoster/DailymotionCom.py | 125 - pyload/plugin/hoster/DataHu.py | 42 - pyload/plugin/hoster/DataportCz.py | 55 - pyload/plugin/hoster/DateiTo.py | 82 - pyload/plugin/hoster/DdlstorageCom.py | 19 - pyload/plugin/hoster/DebridItaliaCom.py | 53 - pyload/plugin/hoster/DepositfilesCom.py | 123 - pyload/plugin/hoster/DevhostSt.py | 48 - pyload/plugin/hoster/DlFreeFr.py | 136 - pyload/plugin/hoster/DodanePl.py | 18 - pyload/plugin/hoster/DuploadOrg.py | 18 - pyload/plugin/hoster/EasybytezCom.py | 26 - pyload/plugin/hoster/EdiskCz.py | 56 - pyload/plugin/hoster/EgoFilesCom.py | 18 - pyload/plugin/hoster/EnteruploadCom.py | 18 - pyload/plugin/hoster/EpicShareNet.py | 18 - pyload/plugin/hoster/EuroshareEu.py | 67 - pyload/plugin/hoster/ExtabitCom.py | 79 - pyload/plugin/hoster/FastixRu.py | 76 - pyload/plugin/hoster/FastshareCz.py | 77 - pyload/plugin/hoster/FileApeCom.py | 18 - pyload/plugin/hoster/FileParadoxIn.py | 25 - pyload/plugin/hoster/FileSharkPl.py | 138 - pyload/plugin/hoster/FileStoreTo.py | 37 - pyload/plugin/hoster/FilebeerInfo.py | 18 - pyload/plugin/hoster/FilecloudIo.py | 125 - pyload/plugin/hoster/FilefactoryCom.py | 90 - pyload/plugin/hoster/FilejungleCom.py | 29 - pyload/plugin/hoster/FileomCom.py | 35 - pyload/plugin/hoster/FilepostCom.py | 130 - pyload/plugin/hoster/FilepupNet.py | 51 - pyload/plugin/hoster/FilerNet.py | 80 - pyload/plugin/hoster/FilerioCom.py | 25 - pyload/plugin/hoster/FilesMailRu.py | 106 - pyload/plugin/hoster/FileserveCom.py | 217 - pyload/plugin/hoster/FileshareInUa.py | 18 - pyload/plugin/hoster/FilesonicCom.py | 19 - pyload/plugin/hoster/FilezyNet.py | 18 - pyload/plugin/hoster/FiredriveCom.py | 18 - pyload/plugin/hoster/FlyFilesNet.py | 45 - pyload/plugin/hoster/FourSharedCom.py | 61 - pyload/plugin/hoster/FreakshareCom.py | 176 - pyload/plugin/hoster/FreeWayMe.py | 36 - pyload/plugin/hoster/FreevideoCz.py | 18 - pyload/plugin/hoster/FshareVn.py | 125 - pyload/plugin/hoster/Ftp.py | 79 - pyload/plugin/hoster/GamefrontCom.py | 90 - pyload/plugin/hoster/GigapetaCom.py | 64 - pyload/plugin/hoster/GooIm.py | 39 - pyload/plugin/hoster/HellshareCz.py | 48 - pyload/plugin/hoster/HellspyCz.py | 18 - pyload/plugin/hoster/HotfileCom.py | 21 - pyload/plugin/hoster/HugefilesNet.py | 27 - pyload/plugin/hoster/HundredEightyUploadCom.py | 27 - pyload/plugin/hoster/IFileWs.py | 18 - pyload/plugin/hoster/IcyFilesCom.py | 18 - pyload/plugin/hoster/IfileIt.py | 67 - pyload/plugin/hoster/IfolderRu.py | 76 - pyload/plugin/hoster/JumbofilesCom.py | 38 - pyload/plugin/hoster/JunocloudMe.py | 28 - pyload/plugin/hoster/Keep2ShareCc.py | 132 - pyload/plugin/hoster/KickloadCom.py | 18 - pyload/plugin/hoster/KingfilesNet.py | 82 - pyload/plugin/hoster/LemUploadsCom.py | 18 - pyload/plugin/hoster/LetitbitNet.py | 142 - pyload/plugin/hoster/LinksnappyCom.py | 76 - pyload/plugin/hoster/LoadTo.py | 75 - pyload/plugin/hoster/LomafileCom.py | 30 - pyload/plugin/hoster/LuckyShareNet.py | 73 - pyload/plugin/hoster/MediafireCom.py | 124 - pyload/plugin/hoster/MegaCoNz.py | 171 - pyload/plugin/hoster/MegaDebridEu.py | 94 - pyload/plugin/hoster/MegaFilesSe.py | 18 - pyload/plugin/hoster/MegaRapidCz.py | 71 - pyload/plugin/hoster/MegacrypterCom.py | 56 - pyload/plugin/hoster/MegareleaseOrg.py | 19 - pyload/plugin/hoster/MegasharesCom.py | 113 - pyload/plugin/hoster/MegauploadCom.py | 18 - pyload/plugin/hoster/MegavideoCom.py | 19 - pyload/plugin/hoster/MovReelCom.py | 26 - pyload/plugin/hoster/MultishareCz.py | 80 - pyload/plugin/hoster/MyfastfileCom.py | 47 - pyload/plugin/hoster/MyvideoDe.py | 49 - pyload/plugin/hoster/NahrajCz.py | 18 - pyload/plugin/hoster/NarodRu.py | 60 - pyload/plugin/hoster/NetloadIn.py | 294 - pyload/plugin/hoster/NosuploadCom.py | 43 - pyload/plugin/hoster/NovafileCom.py | 31 - pyload/plugin/hoster/NowDownloadSx.py | 64 - pyload/plugin/hoster/NowVideoSx.py | 44 - pyload/plugin/hoster/OboomCom.py | 145 - pyload/plugin/hoster/OneFichierCom.py | 71 - pyload/plugin/hoster/OronCom.py | 19 - pyload/plugin/hoster/OverLoadMe.py | 84 - pyload/plugin/hoster/PandaplaNet.py | 18 - pyload/plugin/hoster/PornhostCom.py | 80 - pyload/plugin/hoster/PornhubCom.py | 89 - pyload/plugin/hoster/PotloadCom.py | 18 - pyload/plugin/hoster/PremiumTo.py | 81 - pyload/plugin/hoster/PremiumizeMe.py | 56 - pyload/plugin/hoster/PromptfileCom.py | 45 - pyload/plugin/hoster/PrzeklejPl.py | 18 - pyload/plugin/hoster/QuickshareCz.py | 90 - pyload/plugin/hoster/RPNetBiz.py | 85 - pyload/plugin/hoster/RapidfileshareNet.py | 31 - pyload/plugin/hoster/RapidgatorNet.py | 199 - pyload/plugin/hoster/RapiduNet.py | 82 - pyload/plugin/hoster/RarefileNet.py | 28 - pyload/plugin/hoster/RealdebridCom.py | 94 - pyload/plugin/hoster/RedtubeCom.py | 62 - pyload/plugin/hoster/RehostTo.py | 44 - pyload/plugin/hoster/RemixshareCom.py | 61 - pyload/plugin/hoster/RgHostNet.py | 26 - pyload/plugin/hoster/RyushareCom.py | 81 - pyload/plugin/hoster/SafesharingEu.py | 25 - pyload/plugin/hoster/SecureUploadEu.py | 23 - pyload/plugin/hoster/SendmywayCom.py | 24 - pyload/plugin/hoster/SendspaceCom.py | 60 - pyload/plugin/hoster/Share4WebCom.py | 22 - pyload/plugin/hoster/Share76Com.py | 18 - pyload/plugin/hoster/ShareFilesCo.py | 18 - pyload/plugin/hoster/SharebeesCom.py | 18 - pyload/plugin/hoster/ShareonlineBiz.py | 191 - pyload/plugin/hoster/ShareplaceCom.py | 89 - pyload/plugin/hoster/SharingmatrixCom.py | 19 - pyload/plugin/hoster/ShragleCom.py | 19 - pyload/plugin/hoster/SimplyPremiumCom.py | 82 - pyload/plugin/hoster/SimplydebridCom.py | 64 - pyload/plugin/hoster/SockshareCom.py | 20 - pyload/plugin/hoster/SoundcloudCom.py | 57 - pyload/plugin/hoster/SpeedLoadOrg.py | 18 - pyload/plugin/hoster/SpeedfileCz.py | 18 - pyload/plugin/hoster/SpeedyshareCom.py | 51 - pyload/plugin/hoster/StorageTo.py | 18 - pyload/plugin/hoster/StreamCz.py | 71 - pyload/plugin/hoster/StreamcloudEu.py | 31 - pyload/plugin/hoster/TurbobitNet.py | 173 - pyload/plugin/hoster/TurbouploadCom.py | 18 - pyload/plugin/hoster/TusfilesNet.py | 35 - pyload/plugin/hoster/TwoSharedCom.py | 41 - pyload/plugin/hoster/UlozTo.py | 164 - pyload/plugin/hoster/UloziskoSk.py | 72 - pyload/plugin/hoster/UnibytesCom.py | 70 - pyload/plugin/hoster/UnrestrictLi.py | 91 - pyload/plugin/hoster/UpleaCom.py | 60 - pyload/plugin/hoster/UploadStationCom.py | 19 - pyload/plugin/hoster/UploadableCh.py | 90 - pyload/plugin/hoster/UploadboxCom.py | 18 - pyload/plugin/hoster/UploadedTo.py | 245 - pyload/plugin/hoster/UploadhereCom.py | 18 - pyload/plugin/hoster/UploadheroCom.py | 81 - pyload/plugin/hoster/UploadingCom.py | 104 - pyload/plugin/hoster/UploadkingCom.py | 18 - pyload/plugin/hoster/UpstoreNet.py | 73 - pyload/plugin/hoster/UptoboxCom.py | 34 - pyload/plugin/hoster/VeehdCom.py | 81 - pyload/plugin/hoster/VeohCom.py | 53 - pyload/plugin/hoster/VidPlayNet.py | 26 - pyload/plugin/hoster/VimeoCom.py | 75 - pyload/plugin/hoster/Vipleech4UCom.py | 18 - pyload/plugin/hoster/WarserverCz.py | 18 - pyload/plugin/hoster/WebshareCz.py | 62 - pyload/plugin/hoster/WrzucTo.py | 52 - pyload/plugin/hoster/WuploadCom.py | 19 - pyload/plugin/hoster/X7To.py | 18 - pyload/plugin/hoster/XFileSharingPro.py | 57 - pyload/plugin/hoster/XHamsterCom.py | 129 - pyload/plugin/hoster/XVideosCom.py | 28 - pyload/plugin/hoster/Xdcc.py | 207 - pyload/plugin/hoster/YibaishiwuCom.py | 55 - pyload/plugin/hoster/YoupornCom.py | 60 - pyload/plugin/hoster/YourfilesTo.py | 87 - pyload/plugin/hoster/YoutubeCom.py | 185 - pyload/plugin/hoster/ZDF.py | 59 - pyload/plugin/hoster/ZShareNet.py | 19 - pyload/plugin/hoster/ZeveraCom.py | 42 - pyload/plugin/hoster/ZippyshareCom.py | 65 - pyload/plugin/hoster/__init__.py | 1 - pyload/plugin/internal/AbstractExtractor.py | 109 - pyload/plugin/internal/BasePlugin.py | 106 - pyload/plugin/internal/DeadCrypter.py | 32 - pyload/plugin/internal/DeadHoster.py | 32 - pyload/plugin/internal/MultiHoster.py | 202 - pyload/plugin/internal/SimpleCrypter.py | 152 - pyload/plugin/internal/SimpleHoster.py | 530 -- pyload/plugin/internal/UnRar.py | 221 - pyload/plugin/internal/UnZip.py | 41 - pyload/plugin/internal/UpdateManager.py | 300 - pyload/plugin/internal/XFSAccount.py | 155 - pyload/plugin/internal/XFSCrypter.py | 29 - pyload/plugin/internal/XFSHoster.py | 339 -- pyload/plugin/internal/__init__.py | 1 - pyload/plugin/ocr/GigasizeCom.py | 24 - pyload/plugin/ocr/LinksaveIn.py | 158 - pyload/plugin/ocr/NetloadIn.py | 29 - pyload/plugin/ocr/ShareonlineBiz.py | 39 - pyload/plugin/ocr/__init__.py | 1 - pyload/remote/ClickAndLoadBackend.py | 156 - pyload/remote/SocketBackend.py | 25 - pyload/remote/ThriftBackend.py | 42 - pyload/remote/__init__.py | 3 - pyload/remote/socketbackend/__init__.py | 1 - pyload/remote/socketbackend/create_ttypes.py | 88 - pyload/remote/thriftbackend/Processor.py | 77 - pyload/remote/thriftbackend/Protocol.py | 30 - pyload/remote/thriftbackend/Socket.py | 129 - pyload/remote/thriftbackend/ThriftClient.py | 91 - pyload/remote/thriftbackend/ThriftTest.py | 94 - pyload/remote/thriftbackend/Transport.py | 37 - pyload/remote/thriftbackend/__init__.py | 1 - pyload/remote/thriftbackend/pyload.thrift | 337 -- pyload/remote/thriftbackend/thriftgen/__init__.py | 1 - .../thriftbackend/thriftgen/pyload/Pyload-remote | 570 -- .../thriftbackend/thriftgen/pyload/Pyload.py | 5533 ------------------ .../thriftbackend/thriftgen/pyload/__init__.py | 3 - .../thriftbackend/thriftgen/pyload/constants.py | 10 - .../thriftbackend/thriftgen/pyload/ttypes.py | 834 --- pyload/utils/__init__.py | 263 - pyload/utils/packagetools.py | 155 - pyload/utils/printer.py | 16 - pyload/utils/pylgettext.py | 60 - pyload/webui/__init__.py | 130 - pyload/webui/app/__init__.py | 3 - pyload/webui/app/api.py | 101 - pyload/webui/app/cnl.py | 167 - pyload/webui/app/json.py | 311 - pyload/webui/app/pyload.py | 530 -- pyload/webui/app/utils.py | 123 - pyload/webui/filters.py | 61 - pyload/webui/middlewares.py | 132 - pyload/webui/servers/lighttpd_default.conf | 154 - pyload/webui/servers/nginx_default.conf | 87 - pyload/webui/themes/Dark/css/MooDialog.css | 94 - pyload/webui/themes/Dark/css/base.css | 962 ---- pyload/webui/themes/Dark/css/log.css | 75 - pyload/webui/themes/Dark/css/pathchooser.css | 68 - pyload/webui/themes/Dark/css/window.css | 92 - .../themes/Dark/img/MooDialog/dialog-close.png | Bin 689 -> 0 bytes .../themes/Dark/img/MooDialog/dialog-error.png | Bin 1472 -> 0 bytes .../themes/Dark/img/MooDialog/dialog-question.png | Bin 2073 -> 0 bytes .../themes/Dark/img/MooDialog/dialog-warning.png | Bin 1651 -> 0 bytes pyload/webui/themes/Dark/img/button.png | Bin 569 -> 0 bytes pyload/webui/themes/Dark/img/dark-bg.jpg | Bin 40930 -> 0 bytes .../webui/themes/Dark/img/default/add_folder.png | Bin 571 -> 0 bytes .../webui/themes/Dark/img/default/ajax-loader.gif | Bin 404 -> 0 bytes .../themes/Dark/img/default/arrow_refresh.png | Bin 685 -> 0 bytes .../webui/themes/Dark/img/default/arrow_right.png | Bin 349 -> 0 bytes .../webui/themes/Dark/img/default/big_button.gif | Bin 1905 -> 0 bytes .../themes/Dark/img/default/big_button_over.gif | Bin 728 -> 0 bytes pyload/webui/themes/Dark/img/default/body.png | Bin 402 -> 0 bytes pyload/webui/themes/Dark/img/default/closebtn.gif | Bin 254 -> 0 bytes pyload/webui/themes/Dark/img/default/cog.png | Bin 512 -> 0 bytes .../webui/themes/Dark/img/default/control_add.png | Bin 446 -> 0 bytes .../themes/Dark/img/default/control_add_blue.png | Bin 845 -> 0 bytes .../themes/Dark/img/default/control_cancel.png | Bin 3349 -> 0 bytes .../Dark/img/default/control_cancel_blue.png | Bin 787 -> 0 bytes .../themes/Dark/img/default/control_pause.png | Bin 598 -> 0 bytes .../themes/Dark/img/default/control_pause_blue.png | Bin 721 -> 0 bytes .../webui/themes/Dark/img/default/control_play.png | Bin 592 -> 0 bytes .../themes/Dark/img/default/control_play_blue.png | Bin 717 -> 0 bytes .../webui/themes/Dark/img/default/control_stop.png | Bin 403 -> 0 bytes .../themes/Dark/img/default/control_stop_blue.png | Bin 695 -> 0 bytes pyload/webui/themes/Dark/img/default/delete.png | Bin 715 -> 0 bytes .../webui/themes/Dark/img/default/drag_corner.gif | Bin 76 -> 0 bytes pyload/webui/themes/Dark/img/default/error.png | Bin 701 -> 0 bytes pyload/webui/themes/Dark/img/default/folder.png | Bin 537 -> 0 bytes pyload/webui/themes/Dark/img/default/full.png | Bin 3543 -> 0 bytes .../webui/themes/Dark/img/default/head-login.png | Bin 1288 -> 0 bytes .../Dark/img/default/head-menu-collector.png | Bin 1953 -> 0 bytes .../themes/Dark/img/default/head-menu-config.png | Bin 1802 -> 0 bytes .../Dark/img/default/head-menu-development.png | Bin 876 -> 0 bytes .../themes/Dark/img/default/head-menu-download.png | Bin 721 -> 0 bytes .../themes/Dark/img/default/head-menu-home.png | Bin 920 -> 0 bytes .../themes/Dark/img/default/head-menu-index.png | Bin 482 -> 0 bytes .../themes/Dark/img/default/head-menu-news.png | Bin 628 -> 0 bytes .../themes/Dark/img/default/head-menu-queue.png | Bin 2629 -> 0 bytes .../themes/Dark/img/default/head-menu-recent.png | Bin 932 -> 0 bytes .../themes/Dark/img/default/head-menu-wiki.png | Bin 1204 -> 0 bytes .../Dark/img/default/head-search-noshadow.png | Bin 1187 -> 0 bytes pyload/webui/themes/Dark/img/default/head_bg1.png | Bin 125 -> 0 bytes pyload/webui/themes/Dark/img/default/images.png | Bin 661 -> 0 bytes pyload/webui/themes/Dark/img/default/notice.png | Bin 778 -> 0 bytes .../webui/themes/Dark/img/default/package_go.png | Bin 898 -> 0 bytes .../Dark/img/default/page-tools-backlinks.png | Bin 540 -> 0 bytes .../themes/Dark/img/default/page-tools-edit.png | Bin 574 -> 0 bytes .../Dark/img/default/page-tools-revisions.png | Bin 603 -> 0 bytes pyload/webui/themes/Dark/img/default/parseUri.png | Bin 666 -> 0 bytes pyload/webui/themes/Dark/img/default/pencil.png | Bin 450 -> 0 bytes pyload/webui/themes/Dark/img/default/reconnect.png | Bin 755 -> 0 bytes .../webui/themes/Dark/img/default/status_None.png | Bin 7613 -> 0 bytes .../themes/Dark/img/default/status_downloading.png | Bin 943 -> 0 bytes .../themes/Dark/img/default/status_failed.png | Bin 701 -> 0 bytes .../themes/Dark/img/default/status_finished.png | Bin 781 -> 0 bytes .../themes/Dark/img/default/status_offline.png | Bin 700 -> 0 bytes .../webui/themes/Dark/img/default/status_proc.png | Bin 512 -> 0 bytes .../webui/themes/Dark/img/default/status_queue.png | Bin 7613 -> 0 bytes .../themes/Dark/img/default/status_waiting.png | Bin 889 -> 0 bytes pyload/webui/themes/Dark/img/default/success.png | Bin 781 -> 0 bytes .../themes/Dark/img/default/tabs-border-bottom.png | Bin 163 -> 0 bytes .../Dark/img/default/user-actions-logout.png | Bin 799 -> 0 bytes .../Dark/img/default/user-actions-profile.png | Bin 628 -> 0 bytes pyload/webui/themes/Dark/img/default/user-info.png | Bin 3963 -> 0 bytes pyload/webui/themes/Dark/img/pyload-logo.png | Bin 6947 -> 0 bytes pyload/webui/themes/Dark/img/tab-background.png | Bin 3044 -> 0 bytes pyload/webui/themes/Dark/js/render/admin.coffee | 58 - pyload/webui/themes/Dark/js/render/admin.min.js | 3 - pyload/webui/themes/Dark/js/render/base.coffee | 177 - pyload/webui/themes/Dark/js/render/base.min.js | 3 - pyload/webui/themes/Dark/js/render/package.js | 376 -- pyload/webui/themes/Dark/js/render/settings.coffee | 107 - pyload/webui/themes/Dark/js/render/settings.min.js | 3 - pyload/webui/themes/Dark/js/static/MooDialog.js | 140 - .../webui/themes/Dark/js/static/MooDialog.min.js | 1 - pyload/webui/themes/Dark/js/static/MooDropMenu.js | 86 - .../webui/themes/Dark/js/static/MooDropMenu.min.js | 1 - .../webui/themes/Dark/js/static/mootools-core.js | 5977 -------------------- .../themes/Dark/js/static/mootools-core.min.js | 491 -- .../webui/themes/Dark/js/static/mootools-more.js | 2856 ---------- .../themes/Dark/js/static/mootools-more.min.js | 226 - pyload/webui/themes/Dark/js/static/purr.js | 309 - pyload/webui/themes/Dark/js/static/purr.min.js | 1 - pyload/webui/themes/Dark/js/static/tinytab.js | 43 - pyload/webui/themes/Dark/js/static/tinytab.min.js | 1 - pyload/webui/themes/Dark/tml/admin.html | 98 - pyload/webui/themes/Dark/tml/base.html | 177 - pyload/webui/themes/Dark/tml/captcha.html | 42 - pyload/webui/themes/Dark/tml/downloads.html | 29 - pyload/webui/themes/Dark/tml/folder.html | 15 - pyload/webui/themes/Dark/tml/home.html | 263 - pyload/webui/themes/Dark/tml/info.html | 76 - pyload/webui/themes/Dark/tml/login.html | 37 - pyload/webui/themes/Dark/tml/logout.html | 9 - pyload/webui/themes/Dark/tml/logs.html | 41 - pyload/webui/themes/Dark/tml/pathchooser.html | 76 - pyload/webui/themes/Dark/tml/queue.html | 104 - pyload/webui/themes/Dark/tml/settings.html | 204 - pyload/webui/themes/Dark/tml/settings_item.html | 48 - pyload/webui/themes/Dark/tml/window.html | 52 - pyload/webui/themes/Default/css/MooDialog.css | 91 - pyload/webui/themes/Default/css/base.css | 902 --- pyload/webui/themes/Default/css/log.css | 71 - pyload/webui/themes/Default/css/pathchooser.css | 68 - pyload/webui/themes/Default/css/window.css | 73 - .../themes/Default/img/MooDialog/dialog-close.png | Bin 689 -> 0 bytes .../themes/Default/img/MooDialog/dialog-error.png | Bin 1472 -> 0 bytes .../Default/img/MooDialog/dialog-question.png | Bin 2073 -> 0 bytes .../Default/img/MooDialog/dialog-warning.png | Bin 1651 -> 0 bytes pyload/webui/themes/Default/img/add_folder.png | Bin 571 -> 0 bytes pyload/webui/themes/Default/img/ajax-loader.gif | Bin 404 -> 0 bytes pyload/webui/themes/Default/img/arrow_refresh.png | Bin 685 -> 0 bytes pyload/webui/themes/Default/img/arrow_right.png | Bin 349 -> 0 bytes pyload/webui/themes/Default/img/big_button.gif | Bin 1905 -> 0 bytes .../webui/themes/Default/img/big_button_over.gif | Bin 728 -> 0 bytes pyload/webui/themes/Default/img/body.png | Bin 402 -> 0 bytes pyload/webui/themes/Default/img/button.png | Bin 452 -> 0 bytes pyload/webui/themes/Default/img/closebtn.gif | Bin 254 -> 0 bytes pyload/webui/themes/Default/img/cog.png | Bin 512 -> 0 bytes pyload/webui/themes/Default/img/control_add.png | Bin 446 -> 0 bytes .../webui/themes/Default/img/control_add_blue.png | Bin 845 -> 0 bytes pyload/webui/themes/Default/img/control_cancel.png | Bin 3349 -> 0 bytes .../themes/Default/img/control_cancel_blue.png | Bin 787 -> 0 bytes pyload/webui/themes/Default/img/control_pause.png | Bin 598 -> 0 bytes .../themes/Default/img/control_pause_blue.png | Bin 721 -> 0 bytes pyload/webui/themes/Default/img/control_play.png | Bin 592 -> 0 bytes .../webui/themes/Default/img/control_play_blue.png | Bin 717 -> 0 bytes pyload/webui/themes/Default/img/control_stop.png | Bin 403 -> 0 bytes .../webui/themes/Default/img/control_stop_blue.png | Bin 695 -> 0 bytes pyload/webui/themes/Default/img/delete.png | Bin 715 -> 0 bytes pyload/webui/themes/Default/img/drag_corner.gif | Bin 76 -> 0 bytes pyload/webui/themes/Default/img/error.png | Bin 701 -> 0 bytes pyload/webui/themes/Default/img/folder.png | Bin 537 -> 0 bytes pyload/webui/themes/Default/img/full.png | Bin 3543 -> 0 bytes pyload/webui/themes/Default/img/head-login.png | Bin 1288 -> 0 bytes .../themes/Default/img/head-menu-collector.png | Bin 1953 -> 0 bytes .../webui/themes/Default/img/head-menu-config.png | Bin 1802 -> 0 bytes .../themes/Default/img/head-menu-development.png | Bin 876 -> 0 bytes .../themes/Default/img/head-menu-download.png | Bin 721 -> 0 bytes pyload/webui/themes/Default/img/head-menu-home.png | Bin 920 -> 0 bytes .../webui/themes/Default/img/head-menu-index.png | Bin 482 -> 0 bytes pyload/webui/themes/Default/img/head-menu-news.png | Bin 628 -> 0 bytes .../webui/themes/Default/img/head-menu-queue.png | Bin 2629 -> 0 bytes .../webui/themes/Default/img/head-menu-recent.png | Bin 932 -> 0 bytes pyload/webui/themes/Default/img/head-menu-wiki.png | Bin 1204 -> 0 bytes .../themes/Default/img/head-search-noshadow.png | Bin 1187 -> 0 bytes pyload/webui/themes/Default/img/head_bg1.png | Bin 125 -> 0 bytes pyload/webui/themes/Default/img/images.png | Bin 661 -> 0 bytes pyload/webui/themes/Default/img/notice.png | Bin 778 -> 0 bytes pyload/webui/themes/Default/img/package_go.png | Bin 898 -> 0 bytes .../themes/Default/img/page-tools-backlinks.png | Bin 540 -> 0 bytes .../webui/themes/Default/img/page-tools-edit.png | Bin 574 -> 0 bytes .../themes/Default/img/page-tools-revisions.png | Bin 603 -> 0 bytes pyload/webui/themes/Default/img/parseUri.png | Bin 666 -> 0 bytes pyload/webui/themes/Default/img/pencil.png | Bin 450 -> 0 bytes pyload/webui/themes/Default/img/pyload-logo.png | Bin 8457 -> 0 bytes pyload/webui/themes/Default/img/reconnect.png | Bin 755 -> 0 bytes pyload/webui/themes/Default/img/status_None.png | Bin 7613 -> 0 bytes .../themes/Default/img/status_downloading.png | Bin 943 -> 0 bytes pyload/webui/themes/Default/img/status_failed.png | Bin 701 -> 0 bytes .../webui/themes/Default/img/status_finished.png | Bin 781 -> 0 bytes pyload/webui/themes/Default/img/status_offline.png | Bin 700 -> 0 bytes pyload/webui/themes/Default/img/status_proc.png | Bin 512 -> 0 bytes pyload/webui/themes/Default/img/status_queue.png | Bin 7613 -> 0 bytes pyload/webui/themes/Default/img/status_waiting.png | Bin 889 -> 0 bytes pyload/webui/themes/Default/img/success.png | Bin 781 -> 0 bytes pyload/webui/themes/Default/img/tab-background.png | Bin 179 -> 0 bytes .../themes/Default/img/tabs-border-bottom.png | Bin 163 -> 0 bytes .../themes/Default/img/user-actions-logout.png | Bin 799 -> 0 bytes .../themes/Default/img/user-actions-profile.png | Bin 628 -> 0 bytes pyload/webui/themes/Default/img/user-info.png | Bin 3963 -> 0 bytes pyload/webui/themes/Default/js/render/admin.coffee | 58 - pyload/webui/themes/Default/js/render/admin.min.js | 3 - pyload/webui/themes/Default/js/render/base.coffee | 177 - pyload/webui/themes/Default/js/render/base.min.js | 3 - pyload/webui/themes/Default/js/render/package.js | 376 -- .../webui/themes/Default/js/render/settings.coffee | 107 - .../webui/themes/Default/js/render/settings.min.js | 3 - pyload/webui/themes/Default/js/static/MooDialog.js | 140 - .../themes/Default/js/static/MooDialog.min.js | 1 - .../webui/themes/Default/js/static/MooDropMenu.js | 86 - .../themes/Default/js/static/MooDropMenu.min.js | 1 - .../themes/Default/js/static/mootools-core.js | 5977 -------------------- .../themes/Default/js/static/mootools-core.min.js | 491 -- .../themes/Default/js/static/mootools-more.js | 2856 ---------- .../themes/Default/js/static/mootools-more.min.js | 226 - pyload/webui/themes/Default/js/static/purr.js | 309 - pyload/webui/themes/Default/js/static/purr.min.js | 1 - pyload/webui/themes/Default/js/static/tinytab.js | 43 - .../webui/themes/Default/js/static/tinytab.min.js | 1 - pyload/webui/themes/Default/tml/admin.html | 98 - pyload/webui/themes/Default/tml/base.html | 177 - pyload/webui/themes/Default/tml/captcha.html | 42 - pyload/webui/themes/Default/tml/downloads.html | 29 - pyload/webui/themes/Default/tml/filemanager.html | 76 - pyload/webui/themes/Default/tml/folder.html | 15 - pyload/webui/themes/Default/tml/home.html | 263 - pyload/webui/themes/Default/tml/info.html | 81 - pyload/webui/themes/Default/tml/login.html | 36 - pyload/webui/themes/Default/tml/logout.html | 9 - pyload/webui/themes/Default/tml/logs.html | 41 - pyload/webui/themes/Default/tml/pathchooser.html | 76 - pyload/webui/themes/Default/tml/queue.html | 104 - pyload/webui/themes/Default/tml/settings.html | 204 - pyload/webui/themes/Default/tml/settings_item.html | 48 - pyload/webui/themes/Default/tml/window.html | 46 - pyload/webui/themes/Flat/css/MooDialog.css | 85 - pyload/webui/themes/Flat/css/base.css | 866 --- pyload/webui/themes/Flat/css/log.css | 72 - pyload/webui/themes/Flat/css/pathchooser.css | 68 - pyload/webui/themes/Flat/css/window.css | 70 - .../themes/Flat/img/MooDialog/dialog-close.png | Bin 689 -> 0 bytes .../themes/Flat/img/MooDialog/dialog-error.png | Bin 1472 -> 0 bytes .../themes/Flat/img/MooDialog/dialog-question.png | Bin 2073 -> 0 bytes .../themes/Flat/img/MooDialog/dialog-warning.png | Bin 1651 -> 0 bytes pyload/webui/themes/Flat/img/arrow_refresh.png | Bin 119032 -> 0 bytes pyload/webui/themes/Flat/img/arrow_right.png | Bin 136967 -> 0 bytes pyload/webui/themes/Flat/img/button.png | Bin 569 -> 0 bytes pyload/webui/themes/Flat/img/cog.png | Bin 137406 -> 0 bytes pyload/webui/themes/Flat/img/control_add.png | Bin 116941 -> 0 bytes pyload/webui/themes/Flat/img/control_add_blue.png | Bin 116941 -> 0 bytes pyload/webui/themes/Flat/img/control_cancel.png | Bin 116939 -> 0 bytes .../webui/themes/Flat/img/control_cancel_blue.png | Bin 116939 -> 0 bytes pyload/webui/themes/Flat/img/control_pause.png | Bin 134855 -> 0 bytes .../webui/themes/Flat/img/control_pause_blue.png | Bin 134855 -> 0 bytes pyload/webui/themes/Flat/img/control_play.png | Bin 134904 -> 0 bytes pyload/webui/themes/Flat/img/control_play_blue.png | Bin 134904 -> 0 bytes pyload/webui/themes/Flat/img/control_stop.png | Bin 134835 -> 0 bytes pyload/webui/themes/Flat/img/control_stop_blue.png | Bin 134835 -> 0 bytes .../webui/themes/Flat/img/default/add_folder.png | Bin 571 -> 0 bytes .../webui/themes/Flat/img/default/ajax-loader.gif | Bin 404 -> 0 bytes .../webui/themes/Flat/img/default/big_button.gif | Bin 1905 -> 0 bytes .../themes/Flat/img/default/big_button_over.gif | Bin 728 -> 0 bytes pyload/webui/themes/Flat/img/default/body.png | Bin 402 -> 0 bytes pyload/webui/themes/Flat/img/default/closebtn.gif | Bin 254 -> 0 bytes .../webui/themes/Flat/img/default/drag_corner.gif | Bin 76 -> 0 bytes pyload/webui/themes/Flat/img/default/full.png | Bin 3543 -> 0 bytes .../themes/Flat/img/default/head-menu-recent.png | Bin 932 -> 0 bytes pyload/webui/themes/Flat/img/default/head_bg1.png | Bin 125 -> 0 bytes pyload/webui/themes/Flat/img/default/images.png | Bin 661 -> 0 bytes pyload/webui/themes/Flat/img/default/parseUri.png | Bin 666 -> 0 bytes .../webui/themes/Flat/img/default/pyload-logo.png | Bin 8457 -> 0 bytes .../themes/Flat/img/default/tab-background.png | Bin 179 -> 0 bytes .../themes/Flat/img/default/tabs-border-bottom.png | Bin 163 -> 0 bytes pyload/webui/themes/Flat/img/delete.png | Bin 117658 -> 0 bytes pyload/webui/themes/Flat/img/error.png | Bin 137673 -> 0 bytes pyload/webui/themes/Flat/img/folder.png | Bin 134669 -> 0 bytes pyload/webui/themes/Flat/img/head-login.png | Bin 137406 -> 0 bytes .../webui/themes/Flat/img/head-menu-collector.png | Bin 134985 -> 0 bytes pyload/webui/themes/Flat/img/head-menu-config.png | Bin 137664 -> 0 bytes .../themes/Flat/img/head-menu-development.png | Bin 135818 -> 0 bytes .../webui/themes/Flat/img/head-menu-download.png | Bin 137664 -> 0 bytes pyload/webui/themes/Flat/img/head-menu-home.png | Bin 139387 -> 0 bytes pyload/webui/themes/Flat/img/head-menu-index.png | Bin 136511 -> 0 bytes pyload/webui/themes/Flat/img/head-menu-news.png | Bin 136511 -> 0 bytes pyload/webui/themes/Flat/img/head-menu-queue.png | Bin 136269 -> 0 bytes pyload/webui/themes/Flat/img/head-menu-wiki.png | Bin 137217 -> 0 bytes .../webui/themes/Flat/img/head-search-noshadow.png | Bin 137217 -> 0 bytes pyload/webui/themes/Flat/img/notice.png | Bin 3061 -> 0 bytes pyload/webui/themes/Flat/img/package_go.png | Bin 136299 -> 0 bytes .../webui/themes/Flat/img/page-tools-backlinks.png | Bin 138112 -> 0 bytes pyload/webui/themes/Flat/img/page-tools-edit.png | Bin 138112 -> 0 bytes .../webui/themes/Flat/img/page-tools-revisions.png | Bin 138112 -> 0 bytes pyload/webui/themes/Flat/img/pencil.png | Bin 138112 -> 0 bytes pyload/webui/themes/Flat/img/reconnect.png | Bin 3063 -> 0 bytes pyload/webui/themes/Flat/img/status_None.png | Bin 138112 -> 0 bytes .../webui/themes/Flat/img/status_downloading.png | Bin 3061 -> 0 bytes pyload/webui/themes/Flat/img/status_failed.png | Bin 137673 -> 0 bytes pyload/webui/themes/Flat/img/status_finished.png | Bin 117658 -> 0 bytes pyload/webui/themes/Flat/img/status_offline.png | Bin 137673 -> 0 bytes pyload/webui/themes/Flat/img/status_proc.png | Bin 137406 -> 0 bytes pyload/webui/themes/Flat/img/status_queue.png | Bin 138112 -> 0 bytes pyload/webui/themes/Flat/img/status_waiting.png | Bin 138112 -> 0 bytes pyload/webui/themes/Flat/img/success.png | Bin 117658 -> 0 bytes .../webui/themes/Flat/img/user-actions-logout.png | Bin 138112 -> 0 bytes .../webui/themes/Flat/img/user-actions-profile.png | Bin 138112 -> 0 bytes pyload/webui/themes/Flat/img/user-info.png | Bin 3080 -> 0 bytes pyload/webui/themes/Flat/js/render/admin.coffee | 58 - pyload/webui/themes/Flat/js/render/admin.min.js | 3 - pyload/webui/themes/Flat/js/render/base.coffee | 177 - pyload/webui/themes/Flat/js/render/base.min.js | 3 - pyload/webui/themes/Flat/js/render/filemanager.js | 291 - pyload/webui/themes/Flat/js/render/package.js | 376 -- pyload/webui/themes/Flat/js/render/settings.coffee | 107 - pyload/webui/themes/Flat/js/render/settings.min.js | 3 - pyload/webui/themes/Flat/js/static/MooDialog.js | 140 - .../webui/themes/Flat/js/static/MooDialog.min.js | 1 - pyload/webui/themes/Flat/js/static/MooDropMenu.js | 86 - .../webui/themes/Flat/js/static/MooDropMenu.min.js | 1 - .../webui/themes/Flat/js/static/mootools-core.js | 5977 -------------------- .../themes/Flat/js/static/mootools-core.min.js | 491 -- .../webui/themes/Flat/js/static/mootools-more.js | 2856 ---------- .../themes/Flat/js/static/mootools-more.min.js | 226 - pyload/webui/themes/Flat/js/static/purr.js | 309 - pyload/webui/themes/Flat/js/static/purr.min.js | 1 - pyload/webui/themes/Flat/js/static/tinytab.js | 43 - pyload/webui/themes/Flat/js/static/tinytab.min.js | 1 - pyload/webui/themes/Flat/tml/admin.html | 98 - pyload/webui/themes/Flat/tml/base.html | 180 - pyload/webui/themes/Flat/tml/captcha.html | 42 - pyload/webui/themes/Flat/tml/downloads.html | 29 - pyload/webui/themes/Flat/tml/filemanager.html | 78 - pyload/webui/themes/Flat/tml/folder.html | 15 - pyload/webui/themes/Flat/tml/home.html | 266 - pyload/webui/themes/Flat/tml/info.html | 81 - pyload/webui/themes/Flat/tml/login.html | 36 - pyload/webui/themes/Flat/tml/logout.html | 9 - pyload/webui/themes/Flat/tml/logs.html | 41 - pyload/webui/themes/Flat/tml/pathchooser.html | 76 - pyload/webui/themes/Flat/tml/queue.html | 104 - pyload/webui/themes/Flat/tml/settings.html | 204 - pyload/webui/themes/Flat/tml/settings_item.html | 48 - pyload/webui/themes/Flat/tml/window.html | 46 - 844 files changed, 88741 deletions(-) delete mode 100644 pyload/Core.py delete mode 100644 pyload/__init__.py delete mode 100644 pyload/api/__init__.py delete mode 100644 pyload/api/types.py delete mode 100644 pyload/cli/AddPackage.py delete mode 100644 pyload/cli/Cli.py delete mode 100644 pyload/cli/Handler.py delete mode 100644 pyload/cli/ManageFiles.py delete mode 100644 pyload/cli/__init__.py delete mode 100644 pyload/config/Parser.py delete mode 100644 pyload/config/Setup.py delete mode 100644 pyload/config/__init__.py delete mode 100644 pyload/config/default.conf delete mode 100644 pyload/database/DatabaseBackend.py delete mode 100644 pyload/database/File.py delete mode 100644 pyload/database/Storage.py delete mode 100644 pyload/database/User.py delete mode 100644 pyload/database/__init__.py delete mode 100644 pyload/datatype/File.py delete mode 100644 pyload/datatype/Package.py delete mode 100644 pyload/datatype/__init__.py delete mode 100644 pyload/manager/Account.py delete mode 100644 pyload/manager/Addon.py delete mode 100644 pyload/manager/Captcha.py delete mode 100644 pyload/manager/Event.py delete mode 100644 pyload/manager/Plugin.py delete mode 100644 pyload/manager/Remote.py delete mode 100644 pyload/manager/Thread.py delete mode 100644 pyload/manager/__init__.py delete mode 100644 pyload/manager/event/Scheduler.py delete mode 100644 pyload/manager/event/__init__.py delete mode 100644 pyload/manager/thread/Addon.py delete mode 100644 pyload/manager/thread/Decrypter.py delete mode 100644 pyload/manager/thread/Download.py delete mode 100644 pyload/manager/thread/Info.py delete mode 100644 pyload/manager/thread/Plugin.py delete mode 100644 pyload/manager/thread/Server.py delete mode 100644 pyload/manager/thread/__init__.py delete mode 100644 pyload/network/Browser.py delete mode 100644 pyload/network/Bucket.py delete mode 100644 pyload/network/CookieJar.py delete mode 100644 pyload/network/HTTPChunk.py delete mode 100644 pyload/network/HTTPDownload.py delete mode 100644 pyload/network/HTTPRequest.py delete mode 100644 pyload/network/JsEngine.py delete mode 100644 pyload/network/RequestFactory.py delete mode 100644 pyload/network/XDCCRequest.py delete mode 100644 pyload/network/__init__.py delete mode 100644 pyload/plugin/Account.py delete mode 100644 pyload/plugin/Addon.py delete mode 100644 pyload/plugin/Captcha.py delete mode 100644 pyload/plugin/Container.py delete mode 100644 pyload/plugin/Crypter.py delete mode 100644 pyload/plugin/Hoster.py delete mode 100644 pyload/plugin/OCR.py delete mode 100644 pyload/plugin/Plugin.py delete mode 100644 pyload/plugin/__init__.py delete mode 100644 pyload/plugin/account/AlldebridCom.py delete mode 100644 pyload/plugin/account/BayfilesCom.py delete mode 100644 pyload/plugin/account/BillionuploadsCom.py delete mode 100644 pyload/plugin/account/BitshareCom.py delete mode 100644 pyload/plugin/account/CatShareNet.py delete mode 100644 pyload/plugin/account/CramitIn.py delete mode 100644 pyload/plugin/account/CzshareCom.py delete mode 100644 pyload/plugin/account/DebridItaliaCom.py delete mode 100644 pyload/plugin/account/DepositfilesCom.py delete mode 100644 pyload/plugin/account/DropboxCom.py delete mode 100644 pyload/plugin/account/EasybytezCom.py delete mode 100644 pyload/plugin/account/EuroshareEu.py delete mode 100644 pyload/plugin/account/FastixRu.py delete mode 100644 pyload/plugin/account/FastshareCz.py delete mode 100644 pyload/plugin/account/File4SafeCom.py delete mode 100644 pyload/plugin/account/FileParadoxIn.py delete mode 100644 pyload/plugin/account/FilecloudIo.py delete mode 100644 pyload/plugin/account/FilefactoryCom.py delete mode 100644 pyload/plugin/account/FilejungleCom.py delete mode 100644 pyload/plugin/account/FileomCom.py delete mode 100644 pyload/plugin/account/FilerNet.py delete mode 100644 pyload/plugin/account/FilerioCom.py delete mode 100644 pyload/plugin/account/FilesMailRu.py delete mode 100644 pyload/plugin/account/FileserveCom.py delete mode 100644 pyload/plugin/account/FourSharedCom.py delete mode 100644 pyload/plugin/account/FreakshareCom.py delete mode 100644 pyload/plugin/account/FreeWayMe.py delete mode 100644 pyload/plugin/account/FshareVn.py delete mode 100644 pyload/plugin/account/Ftp.py delete mode 100644 pyload/plugin/account/HellshareCz.py delete mode 100644 pyload/plugin/account/Http.py delete mode 100644 pyload/plugin/account/HugefilesNet.py delete mode 100644 pyload/plugin/account/HundredEightyUploadCom.py delete mode 100644 pyload/plugin/account/JunocloudMe.py delete mode 100644 pyload/plugin/account/Keep2ShareCc.py delete mode 100644 pyload/plugin/account/LetitbitNet.py delete mode 100644 pyload/plugin/account/LinestorageCom.py delete mode 100644 pyload/plugin/account/LinksnappyCom.py delete mode 100644 pyload/plugin/account/LomafileCom.py delete mode 100644 pyload/plugin/account/MegaDebridEu.py delete mode 100644 pyload/plugin/account/MegaRapidCz.py delete mode 100644 pyload/plugin/account/MegasharesCom.py delete mode 100644 pyload/plugin/account/MovReelCom.py delete mode 100644 pyload/plugin/account/MultishareCz.py delete mode 100644 pyload/plugin/account/MyfastfileCom.py delete mode 100644 pyload/plugin/account/NetloadIn.py delete mode 100644 pyload/plugin/account/NosuploadCom.py delete mode 100644 pyload/plugin/account/NovafileCom.py delete mode 100644 pyload/plugin/account/NowVideoSx.py delete mode 100644 pyload/plugin/account/OboomCom.py delete mode 100644 pyload/plugin/account/OneFichierCom.py delete mode 100644 pyload/plugin/account/OverLoadMe.py delete mode 100644 pyload/plugin/account/PremiumTo.py delete mode 100644 pyload/plugin/account/PremiumizeMe.py delete mode 100644 pyload/plugin/account/QuickshareCz.py delete mode 100644 pyload/plugin/account/RPNetBiz.py delete mode 100644 pyload/plugin/account/RapidfileshareNet.py delete mode 100644 pyload/plugin/account/RapidgatorNet.py delete mode 100644 pyload/plugin/account/RapiduNet.py delete mode 100644 pyload/plugin/account/RarefileNet.py delete mode 100644 pyload/plugin/account/RealdebridCom.py delete mode 100644 pyload/plugin/account/RehostTo.py delete mode 100644 pyload/plugin/account/RyushareCom.py delete mode 100644 pyload/plugin/account/SafesharingEu.py delete mode 100644 pyload/plugin/account/SecureUploadEu.py delete mode 100644 pyload/plugin/account/SendmywayCom.py delete mode 100644 pyload/plugin/account/ShareonlineBiz.py delete mode 100644 pyload/plugin/account/SimplyPremiumCom.py delete mode 100644 pyload/plugin/account/SimplydebridCom.py delete mode 100644 pyload/plugin/account/StahnuTo.py delete mode 100644 pyload/plugin/account/StreamcloudEu.py delete mode 100644 pyload/plugin/account/TurbobitNet.py delete mode 100644 pyload/plugin/account/TusfilesNet.py delete mode 100644 pyload/plugin/account/UlozTo.py delete mode 100644 pyload/plugin/account/UnrestrictLi.py delete mode 100644 pyload/plugin/account/UploadcCom.py delete mode 100644 pyload/plugin/account/UploadedTo.py delete mode 100644 pyload/plugin/account/UploadheroCom.py delete mode 100644 pyload/plugin/account/UploadingCom.py delete mode 100644 pyload/plugin/account/UptoboxCom.py delete mode 100644 pyload/plugin/account/VidPlayNet.py delete mode 100644 pyload/plugin/account/XFileSharingPro.py delete mode 100644 pyload/plugin/account/YibaishiwuCom.py delete mode 100644 pyload/plugin/account/ZeveraCom.py delete mode 100644 pyload/plugin/account/__init__.py delete mode 100644 pyload/plugin/addon/Checksum.py delete mode 100644 pyload/plugin/addon/ClickAndLoad.py delete mode 100644 pyload/plugin/addon/DeleteFinished.py delete mode 100644 pyload/plugin/addon/DownloadScheduler.py delete mode 100644 pyload/plugin/addon/ExternalScripts.py delete mode 100644 pyload/plugin/addon/ExtractArchive.py delete mode 100644 pyload/plugin/addon/HotFolder.py delete mode 100644 pyload/plugin/addon/IRCInterface.py delete mode 100644 pyload/plugin/addon/MergeFiles.py delete mode 100644 pyload/plugin/addon/MultiHome.py delete mode 100644 pyload/plugin/addon/RestartFailed.py delete mode 100644 pyload/plugin/addon/RestartSlow.py delete mode 100644 pyload/plugin/addon/SkipRev.py delete mode 100644 pyload/plugin/addon/UnSkipOnFail.py delete mode 100644 pyload/plugin/addon/UpdateManager.py delete mode 100644 pyload/plugin/addon/WindowsPhoneToastNotify.py delete mode 100644 pyload/plugin/addon/XMPPInterface.py delete mode 100644 pyload/plugin/addon/__init__.py delete mode 100644 pyload/plugin/captcha/AdYouLike.py delete mode 100644 pyload/plugin/captcha/AdsCaptcha.py delete mode 100644 pyload/plugin/captcha/ReCaptcha.py delete mode 100644 pyload/plugin/captcha/SolveMedia.py delete mode 100644 pyload/plugin/captcha/__init__.py delete mode 100644 pyload/plugin/container/CCF.py delete mode 100644 pyload/plugin/container/LinkList.py delete mode 100644 pyload/plugin/container/RSDF.py delete mode 100644 pyload/plugin/container/__init__.py delete mode 100644 pyload/plugin/crypter/BitshareCom.py delete mode 100644 pyload/plugin/crypter/C1NeonCom.py delete mode 100644 pyload/plugin/crypter/ChipDe.py delete mode 100644 pyload/plugin/crypter/CrockoCom.py delete mode 100644 pyload/plugin/crypter/CryptItCom.py delete mode 100644 pyload/plugin/crypter/CzshareCom.py delete mode 100644 pyload/plugin/crypter/DDLMusicOrg.py delete mode 100644 pyload/plugin/crypter/DailymotionBatch.py delete mode 100644 pyload/plugin/crypter/DataHu.py delete mode 100644 pyload/plugin/crypter/DdlstorageCom.py delete mode 100644 pyload/plugin/crypter/DepositfilesCom.py delete mode 100644 pyload/plugin/crypter/Dereferer.py delete mode 100644 pyload/plugin/crypter/DevhostStFolder.py delete mode 100644 pyload/plugin/crypter/DlProtectCom.py delete mode 100644 pyload/plugin/crypter/DontKnowMe.py delete mode 100644 pyload/plugin/crypter/DuckCryptInfo.py delete mode 100644 pyload/plugin/crypter/DuploadOrg.py delete mode 100644 pyload/plugin/crypter/EasybytezCom.py delete mode 100644 pyload/plugin/crypter/EmbeduploadCom.py delete mode 100644 pyload/plugin/crypter/FilebeerInfo.py delete mode 100644 pyload/plugin/crypter/FilecloudIo.py delete mode 100644 pyload/plugin/crypter/FilecryptCc.py delete mode 100644 pyload/plugin/crypter/FilefactoryCom.py delete mode 100644 pyload/plugin/crypter/FilerNet.py delete mode 100644 pyload/plugin/crypter/FileserveCom.py delete mode 100644 pyload/plugin/crypter/FilesonicCom.py delete mode 100644 pyload/plugin/crypter/FilestubeCom.py delete mode 100644 pyload/plugin/crypter/FiletramCom.py delete mode 100644 pyload/plugin/crypter/FiredriveCom.py delete mode 100644 pyload/plugin/crypter/FourChanOrg.py delete mode 100644 pyload/plugin/crypter/FreakhareCom.py delete mode 100644 pyload/plugin/crypter/FreetexthostCom.py delete mode 100644 pyload/plugin/crypter/FshareVn.py delete mode 100644 pyload/plugin/crypter/Go4UpCom.py delete mode 100644 pyload/plugin/crypter/GooGl.py delete mode 100644 pyload/plugin/crypter/HoerbuchIn.py delete mode 100644 pyload/plugin/crypter/HotfileCom.py delete mode 100644 pyload/plugin/crypter/ILoadTo.py delete mode 100644 pyload/plugin/crypter/ImgurComAlbum.py delete mode 100644 pyload/plugin/crypter/JunocloudMe.py delete mode 100644 pyload/plugin/crypter/LetitbitNet.py delete mode 100644 pyload/plugin/crypter/LinkCryptWs.py delete mode 100644 pyload/plugin/crypter/LinkSaveIn.py delete mode 100644 pyload/plugin/crypter/LinkdecrypterCom.py delete mode 100644 pyload/plugin/crypter/LixIn.py delete mode 100644 pyload/plugin/crypter/LofCc.py delete mode 100644 pyload/plugin/crypter/MBLinkInfo.py delete mode 100644 pyload/plugin/crypter/MediafireCom.py delete mode 100644 pyload/plugin/crypter/MegaRapidCz.py delete mode 100644 pyload/plugin/crypter/MegauploadCom.py delete mode 100644 pyload/plugin/crypter/Movie2KTo.py delete mode 100644 pyload/plugin/crypter/MultiUpOrg.py delete mode 100644 pyload/plugin/crypter/MultiloadCz.py delete mode 100644 pyload/plugin/crypter/MultiuploadCom.py delete mode 100644 pyload/plugin/crypter/NCryptIn.py delete mode 100644 pyload/plugin/crypter/NetfolderIn.py delete mode 100644 pyload/plugin/crypter/NosvideoCom.py delete mode 100644 pyload/plugin/crypter/OneKhDe.py delete mode 100644 pyload/plugin/crypter/OronCom.py delete mode 100644 pyload/plugin/crypter/PastebinCom.py delete mode 100644 pyload/plugin/crypter/QuickshareCz.py delete mode 100644 pyload/plugin/crypter/RSLayerCom.py delete mode 100644 pyload/plugin/crypter/RapidfileshareNet.py delete mode 100644 pyload/plugin/crypter/RelinkUs.py delete mode 100644 pyload/plugin/crypter/SafelinkingNet.py delete mode 100644 pyload/plugin/crypter/SecuredIn.py delete mode 100644 pyload/plugin/crypter/SexuriaCom.py delete mode 100644 pyload/plugin/crypter/ShareLinksBiz.py delete mode 100644 pyload/plugin/crypter/SharingmatrixCom.py delete mode 100644 pyload/plugin/crypter/SpeedLoadOrg.py delete mode 100644 pyload/plugin/crypter/StealthTo.py delete mode 100644 pyload/plugin/crypter/TnyCz.py delete mode 100644 pyload/plugin/crypter/TrailerzoneInfo.py delete mode 100644 pyload/plugin/crypter/TurbobitNet.py delete mode 100644 pyload/plugin/crypter/TusfilesNet.py delete mode 100644 pyload/plugin/crypter/UlozTo.py delete mode 100644 pyload/plugin/crypter/UploadableCh.py delete mode 100644 pyload/plugin/crypter/UploadedTo.py delete mode 100644 pyload/plugin/crypter/WiiReloadedOrg.py delete mode 100644 pyload/plugin/crypter/WuploadCom.py delete mode 100644 pyload/plugin/crypter/XFileSharingPro.py delete mode 100644 pyload/plugin/crypter/XupPl.py delete mode 100644 pyload/plugin/crypter/YoutubeBatch.py delete mode 100644 pyload/plugin/crypter/__init__.py delete mode 100644 pyload/plugin/hook/AlldebridCom.py delete mode 100644 pyload/plugin/hook/BypassCaptcha.py delete mode 100644 pyload/plugin/hook/Captcha9Kw.py delete mode 100644 pyload/plugin/hook/CaptchaBrotherhood.py delete mode 100644 pyload/plugin/hook/DeathByCaptcha.py delete mode 100644 pyload/plugin/hook/DebridItaliaCom.py delete mode 100644 pyload/plugin/hook/EasybytezCom.py delete mode 100644 pyload/plugin/hook/ExpertDecoders.py delete mode 100644 pyload/plugin/hook/FastixRu.py delete mode 100644 pyload/plugin/hook/FreeWayMe.py delete mode 100644 pyload/plugin/hook/ImageTyperz.py delete mode 100644 pyload/plugin/hook/LinkdecrypterCom.py delete mode 100644 pyload/plugin/hook/LinksnappyCom.py delete mode 100644 pyload/plugin/hook/MegaDebridEu.py delete mode 100644 pyload/plugin/hook/MultishareCz.py delete mode 100644 pyload/plugin/hook/MyfastfileCom.py delete mode 100644 pyload/plugin/hook/OverLoadMe.py delete mode 100644 pyload/plugin/hook/PremiumTo.py delete mode 100644 pyload/plugin/hook/PremiumizeMe.py delete mode 100644 pyload/plugin/hook/RPNetBiz.py delete mode 100644 pyload/plugin/hook/RealdebridCom.py delete mode 100644 pyload/plugin/hook/RehostTo.py delete mode 100644 pyload/plugin/hook/SimplyPremiumCom.py delete mode 100644 pyload/plugin/hook/SimplydebridCom.py delete mode 100644 pyload/plugin/hook/UnrestrictLi.py delete mode 100644 pyload/plugin/hook/XFileSharingPro.py delete mode 100644 pyload/plugin/hook/ZeveraCom.py delete mode 100644 pyload/plugin/hook/__init__.py delete mode 100644 pyload/plugin/hoster/AlldebridCom.py delete mode 100644 pyload/plugin/hoster/BayfilesCom.py delete mode 100644 pyload/plugin/hoster/BezvadataCz.py delete mode 100644 pyload/plugin/hoster/BillionuploadsCom.py delete mode 100644 pyload/plugin/hoster/BitshareCom.py delete mode 100644 pyload/plugin/hoster/BoltsharingCom.py delete mode 100644 pyload/plugin/hoster/CatShareNet.py delete mode 100644 pyload/plugin/hoster/CloudzerNet.py delete mode 100644 pyload/plugin/hoster/CramitIn.py delete mode 100644 pyload/plugin/hoster/CrockoCom.py delete mode 100644 pyload/plugin/hoster/CyberlockerCh.py delete mode 100644 pyload/plugin/hoster/CzshareCom.py delete mode 100644 pyload/plugin/hoster/DailymotionCom.py delete mode 100644 pyload/plugin/hoster/DataHu.py delete mode 100644 pyload/plugin/hoster/DataportCz.py delete mode 100644 pyload/plugin/hoster/DateiTo.py delete mode 100644 pyload/plugin/hoster/DdlstorageCom.py delete mode 100644 pyload/plugin/hoster/DebridItaliaCom.py delete mode 100644 pyload/plugin/hoster/DepositfilesCom.py delete mode 100644 pyload/plugin/hoster/DevhostSt.py delete mode 100644 pyload/plugin/hoster/DlFreeFr.py delete mode 100644 pyload/plugin/hoster/DodanePl.py delete mode 100644 pyload/plugin/hoster/DuploadOrg.py delete mode 100644 pyload/plugin/hoster/EasybytezCom.py delete mode 100644 pyload/plugin/hoster/EdiskCz.py delete mode 100644 pyload/plugin/hoster/EgoFilesCom.py delete mode 100644 pyload/plugin/hoster/EnteruploadCom.py delete mode 100644 pyload/plugin/hoster/EpicShareNet.py delete mode 100644 pyload/plugin/hoster/EuroshareEu.py delete mode 100644 pyload/plugin/hoster/ExtabitCom.py delete mode 100644 pyload/plugin/hoster/FastixRu.py delete mode 100644 pyload/plugin/hoster/FastshareCz.py delete mode 100644 pyload/plugin/hoster/FileApeCom.py delete mode 100644 pyload/plugin/hoster/FileParadoxIn.py delete mode 100644 pyload/plugin/hoster/FileSharkPl.py delete mode 100644 pyload/plugin/hoster/FileStoreTo.py delete mode 100644 pyload/plugin/hoster/FilebeerInfo.py delete mode 100644 pyload/plugin/hoster/FilecloudIo.py delete mode 100644 pyload/plugin/hoster/FilefactoryCom.py delete mode 100644 pyload/plugin/hoster/FilejungleCom.py delete mode 100644 pyload/plugin/hoster/FileomCom.py delete mode 100644 pyload/plugin/hoster/FilepostCom.py delete mode 100644 pyload/plugin/hoster/FilepupNet.py delete mode 100644 pyload/plugin/hoster/FilerNet.py delete mode 100644 pyload/plugin/hoster/FilerioCom.py delete mode 100644 pyload/plugin/hoster/FilesMailRu.py delete mode 100644 pyload/plugin/hoster/FileserveCom.py delete mode 100644 pyload/plugin/hoster/FileshareInUa.py delete mode 100644 pyload/plugin/hoster/FilesonicCom.py delete mode 100644 pyload/plugin/hoster/FilezyNet.py delete mode 100644 pyload/plugin/hoster/FiredriveCom.py delete mode 100644 pyload/plugin/hoster/FlyFilesNet.py delete mode 100644 pyload/plugin/hoster/FourSharedCom.py delete mode 100644 pyload/plugin/hoster/FreakshareCom.py delete mode 100644 pyload/plugin/hoster/FreeWayMe.py delete mode 100644 pyload/plugin/hoster/FreevideoCz.py delete mode 100644 pyload/plugin/hoster/FshareVn.py delete mode 100644 pyload/plugin/hoster/Ftp.py delete mode 100644 pyload/plugin/hoster/GamefrontCom.py delete mode 100644 pyload/plugin/hoster/GigapetaCom.py delete mode 100644 pyload/plugin/hoster/GooIm.py delete mode 100644 pyload/plugin/hoster/HellshareCz.py delete mode 100644 pyload/plugin/hoster/HellspyCz.py delete mode 100644 pyload/plugin/hoster/HotfileCom.py delete mode 100644 pyload/plugin/hoster/HugefilesNet.py delete mode 100644 pyload/plugin/hoster/HundredEightyUploadCom.py delete mode 100644 pyload/plugin/hoster/IFileWs.py delete mode 100644 pyload/plugin/hoster/IcyFilesCom.py delete mode 100644 pyload/plugin/hoster/IfileIt.py delete mode 100644 pyload/plugin/hoster/IfolderRu.py delete mode 100644 pyload/plugin/hoster/JumbofilesCom.py delete mode 100644 pyload/plugin/hoster/JunocloudMe.py delete mode 100644 pyload/plugin/hoster/Keep2ShareCc.py delete mode 100644 pyload/plugin/hoster/KickloadCom.py delete mode 100644 pyload/plugin/hoster/KingfilesNet.py delete mode 100644 pyload/plugin/hoster/LemUploadsCom.py delete mode 100644 pyload/plugin/hoster/LetitbitNet.py delete mode 100644 pyload/plugin/hoster/LinksnappyCom.py delete mode 100644 pyload/plugin/hoster/LoadTo.py delete mode 100644 pyload/plugin/hoster/LomafileCom.py delete mode 100644 pyload/plugin/hoster/LuckyShareNet.py delete mode 100644 pyload/plugin/hoster/MediafireCom.py delete mode 100644 pyload/plugin/hoster/MegaCoNz.py delete mode 100644 pyload/plugin/hoster/MegaDebridEu.py delete mode 100644 pyload/plugin/hoster/MegaFilesSe.py delete mode 100644 pyload/plugin/hoster/MegaRapidCz.py delete mode 100644 pyload/plugin/hoster/MegacrypterCom.py delete mode 100644 pyload/plugin/hoster/MegareleaseOrg.py delete mode 100644 pyload/plugin/hoster/MegasharesCom.py delete mode 100644 pyload/plugin/hoster/MegauploadCom.py delete mode 100644 pyload/plugin/hoster/MegavideoCom.py delete mode 100644 pyload/plugin/hoster/MovReelCom.py delete mode 100644 pyload/plugin/hoster/MultishareCz.py delete mode 100644 pyload/plugin/hoster/MyfastfileCom.py delete mode 100644 pyload/plugin/hoster/MyvideoDe.py delete mode 100644 pyload/plugin/hoster/NahrajCz.py delete mode 100644 pyload/plugin/hoster/NarodRu.py delete mode 100644 pyload/plugin/hoster/NetloadIn.py delete mode 100644 pyload/plugin/hoster/NosuploadCom.py delete mode 100644 pyload/plugin/hoster/NovafileCom.py delete mode 100644 pyload/plugin/hoster/NowDownloadSx.py delete mode 100644 pyload/plugin/hoster/NowVideoSx.py delete mode 100644 pyload/plugin/hoster/OboomCom.py delete mode 100644 pyload/plugin/hoster/OneFichierCom.py delete mode 100644 pyload/plugin/hoster/OronCom.py delete mode 100644 pyload/plugin/hoster/OverLoadMe.py delete mode 100644 pyload/plugin/hoster/PandaplaNet.py delete mode 100644 pyload/plugin/hoster/PornhostCom.py delete mode 100644 pyload/plugin/hoster/PornhubCom.py delete mode 100644 pyload/plugin/hoster/PotloadCom.py delete mode 100644 pyload/plugin/hoster/PremiumTo.py delete mode 100644 pyload/plugin/hoster/PremiumizeMe.py delete mode 100644 pyload/plugin/hoster/PromptfileCom.py delete mode 100644 pyload/plugin/hoster/PrzeklejPl.py delete mode 100644 pyload/plugin/hoster/QuickshareCz.py delete mode 100644 pyload/plugin/hoster/RPNetBiz.py delete mode 100644 pyload/plugin/hoster/RapidfileshareNet.py delete mode 100644 pyload/plugin/hoster/RapidgatorNet.py delete mode 100644 pyload/plugin/hoster/RapiduNet.py delete mode 100644 pyload/plugin/hoster/RarefileNet.py delete mode 100644 pyload/plugin/hoster/RealdebridCom.py delete mode 100644 pyload/plugin/hoster/RedtubeCom.py delete mode 100644 pyload/plugin/hoster/RehostTo.py delete mode 100644 pyload/plugin/hoster/RemixshareCom.py delete mode 100644 pyload/plugin/hoster/RgHostNet.py delete mode 100644 pyload/plugin/hoster/RyushareCom.py delete mode 100644 pyload/plugin/hoster/SafesharingEu.py delete mode 100644 pyload/plugin/hoster/SecureUploadEu.py delete mode 100644 pyload/plugin/hoster/SendmywayCom.py delete mode 100644 pyload/plugin/hoster/SendspaceCom.py delete mode 100644 pyload/plugin/hoster/Share4WebCom.py delete mode 100644 pyload/plugin/hoster/Share76Com.py delete mode 100644 pyload/plugin/hoster/ShareFilesCo.py delete mode 100644 pyload/plugin/hoster/SharebeesCom.py delete mode 100644 pyload/plugin/hoster/ShareonlineBiz.py delete mode 100644 pyload/plugin/hoster/ShareplaceCom.py delete mode 100644 pyload/plugin/hoster/SharingmatrixCom.py delete mode 100644 pyload/plugin/hoster/ShragleCom.py delete mode 100644 pyload/plugin/hoster/SimplyPremiumCom.py delete mode 100644 pyload/plugin/hoster/SimplydebridCom.py delete mode 100644 pyload/plugin/hoster/SockshareCom.py delete mode 100644 pyload/plugin/hoster/SoundcloudCom.py delete mode 100644 pyload/plugin/hoster/SpeedLoadOrg.py delete mode 100644 pyload/plugin/hoster/SpeedfileCz.py delete mode 100644 pyload/plugin/hoster/SpeedyshareCom.py delete mode 100644 pyload/plugin/hoster/StorageTo.py delete mode 100644 pyload/plugin/hoster/StreamCz.py delete mode 100644 pyload/plugin/hoster/StreamcloudEu.py delete mode 100644 pyload/plugin/hoster/TurbobitNet.py delete mode 100644 pyload/plugin/hoster/TurbouploadCom.py delete mode 100644 pyload/plugin/hoster/TusfilesNet.py delete mode 100644 pyload/plugin/hoster/TwoSharedCom.py delete mode 100644 pyload/plugin/hoster/UlozTo.py delete mode 100644 pyload/plugin/hoster/UloziskoSk.py delete mode 100644 pyload/plugin/hoster/UnibytesCom.py delete mode 100644 pyload/plugin/hoster/UnrestrictLi.py delete mode 100644 pyload/plugin/hoster/UpleaCom.py delete mode 100644 pyload/plugin/hoster/UploadStationCom.py delete mode 100644 pyload/plugin/hoster/UploadableCh.py delete mode 100644 pyload/plugin/hoster/UploadboxCom.py delete mode 100644 pyload/plugin/hoster/UploadedTo.py delete mode 100644 pyload/plugin/hoster/UploadhereCom.py delete mode 100644 pyload/plugin/hoster/UploadheroCom.py delete mode 100644 pyload/plugin/hoster/UploadingCom.py delete mode 100644 pyload/plugin/hoster/UploadkingCom.py delete mode 100644 pyload/plugin/hoster/UpstoreNet.py delete mode 100644 pyload/plugin/hoster/UptoboxCom.py delete mode 100644 pyload/plugin/hoster/VeehdCom.py delete mode 100644 pyload/plugin/hoster/VeohCom.py delete mode 100644 pyload/plugin/hoster/VidPlayNet.py delete mode 100644 pyload/plugin/hoster/VimeoCom.py delete mode 100644 pyload/plugin/hoster/Vipleech4UCom.py delete mode 100644 pyload/plugin/hoster/WarserverCz.py delete mode 100644 pyload/plugin/hoster/WebshareCz.py delete mode 100644 pyload/plugin/hoster/WrzucTo.py delete mode 100644 pyload/plugin/hoster/WuploadCom.py delete mode 100644 pyload/plugin/hoster/X7To.py delete mode 100644 pyload/plugin/hoster/XFileSharingPro.py delete mode 100644 pyload/plugin/hoster/XHamsterCom.py delete mode 100644 pyload/plugin/hoster/XVideosCom.py delete mode 100644 pyload/plugin/hoster/Xdcc.py delete mode 100644 pyload/plugin/hoster/YibaishiwuCom.py delete mode 100644 pyload/plugin/hoster/YoupornCom.py delete mode 100644 pyload/plugin/hoster/YourfilesTo.py delete mode 100644 pyload/plugin/hoster/YoutubeCom.py delete mode 100644 pyload/plugin/hoster/ZDF.py delete mode 100644 pyload/plugin/hoster/ZShareNet.py delete mode 100644 pyload/plugin/hoster/ZeveraCom.py delete mode 100644 pyload/plugin/hoster/ZippyshareCom.py delete mode 100644 pyload/plugin/hoster/__init__.py delete mode 100644 pyload/plugin/internal/AbstractExtractor.py delete mode 100644 pyload/plugin/internal/BasePlugin.py delete mode 100644 pyload/plugin/internal/DeadCrypter.py delete mode 100644 pyload/plugin/internal/DeadHoster.py delete mode 100644 pyload/plugin/internal/MultiHoster.py delete mode 100644 pyload/plugin/internal/SimpleCrypter.py delete mode 100644 pyload/plugin/internal/SimpleHoster.py delete mode 100644 pyload/plugin/internal/UnRar.py delete mode 100644 pyload/plugin/internal/UnZip.py delete mode 100644 pyload/plugin/internal/UpdateManager.py delete mode 100644 pyload/plugin/internal/XFSAccount.py delete mode 100644 pyload/plugin/internal/XFSCrypter.py delete mode 100644 pyload/plugin/internal/XFSHoster.py delete mode 100644 pyload/plugin/internal/__init__.py delete mode 100644 pyload/plugin/ocr/GigasizeCom.py delete mode 100644 pyload/plugin/ocr/LinksaveIn.py delete mode 100644 pyload/plugin/ocr/NetloadIn.py delete mode 100644 pyload/plugin/ocr/ShareonlineBiz.py delete mode 100644 pyload/plugin/ocr/__init__.py delete mode 100644 pyload/remote/ClickAndLoadBackend.py delete mode 100644 pyload/remote/SocketBackend.py delete mode 100644 pyload/remote/ThriftBackend.py delete mode 100644 pyload/remote/__init__.py delete mode 100644 pyload/remote/socketbackend/__init__.py delete mode 100644 pyload/remote/socketbackend/create_ttypes.py delete mode 100644 pyload/remote/thriftbackend/Processor.py delete mode 100644 pyload/remote/thriftbackend/Protocol.py delete mode 100644 pyload/remote/thriftbackend/Socket.py delete mode 100644 pyload/remote/thriftbackend/ThriftClient.py delete mode 100644 pyload/remote/thriftbackend/ThriftTest.py delete mode 100644 pyload/remote/thriftbackend/Transport.py delete mode 100644 pyload/remote/thriftbackend/__init__.py delete mode 100644 pyload/remote/thriftbackend/pyload.thrift delete mode 100644 pyload/remote/thriftbackend/thriftgen/__init__.py delete mode 100644 pyload/remote/thriftbackend/thriftgen/pyload/Pyload-remote delete mode 100644 pyload/remote/thriftbackend/thriftgen/pyload/Pyload.py delete mode 100644 pyload/remote/thriftbackend/thriftgen/pyload/__init__.py delete mode 100644 pyload/remote/thriftbackend/thriftgen/pyload/constants.py delete mode 100644 pyload/remote/thriftbackend/thriftgen/pyload/ttypes.py delete mode 100644 pyload/utils/__init__.py delete mode 100644 pyload/utils/packagetools.py delete mode 100644 pyload/utils/printer.py delete mode 100644 pyload/utils/pylgettext.py delete mode 100644 pyload/webui/__init__.py delete mode 100644 pyload/webui/app/__init__.py delete mode 100644 pyload/webui/app/api.py delete mode 100644 pyload/webui/app/cnl.py delete mode 100644 pyload/webui/app/json.py delete mode 100644 pyload/webui/app/pyload.py delete mode 100644 pyload/webui/app/utils.py delete mode 100644 pyload/webui/filters.py delete mode 100644 pyload/webui/middlewares.py delete mode 100644 pyload/webui/servers/lighttpd_default.conf delete mode 100644 pyload/webui/servers/nginx_default.conf delete mode 100644 pyload/webui/themes/Dark/css/MooDialog.css delete mode 100644 pyload/webui/themes/Dark/css/base.css delete mode 100644 pyload/webui/themes/Dark/css/log.css delete mode 100644 pyload/webui/themes/Dark/css/pathchooser.css delete mode 100644 pyload/webui/themes/Dark/css/window.css delete mode 100644 pyload/webui/themes/Dark/img/MooDialog/dialog-close.png delete mode 100644 pyload/webui/themes/Dark/img/MooDialog/dialog-error.png delete mode 100644 pyload/webui/themes/Dark/img/MooDialog/dialog-question.png delete mode 100644 pyload/webui/themes/Dark/img/MooDialog/dialog-warning.png delete mode 100644 pyload/webui/themes/Dark/img/button.png delete mode 100644 pyload/webui/themes/Dark/img/dark-bg.jpg delete mode 100644 pyload/webui/themes/Dark/img/default/add_folder.png delete mode 100644 pyload/webui/themes/Dark/img/default/ajax-loader.gif delete mode 100644 pyload/webui/themes/Dark/img/default/arrow_refresh.png delete mode 100644 pyload/webui/themes/Dark/img/default/arrow_right.png delete mode 100644 pyload/webui/themes/Dark/img/default/big_button.gif delete mode 100644 pyload/webui/themes/Dark/img/default/big_button_over.gif delete mode 100644 pyload/webui/themes/Dark/img/default/body.png delete mode 100644 pyload/webui/themes/Dark/img/default/closebtn.gif delete mode 100644 pyload/webui/themes/Dark/img/default/cog.png delete mode 100644 pyload/webui/themes/Dark/img/default/control_add.png delete mode 100644 pyload/webui/themes/Dark/img/default/control_add_blue.png delete mode 100644 pyload/webui/themes/Dark/img/default/control_cancel.png delete mode 100644 pyload/webui/themes/Dark/img/default/control_cancel_blue.png delete mode 100644 pyload/webui/themes/Dark/img/default/control_pause.png delete mode 100644 pyload/webui/themes/Dark/img/default/control_pause_blue.png delete mode 100644 pyload/webui/themes/Dark/img/default/control_play.png delete mode 100644 pyload/webui/themes/Dark/img/default/control_play_blue.png delete mode 100644 pyload/webui/themes/Dark/img/default/control_stop.png delete mode 100644 pyload/webui/themes/Dark/img/default/control_stop_blue.png delete mode 100644 pyload/webui/themes/Dark/img/default/delete.png delete mode 100644 pyload/webui/themes/Dark/img/default/drag_corner.gif delete mode 100644 pyload/webui/themes/Dark/img/default/error.png delete mode 100644 pyload/webui/themes/Dark/img/default/folder.png delete mode 100644 pyload/webui/themes/Dark/img/default/full.png delete mode 100644 pyload/webui/themes/Dark/img/default/head-login.png delete mode 100644 pyload/webui/themes/Dark/img/default/head-menu-collector.png delete mode 100644 pyload/webui/themes/Dark/img/default/head-menu-config.png delete mode 100644 pyload/webui/themes/Dark/img/default/head-menu-development.png delete mode 100644 pyload/webui/themes/Dark/img/default/head-menu-download.png delete mode 100644 pyload/webui/themes/Dark/img/default/head-menu-home.png delete mode 100644 pyload/webui/themes/Dark/img/default/head-menu-index.png delete mode 100644 pyload/webui/themes/Dark/img/default/head-menu-news.png delete mode 100644 pyload/webui/themes/Dark/img/default/head-menu-queue.png delete mode 100644 pyload/webui/themes/Dark/img/default/head-menu-recent.png delete mode 100644 pyload/webui/themes/Dark/img/default/head-menu-wiki.png delete mode 100644 pyload/webui/themes/Dark/img/default/head-search-noshadow.png delete mode 100644 pyload/webui/themes/Dark/img/default/head_bg1.png delete mode 100644 pyload/webui/themes/Dark/img/default/images.png delete mode 100644 pyload/webui/themes/Dark/img/default/notice.png delete mode 100644 pyload/webui/themes/Dark/img/default/package_go.png delete mode 100644 pyload/webui/themes/Dark/img/default/page-tools-backlinks.png delete mode 100644 pyload/webui/themes/Dark/img/default/page-tools-edit.png delete mode 100644 pyload/webui/themes/Dark/img/default/page-tools-revisions.png delete mode 100644 pyload/webui/themes/Dark/img/default/parseUri.png delete mode 100644 pyload/webui/themes/Dark/img/default/pencil.png delete mode 100644 pyload/webui/themes/Dark/img/default/reconnect.png delete mode 100644 pyload/webui/themes/Dark/img/default/status_None.png delete mode 100644 pyload/webui/themes/Dark/img/default/status_downloading.png delete mode 100644 pyload/webui/themes/Dark/img/default/status_failed.png delete mode 100644 pyload/webui/themes/Dark/img/default/status_finished.png delete mode 100644 pyload/webui/themes/Dark/img/default/status_offline.png delete mode 100644 pyload/webui/themes/Dark/img/default/status_proc.png delete mode 100644 pyload/webui/themes/Dark/img/default/status_queue.png delete mode 100644 pyload/webui/themes/Dark/img/default/status_waiting.png delete mode 100644 pyload/webui/themes/Dark/img/default/success.png delete mode 100644 pyload/webui/themes/Dark/img/default/tabs-border-bottom.png delete mode 100644 pyload/webui/themes/Dark/img/default/user-actions-logout.png delete mode 100644 pyload/webui/themes/Dark/img/default/user-actions-profile.png delete mode 100644 pyload/webui/themes/Dark/img/default/user-info.png delete mode 100644 pyload/webui/themes/Dark/img/pyload-logo.png delete mode 100644 pyload/webui/themes/Dark/img/tab-background.png delete mode 100644 pyload/webui/themes/Dark/js/render/admin.coffee delete mode 100644 pyload/webui/themes/Dark/js/render/admin.min.js delete mode 100644 pyload/webui/themes/Dark/js/render/base.coffee delete mode 100644 pyload/webui/themes/Dark/js/render/base.min.js delete mode 100644 pyload/webui/themes/Dark/js/render/package.js delete mode 100644 pyload/webui/themes/Dark/js/render/settings.coffee delete mode 100644 pyload/webui/themes/Dark/js/render/settings.min.js delete mode 100644 pyload/webui/themes/Dark/js/static/MooDialog.js delete mode 100644 pyload/webui/themes/Dark/js/static/MooDialog.min.js delete mode 100644 pyload/webui/themes/Dark/js/static/MooDropMenu.js delete mode 100644 pyload/webui/themes/Dark/js/static/MooDropMenu.min.js delete mode 100644 pyload/webui/themes/Dark/js/static/mootools-core.js delete mode 100644 pyload/webui/themes/Dark/js/static/mootools-core.min.js delete mode 100644 pyload/webui/themes/Dark/js/static/mootools-more.js delete mode 100644 pyload/webui/themes/Dark/js/static/mootools-more.min.js delete mode 100644 pyload/webui/themes/Dark/js/static/purr.js delete mode 100644 pyload/webui/themes/Dark/js/static/purr.min.js delete mode 100644 pyload/webui/themes/Dark/js/static/tinytab.js delete mode 100644 pyload/webui/themes/Dark/js/static/tinytab.min.js delete mode 100644 pyload/webui/themes/Dark/tml/admin.html delete mode 100644 pyload/webui/themes/Dark/tml/base.html delete mode 100644 pyload/webui/themes/Dark/tml/captcha.html delete mode 100644 pyload/webui/themes/Dark/tml/downloads.html delete mode 100644 pyload/webui/themes/Dark/tml/folder.html delete mode 100644 pyload/webui/themes/Dark/tml/home.html delete mode 100644 pyload/webui/themes/Dark/tml/info.html delete mode 100644 pyload/webui/themes/Dark/tml/login.html delete mode 100644 pyload/webui/themes/Dark/tml/logout.html delete mode 100644 pyload/webui/themes/Dark/tml/logs.html delete mode 100644 pyload/webui/themes/Dark/tml/pathchooser.html delete mode 100644 pyload/webui/themes/Dark/tml/queue.html delete mode 100644 pyload/webui/themes/Dark/tml/settings.html delete mode 100644 pyload/webui/themes/Dark/tml/settings_item.html delete mode 100644 pyload/webui/themes/Dark/tml/window.html delete mode 100644 pyload/webui/themes/Default/css/MooDialog.css delete mode 100644 pyload/webui/themes/Default/css/base.css delete mode 100644 pyload/webui/themes/Default/css/log.css delete mode 100644 pyload/webui/themes/Default/css/pathchooser.css delete mode 100644 pyload/webui/themes/Default/css/window.css delete mode 100644 pyload/webui/themes/Default/img/MooDialog/dialog-close.png delete mode 100644 pyload/webui/themes/Default/img/MooDialog/dialog-error.png delete mode 100644 pyload/webui/themes/Default/img/MooDialog/dialog-question.png delete mode 100644 pyload/webui/themes/Default/img/MooDialog/dialog-warning.png delete mode 100644 pyload/webui/themes/Default/img/add_folder.png delete mode 100644 pyload/webui/themes/Default/img/ajax-loader.gif delete mode 100644 pyload/webui/themes/Default/img/arrow_refresh.png delete mode 100644 pyload/webui/themes/Default/img/arrow_right.png delete mode 100644 pyload/webui/themes/Default/img/big_button.gif delete mode 100644 pyload/webui/themes/Default/img/big_button_over.gif delete mode 100644 pyload/webui/themes/Default/img/body.png delete mode 100644 pyload/webui/themes/Default/img/button.png delete mode 100644 pyload/webui/themes/Default/img/closebtn.gif delete mode 100644 pyload/webui/themes/Default/img/cog.png delete mode 100644 pyload/webui/themes/Default/img/control_add.png delete mode 100644 pyload/webui/themes/Default/img/control_add_blue.png delete mode 100644 pyload/webui/themes/Default/img/control_cancel.png delete mode 100644 pyload/webui/themes/Default/img/control_cancel_blue.png delete mode 100644 pyload/webui/themes/Default/img/control_pause.png delete mode 100644 pyload/webui/themes/Default/img/control_pause_blue.png delete mode 100644 pyload/webui/themes/Default/img/control_play.png delete mode 100644 pyload/webui/themes/Default/img/control_play_blue.png delete mode 100644 pyload/webui/themes/Default/img/control_stop.png delete mode 100644 pyload/webui/themes/Default/img/control_stop_blue.png delete mode 100644 pyload/webui/themes/Default/img/delete.png delete mode 100644 pyload/webui/themes/Default/img/drag_corner.gif delete mode 100644 pyload/webui/themes/Default/img/error.png delete mode 100644 pyload/webui/themes/Default/img/folder.png delete mode 100644 pyload/webui/themes/Default/img/full.png delete mode 100644 pyload/webui/themes/Default/img/head-login.png delete mode 100644 pyload/webui/themes/Default/img/head-menu-collector.png delete mode 100644 pyload/webui/themes/Default/img/head-menu-config.png delete mode 100644 pyload/webui/themes/Default/img/head-menu-development.png delete mode 100644 pyload/webui/themes/Default/img/head-menu-download.png delete mode 100644 pyload/webui/themes/Default/img/head-menu-home.png delete mode 100644 pyload/webui/themes/Default/img/head-menu-index.png delete mode 100644 pyload/webui/themes/Default/img/head-menu-news.png delete mode 100644 pyload/webui/themes/Default/img/head-menu-queue.png delete mode 100644 pyload/webui/themes/Default/img/head-menu-recent.png delete mode 100644 pyload/webui/themes/Default/img/head-menu-wiki.png delete mode 100644 pyload/webui/themes/Default/img/head-search-noshadow.png delete mode 100644 pyload/webui/themes/Default/img/head_bg1.png delete mode 100644 pyload/webui/themes/Default/img/images.png delete mode 100644 pyload/webui/themes/Default/img/notice.png delete mode 100644 pyload/webui/themes/Default/img/package_go.png delete mode 100644 pyload/webui/themes/Default/img/page-tools-backlinks.png delete mode 100644 pyload/webui/themes/Default/img/page-tools-edit.png delete mode 100644 pyload/webui/themes/Default/img/page-tools-revisions.png delete mode 100644 pyload/webui/themes/Default/img/parseUri.png delete mode 100644 pyload/webui/themes/Default/img/pencil.png delete mode 100644 pyload/webui/themes/Default/img/pyload-logo.png delete mode 100644 pyload/webui/themes/Default/img/reconnect.png delete mode 100644 pyload/webui/themes/Default/img/status_None.png delete mode 100644 pyload/webui/themes/Default/img/status_downloading.png delete mode 100644 pyload/webui/themes/Default/img/status_failed.png delete mode 100644 pyload/webui/themes/Default/img/status_finished.png delete mode 100644 pyload/webui/themes/Default/img/status_offline.png delete mode 100644 pyload/webui/themes/Default/img/status_proc.png delete mode 100644 pyload/webui/themes/Default/img/status_queue.png delete mode 100644 pyload/webui/themes/Default/img/status_waiting.png delete mode 100644 pyload/webui/themes/Default/img/success.png delete mode 100644 pyload/webui/themes/Default/img/tab-background.png delete mode 100644 pyload/webui/themes/Default/img/tabs-border-bottom.png delete mode 100644 pyload/webui/themes/Default/img/user-actions-logout.png delete mode 100644 pyload/webui/themes/Default/img/user-actions-profile.png delete mode 100644 pyload/webui/themes/Default/img/user-info.png delete mode 100644 pyload/webui/themes/Default/js/render/admin.coffee delete mode 100644 pyload/webui/themes/Default/js/render/admin.min.js delete mode 100644 pyload/webui/themes/Default/js/render/base.coffee delete mode 100644 pyload/webui/themes/Default/js/render/base.min.js delete mode 100644 pyload/webui/themes/Default/js/render/package.js delete mode 100644 pyload/webui/themes/Default/js/render/settings.coffee delete mode 100644 pyload/webui/themes/Default/js/render/settings.min.js delete mode 100644 pyload/webui/themes/Default/js/static/MooDialog.js delete mode 100644 pyload/webui/themes/Default/js/static/MooDialog.min.js delete mode 100644 pyload/webui/themes/Default/js/static/MooDropMenu.js delete mode 100644 pyload/webui/themes/Default/js/static/MooDropMenu.min.js delete mode 100644 pyload/webui/themes/Default/js/static/mootools-core.js delete mode 100644 pyload/webui/themes/Default/js/static/mootools-core.min.js delete mode 100644 pyload/webui/themes/Default/js/static/mootools-more.js delete mode 100644 pyload/webui/themes/Default/js/static/mootools-more.min.js delete mode 100644 pyload/webui/themes/Default/js/static/purr.js delete mode 100644 pyload/webui/themes/Default/js/static/purr.min.js delete mode 100644 pyload/webui/themes/Default/js/static/tinytab.js delete mode 100644 pyload/webui/themes/Default/js/static/tinytab.min.js delete mode 100644 pyload/webui/themes/Default/tml/admin.html delete mode 100644 pyload/webui/themes/Default/tml/base.html delete mode 100644 pyload/webui/themes/Default/tml/captcha.html delete mode 100644 pyload/webui/themes/Default/tml/downloads.html delete mode 100644 pyload/webui/themes/Default/tml/filemanager.html delete mode 100644 pyload/webui/themes/Default/tml/folder.html delete mode 100644 pyload/webui/themes/Default/tml/home.html delete mode 100644 pyload/webui/themes/Default/tml/info.html delete mode 100644 pyload/webui/themes/Default/tml/login.html delete mode 100644 pyload/webui/themes/Default/tml/logout.html delete mode 100644 pyload/webui/themes/Default/tml/logs.html delete mode 100644 pyload/webui/themes/Default/tml/pathchooser.html delete mode 100644 pyload/webui/themes/Default/tml/queue.html delete mode 100644 pyload/webui/themes/Default/tml/settings.html delete mode 100644 pyload/webui/themes/Default/tml/settings_item.html delete mode 100644 pyload/webui/themes/Default/tml/window.html delete mode 100644 pyload/webui/themes/Flat/css/MooDialog.css delete mode 100644 pyload/webui/themes/Flat/css/base.css delete mode 100644 pyload/webui/themes/Flat/css/log.css delete mode 100644 pyload/webui/themes/Flat/css/pathchooser.css delete mode 100644 pyload/webui/themes/Flat/css/window.css delete mode 100644 pyload/webui/themes/Flat/img/MooDialog/dialog-close.png delete mode 100644 pyload/webui/themes/Flat/img/MooDialog/dialog-error.png delete mode 100644 pyload/webui/themes/Flat/img/MooDialog/dialog-question.png delete mode 100644 pyload/webui/themes/Flat/img/MooDialog/dialog-warning.png delete mode 100644 pyload/webui/themes/Flat/img/arrow_refresh.png delete mode 100644 pyload/webui/themes/Flat/img/arrow_right.png delete mode 100644 pyload/webui/themes/Flat/img/button.png delete mode 100644 pyload/webui/themes/Flat/img/cog.png delete mode 100644 pyload/webui/themes/Flat/img/control_add.png delete mode 100644 pyload/webui/themes/Flat/img/control_add_blue.png delete mode 100644 pyload/webui/themes/Flat/img/control_cancel.png delete mode 100644 pyload/webui/themes/Flat/img/control_cancel_blue.png delete mode 100644 pyload/webui/themes/Flat/img/control_pause.png delete mode 100644 pyload/webui/themes/Flat/img/control_pause_blue.png delete mode 100644 pyload/webui/themes/Flat/img/control_play.png delete mode 100644 pyload/webui/themes/Flat/img/control_play_blue.png delete mode 100644 pyload/webui/themes/Flat/img/control_stop.png delete mode 100644 pyload/webui/themes/Flat/img/control_stop_blue.png delete mode 100644 pyload/webui/themes/Flat/img/default/add_folder.png delete mode 100644 pyload/webui/themes/Flat/img/default/ajax-loader.gif delete mode 100644 pyload/webui/themes/Flat/img/default/big_button.gif delete mode 100644 pyload/webui/themes/Flat/img/default/big_button_over.gif delete mode 100644 pyload/webui/themes/Flat/img/default/body.png delete mode 100644 pyload/webui/themes/Flat/img/default/closebtn.gif delete mode 100644 pyload/webui/themes/Flat/img/default/drag_corner.gif delete mode 100644 pyload/webui/themes/Flat/img/default/full.png delete mode 100644 pyload/webui/themes/Flat/img/default/head-menu-recent.png delete mode 100644 pyload/webui/themes/Flat/img/default/head_bg1.png delete mode 100644 pyload/webui/themes/Flat/img/default/images.png delete mode 100644 pyload/webui/themes/Flat/img/default/parseUri.png delete mode 100644 pyload/webui/themes/Flat/img/default/pyload-logo.png delete mode 100644 pyload/webui/themes/Flat/img/default/tab-background.png delete mode 100644 pyload/webui/themes/Flat/img/default/tabs-border-bottom.png delete mode 100644 pyload/webui/themes/Flat/img/delete.png delete mode 100644 pyload/webui/themes/Flat/img/error.png delete mode 100644 pyload/webui/themes/Flat/img/folder.png delete mode 100644 pyload/webui/themes/Flat/img/head-login.png delete mode 100644 pyload/webui/themes/Flat/img/head-menu-collector.png delete mode 100644 pyload/webui/themes/Flat/img/head-menu-config.png delete mode 100644 pyload/webui/themes/Flat/img/head-menu-development.png delete mode 100644 pyload/webui/themes/Flat/img/head-menu-download.png delete mode 100644 pyload/webui/themes/Flat/img/head-menu-home.png delete mode 100644 pyload/webui/themes/Flat/img/head-menu-index.png delete mode 100644 pyload/webui/themes/Flat/img/head-menu-news.png delete mode 100644 pyload/webui/themes/Flat/img/head-menu-queue.png delete mode 100644 pyload/webui/themes/Flat/img/head-menu-wiki.png delete mode 100644 pyload/webui/themes/Flat/img/head-search-noshadow.png delete mode 100644 pyload/webui/themes/Flat/img/notice.png delete mode 100644 pyload/webui/themes/Flat/img/package_go.png delete mode 100644 pyload/webui/themes/Flat/img/page-tools-backlinks.png delete mode 100644 pyload/webui/themes/Flat/img/page-tools-edit.png delete mode 100644 pyload/webui/themes/Flat/img/page-tools-revisions.png delete mode 100644 pyload/webui/themes/Flat/img/pencil.png delete mode 100644 pyload/webui/themes/Flat/img/reconnect.png delete mode 100644 pyload/webui/themes/Flat/img/status_None.png delete mode 100644 pyload/webui/themes/Flat/img/status_downloading.png delete mode 100644 pyload/webui/themes/Flat/img/status_failed.png delete mode 100644 pyload/webui/themes/Flat/img/status_finished.png delete mode 100644 pyload/webui/themes/Flat/img/status_offline.png delete mode 100644 pyload/webui/themes/Flat/img/status_proc.png delete mode 100644 pyload/webui/themes/Flat/img/status_queue.png delete mode 100644 pyload/webui/themes/Flat/img/status_waiting.png delete mode 100644 pyload/webui/themes/Flat/img/success.png delete mode 100644 pyload/webui/themes/Flat/img/user-actions-logout.png delete mode 100644 pyload/webui/themes/Flat/img/user-actions-profile.png delete mode 100644 pyload/webui/themes/Flat/img/user-info.png delete mode 100644 pyload/webui/themes/Flat/js/render/admin.coffee delete mode 100644 pyload/webui/themes/Flat/js/render/admin.min.js delete mode 100644 pyload/webui/themes/Flat/js/render/base.coffee delete mode 100644 pyload/webui/themes/Flat/js/render/base.min.js delete mode 100644 pyload/webui/themes/Flat/js/render/filemanager.js delete mode 100644 pyload/webui/themes/Flat/js/render/package.js delete mode 100644 pyload/webui/themes/Flat/js/render/settings.coffee delete mode 100644 pyload/webui/themes/Flat/js/render/settings.min.js delete mode 100644 pyload/webui/themes/Flat/js/static/MooDialog.js delete mode 100644 pyload/webui/themes/Flat/js/static/MooDialog.min.js delete mode 100644 pyload/webui/themes/Flat/js/static/MooDropMenu.js delete mode 100644 pyload/webui/themes/Flat/js/static/MooDropMenu.min.js delete mode 100644 pyload/webui/themes/Flat/js/static/mootools-core.js delete mode 100644 pyload/webui/themes/Flat/js/static/mootools-core.min.js delete mode 100644 pyload/webui/themes/Flat/js/static/mootools-more.js delete mode 100644 pyload/webui/themes/Flat/js/static/mootools-more.min.js delete mode 100644 pyload/webui/themes/Flat/js/static/purr.js delete mode 100644 pyload/webui/themes/Flat/js/static/purr.min.js delete mode 100644 pyload/webui/themes/Flat/js/static/tinytab.js delete mode 100644 pyload/webui/themes/Flat/js/static/tinytab.min.js delete mode 100644 pyload/webui/themes/Flat/tml/admin.html delete mode 100644 pyload/webui/themes/Flat/tml/base.html delete mode 100644 pyload/webui/themes/Flat/tml/captcha.html delete mode 100644 pyload/webui/themes/Flat/tml/downloads.html delete mode 100644 pyload/webui/themes/Flat/tml/filemanager.html delete mode 100644 pyload/webui/themes/Flat/tml/folder.html delete mode 100644 pyload/webui/themes/Flat/tml/home.html delete mode 100644 pyload/webui/themes/Flat/tml/info.html delete mode 100644 pyload/webui/themes/Flat/tml/login.html delete mode 100644 pyload/webui/themes/Flat/tml/logout.html delete mode 100644 pyload/webui/themes/Flat/tml/logs.html delete mode 100644 pyload/webui/themes/Flat/tml/pathchooser.html delete mode 100644 pyload/webui/themes/Flat/tml/queue.html delete mode 100644 pyload/webui/themes/Flat/tml/settings.html delete mode 100644 pyload/webui/themes/Flat/tml/settings_item.html delete mode 100644 pyload/webui/themes/Flat/tml/window.html (limited to 'pyload') diff --git a/pyload/Core.py b/pyload/Core.py deleted file mode 100644 index fe4ae566e..000000000 --- a/pyload/Core.py +++ /dev/null @@ -1,632 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN, mkaay, sebnapi, spoob -# @version: v0.4.10 - -CURRENT_VERSION = '0.4.10' - -import __builtin__ - -from getopt import getopt, GetoptError -import pyload.utils.pylgettext as gettext -from imp import find_module -import logging -import logging.handlers -import os -from os import _exit, execl, getcwd, makedirs, remove, sep, walk, chdir, close -from os.path import exists, join -import signal -import subprocess -import sys -from sys import argv, executable, exit -from time import time, sleep -from traceback import print_exc - -from pyload.manager.Account import AccountManager -from pyload.manager.Captcha import CaptchaManager -from pyload.config.Parser import ConfigParser -from pyload.manager.Plugin import PluginManager -from pyload.manager.Event import PullManager -from pyload.network.RequestFactory import RequestFactory -from pyload.manager.thread.Server import WebServer -from pyload.manager.event.Scheduler import Scheduler -from pyload.network.JsEngine import JsEngine -from pyload import remote -from pyload.manager.Remote import RemoteManager -from pyload.database import DatabaseBackend, FileHandler - -from pyload.utils import freeSpace, formatSize, get_console_encoding - -from codecs import getwriter - -enc = get_console_encoding(sys.stdout.encoding) -sys.stdout = getwriter(enc)(sys.stdout, errors="replace") - -# TODO List -# - configurable auth system ldap/mysql -# - cron job like sheduler - -class Core(object): - """pyLoad Core, one tool to rule them all... (the filehosters) :D""" - - def __init__(self): - self.doDebug = False - self.running = False - self.daemon = False - self.remote = True - self.arg_links = [] - self.pidfile = "pyload.pid" - self.deleteLinks = False # will delete links on startup - - if len(argv) > 1: - try: - options, args = getopt(argv[1:], 'vchdusqp:', - ["version", "clear", "clean", "help", "debug", "user", - "setup", "configdir=", "changedir", "daemon", - "quit", "status", "no-remote","pidfile="]) - - for option, argument in options: - if option in ("-v", "--version"): - print "pyLoad", CURRENT_VERSION - exit() - elif option in ("-p", "--pidfile"): - self.pidfile = argument - elif option == "--daemon": - self.daemon = True - elif option in ("-c", "--clear"): - self.deleteLinks = True - elif option in ("-h", "--help"): - self.print_help() - exit() - elif option in ("-d", "--debug"): - self.doDebug = True - elif option in ("-u", "--user"): - from pyload.config.Setup import SetupAssistant as Setup - - self.config = ConfigParser() - s = Setup(self.config) - s.set_user() - exit() - elif option in ("-s", "--setup"): - from pyload.config.Setup import SetupAssistant as Setup - - self.config = ConfigParser() - s = Setup(self.config) - s.start() - exit() - elif option == "--changedir": - from pyload.config.Setup import SetupAssistant as Setup - - self.config = ConfigParser() - s = Setup(self.config) - s.conf_path(True) - exit() - elif option in ("-q", "--quit"): - self.quitInstance() - exit() - elif option == "--status": - pid = self.isAlreadyRunning() - if self.isAlreadyRunning(): - print pid - exit(0) - else: - print "false" - exit(1) - elif option == "--clean": - self.cleanTree() - exit() - elif option == "--no-remote": - self.remote = False - - except GetoptError: - print 'Unknown Argument(s) "%s"' % " ".join(argv[1:]) - self.print_help() - exit() - - def print_help(self): - print - print "pyLoad v%s 2008-2015 the pyLoad Team" % CURRENT_VERSION - print - if sys.argv[0].endswith(".py"): - print "Usage: python pyload.py [options]" - else: - print "Usage: pyload [options]" - print - print "" - print " -v, --version", " " * 10, "Print version to terminal" - print " -c, --clear", " " * 12, "Delete all saved packages/links" - #print " -a, --add=", " " * 2, "Add the specified links" - print " -u, --user", " " * 13, "Manages users" - print " -d, --debug", " " * 12, "Enable debug mode" - print " -s, --setup", " " * 12, "Run Setup Assistant" - print " --configdir=", " " * 6, "Run with as config directory" - print " -p, --pidfile=", " " * 3, "Set pidfile to " - print " --changedir", " " * 12, "Change config dir permanently" - print " --daemon", " " * 15, "Daemonmize after start" - print " --no-remote", " " * 12, "Disable remote access (saves RAM)" - print " --status", " " * 15, "Display pid if running or False" - print " --clean", " " * 16, "Remove .pyc/.pyo files" - print " -q, --quit", " " * 13, "Quit running pyLoad instance" - print " -h, --help", " " * 13, "Display this help screen" - print - - def toggle_pause(self): - if self.threadManager.pause: - self.threadManager.pause = False - return False - elif not self.threadManager.pause: - self.threadManager.pause = True - return True - - def quit(self, a, b): - self.shutdown() - self.log.info(_("Received Quit signal")) - _exit(1) - - def writePidFile(self): - self.deletePidFile() - pid = os.getpid() - f = open(self.pidfile, "wb") - f.write(str(pid)) - f.close() - - def deletePidFile(self): - if self.checkPidFile(): - self.log.debug("Deleting old pidfile %s" % self.pidfile) - os.remove(self.pidfile) - - def checkPidFile(self): - """ return pid as int or 0""" - if os.path.isfile(self.pidfile): - f = open(self.pidfile, "rb") - pid = f.read().strip() - f.close() - if pid: - pid = int(pid) - return pid - - return 0 - - def isAlreadyRunning(self): - pid = self.checkPidFile() - if not pid or os.name == "nt": return False - try: - os.kill(pid, 0) # 0 - default signal (does nothing) - except Exception: - return 0 - - return pid - - def quitInstance(self): - if os.name == "nt": - print "Not supported on windows." - return - - pid = self.isAlreadyRunning() - if not pid: - print "No pyLoad running." - return - - try: - os.kill(pid, 3) #SIGUIT - - t = time() - print "waiting for pyLoad to quit" - - while exists(self.pidfile) and t + 10 > time(): - sleep(0.25) - - if not exists(self.pidfile): - print "pyLoad successfully stopped" - else: - os.kill(pid, 9) #SIGKILL - print "pyLoad did not respond" - print "Kill signal was send to process with id %s" % pid - - except Exception: - print "Error quitting pyLoad" - - - def cleanTree(self): - for path, dirs, files in walk(self.path("")): - for f in files: - if not f.endswith(".pyo") and not f.endswith(".pyc"): - continue - - if "_25" in f or "_26" in f or "_27" in f: - continue - - print join(path, f) - remove(join(path, f)) - - def start(self, rpc=True, web=True): - """ starts the fun :D """ - - self.version = CURRENT_VERSION - - if not exists("pyload.conf"): - from pyload.config.Setup import SetupAssistant as Setup - - print "This is your first start, running configuration assistent now." - self.config = ConfigParser() - s = Setup(self.config) - res = False - try: - res = s.start() - except SystemExit: - pass - except KeyboardInterrupt: - print "\nSetup interrupted" - except Exception: - res = False - print_exc() - print "Setup failed" - if not res: - remove("pyload.conf") - - exit() - - try: signal.signal(signal.SIGQUIT, self.quit) - except Exception: pass - - self.config = ConfigParser() - - gettext.setpaths([join(os.sep, "usr", "share", "pyload", "locale"), None]) - translation = gettext.translation("pyLoad", self.path("locale"), - languages=[self.config['general']['language'], "en"], fallback=True) - translation.install(True) - - self.debug = self.doDebug or self.config['general']['debug_mode'] - self.remote &= self.config['remote']['activated'] - - pid = self.isAlreadyRunning() - if pid: - print _("pyLoad already running with pid %s") % pid - exit() - - if os.name != "nt" and self.config["general"]["renice"]: - os.system("renice %d %d" % (self.config["general"]["renice"], os.getpid())) - - if self.config["permission"]["change_group"]: - if os.name != "nt": - try: - from grp import getgrnam - - group = getgrnam(self.config["permission"]["group"]) - os.setgid(group[2]) - except Exception, e: - print _("Failed changing group: %s") % e - - if self.config["permission"]["change_user"]: - if os.name != "nt": - try: - from pwd import getpwnam - - user = getpwnam(self.config["permission"]["user"]) - os.setuid(user[2]) - except Exception, e: - print _("Failed changing user: %s") % e - - self.check_file(self.config['log']['log_folder'], _("folder for logs"), True) - - if self.debug: - self.init_logger(logging.DEBUG) # logging level - else: - self.init_logger(logging.INFO) # logging level - - self.do_kill = False - self.do_restart = False - self.shuttedDown = False - - self.log.info(_("Starting") + " pyLoad %s" % CURRENT_VERSION) - self.log.info(_("Using home directory: %s") % getcwd()) - - self.writePidFile() - - #@TODO refractor - - remote.activated = self.remote - self.log.debug("Remote activated: %s" % self.remote) - - self.check_install("Crypto", _("pycrypto to decode container files")) - #img = self.check_install("Image", _("Python Image Library (PIL) for captcha reading")) - #self.check_install("pycurl", _("pycurl to download any files"), True, True) - self.check_file("tmp", _("folder for temporary files"), True) - #tesser = self.check_install("tesseract", _("tesseract for captcha reading"), False) if os.name != "nt" else True - - self.captcha = True # checks seems to fail, although tesseract is available - - self.check_file(self.config['general']['download_folder'], _("folder for downloads"), True) - - if self.config['ssl']['activated']: - self.check_install("OpenSSL", _("OpenSSL for secure connection")) - - self.setupDB() - if self.config.oldRemoteData: - self.log.info(_("Moving old user config to DB")) - self.db.addUser(self.config.oldRemoteData["username"], self.config.oldRemoteData["password"]) - - self.log.info(_("Please check your logindata with ./pyload.py -u")) - - if self.deleteLinks: - self.log.info(_("All links removed")) - self.db.purgeLinks() - - self.requestFactory = RequestFactory(self) - __builtin__.pyreq = self.requestFactory - - self.lastClientConnected = 0 - - # later imported because they would trigger api import, and remote value not set correctly - from pyload import api - from pyload.manager.Addon import AddonManager - from pyload.manager.Thread import ThreadManager - - if api.activated != self.remote: - self.log.warning("Import error: API remote status not correct.") - - self.api = api.Api(self) - - self.scheduler = Scheduler(self) - - #hell yeah, so many important managers :D - self.pluginManager = PluginManager(self) - self.pullManager = PullManager(self) - self.accountManager = AccountManager(self) - self.threadManager = ThreadManager(self) - self.captchaManager = CaptchaManager(self) - self.addonManager = AddonManager(self) - self.remoteManager = RemoteManager(self) - - self.js = JsEngine(self) - - self.log.info(_("Downloadtime: %s") % self.api.isTimeDownload()) - - if rpc: - self.remoteManager.startBackends() - - if web: - self.init_webserver() - - spaceLeft = freeSpace(self.config["general"]["download_folder"]) - - self.log.info(_("Free space: %s") % formatSize(spaceLeft)) - - self.config.save() #save so config files gets filled - - link_file = join(pypath, "links.txt") - - if exists(link_file): - f = open(link_file, "rb") - if f.read().strip(): - self.api.addPackage("links.txt", [link_file], 1) - f.close() - - link_file = "links.txt" - if exists(link_file): - f = open(link_file, "rb") - if f.read().strip(): - self.api.addPackage("links.txt", [link_file], 1) - f.close() - - #self.scheduler.addJob(0, self.accountManager.getAccountInfos) - self.log.info(_("Activating Accounts...")) - self.accountManager.getAccountInfos() - - self.threadManager.pause = False - self.running = True - - self.log.info(_("Activating Plugins...")) - self.addonManager.coreReady() - - self.log.info(_("pyLoad is up and running")) - - locals().clear() - - while True: - sleep(2) - if self.do_restart: - self.log.info(_("restarting pyLoad")) - self.restart() - if self.do_kill: - self.shutdown() - self.log.info(_("pyLoad quits")) - self.removeLogger() - _exit(0) #@TODO thrift blocks shutdown - - self.threadManager.work() - self.scheduler.work() - - def setupDB(self): - self.db = DatabaseBackend(self) # the backend - self.db.setup() - - self.files = FileHandler(self) - self.db.manager = self.files #ugly? - - def init_webserver(self): - if self.config['webinterface']['activated']: - self.webserver = WebServer(self) - self.webserver.start() - - def init_logger(self, level): - console = logging.StreamHandler(sys.stdout) - frm = logging.Formatter("%(asctime)s %(levelname)-8s %(message)s", "%d.%m.%Y %H:%M:%S") - console.setFormatter(frm) - self.log = logging.getLogger("log") # settable in config - - if self.config['log']['file_log']: - if self.config['log']['log_rotate']: - file_handler = logging.handlers.RotatingFileHandler(join(self.config['log']['log_folder'], 'log.txt'), - maxBytes=self.config['log']['log_size'] * 1024, - backupCount=int(self.config['log']['log_count']), - encoding="utf8") - else: - file_handler = logging.FileHandler(join(self.config['log']['log_folder'], 'log.txt'), encoding="utf8") - - file_handler.setFormatter(frm) - self.log.addHandler(file_handler) - - self.log.addHandler(console) #if console logging - self.log.setLevel(level) - - def removeLogger(self): - for h in list(self.log.handlers): - self.log.removeHandler(h) - h.close() - - def check_install(self, check_name, legend, python=True, essential=False): - """check wether needed tools are installed""" - try: - if python: - find_module(check_name) - else: - pipe = subprocess.PIPE - subprocess.Popen(check_name, stdout=pipe, stderr=pipe) - - return True - except Exception: - if essential: - self.log.info(_("Install %s") % legend) - exit() - - return False - - def check_file(self, check_names, description="", folder=False, empty=True, essential=False, quiet=False): - """check wether needed files exists""" - tmp_names = [] - if not type(check_names) == list: - tmp_names.append(check_names) - else: - tmp_names.extend(check_names) - file_created = True - file_exists = True - for tmp_name in tmp_names: - if not exists(tmp_name): - file_exists = False - if empty: - try: - if folder: - tmp_name = tmp_name.replace("/", sep) - makedirs(tmp_name) - else: - open(tmp_name, "w") - except Exception: - file_created = False - else: - file_created = False - - if not file_exists and not quiet: - if file_created: - #self.log.info( _("%s created") % description ) - pass - else: - if not empty: - self.log.warning( - _("could not find %(desc)s: %(name)s") % {"desc": description, "name": tmp_name}) - else: - print _("could not create %(desc)s: %(name)s") % {"desc": description, "name": tmp_name} - if essential: - exit() - - def isClientConnected(self): - return (self.lastClientConnected + 30) > time() - - def restart(self): - self.shutdown() - chdir(owd) - # close some open fds - for i in range(3, 50): - try: - close(i) - except : - pass - - execl(executable, executable, *sys.argv) - _exit(0) - - def shutdown(self): - self.log.info(_("shutting down...")) - try: - if self.config['webinterface']['activated'] and hasattr(self, "webserver"): - self.webserver.quit() - - for thread in self.threadManager.threads: - thread.put("quit") - pyfiles = self.files.cache.values() - - for pyfile in pyfiles: - pyfile.abortDownload() - - self.addonManager.coreExiting() - - except Exception: - if self.debug: - print_exc() - self.log.info(_("error while shutting down")) - - finally: - self.files.syncSave() - self.shuttedDown = True - - self.deletePidFile() - - - def path(self, *args): - return join(pypath, *args) - - -def deamon(): - try: - pid = os.fork() - if pid > 0: - sys.exit(0) - except OSError, e: - print >> sys.stderr, "fork #1 failed: %d (%s)" % (e.errno, e.strerror) - sys.exit(1) - - # decouple from parent environment - os.setsid() - os.umask(0) - - # do second fork - try: - pid = os.fork() - if pid > 0: - # exit from second parent, print eventual PID before - print "Daemon PID %d" % pid - sys.exit(0) - except OSError, e: - print >> sys.stderr, "fork #2 failed: %d (%s)" % (e.errno, e.strerror) - sys.exit(1) - - # Iterate through and close some file descriptors. - for fd in range(0, 3): - try: - os.close(fd) - except OSError: # ERROR, fd wasn't open to begin with (ignored) - pass - - os.open(os.devnull, os.O_RDWR) # standard input (0) - os.dup2(0, 1) # standard output (1) - os.dup2(0, 2) - - pyload_core = Core() - pyload_core.start() - - -def main(): - if "--daemon" in sys.argv: - deamon() - else: - pyload_core = Core() - try: - pyload_core.start() - except KeyboardInterrupt: - pyload_core.shutdown() - pyload_core.log.info(_("killed pyLoad from Terminal")) - pyload_core.removeLogger() - _exit(1) - -# And so it begins... -if __name__ == "__main__": - main() diff --git a/pyload/__init__.py b/pyload/__init__.py deleted file mode 100644 index e29c81ad7..000000000 --- a/pyload/__init__.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement - -import __builtin__ - -import os -import platform -import sys - -from codecs import getwriter - -from pyload.utils import get_console_encoding - - -__all__ = ["__status_code__", "__status__", "__version_info__", "__version__", "__author_name__", "__author_mail__", "__license__"] - -__version_info__ = (0, 4, 10) -__version__ = '.'.join(map(str, __version_info__)) - -__status_code__ = 4 -__status__ = {1: "Planning", - 2: "Pre-Alpha", - 3: "Alpha", - 4: "Beta", - 5: "Production/Stable", - 6: "Mature", - 7: "Inactive"}[__status_code__] #: PyPI Development Status Classifiers - -__description__ = "Fast, lightweight and full featured download manager" - -__license__ = "GNU General Public License v3" - -__website__ = "http://pyload.org" - -__authors__ = [("Marius" , "mkaay@mkaay.de" ), - ("RaNaN" , "Mast3rRaNaN@hotmail.de"), - ("Stefano" , "l.stickell@yahoo.it" ), - ("Walter Purcaro", "vuolter@gmail.com" ), - ("himbrr" , "himbrr@himbrr.ws" ), - ("sebnapi" , "" ), - ("spoob" , "spoob@gmx.de" ), - ("zoidberg10" , "zoidberg@mujmail.cz" )] - - -################################# InitHomeDir ################################# - -__builtin__.owd = os.path.abspath("") #: original working directory -__builtin__.homedir = os.path.expanduser("~") -__builtin__.rootdir = os.path.abspath(os.path.join(__file__, "..")) -__builtin__.configdir = "" -__builtin__.pypath = os.path.abspath(os.path.join(rootdir, "..")) - - -if "64" in platform.machine(): - sys.path.append(os.path.join(pypath, "lib64")) -sys.path.append(os.path.join(pypath, "lib")) - -sys.stdout = getwriter(get_console_encoding(sys.stdout.encoding))(sys.stdout, errors="replace") - -if homedir == "~" and os.name == "nt": - import ctypes - - CSIDL_APPDATA = 26 - - _SHGetFolderPath = ctypes.windll.shell32.SHGetFolderPathW - _SHGetFolderPath.argtypes = [ctypes.wintypes.HWND, - ctypes.c_int, - ctypes.wintypes.HANDLE, - ctypes.wintypes.DWORD, - ctypes.wintypes.LPCWSTR] - - path_buf = ctypes.wintypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH) - - _SHGetFolderPath(0, CSIDL_APPDATA, 0, 0, path_buf) - - __builtin__.homedir = path_buf.value - -try: - p = os.path.join(rootdir, "config", "configdir") - - with open(p, "rb") as f: - configdir = f.read().strip() - -except IOError: - if os.name == "posix": - configdir = os.path.join(homedir, ".pyload") - else: - configdir = os.path.join(homedir, "pyload") - -try: - if not os.path.exists(configdir): - os.makedirs(configdir, 0700) - - os.chdir(configdir) - -except IOError, e: - print >> sys.stderr, "configdir init failed: %d (%s)" % (e.errno, e.strerror) - sys.exit(1) - -else: - __builtin__.configdir = configdir diff --git a/pyload/api/__init__.py b/pyload/api/__init__.py deleted file mode 100644 index 387481da2..000000000 --- a/pyload/api/__init__.py +++ /dev/null @@ -1,973 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -from base64 import standard_b64encode -from os.path import join -from time import time -import re - -from urlparse import urlparse - -from pyload.datatype.File import PyFile -from pyload.utils.packagetools import parseNames -from pyload.network.RequestFactory import getURL -from pyload.remote import activated -from pyload.utils import compare_time, freeSpace, safe_filename - -if activated: - try: - from thrift.protocol import TBase - from pyload.remote.thriftbackend.thriftgen.pyload.ttypes import * - from pyload.remote.thriftbackend.thriftgen.pyload.Pyload import Iface - - BaseObject = TBase - - except ImportError: - from pyload.api.types import * - - print "Thrift not imported" - -else: - from pyload.api.types import * - -# contains function names mapped to their permissions -# unlisted functions are for admins only -permMap = {} - - -# decorator only called on init, never initialized, so has no effect on runtime -def permission(bits): - class _Dec(object): - def __new__(cls, func, *args, **kwargs): - permMap[func.__name__] = bits - return func - return _Dec - - -urlmatcher = re.compile(r"((https?|ftps?|xdcc|sftp):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+\-=\\\.&\[\]\|]*)", re.IGNORECASE) - - -class PERMS(object): - ALL = 0 # requires no permission, but login - ADD = 1 # can add packages - DELETE = 2 # can delete packages - STATUS = 4 # see and change server status - LIST = 16 # see queue and collector - MODIFY = 32 # moddify some attribute of downloads - DOWNLOAD = 64 # can download from webinterface - SETTINGS = 128 # can access settings - ACCOUNTS = 256 # can access accounts - LOGS = 512 # can see server logs - - -class ROLE(object): - ADMIN = 0 # admin has all permissions implicit - USER = 1 - - -def has_permission(userperms, perms): - # bytewise or perms before if needed - return perms == (userperms & perms) - - -class Api(Iface): - """ - **pyLoads API** - - This is accessible either internal via core.api or via thrift backend. - - see Thrift specification file remote/thriftbackend/pyload.thrift\ - for information about data structures and what methods are usuable with rpc. - - Most methods requires specific permissions, please look at the source code if you need to know.\ - These can be configured via webinterface. - Admin user have all permissions, and are the only ones who can access the methods with no specific permission. - """ - EXTERNAL = Iface # let the json api know which methods are external - - def __init__(self, core): - self.core = core - - def _convertPyFile(self, p): - fdata = FileData(p["id"], p["url"], p["name"], p["plugin"], p["size"], - p["format_size"], p["status"], p["statusmsg"], - p["package"], p["error"], p["order"]) - return fdata - - def _convertConfigFormat(self, c): - sections = {} - for sectionName, sub in c.iteritems(): - section = ConfigSection(sectionName, sub["desc"]) - items = [] - for key, data in sub.iteritems(): - if key in ("desc", "outline"): - continue - item = ConfigItem() - item.name = key - item.description = data["desc"] - item.value = str(data["value"]) if not isinstance(data["value"], basestring) else data["value"] - item.type = data["type"] - items.append(item) - section.items = items - sections[sectionName] = section - if "outline" in sub: - section.outline = sub["outline"] - return sections - - @permission(PERMS.SETTINGS) - def getConfigValue(self, category, option, section="core"): - """Retrieve config value. - - :param category: name of category, or plugin - :param option: config option - :param section: 'plugin' or 'core' - :return: config value as string - """ - if section == "core": - value = self.core.config[category][option] - else: - value = self.core.config.getPlugin(category, option) - return str(value) - - @permission(PERMS.SETTINGS) - def setConfigValue(self, category, option, value, section="core"): - """Set new config value. - - :param category: - :param option: - :param value: new config value - :param section: 'plugin' or 'core - """ - self.core.addonManager.dispatchEvent("config-changed", category, option, value, section) - if section == "core": - self.core.config[category][option] = value - if option in ("limit_speed", "max_speed"): # not so nice to update the limit - self.core.requestFactory.updateBucket() - elif section == "plugin": - self.core.config.setPlugin(category, option, value) - - @permission(PERMS.SETTINGS) - def getConfig(self): - """Retrieves complete config of core. - - :return: list of `ConfigSection` - """ - return self._convertConfigFormat(self.core.config.config) - - def getConfigDict(self): - """Retrieves complete config in dict format, not for RPC. - - :return: dict - """ - return self.core.config.config - - @permission(PERMS.SETTINGS) - def getPluginConfig(self): - """Retrieves complete config for all plugins. - - :return: list of `ConfigSection` - """ - return self._convertConfigFormat(self.core.config.plugin) - - def getPluginConfigDict(self): - """Plugin config as dict, not for RPC. - - :return: dict - """ - return self.core.config.plugin - - @permission(PERMS.STATUS) - def pauseServer(self): - """Pause server: Tt wont start any new downloads, but nothing gets aborted.""" - self.core.threadManager.pause = True - - @permission(PERMS.STATUS) - def unpauseServer(self): - """Unpause server: New Downloads will be started.""" - self.core.threadManager.pause = False - - @permission(PERMS.STATUS) - def togglePause(self): - """Toggle pause state. - - :return: new pause state - """ - self.core.threadManager.pause ^= True - return self.core.threadManager.pause - - @permission(PERMS.STATUS) - def toggleReconnect(self): - """Toggle reconnect activation. - - :return: new reconnect state - """ - self.core.config["reconnect"]["activated"] ^= True - return self.core.config["reconnect"]["activated"] - - @permission(PERMS.LIST) - def statusServer(self): - """Some general information about the current status of pyLoad. - - :return: `ServerStatus` - """ - serverStatus = ServerStatus(self.core.threadManager.pause, len(self.core.threadManager.processingIds()), - self.core.files.getQueueCount(), self.core.files.getFileCount(), 0, - not self.core.threadManager.pause and self.isTimeDownload(), - self.core.config['reconnect']['activated'] and self.isTimeReconnect()) - for pyfile in [x.active for x in self.core.threadManager.threads if x.active and isinstance(x.active, PyFile)]: - serverStatus.speed += pyfile.getSpeed() # bytes/s - return serverStatus - - @permission(PERMS.STATUS) - def freeSpace(self): - """Available free space at download directory in bytes""" - return freeSpace(self.core.config["general"]["download_folder"]) - - @permission(PERMS.ALL) - def getServerVersion(self): - """pyLoad Core version """ - return self.core.version - - def kill(self): - """Clean way to quit pyLoad""" - self.core.do_kill = True - - def restart(self): - """Restart pyload core""" - self.core.do_restart = True - - @permission(PERMS.LOGS) - def getLog(self, offset=0): - """Returns most recent log entries. - - :param offset: line offset - :return: List of log entries - """ - filename = join(self.core.config['log']['log_folder'], 'log.txt') - try: - fh = open(filename, "r") - lines = fh.readlines() - fh.close() - if offset >= len(lines): - return [] - return lines[offset:] - except Exception: - return ['No log available'] - - @permission(PERMS.STATUS) - def isTimeDownload(self): - """Checks if pyload will start new downloads according to time in config. - - :return: bool - """ - start = self.core.config['downloadTime']['start'].split(":") - end = self.core.config['downloadTime']['end'].split(":") - return compare_time(start, end) - - @permission(PERMS.STATUS) - def isTimeReconnect(self): - """Checks if pyload will try to make a reconnect - - :return: bool - """ - start = self.core.config['reconnect']['startTime'].split(":") - end = self.core.config['reconnect']['endTime'].split(":") - return compare_time(start, end) and self.core.config["reconnect"]["activated"] - - @permission(PERMS.LIST) - def statusDownloads(self): - """ Status off all currently running downloads. - - :return: list of `DownloadStatus` - """ - data = [] - for pyfile in self.core.threadManager.getActiveFiles(): - if not isinstance(pyfile, PyFile): - continue - data.append(DownloadInfo( - pyfile.id, pyfile.name, pyfile.getSpeed(), pyfile.getETA(), pyfile.formatETA(), - pyfile.getBytesLeft(), pyfile.getSize(), pyfile.formatSize(), pyfile.getPercent(), - pyfile.status, pyfile.getStatusName(), pyfile.formatWait(), - pyfile.waitUntil, pyfile.packageid, pyfile.package().name, pyfile.pluginname)) - return data - - @permission(PERMS.ADD) - def addPackage(self, name, links, dest=Destination.Queue): - """Adds a package, with links to desired destination. - - :param name: name of the new package - :param links: list of urls - :param dest: `Destination` - :return: package id of the new package - """ - if self.core.config['general']['folder_per_package']: - folder = urlparse(name).path.split("/")[-1] - else: - folder = "" - - folder = safe_filename(folder) - - pid = self.core.files.addPackage(name, folder, dest) - - self.core.files.addLinks(links, pid) - - self.core.log.info(_("Added package %(name)s containing %(count)d links") % {"name": name, "count": len(links)}) - - self.core.files.save() - - return pid - - @permission(PERMS.ADD) - def parseURLs(self, html=None, url=None): - """Parses html content or any arbitaty text for links and returns result of `checkURLs` - - :param html: html source - :return: - """ - urls = [] - if html: - urls += [x[0] for x in urlmatcher.findall(html)] - if url: - page = getURL(url) - urls += [x[0] for x in urlmatcher.findall(page)] - # remove duplicates - return self.checkURLs(set(urls)) - - @permission(PERMS.ADD) - def checkURLs(self, urls): - """ Gets urls and returns pluginname mapped to list of matches urls. - - :param urls: - :return: {plugin: urls} - """ - data = self.core.pluginManager.parseUrls(urls) - plugins = {} - - for url, plugintype, pluginname in data: - try: - plugins[plugintype][pluginname].append(url) - except Exception: - plugins[plugintype][pluginname] = [url] - - return plugins - - @permission(PERMS.ADD) - def checkOnlineStatus(self, urls): - """ initiates online status check - - :param urls: - :return: initial set of data as `OnlineCheck` instance containing the result id - """ - data = self.core.pluginManager.parseUrls(urls) - - rid = self.core.threadManager.createResultThread(data, False) - - tmp = [(url, (url, OnlineStatus(url, (plugintype, pluginname), "unknown", 3, 0))) for url, plugintype, pluginname in data] - data = parseNames(tmp) - result = {} - for k, v in data.iteritems(): - for url, status in v: - status.packagename = k - result[url] = status - - return OnlineCheck(rid, result) - - @permission(PERMS.ADD) - def checkOnlineStatusContainer(self, urls, container, data): - """ checks online status of urls and a submited container file - - :param urls: list of urls - :param container: container file name - :param data: file content - :return: online check - """ - th = open(join(self.core.config["general"]["download_folder"], "tmp_" + container), "wb") - th.write(str(data)) - th.close() - return self.checkOnlineStatus(urls + [th.name]) - - @permission(PERMS.ADD) - def pollResults(self, rid): - """ Polls the result available for ResultID - - :param rid: `ResultID` - :return: `OnlineCheck`, if rid is -1 then no more data available - """ - result = self.core.threadManager.getInfoResult(rid) - if "ALL_INFO_FETCHED" in result: - del result["ALL_INFO_FETCHED"] - return OnlineCheck(-1, result) - else: - return OnlineCheck(rid, result) - - @permission(PERMS.ADD) - def generatePackages(self, links): - """ Parses links, generates packages names from urls - - :param links: list of urls - :return: package names mapped to urls - """ - return parseNames((x, x) for x in links) - - @permission(PERMS.ADD) - def generateAndAddPackages(self, links, dest=Destination.Queue): - """Generates and add packages - - :param links: list of urls - :param dest: `Destination` - :return: list of package ids - """ - return [self.addPackage(name, urls, dest) for name, urls - in self.generatePackages(links).iteritems()] - - @permission(PERMS.ADD) - def checkAndAddPackages(self, links, dest=Destination.Queue): - """Checks online status, retrieves names, and will add packages.\ - Because of this packages are not added immediatly, only for internal use. - - :param links: list of urls - :param dest: `Destination` - :return: None - """ - data = self.core.pluginManager.parseUrls(links) - self.core.threadManager.createResultThread(data, True) - - @permission(PERMS.LIST) - def getPackageData(self, pid): - """Returns complete information about package, and included files. - - :param pid: package id - :return: `PackageData` with .links attribute - """ - data = self.core.files.getPackageData(int(pid)) - if not data: - raise PackageDoesNotExists(pid) - return PackageData(data["id"], data["name"], data["folder"], data["site"], data["password"], - data["queue"], data["order"], - links=[self._convertPyFile(x) for x in data["links"].itervalues()]) - - @permission(PERMS.LIST) - def getPackageInfo(self, pid): - """Returns information about package, without detailed information about containing files - - :param pid: package id - :return: `PackageData` with .fid attribute - """ - data = self.core.files.getPackageData(int(pid)) - - if not data: - raise PackageDoesNotExists(pid) - return PackageData(data["id"], data["name"], data["folder"], data["site"], data["password"], - data["queue"], data["order"], - fids=[int(x) for x in data["links"]]) - - @permission(PERMS.LIST) - def getFileData(self, fid): - """Get complete information about a specific file. - - :param fid: file id - :return: `FileData` - """ - info = self.core.files.getFileData(int(fid)) - if not info: - raise FileDoesNotExists(fid) - return self._convertPyFile(info.values()[0]) - - @permission(PERMS.DELETE) - def deleteFiles(self, fids): - """Deletes several file entries from pyload. - - :param fids: list of file ids - """ - for fid in fids: - self.core.files.deleteLink(int(fid)) - self.core.files.save() - - @permission(PERMS.DELETE) - def deletePackages(self, pids): - """Deletes packages and containing links. - - :param pids: list of package ids - """ - for pid in pids: - self.core.files.deletePackage(int(pid)) - self.core.files.save() - - @permission(PERMS.LIST) - def getQueue(self): - """Returns info about queue and packages, **not** about files, see `getQueueData` \ - or `getPackageData` instead. - - :return: list of `PackageInfo` - """ - return [PackageData(pack["id"], pack["name"], pack["folder"], pack["site"], - pack["password"], pack["queue"], pack["order"], - pack["linksdone"], pack["sizedone"], pack["sizetotal"], - pack["linkstotal"]) - for pack in self.core.files.getInfoData(Destination.Queue).itervalues()] - - @permission(PERMS.LIST) - def getQueueData(self): - """Return complete data about everything in queue, this is very expensive use it sparely.\ - See `getQueue` for alternative. - - :return: list of `PackageData` - """ - return [PackageData(pack["id"], pack["name"], pack["folder"], pack["site"], - pack["password"], pack["queue"], pack["order"], - pack["linksdone"], pack["sizedone"], pack["sizetotal"], - links=[self._convertPyFile(x) for x in pack["links"].itervalues()]) - for pack in self.core.files.getCompleteData(Destination.Queue).itervalues()] - - @permission(PERMS.LIST) - def getCollector(self): - """same as `getQueue` for collector. - - :return: list of `PackageInfo` - """ - return [PackageData(pack["id"], pack["name"], pack["folder"], pack["site"], - pack["password"], pack["queue"], pack["order"], - pack["linksdone"], pack["sizedone"], pack["sizetotal"], - pack["linkstotal"]) - for pack in self.core.files.getInfoData(Destination.Collector).itervalues()] - - @permission(PERMS.LIST) - def getCollectorData(self): - """same as `getQueueData` for collector. - - :return: list of `PackageInfo` - """ - return [PackageData(pack["id"], pack["name"], pack["folder"], pack["site"], - pack["password"], pack["queue"], pack["order"], - pack["linksdone"], pack["sizedone"], pack["sizetotal"], - links=[self._convertPyFile(x) for x in pack["links"].itervalues()]) - for pack in self.core.files.getCompleteData(Destination.Collector).itervalues()] - - @permission(PERMS.ADD) - def addFiles(self, pid, links): - """Adds files to specific package. - - :param pid: package id - :param links: list of urls - """ - self.core.files.addLinks(links, int(pid)) - self.core.log.info(_("Added %(count)d links to package #%(package)d ") % {"count": len(links), "package": pid}) - self.core.files.save() - - @permission(PERMS.MODIFY) - def pushToQueue(self, pid): - """Moves package from Collector to Queue. - - :param pid: package id - """ - self.core.files.setPackageLocation(pid, Destination.Queue) - - @permission(PERMS.MODIFY) - def pullFromQueue(self, pid): - """Moves package from Queue to Collector. - - :param pid: package id - """ - self.core.files.setPackageLocation(pid, Destination.Collector) - - @permission(PERMS.MODIFY) - def restartPackage(self, pid): - """Restarts a package, resets every containing files. - - :param pid: package id - """ - self.core.files.restartPackage(int(pid)) - - @permission(PERMS.MODIFY) - def restartFile(self, fid): - """Resets file status, so it will be downloaded again. - - :param fid: file id - """ - self.core.files.restartFile(int(fid)) - - @permission(PERMS.MODIFY) - def recheckPackage(self, pid): - """Proofes online status of all files in a package, also a default action when package is added. - - :param pid: - :return: - """ - self.core.files.reCheckPackage(int(pid)) - - @permission(PERMS.MODIFY) - def stopAllDownloads(self): - """Aborts all running downloads.""" - - pyfiles = self.core.files.cache.values() - for pyfile in pyfiles: - pyfile.abortDownload() - - @permission(PERMS.MODIFY) - def stopDownloads(self, fids): - """Aborts specific downloads. - - :param fids: list of file ids - :return: - """ - pyfiles = self.core.files.cache.values() - for pyfile in pyfiles: - if pyfile.id in fids: - pyfile.abortDownload() - - @permission(PERMS.MODIFY) - def setPackageName(self, pid, name): - """Renames a package. - - :param pid: package id - :param name: new package name - """ - pack = self.core.files.getPackage(pid) - pack.name = name - pack.sync() - - @permission(PERMS.MODIFY) - def movePackage(self, destination, pid): - """Set a new package location. - - :param destination: `Destination` - :param pid: package id - """ - if destination in (0, 1): - self.core.files.setPackageLocation(pid, destination) - - @permission(PERMS.MODIFY) - def moveFiles(self, fids, pid): - """Move multiple files to another package - - :param fids: list of file ids - :param pid: destination package - :return: - """ - # TODO: implement - pass - - - @permission(PERMS.ADD) - def uploadContainer(self, filename, data): - """Uploads and adds a container file to pyLoad. - - :param filename: filename, extension is important so it can correctly decrypted - :param data: file content - """ - th = open(join(self.core.config["general"]["download_folder"], "tmp_" + filename), "wb") - th.write(str(data)) - th.close() - self.addPackage(th.name, [th.name], Destination.Queue) - - @permission(PERMS.MODIFY) - def orderPackage(self, pid, position): - """Gives a package a new position. - - :param pid: package id - :param position: - """ - self.core.files.reorderPackage(pid, position) - - @permission(PERMS.MODIFY) - def orderFile(self, fid, position): - """Gives a new position to a file within its package. - - :param fid: file id - :param position: - """ - self.core.files.reorderFile(fid, position) - - @permission(PERMS.MODIFY) - def setPackageData(self, pid, data): - """Allows to modify several package attributes. - - :param pid: package id - :param data: dict that maps attribute to desired value - """ - package = self.core.files.getPackage(pid) - if not package: - raise PackageDoesNotExists(pid) - for key, value in data.iteritems(): - if key == "id": - continue - setattr(package, key, value) - package.sync() - self.core.files.save() - - @permission(PERMS.DELETE) - def deleteFinished(self): - """Deletes all finished files and completly finished packages. - - :return: list of deleted package ids - """ - return self.core.files.deleteFinishedLinks() - - @permission(PERMS.MODIFY) - def restartFailed(self): - """Restarts all failed failes.""" - self.core.files.restartFailed() - - @permission(PERMS.LIST) - def getPackageOrder(self, destination): - """Returns information about package order. - - :param destination: `Destination` - :return: dict mapping order to package id - """ - packs = self.core.files.getInfoData(destination) - order = {} - for pid in packs: - pack = self.core.files.getPackageData(int(pid)) - while pack["order"] in order.keys(): # just in case - pack["order"] += 1 - order[pack["order"]] = pack["id"] - return order - - @permission(PERMS.LIST) - def getFileOrder(self, pid): - """Information about file order within package. - - :param pid: - :return: dict mapping order to file id - """ - rawdata = self.core.files.getPackageData(int(pid)) - order = {} - for id, pyfile in rawdata["links"].iteritems(): - while pyfile["order"] in order.keys(): # just in case - pyfile["order"] += 1 - order[pyfile["order"]] = pyfile["id"] - return order - - - @permission(PERMS.STATUS) - def isCaptchaWaiting(self): - """Indicates wether a captcha task is available - - :return: bool - """ - self.core.lastClientConnected = time() - task = self.core.captchaManager.getTask() - return not task is None - - @permission(PERMS.STATUS) - def getCaptchaTask(self, exclusive=False): - """Returns a captcha task - - :param exclusive: unused - :return: `CaptchaTask` - """ - self.core.lastClientConnected = time() - task = self.core.captchaManager.getTask() - if task: - task.setWatingForUser(exclusive=exclusive) - data, type, result = task.getCaptcha() - ctask = CaptchaTask(int(task.id), standard_b64encode(data), type, result) - return ctask - return CaptchaTask(-1) - - @permission(PERMS.STATUS) - def getCaptchaTaskStatus(self, tid): - """Get information about captcha task - - :param tid: task id - :return: string - """ - self.core.lastClientConnected = time() - task = self.core.captchaManager.getTaskByID(tid) - return task.getStatus() if task else "" - - @permission(PERMS.STATUS) - def setCaptchaResult(self, tid, result): - """Set result for a captcha task - - :param tid: task id - :param result: captcha result - """ - self.core.lastClientConnected = time() - task = self.core.captchaManager.getTaskByID(tid) - if task: - task.setResult(result) - self.core.captchaManager.removeTask(task) - - @permission(PERMS.STATUS) - def getEvents(self, uuid): - """Lists occured events, may be affected to changes in future. - - :param uuid: - :return: list of `Events` - """ - events = self.core.pullManager.getEvents(uuid) - new_events = [] - - def convDest(d): - return Destination.Queue if d == "queue" else Destination.Collector - - for e in events: - event = EventInfo() - event.eventname = e[0] - if e[0] in ("update", "remove", "insert"): - event.id = e[3] - event.type = ElementType.Package if e[2] == "pack" else ElementType.File - event.destination = convDest(e[1]) - elif e[0] == "order": - if e[1]: - event.id = e[1] - event.type = ElementType.Package if e[2] == "pack" else ElementType.File - event.destination = convDest(e[3]) - elif e[0] == "reload": - event.destination = convDest(e[1]) - new_events.append(event) - return new_events - - @permission(PERMS.ACCOUNTS) - def getAccounts(self, refresh): - """Get information about all entered accounts. - - :param refresh: reload account info - :return: list of `AccountInfo` - """ - accs = self.core.accountManager.getAccountInfos(False, refresh) - for group in accs.values(): - accounts = [AccountInfo(acc["validuntil"], acc["login"], acc["options"], acc["valid"], - acc["trafficleft"], acc["maxtraffic"], acc["premium"], acc["type"]) - for acc in group] - return accounts or [] - - @permission(PERMS.ALL) - def getAccountTypes(self): - """All available account types. - - :return: list - """ - return self.core.accountManager.accounts.keys() - - @permission(PERMS.ACCOUNTS) - def updateAccount(self, plugin, account, password=None, options=None): - """Changes pw/options for specific account.""" - self.core.accountManager.updateAccount(plugin, account, password, options or {}) - - @permission(PERMS.ACCOUNTS) - def removeAccount(self, plugin, account): - """Remove account from pyload. - - :param plugin: pluginname - :param account: accountname - """ - self.core.accountManager.removeAccount(plugin, account) - - @permission(PERMS.ALL) - def login(self, username, password, remoteip=None): - """Login into pyLoad, this **must** be called when using rpc before any methods can be used. - - :param username: - :param password: - :param remoteip: Omit this argument, its only used internal - :return: bool indicating login was successful - """ - return bool(self.checkAuth(username, password, remoteip)) - - def checkAuth(self, username, password, remoteip=None): - """Check authentication and returns details - - :param username: - :param password: - :param remoteip: - :return: dict with info, empty when login is incorrect - """ - if self.core.config["remote"]["nolocalauth"] and remoteip == "127.0.0.1": - return "local" - else: - return self.core.db.checkAuth(username, password) - - def isAuthorized(self, func, userdata): - """checks if the user is authorized for specific method - - :param func: function name - :param userdata: dictionary of user data - :return: boolean - """ - if userdata == "local" or userdata["role"] == ROLE.ADMIN: - return True - elif func in permMap and has_permission(userdata["permission"], permMap[func]): - return True - else: - return False - - @permission(PERMS.ALL) - def getUserData(self, username, password): - """similar to `checkAuth` but returns UserData thrift type """ - user = self.checkAuth(username, password) - if user: - return UserData(user["name"], user["email"], user["role"], user["permission"], user["template"]) - else: - return UserData() - - def getAllUserData(self): - """returns all known user and info""" - return dict((user, UserData(user, data["email"], data["role"], data["permission"], data["template"])) for user, data - in self.core.db.getAllUserData().iteritems()) - - @permission(PERMS.STATUS) - def getServices(self): - """ A dict of available services, these can be defined by addon plugins. - - :return: dict with this style: {"plugin": {"method": "description"}} - """ - return dict((plugin, funcs) for plugin, funcs in self.core.addonManager.methods.iteritems()) - - @permission(PERMS.STATUS) - def hasService(self, plugin, func): - """Checks wether a service is available. - - :param plugin: - :param func: - :return: bool - """ - cont = self.core.addonManager.methods - return plugin in cont and func in cont[plugin] - - @permission(PERMS.STATUS) - def call(self, info): - """Calls a service (a method in addon plugin). - - :param info: `ServiceCall` - :return: result - :raises: ServiceDoesNotExists, when its not available - :raises: ServiceException, when a exception was raised - """ - plugin = info.plugin - func = info.func - args = info.arguments - parse = info.parseArguments - if not self.hasService(plugin, func): - raise ServiceDoesNotExists(plugin, func) - try: - ret = self.core.addonManager.callRPC(plugin, func, args, parse) - except Exception, e: - raise ServiceException(e.message) - - @permission(PERMS.STATUS) - def getAllInfo(self): - """Returns all information stored by addon plugins. Values are always strings - - :return: {"plugin": {"name": value}} - """ - return self.core.addonManager.getAllInfo() - - @permission(PERMS.STATUS) - def getInfoByPlugin(self, plugin): - """Returns information stored by a specific plugin. - - :param plugin: pluginname - :return: dict of attr names mapped to value {"name": value} - """ - return self.core.addonManager.getInfo(plugin) - - def changePassword(self, user, oldpw, newpw): - """ changes password for specific user """ - return self.core.db.changePassword(user, oldpw, newpw) - - def setUserPermission(self, user, perm, role): - self.core.db.setPermission(user, perm) - self.core.db.setRole(user, role) diff --git a/pyload/api/types.py b/pyload/api/types.py deleted file mode 100644 index 81385bf9f..000000000 --- a/pyload/api/types.py +++ /dev/null @@ -1,381 +0,0 @@ -# -*- coding: utf-8 -*- -# Autogenerated by pyload -# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - -class BaseObject(object): - __slots__ = [] - -class Destination(object): - Collector = 0 - Queue = 1 - -class DownloadStatus(object): - Aborted = 9 - Custom = 11 - Decrypting = 10 - Downloading = 12 - Failed = 8 - Finished = 0 - Offline = 1 - Online = 2 - Processing = 13 - Queued = 3 - Skipped = 4 - Starting = 7 - TempOffline = 6 - Unknown = 14 - Waiting = 5 - -class ElementType(object): - File = 1 - Package = 0 - -class Input(object): - BOOL = 4 - CHOICE = 6 - CLICK = 5 - LIST = 8 - MULTIPLE = 7 - NONE = 0 - PASSWORD = 3 - TABLE = 9 - TEXT = 1 - TEXTBOX = 2 - -class Output(object): - CAPTCHA = 1 - NOTIFICATION = 4 - QUESTION = 2 - -class AccountInfo(BaseObject): - __slots__ = ['validuntil', 'login', 'options', 'valid', 'trafficleft', 'maxtraffic', 'premium', 'type'] - - def __init__(self, validuntil=None, login=None, options=None, valid=None, trafficleft=None, maxtraffic=None, premium=None, type=None): - self.validuntil = validuntil - self.login = login - self.options = options - self.valid = valid - self.trafficleft = trafficleft - self.maxtraffic = maxtraffic - self.premium = premium - self.type = type - -class CaptchaTask(BaseObject): - __slots__ = ['tid', 'data', 'type', 'resultType'] - - def __init__(self, tid=None, data=None, type=None, resultType=None): - self.tid = tid - self.data = data - self.type = type - self.resultType = resultType - -class ConfigItem(BaseObject): - __slots__ = ['name', 'description', 'value', 'type'] - - def __init__(self, name=None, description=None, value=None, type=None): - self.name = name - self.description = description - self.value = value - self.type = type - -class ConfigSection(BaseObject): - __slots__ = ['name', 'description', 'items', 'outline'] - - def __init__(self, name=None, description=None, items=None, outline=None): - self.name = name - self.description = description - self.items = items - self.outline = outline - -class DownloadInfo(BaseObject): - __slots__ = ['fid', 'name', 'speed', 'eta', 'format_eta', 'bleft', 'size', 'format_size', 'percent', 'status', 'statusmsg', 'format_wait', 'wait_until', 'packageID', 'packageName', 'plugin'] - - def __init__(self, fid=None, name=None, speed=None, eta=None, format_eta=None, bleft=None, size=None, format_size=None, percent=None, status=None, statusmsg=None, format_wait=None, wait_until=None, packageID=None, packageName=None, plugin=None): - self.fid = fid - self.name = name - self.speed = speed - self.eta = eta - self.format_eta = format_eta - self.bleft = bleft - self.size = size - self.format_size = format_size - self.percent = percent - self.status = status - self.statusmsg = statusmsg - self.format_wait = format_wait - self.wait_until = wait_until - self.packageID = packageID - self.packageName = packageName - self.plugin = plugin - -class EventInfo(BaseObject): - __slots__ = ['eventname', 'id', 'type', 'destination'] - - def __init__(self, eventname=None, id=None, type=None, destination=None): - self.eventname = eventname - self.id = id - self.type = type - self.destination = destination - -class FileData(BaseObject): - __slots__ = ['fid', 'url', 'name', 'plugin', 'size', 'format_size', 'status', 'statusmsg', 'packageID', 'error', 'order'] - - def __init__(self, fid=None, url=None, name=None, plugin=None, size=None, format_size=None, status=None, statusmsg=None, packageID=None, error=None, order=None): - self.fid = fid - self.url = url - self.name = name - self.plugin = plugin - self.size = size - self.format_size = format_size - self.status = status - self.statusmsg = statusmsg - self.packageID = packageID - self.error = error - self.order = order - -class FileDoesNotExists(Exception): - __slots__ = ['fid'] - - def __init__(self, fid=None): - self.fid = fid - -class InteractionTask(BaseObject): - __slots__ = ['iid', 'input', 'structure', 'preset', 'output', 'data', 'title', 'description', 'plugin'] - - def __init__(self, iid=None, input=None, structure=None, preset=None, output=None, data=None, title=None, description=None, plugin=None): - self.iid = iid - self.input = input - self.structure = structure - self.preset = preset - self.output = output - self.data = data - self.title = title - self.description = description - self.plugin = plugin - -class OnlineCheck(BaseObject): - __slots__ = ['rid', 'data'] - - def __init__(self, rid=None, data=None): - self.rid = rid - self.data = data - -class OnlineStatus(BaseObject): - __slots__ = ['name', 'plugin', 'packagename', 'status', 'size'] - - def __init__(self, name=None, plugin=(None, None), packagename=None, status=None, size=None): - self.name = name - self.plugin = plugin - self.packagename = packagename - self.status = status - self.size = size - -class PackageData(BaseObject): - __slots__ = ['pid', 'name', 'folder', 'site', 'password', 'dest', 'order', 'linksdone', 'sizedone', 'sizetotal', 'linkstotal', 'links', 'fids'] - - def __init__(self, pid=None, name=None, folder=None, site=None, password=None, dest=None, order=None, linksdone=None, sizedone=None, sizetotal=None, linkstotal=None, links=None, fids=None): - self.pid = pid - self.name = name - self.folder = folder - self.site = site - self.password = password - self.dest = dest - self.order = order - self.linksdone = linksdone - self.sizedone = sizedone - self.sizetotal = sizetotal - self.linkstotal = linkstotal - self.links = links - self.fids = fids - -class PackageDoesNotExists(Exception): - __slots__ = ['pid'] - - def __init__(self, pid=None): - self.pid = pid - -class ServerStatus(BaseObject): - __slots__ = ['pause', 'active', 'queue', 'total', 'speed', 'download', 'reconnect'] - - def __init__(self, pause=None, active=None, queue=None, total=None, speed=None, download=None, reconnect=None): - self.pause = pause - self.active = active - self.queue = queue - self.total = total - self.speed = speed - self.download = download - self.reconnect = reconnect - -class ServiceCall(BaseObject): - __slots__ = ['plugin', 'func', 'arguments', 'parseArguments'] - - def __init__(self, plugin=None, func=None, arguments=None, parseArguments=None): - self.plugin = plugin - self.func = func - self.arguments = arguments - self.parseArguments = parseArguments - -class ServiceDoesNotExists(Exception): - __slots__ = ['plugin', 'func'] - - def __init__(self, plugin=None, func=None): - self.plugin = plugin - self.func = func - -class ServiceException(Exception): - __slots__ = ['msg'] - - def __init__(self, msg=None): - self.msg = msg - -class UserData(BaseObject): - __slots__ = ['name', 'email', 'role', 'permission', 'templateName'] - - def __init__(self, name=None, email=None, role=None, permission=None, templateName=None): - self.name = name - self.email = email - self.role = role - self.permission = permission - self.templateName = templateName - -class Iface(object): - def addFiles(self, pid, links): - pass - def addPackage(self, name, links, dest): - pass - def call(self, info): - pass - def checkOnlineStatus(self, urls): - pass - def checkOnlineStatusContainer(self, urls, filename, data): - pass - def checkURLs(self, urls): - pass - def deleteFiles(self, fids): - pass - def deleteFinished(self): - pass - def deletePackages(self, pids): - pass - def freeSpace(self): - pass - def generateAndAddPackages(self, links, dest): - pass - def generatePackages(self, links): - pass - def getAccountTypes(self): - pass - def getAccounts(self, refresh): - pass - def getAllInfo(self): - pass - def getAllUserData(self): - pass - def getCaptchaTask(self, exclusive): - pass - def getCaptchaTaskStatus(self, tid): - pass - def getCollector(self): - pass - def getCollectorData(self): - pass - def getConfig(self): - pass - def getConfigValue(self, category, option, section): - pass - def getEvents(self, uuid): - pass - def getFileData(self, fid): - pass - def getFileOrder(self, pid): - pass - def getInfoByPlugin(self, plugin): - pass - def getLog(self, offset): - pass - def getPackageData(self, pid): - pass - def getPackageInfo(self, pid): - pass - def getPackageOrder(self, destination): - pass - def getPluginConfig(self): - pass - def getQueue(self): - pass - def getQueueData(self): - pass - def getServerVersion(self): - pass - def getServices(self): - pass - def getUserData(self, username, password): - pass - def hasService(self, plugin, func): - pass - def isCaptchaWaiting(self): - pass - def isTimeDownload(self): - pass - def isTimeReconnect(self): - pass - def kill(self): - pass - def login(self, username, password): - pass - def moveFiles(self, fids, pid): - pass - def movePackage(self, destination, pid): - pass - def orderFile(self, fid, position): - pass - def orderPackage(self, pid, position): - pass - def parseURLs(self, html, url): - pass - def pauseServer(self): - pass - def pollResults(self, rid): - pass - def pullFromQueue(self, pid): - pass - def pushToQueue(self, pid): - pass - def recheckPackage(self, pid): - pass - def removeAccount(self, plugin, account): - pass - def restart(self): - pass - def restartFailed(self): - pass - def restartFile(self, fid): - pass - def restartPackage(self, pid): - pass - def setCaptchaResult(self, tid, result): - pass - def setConfigValue(self, category, option, value, section): - pass - def setPackageData(self, pid, data): - pass - def setPackageName(self, pid, name): - pass - def statusDownloads(self): - pass - def statusServer(self): - pass - def stopAllDownloads(self): - pass - def stopDownloads(self, fids): - pass - def togglePause(self): - pass - def toggleReconnect(self): - pass - def unpauseServer(self): - pass - def updateAccount(self, plugin, account, password, options): - pass - def uploadContainer(self, filename, data): - pass diff --git a/pyload/cli/AddPackage.py b/pyload/cli/AddPackage.py deleted file mode 100644 index f7e30b64e..000000000 --- a/pyload/cli/AddPackage.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -from pyload.cli.Handler import Handler -from pyload.utils.printer import * - - -class AddPackage(Handler): - """ let the user add packages """ - - def init(self): - self.name = "" - self.urls = [] - - def onEnter(self, inp): - if inp == "0": - self.cli.reset() - - if not self.name: - self.name = inp - self.setInput() - elif inp == "END": - #add package - self.client.addPackage(self.name, self.urls, 1) - self.cli.reset() - else: - if inp.strip(): - self.urls.append(inp) - self.setInput() - - def renderBody(self, line): - println(line, white(_("Add Package:"))) - println(line + 1, "") - line += 2 - - if not self.name: - println(line, _("Enter a name for the new package")) - println(line + 1, "") - line += 2 - else: - println(line, _("Package: %s") % self.name) - println(line + 1, _("Parse the links you want to add.")) - println(line + 2, _("Type %s when done.") % mag("END")) - println(line + 3, _("Links added: ") + mag(len(self.urls))) - line += 4 - - println(line, "") - println(line + 1, mag("0.") + _(" back to main menu")) - - return line + 2 diff --git a/pyload/cli/Cli.py b/pyload/cli/Cli.py deleted file mode 100644 index d8c8602fc..000000000 --- a/pyload/cli/Cli.py +++ /dev/null @@ -1,570 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -from __future__ import with_statement - -from getopt import GetoptError, getopt - -import pyload.utils.pylgettext as gettext -import os -from os import _exit -from os.path import join, exists, abspath, basename -import sys -from sys import exit -from threading import Thread, Lock -from time import sleep -from traceback import print_exc - -from pyload.config.Parser import ConfigParser - -from codecs import getwriter - -if os.name == "nt": - enc = "cp850" -else: - enc = "utf8" - -sys.stdout = getwriter(enc)(sys.stdout, errors="replace") - -from pyload.cli.printer import * -from pyload.cli import AddPackage, ManageFiles - -from pyload.api import Destination -from pyload.utils import formatSize, decode -from pyload.remote.thriftbackend.ThriftClient import ThriftClient, NoConnection, NoSSL, WrongLogin, ConnectionClosed -from Getch import Getch -from rename_process import renameProcess - -class Cli(object): - def __init__(self, client, command): - self.client = client - self.command = command - - if not self.command: - renameProcess('pyload-cli') - self.getch = Getch() - self.input = "" - self.inputline = 0 - self.lastLowestLine = 0 - self.menuline = 0 - - self.lock = Lock() - - #processor funcions, these will be changed dynamically depending on control flow - self.headerHandler = self #the download status - self.bodyHandler = self #the menu section - self.inputHandler = self - - os.system("clear") - println(1, blue("py") + yellow("Load") + white(_(" Command Line Interface"))) - println(2, "") - - self.thread = RefreshThread(self) - self.thread.start() - - self.start() - else: - self.processCommand() - - def reset(self): - """ reset to initial main menu """ - self.input = "" - self.headerHandler = self.bodyHandler = self.inputHandler = self - - def start(self): - """ main loop. handle input """ - while True: - #inp = raw_input() - inp = self.getch.impl() - if ord(inp) == 3: - os.system("clear") - sys.exit() # ctrl + c - elif ord(inp) == 13: #enter - try: - self.lock.acquire() - self.inputHandler.onEnter(self.input) - - except Exception, e: - println(2, red(e)) - finally: - self.lock.release() - - elif ord(inp) == 127: - self.input = self.input[:-1] #backspace - try: - self.lock.acquire() - self.inputHandler.onBackSpace() - finally: - self.lock.release() - - elif ord(inp) == 27: #ugly symbol - pass - else: - self.input += inp - try: - self.lock.acquire() - self.inputHandler.onChar(inp) - finally: - self.lock.release() - - self.inputline = self.bodyHandler.renderBody(self.menuline) - self.renderFooter(self.inputline) - - - def refresh(self): - """refresh screen""" - - println(1, blue("py") + yellow("Load") + white(_(" Command Line Interface"))) - println(2, "") - - self.lock.acquire() - - self.menuline = self.headerHandler.renderHeader(3) + 1 - println(self.menuline - 1, "") - self.inputline = self.bodyHandler.renderBody(self.menuline) - self.renderFooter(self.inputline) - - self.lock.release() - - - def setInput(self, string=""): - self.input = string - - def setHandler(self, klass): - #create new handler with reference to cli - self.bodyHandler = self.inputHandler = klass(self) - self.input = "" - - def renderHeader(self, line): - """ prints download status """ - #print updated information - # print "\033[J" #clear screen - # self.println(1, blue("py") + yellow("Load") + white(_(" Command Line Interface"))) - # self.println(2, "") - # self.println(3, white(_("%s Downloads:") % (len(data)))) - - data = self.client.statusDownloads() - speed = 0 - - println(line, white(_("%s Downloads:") % (len(data)))) - line += 1 - - for download in data: - if download.status == 12: # downloading - percent = download.percent - z = percent / 4 - speed += download.speed - println(line, cyan(download.name)) - line += 1 - println(line, - blue("[") + yellow(z * "#" + (25 - z) * " ") + blue("] ") + green(str(percent) + "%") + _( - " Speed: ") + green(formatSize(download.speed) + "/s") + _(" Size: ") + green( - download.format_size) + _(" Finished in: ") + green(download.format_eta) + _( - " ID: ") + green(download.fid)) - line += 1 - if download.status == 5: - println(line, cyan(download.name)) - line += 1 - println(line, _("waiting: ") + green(download.format_wait)) - line += 1 - - println(line, "") - line += 1 - status = self.client.statusServer() - if status.pause: - paused = _("Status:") + " " + red(_("paused")) - else: - paused = _("Status:") + " " + red(_("running")) - - println(line,"%s %s: %s %s: %s %s: %s" % ( - paused, _("total Speed"), red(formatSize(speed) + "/s"), _("Files in queue"), red( - status.queue), _("Total"), red(status.total))) - - return line + 1 - - def renderBody(self, line): - """ prints initial menu """ - println(line, white(_("Menu:"))) - println(line + 1, "") - println(line + 2, mag("1.") + _(" Add Links")) - println(line + 3, mag("2.") + _(" Manage Queue")) - println(line + 4, mag("3.") + _(" Manage Collector")) - println(line + 5, mag("4.") + _(" (Un)Pause Server")) - println(line + 6, mag("5.") + _(" Kill Server")) - println(line + 7, mag("6.") + _(" Quit")) - - return line + 8 - - def renderFooter(self, line): - """ prints out the input line with input """ - println(line, "") - line += 1 - - println(line, white(" Input: ") + decode(self.input)) - - #clear old output - if line < self.lastLowestLine: - for i in range(line + 1, self.lastLowestLine + 1): - println(i, "") - - self.lastLowestLine = line - - #set cursor to position - print "\033[" + str(self.inputline) + ";0H" - - def onChar(self, char): - """ default no special handling for single chars """ - if char == "1": - self.setHandler(AddPackage) - elif char == "2": - self.setHandler(ManageFiles) - elif char == "3": - self.setHandler(ManageFiles) - self.bodyHandler.target = Destination.Collector - elif char == "4": - self.client.togglePause() - self.setInput() - elif char == "5": - self.client.kill() - self.client.close() - sys.exit() - elif char == "6": - os.system('clear') - sys.exit() - - def onEnter(self, inp): - pass - - def onBackSpace(self): - pass - - def processCommand(self): - command = self.command[0] - args = [] - if len(self.command) > 1: - args = self.command[1:] - - if command == "status": - files = self.client.statusDownloads() - - if not files: - print "No downloads running." - - for download in files: - if download.status == 12: # downloading - print print_status(download) - print "\tDownloading: %s @ %s/s\t %s (%s%%)" % ( - download.format_eta, formatSize(download.speed), formatSize(download.size - download.bleft), - download.percent) - elif download.status == 5: - print print_status(download) - print "\tWaiting: %s" % download.format_wait - else: - print print_status(download) - - elif command == "queue": - print_packages(self.client.getQueueData()) - - elif command == "collector": - print_packages(self.client.getCollectorData()) - - elif command == "add": - if len(args) < 2: - print _("Please use this syntax: add ...") - return - - self.client.addPackage(args[0], args[1:], Destination.Queue) - - elif command == "add_coll": - if len(args) < 2: - print _("Please use this syntax: add ...") - return - - self.client.addPackage(args[0], args[1:], Destination.Collector) - - elif command == "del_file": - self.client.deleteFiles([int(x) for x in args]) - print "Files deleted." - - elif command == "del_package": - self.client.deletePackages([int(x) for x in args]) - print "Packages deleted." - - elif command == "move": - for pid in args: - pack = self.client.getPackageInfo(int(pid)) - self.client.movePackage((pack.dest + 1) % 2, pack.pid) - - elif command == "check": - print _("Checking %d links:") % len(args) - print - rid = self.client.checkOnlineStatus(args).rid - self.printOnlineCheck(self.client, rid) - - - elif command == "check_container": - path = args[0] - if not exists(join(owd, path)): - print _("File does not exists.") - return - - f = open(join(owd, path), "rb") - content = f.read() - f.close() - - rid = self.client.checkOnlineStatusContainer([], basename(f.name), content).rid - self.printOnlineCheck(self.client, rid) - - - elif command == "pause": - self.client.pause() - - elif command == "unpause": - self.client.unpause() - - elif command == "toggle": - self.client.togglePause() - - elif command == "kill": - self.client.kill() - elif command == "restart_file": - for x in args: - self.client.restartFile(int(x)) - print "Files restarted." - elif command == "restart_package": - for pid in args: - self.client.restartPackage(int(pid)) - print "Packages restarted." - - else: - print_commands() - - def printOnlineCheck(self, client, rid): - while True: - sleep(1) - result = client.pollResults(rid) - for url, status in result.data.iteritems(): - if status.status == 2: check = "Online" - elif status.status == 1: check = "Offline" - else: check = "Unknown" - - print "%-45s %-12s\t %-15s\t %s" % (status.name, formatSize(status.size), status.plugin, check) - - if result.rid == -1: break - - -class RefreshThread(Thread): - def __init__(self, cli): - Thread.__init__(self) - self.setDaemon(True) - self.cli = cli - - def run(self): - while True: - sleep(1) - try: - self.cli.refresh() - except ConnectionClosed: - os.system("clear") - print _("pyLoad was terminated") - _exit(0) - except Exception, e: - println(2, red(str(e))) - self.cli.reset() - print_exc() - - -def print_help(config): - print - print "pyLoad CLI Copyright (c) 2008-2015 the pyLoad Team" - print - print "Usage: [python] pyload-cli.py [options] [command]" - print - print "" - print "See pyload-cli.py -c for a complete listing." - print - print "" - print " -i, --interactive", " Start in interactive mode" - print - print " -u, --username=", " " * 2, "Specify Username" - print " --pw=", " " * 2, "Password" - print " -a, --address=", " " * 3, "Specify address (current=%s)" % config["addr"] - print " -p, --port", " " * 7, "Specify port (current=%s)" % config["port"] - print - print " -l, --language", " " * 3, "Set user interface language (current=%s)" % config["language"] - print " -h, --help", " " * 7, "Display this help screen" - print " -c, --commands", " " * 3, "List all available commands" - print - - -def print_packages(data): - for pack in data: - print "Package %s (#%s):" % (pack.name, pack.pid) - for download in pack.links: - print "\t" + print_file(download) - print - - -def print_file(download): - return "#%(id)-6d %(name)-30s %(statusmsg)-10s %(plugin)-8s" % { - "id": download.fid, - "name": download.name, - "statusmsg": download.statusmsg, - "plugin": download.plugin - } - - -def print_status(download): - return "#%(id)-6s %(name)-40s Status: %(statusmsg)-10s Size: %(size)s" % { - "id": download.fid, - "name": download.name, - "statusmsg": download.statusmsg, - "size": download.format_size - } - - -def print_commands(): - commands = [("status", _("Prints server status")), - ("queue", _("Prints downloads in queue")), - ("collector", _("Prints downloads in collector")), - ("add ...", _("Adds package to queue")), - ("add_coll ...", _("Adds package to collector")), - ("del_file ...", _("Delete Files from Queue/Collector")), - ("del_package ...", _("Delete Packages from Queue/Collector")), - ("move ...", _("Move Packages from Queue to Collector or vice versa")), - ("restart_file ...", _("Restart files")), - ("restart_package ...", _("Restart packages")), - ("check ...", _("Check online status, works with local container")), - ("check_container path", _("Checks online status of a container file")), - ("pause", _("Pause the server")), - ("unpause", _("continue downloads")), - ("toggle", _("Toggle pause/unpause")), - ("kill", _("kill server")), ] - - print _("List of commands:") - print - for c in commands: - print "%-35s %s" % c - - -def writeConfig(opts): - try: - with open(join(homedir, ".pyload-cli"), "w") as cfgfile: - cfgfile.write("[cli]") - for opt in opts: - cfgfile.write("%s=%s\n" % (opt, opts[opt])) - except Exception: - print _("Couldn't write user config file") - - -def main(): - config = {"addr": "127.0.0.1", "port": "7227", "language": "en"} - try: - config["language"] = os.environ["LANG"][0:2] - except Exception: - pass - - if (not exists(join(pypath, "locale", config["language"]))) or config["language"] == "": - config["language"] = "en" - - configFile = ConfigParser.ConfigParser() - configFile.read(join(homedir, ".pyload-cli")) - - if configFile.has_section("cli"): - for opt in configFile.items("cli"): - config[opt[0]] = opt[1] - - gettext.setpaths([join(os.sep, "usr", "share", "pyload", "locale"), None]) - translation = gettext.translation("Cli", join(pypath, "locale"), - languages=[config["language"], "en"], fallback=True) - translation.install(unicode=True) - - interactive = False - command = None - username = "" - password = "" - - shortOptions = 'iu:p:a:hcl:' - longOptions = ['interactive', "username=", "pw=", "address=", "port=", "help", "commands", "language="] - - try: - opts, extraparams = getopt(sys.argv[1:], shortOptions, longOptions) - for option, params in opts: - if option in ("-i", "--interactive"): - interactive = True - elif option in ("-u", "--username"): - username = params - elif option in ("-a", "--address"): - config["addr"] = params - elif option in ("-p", "--port"): - config["port"] = params - elif option in ("-l", "--language"): - config["language"] = params - gettext.setpaths([join(os.sep, "usr", "share", "pyload", "locale"), None]) - translation = gettext.translation("Cli", join(pypath, "locale"), - languages=[config["language"], "en"], fallback=True) - translation.install(unicode=True) - elif option in ("-h", "--help"): - print_help(config) - exit() - elif option in ("--pw"): - password = params - elif option in ("-c", "--comands"): - print_commands() - exit() - - except GetoptError: - print 'Unknown Argument(s) "%s"' % " ".join(sys.argv[1:]) - print_help(config) - exit() - - if len(extraparams) >= 1: - command = extraparams - - client = False - - if interactive: - try: - client = ThriftClient(config["addr"], int(config["port"]), username, password) - except WrongLogin: - pass - except NoSSL: - print _("You need py-openssl to connect to this pyLoad Core.") - exit() - except NoConnection: - config["addr"] = False - config["port"] = False - - if not client: - if not config["addr"]: config["addr"] = raw_input(_("Address: ")) - if not config["port"]: config["port"] = raw_input(_("Port: ")) - if not username: username = raw_input(_("Username: ")) - if not password: - from getpass import getpass - - password = getpass(_("Password: ")) - - try: - client = ThriftClient(config["addr"], int(config["port"]), username, password) - except WrongLogin: - print _("Login data is wrong.") - except NoConnection: - print _("Could not establish connection to %(addr)s:%(port)s." % {"addr": config["addr"], - "port": config["port"]}) - - else: - try: - client = ThriftClient(config["addr"], int(config["port"]), username, password) - except WrongLogin: - print _("Login data is wrong.") - except NoConnection: - print _("Could not establish connection to %(addr)s:%(port)s." % {"addr": config["addr"], - "port": config["port"]}) - except NoSSL: - print _("You need py-openssl to connect to this pyLoad core.") - - if interactive and command: print _("Interactive mode ignored since you passed some commands.") - - if client: - writeConfig(config) - cli = Cli(client, command) diff --git a/pyload/cli/Handler.py b/pyload/cli/Handler.py deleted file mode 100644 index 4aab3f0e2..000000000 --- a/pyload/cli/Handler.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -class Handler(object): - def __init__(self, cli): - self.cli = cli - self.init() - - client = property(lambda self: self.cli.client) - input = property(lambda self: self.cli.input) - - def init(self): - pass - - def onChar(self, char): - pass - - def onBackSpace(self): - pass - - def onEnter(self, inp): - pass - - def setInput(self, inp=""): - self.cli.setInput(inp) - - def backspace(self): - self.cli.setInput(self.input[:-1]) - - def renderBody(self, line): - """ gets the line where to render output and should return the line number below its content """ - return line + 1 diff --git a/pyload/cli/ManageFiles.py b/pyload/cli/ManageFiles.py deleted file mode 100644 index ca1070113..000000000 --- a/pyload/cli/ManageFiles.py +++ /dev/null @@ -1,178 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -from itertools import islice -from time import time - -from pyload.cli.Handler import Handler -from pyload.utils.printer import * - -from pyload.api import Destination, PackageData - - -class ManageFiles(Handler): - """ possibility to manage queue/collector """ - - def init(self): - self.target = Destination.Queue - self.pos = 0 #position in queue - self.package = -1 #choosen package - self.mode = "" # move/delete/restart - self.cache = None - self.links = None - self.time = 0 - - def onChar(self, char): - if char in ("m", "d", "r"): - self.mode = char - self.setInput() - elif char == "p": - self.pos = max(0, self.pos - 5) - self.backspace() - elif char == "n": - self.pos += 5 - self.backspace() - - def onBackSpace(self): - if not self.input and self.mode: - self.mode = "" - if not self.input and self.package > -1: - self.package = -1 - - def onEnter(self, input): - if input == "0": - self.cli.reset() - elif self.package < 0 and self.mode: - #mode select - packs = self.parseInput(input) - if self.mode == "m": - [self.client.movePackage((self.target + 1) % 2, x) for x in packs] - elif self.mode == "d": - self.client.deletePackages(packs) - elif self.mode == "r": - [self.client.restartPackage(x) for x in packs] - - elif self.mode: - #edit links - links = self.parseInput(input, False) - - if self.mode == "d": - self.client.deleteFiles(links) - elif self.mode == "r": - map(self.client.restartFile, links) - - else: - #look into package - try: - self.package = int(input) - except Exception: - pass - - self.cache = None - self.links = None - self.pos = 0 - self.mode = "" - self.setInput() - - def renderBody(self, line): - if self.package < 0: - println(line, white(_("Manage Packages:"))) - else: - println(line, white((_("Manage Links:")))) - line += 1 - - if self.mode: - if self.mode == "m": - println(line, _("What do you want to move?")) - elif self.mode == "d": - println(line, _("What do you want to delete?")) - elif self.mode == "r": - println(line, _("What do you want to restart?")) - - println(line + 1, "Enter single number, comma seperated numbers or ranges. eg. 1, 2, 3 or 1-3.") - line += 2 - else: - println(line, _("Choose what yout want to do or enter package number.")) - println(line + 1, ("%s - %%s, %s - %%s, %s - %%s" % (mag("d"), mag("m"), mag("r"))) % ( - _("delete"), _("move"), _("restart"))) - line += 2 - - if self.package < 0: - #print package info - pack = self.getPackages() - i = 0 - for value in islice(pack, self.pos, self.pos + 5): - try: - println(line, mag(str(value.pid)) + ": " + value.name) - line += 1 - i += 1 - except Exception, e: - pass - for x in range(5 - i): - println(line, "") - line += 1 - else: - #print links info - pack = self.getLinks() - i = 0 - for value in islice(pack.links, self.pos, self.pos + 5): - try: - println(line, mag(value.fid) + ": %s | %s | %s" % ( - value.name, value.statusmsg, value.plugin)) - line += 1 - i += 1 - except Exception, e: - pass - for x in range(5 - i): - println(line, "") - line += 1 - - println(line, mag("p") + _(" - previous") + " | " + mag("n") + _(" - next")) - println(line + 1, mag("0.") + _(" back to main menu")) - return line + 2 - - def getPackages(self): - if self.cache and self.time + 2 < time(): - return self.cache - - if self.target == Destination.Queue: - data = self.client.getQueue() - else: - data = self.client.getCollector() - - self.cache = data - self.time = time() - - return data - - def getLinks(self): - if self.links and self.time + 1 < time(): - return self.links - try: - data = self.client.getPackageData(self.package) - except Exception: - data = PackageData(links=[]) - self.links = data - self.time = time() - return data - - def parseInput(self, inp, package=True): - inp = inp.strip() - if "-" in inp: - l, n, h = inp.partition("-") - l = int(l) - h = int(h) - r = range(l, h + 1) - - ret = [] - if package: - for p in self.cache: - if p.pid in r: - ret.append(p.pid) - else: - for l in self.links.links: - if l.lid in r: - ret.append(l.lid) - return ret - else: - return [int(x) for x in inp.split(",")] diff --git a/pyload/cli/__init__.py b/pyload/cli/__init__.py deleted file mode 100644 index a64fc0c0c..000000000 --- a/pyload/cli/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.cli.AddPackage import AddPackage -from pyload.cli.ManageFiles import ManageFiles diff --git a/pyload/config/Parser.py b/pyload/config/Parser.py deleted file mode 100644 index e21eaba9f..000000000 --- a/pyload/config/Parser.py +++ /dev/null @@ -1,353 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement - -from time import sleep -from os.path import exists, join -from shutil import copy - -from traceback import print_exc -from pyload.utils import chmod, encode, decode - - -CONF_VERSION = 1 - - -class ConfigParser(object): - """ - holds and manage the configuration - - current dict layout: - - { - - section: { - option: { - value: - type: - desc: - } - desc: - - } - """ - - def __init__(self): - """Constructor""" - self.config = {} #: the config values - self.plugin = {} #: the config for plugins - self.oldRemoteData = {} - - self.pluginCB = None #: callback when plugin config value is changed - - self.checkVersion() - - self.readConfig() - - - def checkVersion(self, n=0): - """determines if config need to be copied""" - try: - if not exists("pyload.conf"): - copy(join(pypath, "pyload", "config", "default.conf"), "pyload.conf") - - if not exists("plugin.conf"): - f = open("plugin.conf", "wb") - f.write("version: " + str(CONF_VERSION)) - f.close() - - f = open("pyload.conf", "rb") - v = f.readline() - f.close() - v = v[v.find(":") + 1:].strip() - - if not v or int(v) < CONF_VERSION: - copy(join(pypath, "pyload", "config", "default.conf"), "pyload.conf") - print "Old version of config was replaced" - - f = open("plugin.conf", "rb") - v = f.readline() - f.close() - v = v[v.find(":") + 1:].strip() - - if not v or int(v) < CONF_VERSION: - f = open("plugin.conf", "wb") - f.write("version: " + str(CONF_VERSION)) - f.close() - print "Old version of plugin-config replaced" - except Exception: - if n >= 3: - raise - sleep(0.3) - self.checkVersion(n + 1) - - - def readConfig(self): - """reads the config file""" - self.config = self.parseConfig(join(pypath, "pyload", "config", "default.conf")) - self.plugin = self.parseConfig("plugin.conf") - - try: - homeconf = self.parseConfig("pyload.conf") - if "username" in homeconf["remote"]: - if "password" in homeconf["remote"]: - self.oldRemoteData = {"username": homeconf["remote"]["username"]["value"], - "password": homeconf["remote"]["username"]["value"]} - del homeconf["remote"]["password"] - del homeconf["remote"]["username"] - self.updateValues(homeconf, self.config) - except Exception: - print "Config Warning" - print_exc() - - - def parseConfig(self, config): - """parses a given configfile""" - - f = open(config) - - config = f.read() - - config = config.splitlines()[1:] - - conf = {} - - section, option, value, typ, desc = "", "", "", "", "" - - listmode = False - - for line in config: - comment = line.rfind("#") - if line.find(":", comment) < 0 > line.find("=", comment) and comment > 0 and line[comment - 1].isspace(): - line = line.rpartition("#") #: removes comments - if line[1]: - line = line[0] - else: - line = line[2] - - line = line.strip() - - try: - if line == "": - continue - elif line.endswith(":"): - section, none, desc = line[:-1].partition('-') - section = section.strip() - desc = desc.replace('"', "").strip() - conf[section] = {"desc": desc} - else: - if listmode: - if line.endswith("]"): - listmode = False - line = line.replace("]", "") - - value += [self.cast(typ, x.strip()) for x in line.split(",") if x] - - if not listmode: - conf[section][option] = {"desc": desc, - "type": typ, - "value": value} - - - else: - content, none, value = line.partition("=") - - content, none, desc = content.partition(":") - - desc = desc.replace('"', "").strip() - - typ, none, option = content.strip().rpartition(" ") - - value = value.strip() - - if value.startswith("["): - if value.endswith("]"): - listmode = False - value = value[:-1] - else: - listmode = True - - value = [self.cast(typ, x.strip()) for x in value[1:].split(",") if x] - else: - value = self.cast(typ, value) - - if not listmode: - conf[section][option] = {"desc": desc, - "type": typ, - "value": value} - - except Exception, e: - print "Config Warning" - print_exc() - - f.close() - return conf - - - def updateValues(self, config, dest): - """sets the config values from a parsed config file to values in destination""" - - for section in config.iterkeys(): - if section in dest: - for option in config[section].iterkeys(): - if option in ("desc", "outline"): - continue - - if option in dest[section]: - dest[section][option]["value"] = config[section][option]["value"] - - # else: - # dest[section][option] = config[section][option] - - - # else: - # dest[section] = config[section] - - - def saveConfig(self, config, filename): - """saves config to filename""" - with open(filename, "wb") as f: - chmod(filename, 0600) - f.write("version: %i \n" % CONF_VERSION) - for section in config.iterkeys(): - f.write('\n%s - "%s":\n' % (section, config[section]["desc"])) - - for option, data in config[section].iteritems(): - if option in ("desc", "outline"): continue - - if isinstance(data["value"], list): - value = "[ \n" - for x in data["value"]: - value += "\t\t" + str(x) + ",\n" - value += "\t\t]\n" - else: - if isinstance(data["value"], basestring): - value = data["value"] + "\n" - else: - value = str(data["value"]) + "\n" - try: - f.write('\t%s %s : "%s" = %s' % (data["type"], option, data["desc"], value)) - except UnicodeEncodeError: - f.write('\t%s %s : "%s" = %s' % (data["type"], option, data["desc"], encode(value))) - - - def cast(self, typ, value): - """cast value to given format""" - if not isinstance(value, basestring): - return value - - elif typ == "int": - return int(value) - elif typ == "bool": - return value.lower() in ("1", "true", "on", "an", "yes") - elif typ == "time": - if not value: - value = "0:00" - if not ":" in value: - value += ":00" - return value - elif typ in ("str", "file", "folder"): - return encode(value) - else: - return value - - - def save(self): - """saves the configs to disk""" - self.saveConfig(self.config, "pyload.conf") - self.saveConfig(self.plugin, "plugin.conf") - - - def __getitem__(self, section): - """provides dictonary like access: c['section']['option']""" - return Section(self, section) - - - def get(self, section, option): - """get value""" - value = self.config[section][option]["value"] - return decode(value) - - - def set(self, section, option, value): - """set value""" - - value = self.cast(self.config[section][option]["type"], value) - - self.config[section][option]["value"] = value - self.save() - - - def getPlugin(self, plugin, option): - """gets a value for a plugin""" - value = self.plugin[plugin][option]["value"] - return encode(value) - - - def setPlugin(self, plugin, option, value): - """sets a value for a plugin""" - - value = self.cast(self.plugin[plugin][option]["type"], value) - - if self.pluginCB: self.pluginCB(plugin, option, value) - - self.plugin[plugin][option]["value"] = value - self.save() - - - def getMetaData(self, section, option): - """ get all config data for an option """ - return self.config[section][option] - - - def addPluginConfig(self, name, config, outline=""): - """adds config options with tuples (name, type, desc, default)""" - if name not in self.plugin: - conf = {"desc": name, - "outline": outline} - self.plugin[name] = conf - else: - conf = self.plugin[name] - conf["outline"] = outline - - for item in config: - if item[0] in conf: - conf[item[0]]["type"] = item[1] - conf[item[0]]["desc"] = item[2] - else: - conf[item[0]] = { - "desc": item[2], - "type": item[1], - "value": self.cast(item[1], item[3]) - } - - values = [x[0] for x in config] + ["desc", "outline"] - # delete old values - for item in conf.keys(): - if item not in values: - del conf[item] - - - def deleteConfig(self, name): - """Removes a plugin config""" - if name in self.plugin: - del self.plugin[name] - - -class Section(object): - """provides dictionary like access for configparser""" - - def __init__(self, parser, section): - """Constructor""" - self.parser = parser - self.section = section - - - def __getitem__(self, item): - """getitem""" - return self.parser.get(self.section, item) - - - def __setitem__(self, item, value): - """setitem""" - self.parser.set(self.section, item, value) diff --git a/pyload/config/Setup.py b/pyload/config/Setup.py deleted file mode 100644 index 8b88daa48..000000000 --- a/pyload/config/Setup.py +++ /dev/null @@ -1,553 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: vuolter - -from __future__ import with_statement - -import __builtin__ - -import os -import sys - -from getpass import getpass -from os import chdir, makedirs, path -from subprocess import PIPE, call - -from pyload.network.JsEngine import JsEngine -from pyload.utils import get_console_encoding, load_translation, safe_join, versiontuple - - -class SetupAssistant(object): - """ pyLoads initial setup configuration assistant """ - - def __init__(self, config): - self.config = config - self.lang = "en" - self.stdin_encoding = get_console_encoding(sys.stdin.encoding) - - - def start(self): - print - langs = sorted(self.config.getMetaData("general", "language")['type'].split(";")) - self.lang = self.ask(u"Choose setup language", "en", langs) - - load_translation("setup", self.lang) - - #Input shorthand for yes - self.yes = _("y") - #Input shorthand for no - self.no = _("n") - - # print - # print _("Would you like to configure pyLoad via Webinterface?") - # print _("You need a Browser and a connection to this PC for it.") - # viaweb = self.ask(_("Start initial webinterface for configuration?"), "y", bool=True) - # ... - - print - print - print _("## Welcome to the pyLoad Configuration Assistant ##") - print - print _("It will check your system and make a basic setup in order to run pyLoad.") - print - print _("The value in brackets [] always is the default value,") - print _("in case you don't want to change it or you are unsure what to choose, just hit enter.") - print _( - "Don't forget: You can always rerun this assistant with --setup or -s parameter, when you start pyload.py .") - print _("If you have any problems with this assistant hit STRG-C,") - print _("to abort and don't let him start with pyload.py automatically anymore.") - print - print - raw_input(_("When you are ready for system check, hit enter.")) - print - print - - basic, ssl, captcha, web, js = self.system_check() - print - print - - if not basic: - print _("You need pycurl, sqlite and python 2.5, 2.6 or 2.7 to run pyLoad.") - print _("Please correct this and re-run pyLoad.") - print - print _("Setup will now close.") - print - print - raw_input(_("Press Enter to exit.")) - return False - - raw_input(_("System check finished, hit enter to see your status report.")) - print - print - print _("## Status ##") - print - - avail = [] - if self.check_module("Crypto"): - avail.append(_("- container decrypting")) - if ssl: - avail.append(_("- ssl connection")) - if captcha: - avail.append(_("- automatic captcha decryption")) - if web: - avail.append(_("- webinterface")) - if js: - avail.append(_("- extended Click'N'Load")) - - if avail: - print _("AVAILABLE FEATURES:") - for feature in avail: - print feature - print - - if len(avail) < 5: - print _("MISSING FEATURES:") - - if not self.check_module("Crypto"): - print _("- no py-crypto available") - print _("You need this if you want to decrypt container files.") - print - - if not ssl: - print _("- no SSL available") - print _("This is needed if you want to establish a secure connection to core or webinterface.") - print _("If you only want to access locally to pyLoad ssl is not usefull.") - print - - if not captcha: - print _("- no Captcha Recognition available") - print _("Only needed for some hosters and as freeuser.") - print - - if not js: - print _("- no JavaScript engine found") - print _("You will need this for some Click'N'Load links. Install Spidermonkey, ossp-js, pyv8 or rhino") - print - - print - print _("You can abort the setup now and fix some dependicies if you want.") - else: - print _("NO MISSING FEATURES!") - - print - print - con = self.ask(_("Continue with setup?"), self.yes, bool=True) - - if not con: - return False - - print - print - print _("CURRENT CONFIG PATH: %s") % configdir - print - print _("NOTE: If you use pyLoad on a server or the home partition lives on an iternal flash it may be a good idea to change it.") - confpath = self.ask(_("Do you want to change the config path?"), self.no, bool=True) - if confpath: - print - self.conf_path() - print - - print - print _("Do you want to configure login data and basic settings?") - print _("This is recommend for first run.") - con = self.ask(_("Make basic setup?"), self.yes, bool=True) - - if con: - print - print - self.conf_basic() - - if ssl: - print - print _("Do you want to configure ssl?") - ssl = self.ask(_("Configure ssl?"), self.no, bool=True) - if ssl: - print - print - self.conf_ssl() - - if web: - print - print _("Do you want to configure webinterface?") - web = self.ask(_("Configure webinterface?"), self.yes, bool=True) - if web: - print - print - self.conf_web() - - print - print - print _("Setup finished successfully!") - print - print - raw_input(_("Hit enter to exit and restart pyLoad.")) - return True - - - def system_check(self): - """ make a systemcheck and return the results """ - import platform - - print _("## System Information ##") - print - print _("Platform: ") + platform.platform(aliased=True) - print _("OS: ") + platform.system() or "Unknown" - print _("Python: ") + sys.version.replace("\n", "") - print - print - - print _("## System Check ##") - print - - if (2, 5) > sys.version_info > (2, 7): - python = False - else: - python = True - - self.print_dep("python", python, false="NOT OK") - - curl = self.check_module("pycurl") - self.print_dep("pycurl", curl) - - sqlite = self.check_module("sqlite3") - self.print_dep("sqlite3", sqlite) - - basic = python and curl and sqlite - - print - - crypto = self.check_module("Crypto") - self.print_dep("pycrypto", crypto) - - ssl = self.check_module("OpenSSL") - self.print_dep("py-OpenSSL", ssl) - - print - - pil = self.check_module("Image") - self.print_dep("py-imaging", pil) - - if os.name == "nt": - tesser = self.check_prog([path.join(pypath, "tesseract", "tesseract.exe"), "-v"]) - else: - tesser = self.check_prog(["tesseract", "-v"]) - - self.print_dep("tesseract", tesser) - - captcha = pil and tesser - - print - - try: - import jinja2 - - v = jinja2.__version__ - if v and versiontuple(v) < (2, 5, 0): - jinja = False - else: - jinja = True - except Exception: - jinja = False - jinja_error = "MISSING" - else: - jinja_error = "NOT OK" - - self.print_dep("jinja2", jinja, false=jinja_error) - - beaker = self.check_module("beaker") - self.print_dep("beaker", beaker) - - bjoern = self.check_module("bjoern") - self.print_dep("bjoern", bjoern) - - web = sqlite and beaker - - js = True if JsEngine.find() else False - self.print_dep(_("JS engine"), js) - - if not python: - print - print - if sys.version_info > (2, 7): - print _("WARNING: Your python version is too NEW!") - print _("Please use Python version 2.6/2.7 .") - else: - print _("WARNING: Your python version is too OLD!") - print _("Please use at least Python version 2.5 .") - - if not jinja and jinja_error == "NOT OK": - print - print - print _("WARNING: Your installed jinja2 version %s is too OLD!") % jinja2.__version__ - print _("You can safely continue but if the webinterface is not working,") - print _("please upgrade or uninstall it, because pyLoad self-includes jinja2 libary.") - - return basic, ssl, captcha, web, js - - - def conf_basic(self): - print _("## Basic Setup ##") - - print - print _("The following logindata is valid for CLI and webinterface.") - - from pyload.database import DatabaseBackend - - db = DatabaseBackend(None) - db.setup() - print _("NOTE: Consider a password of 10 or more symbols if you expect to access to your local network from outside (ex. internet).") - print - username = self.ask(_("Username"), "User") - password = self.ask("", "", password=True) - db.addUser(username, password) - db.shutdown() - - print - print _("External clients (GUI, CLI or other) need remote access to work over the network.") - print _("However, if you only want to use the webinterface you may disable it to save ram.") - self.config.set("remote", "activated", self.ask(_("Enable remote access"), self.no, bool=True)) - - print - langs = sorted(self.config.getMetaData("general", "language")['type'].split(";")) - self.config.set("general", "language", self.ask(_("Choose system language"), self.lang, langs)) - - print - self.config.set("general", "download_folder", self.ask(_("Download folder"), "Downloads")) - print - self.config.set("download", "max_downloads", self.ask(_("Max parallel downloads"), "3")) - print - reconnect = self.ask(_("Use Reconnect?"), self.no, bool=True) - self.config.set("reconnect", "activated", reconnect) - if reconnect: - self.config.set("reconnect", "method", self.ask(_("Reconnect script location"), "./reconnect.sh")) - - - def conf_web(self): - print _("## Webinterface Setup ##") - - print - print _("Listen address, if you use 127.0.0.1 or localhost, the webinterface will only accessible locally.") - self.config.set("webui", "host", self.ask(_("Address"), "0.0.0.0")) - self.config.set("webui", "port", self.ask(_("Port"), "8000")) - print - print _("pyLoad offers several server backends, now following a short explanation.") - print "- auto:", _("Automatically choose the best webserver for your platform.") - print "- builtin:", _("First choice if you plan to use pyLoad just for you.") - print "- threaded:", _("Support SSL connection and can serve simultaneously more client flawlessly.") - print "- fastcgi:", _( - "Can be used by apache, lighttpd, etc.; needs to be properly configured before.") - if os.name != "nt": - print "- lightweight:", _("Very fast alternative to builtin; requires libev and bjoern packages.") - - print - print _("NOTE: In some rare cases the builtin server not works correctly, so if you have troubles with the web interface") - print _("run this setup assistant again and change the builtin server to the threaded.") - - if os.name == "nt": - servers = ["auto", "builtin", "threaded", "fastcgi"] - else: - servers = ["auto", "builtin", "threaded", "fastcgi", "lightweight"] - - self.config.set("webui", "server", self.ask(_("Choose webserver"), "auto", servers)) - - - def conf_ssl(self): - print _("## SSL Setup ##") - print - print _("Execute these commands from pyLoad config folder to make ssl certificates:") - print - print "openssl genrsa -out ssl.key 1024" - print "openssl req -new -key ssl.key -out ssl.csr" - print "openssl req -days 36500 -x509 -key ssl.key -in ssl.csr > ssl.crt " - print - print _("If you're done and everything went fine, you can activate ssl now.") - - ssl = self.ask(_("Activate SSL?"), self.yes, bool=True) - self.config.set("remote", "ssl", ssl) - self.config.set("webui", "ssl", ssl) - - - def set_user(self): - load_translation("setup", self.config.get("general", "language")) - - from pyload.database import DatabaseBackend - - db = DatabaseBackend(None) - db.setup() - - noaction = True - try: - while True: - print _("Select action") - print _("1 - Create/Edit user") - print _("2 - List users") - print _("3 - Remove user") - print _("4 - Quit") - action = raw_input("[1]/2/3/4: ") - if not action in ("1", "2", "3", "4"): - continue - elif action == "1": - print - username = self.ask(_("Username"), "User") - password = self.ask("", "", password=True) - db.addUser(username, password) - noaction = False - elif action == "2": - print - print _("Users") - print "-----" - users = db.listUsers() - noaction = False - for user in users: - print user - print "-----" - print - elif action == "3": - print - username = self.ask(_("Username"), "") - if username: - db.removeUser(username) - noaction = False - elif action == "4": - break - finally: - if not noaction: - db.shutdown() - - - def set_configdir(self, configdir, persistent=False): - dirname = path.abspath(configdir) - try: - if not path.exists(dirname): - makedirs(dirname, 0700) - - chdir(dirname) - - if persistent: - c = path.join(rootdir, "config", "configdir") - if not path.exists(c): - makedirs(c, 0700) - - with open(c, "wb") as f: - f.write(dirname) - - except IOError: - return False - - else: - __builtin__.configdir = dirname - return dirname #: return always abspath - - - def conf_path(self): - print _("Setting new config path.") - print _("NOTE: Current configuration will not be transfered!") - - while True: - confdir = self.ask(_("CONFIG PATH"), configdir) - confpath = self.set_configdir(confdir) - print - if not confpath: - print _("Failed to change the current config path!") - print - else: - print _("pyLoad config path successfully changed.") - break - - - def print_dep(self, name, value, false="MISSING", true="OK"): - """ Print Status of dependency """ - if value and isinstance(value, basestring): - msg = "%(dep)-12s %(bool)s (%(info)s)" - else: - msg = "%(dep)-12s %(bool)s" - - print msg % {'dep': name + ':', - 'bool': _(true if value else false).upper(), - 'info': ", ".join(value)} - - - def check_module(self, module): - try: - __import__(module) - return True - except Exception: - return False - - - def check_prog(self, command): - pipe = PIPE - try: - call(command, stdout=pipe, stderr=pipe) - return True - except Exception: - return False - - - def ask(self, qst, default, answers=[], bool=False, password=False): - """ produce one line to asking for input """ - if answers: - info = "(" - - for i, answer in enumerate(answers): - info += (", " if i != 0 else "") + str((answer == default and "[%s]" % answer) or answer) - - info += ")" - elif bool: - if default == self.yes: - info = "([%s]/%s)" % (self.yes, self.no) - else: - info = "(%s/[%s])" % (self.yes, self.no) - else: - info = "[%s]" % default - - if password: - p1 = True - p2 = False - pwlen = 8 - while p1 != p2: - sys.stdout.write(_("Password: ")) - p1 = getpass("") - - if len(p1) < pwlen: - print _("Password too short! Use at least %s symbols." % pwlen) - continue - elif not p1.isalnum(): - print _("Password must be alphanumeric.") - continue - - sys.stdout.write(_("Password (again): ")) - p2 = getpass("") - - if p1 == p2: - return p1 - else: - print _("Passwords did not match.") - - while True: - try: - input = raw_input(qst + " %s: " % info) - except KeyboardInterrupt: - print "\nSetup interrupted" - sys.exit() - - input = input.decode(self.stdin_encoding) - - if input.strip() == "": - input = default - - if bool: - # yes, true, t are inputs for booleans with value true - if input.lower().strip() in [self.yes, _("yes"), _("true"), _("t"), "yes"]: - return True - # no, false, f are inputs for booleans with value false - elif input.lower().strip() in [self.no, _("no"), _("false"), _("f"), "no"]: - return False - else: - print _("Invalid Input") - print - continue - - if not answers or input in answers: - return input - else: - print _("Invalid Input") diff --git a/pyload/config/__init__.py b/pyload/config/__init__.py deleted file mode 100644 index 40a96afc6..000000000 --- a/pyload/config/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/pyload/config/default.conf b/pyload/config/default.conf deleted file mode 100644 index 6e2fb7749..000000000 --- a/pyload/config/default.conf +++ /dev/null @@ -1,65 +0,0 @@ -version: 1 - -remote - "Remote": - int port : "Port" = 7227 - ip listenaddr : "Address" = 0.0.0.0 - bool nolocalauth : "No authentication on local connections" = True - bool activated : "Activated" = True -ssl - "SSL": - bool activated : "Activated"= False - file cert : "SSL Certificate" = ssl.crt - file key : "SSL Key" = ssl.key -webinterface - "Web UI": - bool activated : "Activated" = True - builtin;threaded;fastcgi;lightweight server : "Server" = builtin - bool https : "Use HTTPS" = False - ip host : "IP" = 0.0.0.0 - int port : "Port" = 8001 - Default;Dark;Flat theme : "Theme" = Default - str prefix: "Path Prefix" = -log - "Log": - bool file_log : "File Log" = True - folder log_folder : "Folder" = Logs - int log_count : "Count" = 5 - int log_size : "Size in kb" = 100 - bool log_rotate : "Log Rotate" = True -general - "General": - en;de;fr;it;es;nl;sv;ru;pl;cs;sr;pt_BR language : "Language" = en - folder download_folder : "Download Folder" = Downloads - bool debug_mode : "Debug Mode" = False - int min_free_space : "Min Free Space (MB)" = 200 - bool folder_per_package : "Create folder for each package" = True - int renice : "CPU Priority" = 0 - auto;common;pyv8;node;rhino;jsc jsengine : "JS Engine" = auto -download - "Download": - int chunks : "Max connections for one download" = 3 - int max_downloads : "Max Parallel Downloads" = 3 - int max_speed : "Max Download Speed in kb/s" = -1 - bool limit_speed : "Limit Download Speed" = False - str interface : "Download interface to bind (ip or Name)" = None - bool ipv6: "Allow IPv6" = False - bool skip_existing : "Skip already existing files" = False -permission - "Permissions": - bool change_user : "Change user of running process" = False - str user : "Username" = user - str folder : "Folder Permission mode" = 0755 - bool change_file : "Change file mode of downloads" = False - str file : "Filemode for Downloads" = 0644 - bool change_group : "Change group of running process" = False - str group : "Groupname" = users - bool change_dl : "Change Group and User of Downloads" = False -reconnect - "Reconnect": - bool activated : "Use Reconnect" = False - str method : "Method" = None - time startTime : "Start" = 0:00 - time endTime : "End" = 0:00 -downloadTime - "Download Time": - time start : "Start" = 0:00 - time end : "End" = 0:00 -proxy - "Proxy": - str address : "Address" = "localhost" - int port : "Port" = 7070 - http;socks4;socks5 type : "Protocol" = http - str username : "Username" = None - password password : "Password" = None - bool proxy : "Use Proxy" = False diff --git a/pyload/database/DatabaseBackend.py b/pyload/database/DatabaseBackend.py deleted file mode 100644 index 4b63dd284..000000000 --- a/pyload/database/DatabaseBackend.py +++ /dev/null @@ -1,290 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN, mkaay - -from threading import Event, Thread -from os import remove -from os.path import exists -from shutil import move - -from Queue import Queue -from traceback import print_exc - -from pyload.utils import chmod - -try: - from pysqlite2 import dbapi2 as sqlite3 -except Exception: - import sqlite3 - -DB_VERSION = 4 - -class style(object): - db = None - - @classmethod - def setDB(cls, db): - cls.db = db - - @classmethod - def inner(cls, f): - @staticmethod - def x(*args, **kwargs): - if cls.db: - return f(cls.db, *args, **kwargs) - return x - - @classmethod - def queue(cls, f): - @staticmethod - def x(*args, **kwargs): - if cls.db: - return cls.db.queue(f, *args, **kwargs) - return x - - @classmethod - def async(cls, f): - @staticmethod - def x(*args, **kwargs): - if cls.db: - return cls.db.async(f, *args, **kwargs) - return x - -class DatabaseJob(object): - def __init__(self, f, *args, **kwargs): - self.done = Event() - - self.f = f - self.args = args - self.kwargs = kwargs - - self.result = None - self.exception = False - -# import inspect -# self.frame = inspect.currentframe() - - def __repr__(self): - from os.path import basename - frame = self.frame.f_back - output = "" - for i in range(5): - output += "\t%s:%s, %s\n" % (basename(frame.f_code.co_filename), frame.f_lineno, frame.f_code.co_name) - frame = frame.f_back - del frame - del self.frame - - return "DataBase Job %s:%s\n%sResult: %s" % (self.f.__name__, self.args[1:], output, self.result) - - def processJob(self): - try: - self.result = self.f(*self.args, **self.kwargs) - except Exception, e: - print_exc() - try: - print "Database Error @", self.f.__name__, self.args[1:], self.kwargs, e - except Exception: - pass - - self.exception = e - finally: - self.done.set() - - def wait(self): - self.done.wait() - -class DatabaseBackend(Thread): - subs = [] - def __init__(self, core): - Thread.__init__(self) - self.setDaemon(True) - self.core = core - - self.jobs = Queue() - - self.setuplock = Event() - - style.setDB(self) - - def setup(self): - self.start() - self.setuplock.wait() - - def run(self): - """main loop, which executes commands""" - convert = self._checkVersion() #returns None or current version - - self.conn = sqlite3.connect("files.db") - chmod("files.db", 0600) - - self.c = self.conn.cursor() #compatibility - - if convert is not None: - self._convertDB(convert) - - self._createTables() - self._migrateUser() - - self.conn.commit() - - self.setuplock.set() - - while True: - j = self.jobs.get() - if j == "quit": - self.c.close() - self.conn.close() - break - j.processJob() - - @style.queue - def shutdown(self): - self.conn.commit() - self.jobs.put("quit") - - def _checkVersion(self): - """ check db version and delete it if needed""" - if not exists("files.version"): - f = open("files.version", "wb") - f.write(str(DB_VERSION)) - f.close() - return - - f = open("files.version", "rb") - v = int(f.read().strip()) - f.close() - if v < DB_VERSION: - if v < 2: - try: - self.manager.core.log.warning(_("Filedatabase was deleted due to incompatible version.")) - except Exception: - print "Filedatabase was deleted due to incompatible version." - remove("files.version") - move("files.db", "files.backup.db") - f = open("files.version", "wb") - f.write(str(DB_VERSION)) - f.close() - return v - - def _convertDB(self, v): - try: - getattr(self, "_convertV%i" % v)() - except Exception: - try: - self.core.log.error(_("Filedatabase could NOT be converted.")) - except Exception: - print "Filedatabase could NOT be converted." - - #convert scripts start----------------------------------------------------- - - def _convertV2(self): - self.c.execute('CREATE TABLE IF NOT EXISTS "storage" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "identifier" TEXT NOT NULL, "key" TEXT NOT NULL, "value" TEXT DEFAULT "")') - try: - self.manager.core.log.info(_("Database was converted from v2 to v3.")) - except Exception: - print "Database was converted from v2 to v3." - self._convertV3() - - def _convertV3(self): - self.c.execute('CREATE TABLE IF NOT EXISTS "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "name" TEXT NOT NULL, "email" TEXT DEFAULT "" NOT NULL, "password" TEXT NOT NULL, "role" INTEGER DEFAULT 0 NOT NULL, "permission" INTEGER DEFAULT 0 NOT NULL, "template" TEXT DEFAULT "default" NOT NULL)') - try: - self.manager.core.log.info(_("Database was converted from v3 to v4.")) - except Exception: - print "Database was converted from v3 to v4." - - #convert scripts end------------------------------------------------------- - - def _createTables(self): - """create tables for database""" - - self.c.execute('CREATE TABLE IF NOT EXISTS "packages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "name" TEXT NOT NULL, "folder" TEXT, "password" TEXT DEFAULT "", "site" TEXT DEFAULT "", "queue" INTEGER DEFAULT 0 NOT NULL, "packageorder" INTEGER DEFAULT 0 NOT NULL)') - self.c.execute('CREATE TABLE IF NOT EXISTS "links" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "url" TEXT NOT NULL, "name" TEXT, "size" INTEGER DEFAULT 0 NOT NULL, "status" INTEGER DEFAULT 3 NOT NULL, "plugin" TEXT DEFAULT "BasePlugin" NOT NULL, "error" TEXT DEFAULT "", "linkorder" INTEGER DEFAULT 0 NOT NULL, "package" INTEGER DEFAULT 0 NOT NULL, FOREIGN KEY(package) REFERENCES packages(id))') - self.c.execute('CREATE INDEX IF NOT EXISTS "pIdIndex" ON links(package)') - self.c.execute('CREATE TABLE IF NOT EXISTS "storage" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "identifier" TEXT NOT NULL, "key" TEXT NOT NULL, "value" TEXT DEFAULT "")') - self.c.execute('CREATE TABLE IF NOT EXISTS "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "name" TEXT NOT NULL, "email" TEXT DEFAULT "" NOT NULL, "password" TEXT NOT NULL, "role" INTEGER DEFAULT 0 NOT NULL, "permission" INTEGER DEFAULT 0 NOT NULL, "template" TEXT DEFAULT "default" NOT NULL)') - - self.c.execute('CREATE VIEW IF NOT EXISTS "pstats" AS \ - SELECT p.id AS id, SUM(l.size) AS sizetotal, COUNT(l.id) AS linkstotal, linksdone, sizedone\ - FROM packages p JOIN links l ON p.id = l.package LEFT OUTER JOIN\ - (SELECT p.id AS id, COUNT(*) AS linksdone, SUM(l.size) AS sizedone \ - FROM packages p JOIN links l ON p.id = l.package AND l.status in (0, 4, 13) GROUP BY p.id) s ON s.id = p.id \ - GROUP BY p.id') - - #try to lower ids - self.c.execute('SELECT max(id) FROM LINKS') - fid = self.c.fetchone()[0] - if fid: - fid = int(fid) - else: - fid = 0 - self.c.execute('UPDATE SQLITE_SEQUENCE SET seq=? WHERE name=?', (fid, "links")) - - - self.c.execute('SELECT max(id) FROM packages') - pid = self.c.fetchone()[0] - if pid: - pid = int(pid) - else: - pid = 0 - self.c.execute('UPDATE SQLITE_SEQUENCE SET seq=? WHERE name=?', (pid, "packages")) - - self.c.execute('VACUUM') - - - def _migrateUser(self): - if exists("pyload.db"): - try: - self.core.log.info(_("Converting old Django DB")) - except Exception: - print "Converting old Django DB" - conn = sqlite3.connect('pyload.db') - c = conn.cursor() - c.execute("SELECT username, password, email from auth_user WHERE is_superuser") - users = [] - for r in c: - pw = r[1].split("$") - users.append((r[0], pw[1] + pw[2], r[2])) - c.close() - conn.close() - - self.c.executemany("INSERT INTO users(name, password, email) VALUES (?, ?, ?)", users) - move("pyload.db", "pyload.old.db") - - def createCursor(self): - return self.conn.cursor() - - @style.async - def commit(self): - self.conn.commit() - - @style.queue - def syncSave(self): - self.conn.commit() - - @style.async - def rollback(self): - self.conn.rollback() - - def async(self, f, *args, **kwargs): - args = (self,) + args - job = DatabaseJob(f, *args, **kwargs) - self.jobs.put(job) - - def queue(self, f, *args, **kwargs): - args = (self,) + args - job = DatabaseJob(f, *args, **kwargs) - self.jobs.put(job) - job.wait() - return job.result - - @classmethod - def registerSub(cls, klass): - cls.subs.append(klass) - - @classmethod - def unregisterSub(cls, klass): - cls.subs.remove(klass) - - def __getattr__(self, attr): - for sub in DatabaseBackend.subs: - if hasattr(sub, attr): - return getattr(sub, attr) diff --git a/pyload/database/File.py b/pyload/database/File.py deleted file mode 100644 index 2b7c6cad9..000000000 --- a/pyload/database/File.py +++ /dev/null @@ -1,875 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN, mkaay - -from threading import RLock -from time import time - -from pyload.utils import formatSize, lock -from pyload.manager.Event import InsertEvent, ReloadAllEvent, RemoveEvent, UpdateEvent -from pyload.datatype.Package import PyPackage -from pyload.datatype.File import PyFile -from pyload.database import style, DatabaseBackend - -try: - from pysqlite2 import dbapi2 as sqlite3 -except Exception: - import sqlite3 - - -class FileHandler(object): - """Handles all request made to obtain information, - modify status or other request for links or packages""" - - def __init__(self, core): - """Constructor""" - self.core = core - - # translations - self.statusMsg = [_("finished"), _("offline"), _("online"), _("queued"), _("skipped"), _("waiting"), _("temp. offline"), _("starting"), _("failed"), _("aborted"), _("decrypting"), _("custom"), _("downloading"), _("processing"), _("unknown")] - - self.cache = {} #holds instances for files - self.packageCache = {} # same for packages - #@TODO: purge the cache - - self.jobCache = {} - - self.lock = RLock() #@TODO should be a Lock w/o R - #self.lock._Verbose__verbose = True - - self.filecount = -1 # if an invalid value is set get current value from db - self.queuecount = -1 #number of package to be loaded - self.unchanged = False #determines if any changes was made since last call - - self.db = self.core.db - - def change(func): - def new(*args): - args[0].unchanged = False - args[0].filecount = -1 - args[0].queuecount = -1 - args[0].jobCache = {} - return func(*args) - return new - - #-------------------------------------------------------------------------- - def save(self): - """saves all data to backend""" - self.db.commit() - - #-------------------------------------------------------------------------- - def syncSave(self): - """saves all data to backend and waits until all data are written""" - pyfiles = self.cache.values() - for pyfile in pyfiles: - pyfile.sync() - - pypacks = self.packageCache.values() - for pypack in pypacks: - pypack.sync() - - self.db.syncSave() - - @lock - def getCompleteData(self, queue=1): - """gets a complete data representation""" - - data = self.db.getAllLinks(queue) - packs = self.db.getAllPackages(queue) - - data.update([(x.id, x.toDbDict()[x.id]) for x in self.cache.values()]) - - for x in self.packageCache.itervalues(): - if x.queue != queue or x.id not in packs: continue - packs[x.id].update(x.toDict()[x.id]) - - for key, value in data.iteritems(): - if value["package"] in packs: - packs[value["package"]]["links"][key] = value - - return packs - - @lock - def getInfoData(self, queue=1): - """gets a data representation without links""" - - packs = self.db.getAllPackages(queue) - for x in self.packageCache.itervalues(): - if x.queue != queue or x.id not in packs: continue - packs[x.id].update(x.toDict()[x.id]) - - return packs - - @lock - @change - def addLinks(self, urls, package): - """adds links""" - - self.core.addonManager.dispatchEvent("links-added", urls, package) - - data = self.core.pluginManager.parseUrls(urls) - - self.db.addLinks(data, package) - self.core.threadManager.createInfoThread(data, package) - - #@TODO change from reloadAll event to package update event - self.core.pullManager.addEvent(ReloadAllEvent("collector")) - - #-------------------------------------------------------------------------- - @lock - @change - def addPackage(self, name, folder, queue=0): - """adds a package, default to link collector""" - lastID = self.db.addPackage(name, folder, queue) - p = self.db.getPackage(lastID) - e = InsertEvent("pack", lastID, p.order, "collector" if not queue else "queue") - self.core.pullManager.addEvent(e) - return lastID - - #-------------------------------------------------------------------------- - @lock - @change - def deletePackage(self, id): - """delete package and all contained links""" - - p = self.getPackage(id) - if not p: - if id in self.packageCache: del self.packageCache[id] - return - - oldorder = p.order - queue = p.queue - - e = RemoveEvent("pack", id, "collector" if not p.queue else "queue") - - pyfiles = self.cache.values() - - for pyfile in pyfiles: - if pyfile.packageid == id: - pyfile.abortDownload() - pyfile.release() - - self.db.deletePackage(p) - self.core.pullManager.addEvent(e) - self.core.addonManager.dispatchEvent("package-deleted", id) - - if id in self.packageCache: - del self.packageCache[id] - - packs = self.packageCache.values() - for pack in packs: - if pack.queue == queue and pack.order > oldorder: - pack.order -= 1 - pack.notifyChange() - - #-------------------------------------------------------------------------- - @lock - @change - def deleteLink(self, id): - """deletes links""" - - f = self.getFile(id) - if not f: - return None - - pid = f.packageid - e = RemoveEvent("file", id, "collector" if not f.package().queue else "queue") - - oldorder = f.order - - if id in self.core.threadManager.processingIds(): - self.cache[id].abortDownload() - - if id in self.cache: - del self.cache[id] - - self.db.deleteLink(f) - - self.core.pullManager.addEvent(e) - - p = self.getPackage(pid) - if not len(p.getChildren()): - p.delete() - - pyfiles = self.cache.values() - for pyfile in pyfiles: - if pyfile.packageid == pid and pyfile.order > oldorder: - pyfile.order -= 1 - pyfile.notifyChange() - - #-------------------------------------------------------------------------- - def releaseLink(self, id): - """removes pyfile from cache""" - if id in self.cache: - del self.cache[id] - - #-------------------------------------------------------------------------- - def releasePackage(self, id): - """removes package from cache""" - if id in self.packageCache: - del self.packageCache[id] - - #-------------------------------------------------------------------------- - def updateLink(self, pyfile): - """updates link""" - self.db.updateLink(pyfile) - - e = UpdateEvent("file", pyfile.id, "collector" if not pyfile.package().queue else "queue") - self.core.pullManager.addEvent(e) - - #-------------------------------------------------------------------------- - def updatePackage(self, pypack): - """updates a package""" - self.db.updatePackage(pypack) - - e = UpdateEvent("pack", pypack.id, "collector" if not pypack.queue else "queue") - self.core.pullManager.addEvent(e) - - #-------------------------------------------------------------------------- - def getPackage(self, id): - """return package instance""" - - if id in self.packageCache: - return self.packageCache[id] - else: - return self.db.getPackage(id) - - #-------------------------------------------------------------------------- - def getPackageData(self, id): - """returns dict with package information""" - pack = self.getPackage(id) - - if not pack: - return None - - pack = pack.toDict()[id] - - data = self.db.getPackageData(id) - - tmplist = [] - - cache = self.cache.values() - for x in cache: - if int(x.toDbDict()[x.id]["package"]) == int(id): - tmplist.append((x.id, x.toDbDict()[x.id])) - data.update(tmplist) - - pack["links"] = data - - return pack - - #-------------------------------------------------------------------------- - def getFileData(self, id): - """returns dict with file information""" - if id in self.cache: - return self.cache[id].toDbDict() - - return self.db.getLinkData(id) - - #-------------------------------------------------------------------------- - def getFile(self, id): - """returns pyfile instance""" - if id in self.cache: - return self.cache[id] - else: - return self.db.getFile(id) - - #-------------------------------------------------------------------------- - @lock - def getJob(self, occ): - """get suitable job""" - - #@TODO clean mess - #@TODO improve selection of valid jobs - - if occ in self.jobCache: - if self.jobCache[occ]: - id = self.jobCache[occ].pop() - if id == "empty": - pyfile = None - self.jobCache[occ].append("empty") - else: - pyfile = self.getFile(id) - else: - jobs = self.db.getJob(occ) - jobs.reverse() - if not jobs: - self.jobCache[occ].append("empty") - pyfile = None - else: - self.jobCache[occ].extend(jobs) - pyfile = self.getFile(self.jobCache[occ].pop()) - - else: - self.jobCache = {} #better not caching to much - jobs = self.db.getJob(occ) - jobs.reverse() - self.jobCache[occ] = jobs - - if not jobs: - self.jobCache[occ].append("empty") - pyfile = None - else: - pyfile = self.getFile(self.jobCache[occ].pop()) - - #@TODO: maybe the new job has to be approved... - - - #pyfile = self.getFile(self.jobCache[occ].pop()) - return pyfile - - @lock - def getDecryptJob(self): - """return job for decrypting""" - if "decrypt" in self.jobCache: - return None - - plugins = self.core.pluginManager.crypterPlugins.keys() + self.core.pluginManager.containerPlugins.keys() - plugins = str(tuple(plugins)) - - jobs = self.db.getPluginJob(plugins) - if jobs: - return self.getFile(jobs[0]) - else: - self.jobCache["decrypt"] = "empty" - return None - - def getFileCount(self): - """returns number of files""" - - if self.filecount == -1: - self.filecount = self.db.filecount(1) - - return self.filecount - - def getQueueCount(self, force=False): - """number of files that have to be processed""" - if self.queuecount == -1 or force: - self.queuecount = self.db.queuecount(1) - - return self.queuecount - - def checkAllLinksFinished(self): - """checks if all files are finished and dispatch event""" - - if not self.getQueueCount(True): - self.core.addonManager.dispatchEvent("all_downloads-finished") - self.core.log.debug("All downloads finished") - return True - - return False - - def checkAllLinksProcessed(self, fid): - """checks if all files was processed and pyload would idle now, needs fid which will be ignored when counting""" - - # reset count so statistic will update (this is called when dl was processed) - self.resetCount() - - if not self.db.processcount(1, fid): - self.core.addonManager.dispatchEvent("all_downloads-processed") - self.core.log.debug("All downloads processed") - return True - - return False - - def resetCount(self): - self.queuecount = -1 - - @lock - @change - def restartPackage(self, id): - """restart package""" - pyfiles = self.cache.values() - for pyfile in pyfiles: - if pyfile.packageid == id: - self.restartFile(pyfile.id) - - self.db.restartPackage(id) - - if id in self.packageCache: - self.packageCache[id].setFinished = False - - e = UpdateEvent("pack", id, "collector" if not self.getPackage(id).queue else "queue") - self.core.pullManager.addEvent(e) - - @lock - @change - def restartFile(self, id): - """ restart file""" - if id in self.cache: - self.cache[id].status = 3 - self.cache[id].name = self.cache[id].url - self.cache[id].error = "" - self.cache[id].abortDownload() - - - self.db.restartFile(id) - - e = UpdateEvent("file", id, "collector" if not self.getFile(id).package().queue else "queue") - self.core.pullManager.addEvent(e) - - @lock - @change - def setPackageLocation(self, id, queue): - """push package to queue""" - - p = self.db.getPackage(id) - oldorder = p.order - - e = RemoveEvent("pack", id, "collector" if not p.queue else "queue") - self.core.pullManager.addEvent(e) - - self.db.clearPackageOrder(p) - - p = self.db.getPackage(id) - - p.queue = queue - self.db.updatePackage(p) - - self.db.reorderPackage(p, -1, True) - - packs = self.packageCache.values() - for pack in packs: - if pack.queue != queue and pack.order > oldorder: - pack.order -= 1 - pack.notifyChange() - - self.db.commit() - self.releasePackage(id) - p = self.getPackage(id) - - e = InsertEvent("pack", id, p.order, "collector" if not p.queue else "queue") - self.core.pullManager.addEvent(e) - - @lock - @change - def reorderPackage(self, id, position): - p = self.getPackage(id) - - e = RemoveEvent("pack", id, "collector" if not p.queue else "queue") - self.core.pullManager.addEvent(e) - self.db.reorderPackage(p, position) - - packs = self.packageCache.values() - for pack in packs: - if pack.queue != p.queue or pack.order < 0 or pack == p: continue - if p.order > position: - if pack.order >= position and pack.order < p.order: - pack.order += 1 - pack.notifyChange() - elif p.order < position: - if pack.order <= position and pack.order > p.order: - pack.order -= 1 - pack.notifyChange() - - p.order = position - self.db.commit() - - e = InsertEvent("pack", id, position, "collector" if not p.queue else "queue") - self.core.pullManager.addEvent(e) - - @lock - @change - def reorderFile(self, id, position): - f = self.getFileData(id) - f = f[id] - - e = RemoveEvent("file", id, "collector" if not self.getPackage(f["package"]).queue else "queue") - self.core.pullManager.addEvent(e) - - self.db.reorderLink(f, position) - - pyfiles = self.cache.values() - for pyfile in pyfiles: - if pyfile.packageid != f["package"] or pyfile.order < 0: continue - if f["order"] > position: - if pyfile.order >= position and pyfile.order < f["order"]: - pyfile.order += 1 - pyfile.notifyChange() - elif f["order"] < position: - if pyfile.order <= position and pyfile.order > f["order"]: - pyfile.order -= 1 - pyfile.notifyChange() - - if id in self.cache: - self.cache[id].order = position - - self.db.commit() - - e = InsertEvent("file", id, position, "collector" if not self.getPackage(f["package"]).queue else "queue") - self.core.pullManager.addEvent(e) - - @change - def updateFileInfo(self, data, pid): - """ updates file info (name, size, status, url)""" - ids = self.db.updateLinkInfo(data) - e = UpdateEvent("pack", pid, "collector" if not self.getPackage(pid).queue else "queue") - self.core.pullManager.addEvent(e) - - def checkPackageFinished(self, pyfile): - """ checks if package is finished and calls AddonManager """ - - ids = self.db.getUnfinished(pyfile.packageid) - if not ids or (pyfile.id in ids and len(ids) == 1): - if not pyfile.package().setFinished: - self.core.log.info(_("Package finished: %s") % pyfile.package().name) - self.core.addonManager.packageFinished(pyfile.package()) - pyfile.package().setFinished = True - - - def reCheckPackage(self, pid): - """ recheck links in package """ - data = self.db.getPackageData(pid) - - urls = [] - - for pyfile in data.itervalues(): - if pyfile["status"] not in (0, 12, 13): - urls.append((pyfile["url"], pyfile["plugin"])) - - self.core.threadManager.createInfoThread(urls, pid) - - @lock - @change - def deleteFinishedLinks(self): - """ deletes finished links and packages, return deleted packages """ - - old_packs = self.getInfoData(0) - old_packs.update(self.getInfoData(1)) - - self.db.deleteFinished() - - new_packs = self.db.getAllPackages(0) - new_packs.update(self.db.getAllPackages(1)) - #get new packages only from db - - deleted = [] - for id in old_packs.iterkeys(): - if id not in new_packs: - deleted.append(id) - self.deletePackage(int(id)) - - return deleted - - @lock - @change - def restartFailed(self): - """ restart all failed links """ - self.db.restartFailed() - -class FileMethods(object): - @style.queue - def filecount(self, queue): - """returns number of files in queue""" - self.c.execute("SELECT COUNT(*) FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=?", (queue,)) - return self.c.fetchone()[0] - - @style.queue - def queuecount(self, queue): - """ number of files in queue not finished yet""" - self.c.execute("SELECT COUNT(*) FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=? AND l.status NOT IN (0, 4)", (queue,)) - return self.c.fetchone()[0] - - @style.queue - def processcount(self, queue, fid): - """ number of files which have to be proccessed """ - self.c.execute("SELECT COUNT(*) FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=? AND l.status IN (2, 3, 5, 7, 12) AND l.id != ?", (queue, str(fid))) - return self.c.fetchone()[0] - - @style.inner - def _nextPackageOrder(self, queue=0): - self.c.execute('SELECT MAX(packageorder) FROM packages WHERE queue=?', (queue,)) - max = self.c.fetchone()[0] - if max is not None: - return max + 1 - else: - return 0 - - @style.inner - def _nextFileOrder(self, package): - self.c.execute('SELECT MAX(linkorder) FROM links WHERE package=?', (package,)) - max = self.c.fetchone()[0] - if max is not None: - return max + 1 - else: - return 0 - - @style.queue - def addLink(self, url, name, plugin, package): - order = self._nextFileOrder(package) - self.c.execute('INSERT INTO links(url, name, plugin, package, linkorder) VALUES(?,?,?,?,?)', (url, name, (plugintype, pluginname), package, order)) - return self.c.lastrowid - - @style.queue - def addLinks(self, links, package): - """ links is a list of tupels (url, plugin)""" - order = self._nextFileOrder(package) - orders = [order + x for x in range(len(links))] - links = [(x[0], x[0], (x[1], x[2]), package, o) for x, o in zip(links, orders)] - self.c.executemany('INSERT INTO links(url, name, plugin, package, linkorder) VALUES(?,?,?,?,?)', links) - - @style.queue - def addPackage(self, name, folder, queue): - order = self._nextPackageOrder(queue) - self.c.execute('INSERT INTO packages(name, folder, queue, packageorder) VALUES(?,?,?,?)', (name, folder, queue, order)) - return self.c.lastrowid - - @style.queue - def deletePackage(self, p): - - self.c.execute('DELETE FROM links WHERE package=?', (str(p.id),)) - self.c.execute('DELETE FROM packages WHERE id=?', (str(p.id),)) - self.c.execute('UPDATE packages SET packageorder=packageorder-1 WHERE packageorder > ? AND queue=?', (p.order, p.queue)) - - @style.queue - def deleteLink(self, f): - - self.c.execute('DELETE FROM links WHERE id=?', (str(f.id),)) - self.c.execute('UPDATE links SET linkorder=linkorder-1 WHERE linkorder > ? AND package=?', (f.order, str(f.packageid))) - - - @style.queue - def getAllLinks(self, q): - """return information about all links in queue q - - q0 queue - q1 collector - - format: - - { - id: {'name': name, ... 'package': id }, ... - } - - """ - self.c.execute('SELECT l.id, l.url, l.name, l.size, l.status, l.error, l.plugin, l.package, l.linkorder FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=? ORDER BY l.linkorder', (q,)) - data = {} - for r in self.c: - data[r[0]] = { - 'id': r[0], - 'url': r[1], - 'name': r[2], - 'size': r[3], - 'format_size': formatSize(r[3]), - 'status': r[4], - 'statusmsg': self.manager.statusMsg[r[4]], - 'error': r[5], - 'plugin': r[6], - 'package': r[7], - 'order': r[8], - } - - return data - - @style.queue - def getAllPackages(self, q): - """return information about packages in queue q - (only useful in get all data) - - q0 queue - q1 collector - - format: - - { - id: {'name': name ... 'links': {}}, ... - } - """ - self.c.execute('SELECT p.id, p.name, p.folder, p.site, p.password, p.queue, p.packageorder, s.sizetotal, s.sizedone, s.linksdone, s.linkstotal \ - FROM packages p JOIN pstats s ON p.id = s.id \ - WHERE p.queue=? ORDER BY p.packageorder', str(q)) - - data = {} - for r in self.c: - data[r[0]] = { - 'id': r[0], - 'name': r[1], - 'folder': r[2], - 'site': r[3], - 'password': r[4], - 'queue': r[5], - 'order': r[6], - 'sizetotal': int(r[7]), - 'sizedone': r[8] if r[8] else 0, #these can be None - 'linksdone': r[9] if r[9] else 0, - 'linkstotal': r[10], - 'links': {} - } - - return data - - @style.queue - def getLinkData(self, id): - """get link information as dict""" - self.c.execute('SELECT id, url, name, size, status, error, plugin, package, linkorder FROM links WHERE id=?', (str(id),)) - data = {} - r = self.c.fetchone() - if not r: - return None - data[r[0]] = { - 'id': r[0], - 'url': r[1], - 'name': r[2], - 'size': r[3], - 'format_size': formatSize(r[3]), - 'status': r[4], - 'statusmsg': self.manager.statusMsg[r[4]], - 'error': r[5], - 'plugin': r[6], - 'package': r[7], - 'order': r[8], - } - - return data - - @style.queue - def getPackageData(self, id): - """get data about links for a package""" - self.c.execute('SELECT id, url, name, size, status, error, plugin, package, linkorder FROM links WHERE package=? ORDER BY linkorder', (str(id),)) - - data = {} - for r in self.c: - data[r[0]] = { - 'id': r[0], - 'url': r[1], - 'name': r[2], - 'size': r[3], - 'format_size': formatSize(r[3]), - 'status': r[4], - 'statusmsg': self.manager.statusMsg[r[4]], - 'error': r[5], - 'plugin': r[6], - 'package': r[7], - 'order': r[8], - } - - return data - - - @style.async - def updateLink(self, f): - self.c.execute('UPDATE links SET url=?, name=?, size=?, status=?, error=?, package=? WHERE id=?', (f.url, f.name, f.size, f.status, f.error, str(f.packageid), str(f.id))) - - @style.queue - def updatePackage(self, p): - self.c.execute('UPDATE packages SET name=?, folder=?, site=?, password=?, queue=? WHERE id=?', (p.name, p.folder, p.site, p.password, p.queue, str(p.id))) - - @style.queue - def updateLinkInfo(self, data): - """ data is list of tupels (name, size, status, url) """ - self.c.executemany('UPDATE links SET name=?, size=?, status=? WHERE url=? AND status IN (1, 2, 3, 14)', data) - ids = [] - self.c.execute('SELECT id FROM links WHERE url IN (\'%s\')' % "','".join([x[3] for x in data])) - for r in self.c: - ids.append(int(r[0])) - return ids - - @style.queue - def reorderPackage(self, p, position, noMove=False): - if position == -1: - position = self._nextPackageOrder(p.queue) - if not noMove: - if p.order > position: - self.c.execute('UPDATE packages SET packageorder=packageorder+1 WHERE packageorder >= ? AND packageorder < ? AND queue=? AND packageorder >= 0', (position, p.order, p.queue)) - elif p.order < position: - self.c.execute('UPDATE packages SET packageorder=packageorder-1 WHERE packageorder <= ? AND packageorder > ? AND queue=? AND packageorder >= 0', (position, p.order, p.queue)) - - self.c.execute('UPDATE packages SET packageorder=? WHERE id=?', (position, str(p.id))) - - @style.queue - def reorderLink(self, f, position): - """ reorder link with f as dict for pyfile """ - if f["order"] > position: - self.c.execute('UPDATE links SET linkorder=linkorder+1 WHERE linkorder >= ? AND linkorder < ? AND package=?', (position, f["order"], f["package"])) - elif f["order"] < position: - self.c.execute('UPDATE links SET linkorder=linkorder-1 WHERE linkorder <= ? AND linkorder > ? AND package=?', (position, f["order"], f["package"])) - - self.c.execute('UPDATE links SET linkorder=? WHERE id=?', (position, f["id"])) - - @style.queue - def clearPackageOrder(self, p): - self.c.execute('UPDATE packages SET packageorder=? WHERE id=?', (-1, str(p.id))) - self.c.execute('UPDATE packages SET packageorder=packageorder-1 WHERE packageorder > ? AND queue=? AND id != ?', (p.order, p.queue, str(p.id))) - - @style.async - def restartFile(self, id): - self.c.execute('UPDATE links SET status=3, error="" WHERE id=?', (str(id),)) - - @style.async - def restartPackage(self, id): - self.c.execute('UPDATE links SET status=3 WHERE package=?', (str(id),)) - - @style.queue - def getPackage(self, id): - """return package instance from id""" - self.c.execute("SELECT name, folder, site, password, queue, packageorder FROM packages WHERE id=?", (str(id),)) - r = self.c.fetchone() - if not r: return None - return PyPackage(self.manager, id, * r) - - #-------------------------------------------------------------------------- - @style.queue - def getFile(self, id): - """return link instance from id""" - self.c.execute("SELECT url, name, size, status, error, plugin, package, linkorder FROM links WHERE id=?", (str(id),)) - r = self.c.fetchone() - if not r: return None - return PyFile(self.manager, id, * r) - - - @style.queue - def getJob(self, occ): - """return pyfile ids, which are suitable for download and dont use a occupied plugin""" - - #@TODO improve this hardcoded method - pre = "('DLC', 'LinkList', 'SerienjunkiesOrg', 'CCF', 'RSDF')" #plugins which are processed in collector - - cmd = "(" - for i, item in enumerate(occ): - if i: cmd += ", " - cmd += "'%s'" % item - - cmd += ")" - - cmd = "SELECT l.id FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE ((p.queue=1 AND l.plugin NOT IN %s) OR l.plugin IN %s) AND l.status IN (2, 3, 14) ORDER BY p.packageorder ASC, l.linkorder ASC LIMIT 5" % (cmd, pre) - - self.c.execute(cmd) # very bad! - - return [x[0] for x in self.c] - - @style.queue - def getPluginJob(self, plugins): - """returns pyfile ids with suited plugins""" - cmd = "SELECT l.id FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE l.plugin IN %s AND l.status IN (2, 3, 14) ORDER BY p.packageorder ASC, l.linkorder ASC LIMIT 5" % plugins - - self.c.execute(cmd) # very bad! - - return [x[0] for x in self.c] - - @style.queue - def getUnfinished(self, pid): - """return list of max length 3 ids with pyfiles in package not finished or processed""" - - self.c.execute("SELECT id FROM links WHERE package=? AND status NOT IN (0, 4, 13) LIMIT 3", (str(pid),)) - return [r[0] for r in self.c] - - @style.queue - def deleteFinished(self): - self.c.execute("DELETE FROM links WHERE status IN (0, 4)") - self.c.execute("DELETE FROM packages WHERE NOT EXISTS(SELECT 1 FROM links WHERE packages.id=links.package)") - - @style.queue - def restartFailed(self): - self.c.execute("UPDATE links SET status=3, error='' WHERE status IN (6, 8, 9)") - - @style.queue - def findDuplicates(self, id, folder, filename): - """ checks if filename exists with different id and same package """ - self.c.execute("SELECT l.plugin FROM links as l INNER JOIN packages as p ON l.package=p.id AND p.folder=? WHERE l.id!=? AND l.status=0 AND l.name=?", (folder, id, filename)) - return self.c.fetchone() - - @style.queue - def purgeLinks(self): - self.c.execute("DELETE FROM links;") - self.c.execute("DELETE FROM packages;") - -DatabaseBackend.registerSub(FileMethods) diff --git a/pyload/database/Storage.py b/pyload/database/Storage.py deleted file mode 100644 index 75e166d39..000000000 --- a/pyload/database/Storage.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: mkaay - -from pyload.database import style -from pyload.database import DatabaseBackend - -class StorageMethods(object): - @style.queue - def setStorage(db, identifier, key, value): - db.c.execute("SELECT id FROM storage WHERE identifier=? AND key=?", (identifier, key)) - if db.c.fetchone() is not None: - db.c.execute("UPDATE storage SET value=? WHERE identifier=? AND key=?", (value, identifier, key)) - else: - db.c.execute("INSERT INTO storage (identifier, key, value) VALUES (?, ?, ?)", (identifier, key, value)) - - @style.queue - def getStorage(db, identifier, key=None): - if key is not None: - db.c.execute("SELECT value FROM storage WHERE identifier=? AND key=?", (identifier, key)) - row = db.c.fetchone() - if row is not None: - return row[0] - else: - db.c.execute("SELECT key, value FROM storage WHERE identifier=?", (identifier,)) - d = {} - for row in db.c: - d[row[0]] = row[1] - return d - - @style.queue - def delStorage(db, identifier, key): - db.c.execute("DELETE FROM storage WHERE identifier=? AND key=?", (identifier, key)) - -DatabaseBackend.registerSub(StorageMethods) diff --git a/pyload/database/User.py b/pyload/database/User.py deleted file mode 100644 index 67cb62ab9..000000000 --- a/pyload/database/User.py +++ /dev/null @@ -1,93 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: mkaay - -from hashlib import sha1 -import random - -from pyload.database.DatabaseBackend import DatabaseBackend -from pyload.database.DatabaseBackend import style - -class UserMethods(object): - @style.queue - def checkAuth(db, user, password): - c = db.c - c.execute('SELECT id, name, password, role, permission, template, email FROM "users" WHERE name=?', (user,)) - r = c.fetchone() - if not r: - return {} - - salt = r[2][:5] - pw = r[2][5:] - h = sha1(salt + password) - if h.hexdigest() == pw: - return {"id": r[0], "name": r[1], "role": r[3], - "permission": r[4], "template": r[5], "email": r[6]} - else: - return {} - - @style.queue - def addUser(db, user, password): - salt = reduce(lambda x, y: x + y, [str(random.randint(0, 9)) for i in range(0, 5)]) - h = sha1(salt + password) - password = salt + h.hexdigest() - - c = db.c - c.execute('SELECT name FROM users WHERE name=?', (user,)) - if c.fetchone() is not None: - c.execute('UPDATE users SET password=? WHERE name=?', (password, user)) - else: - c.execute('INSERT INTO users (name, password) VALUES (?, ?)', (user, password)) - - - @style.queue - def changePassword(db, user, oldpw, newpw): - db.c.execute('SELECT id, name, password FROM users WHERE name=?', (user,)) - r = db.c.fetchone() - if not r: - return False - - salt = r[2][:5] - pw = r[2][5:] - h = sha1(salt + oldpw) - if h.hexdigest() == pw: - salt = reduce(lambda x, y: x + y, [str(random.randint(0, 9)) for i in range(0, 5)]) - h = sha1(salt + newpw) - password = salt + h.hexdigest() - - db.c.execute("UPDATE users SET password=? WHERE name=?", (password, user)) - return True - - return False - - - @style.async - def setPermission(db, user, perms): - db.c.execute("UPDATE users SET permission=? WHERE name=?", (perms, user)) - - @style.async - def setRole(db, user, role): - db.c.execute("UPDATE users SET role=? WHERE name=?", (role, user)) - - - @style.queue - def listUsers(db): - db.c.execute('SELECT name FROM users') - users = [] - for row in db.c: - users.append(row[0]) - return users - - @style.queue - def getAllUserData(db): - db.c.execute("SELECT name, permission, role, template, email FROM users") - user = {} - for r in db.c: - user[r[0]] = {"permission": r[1], "role": r[2], "template": r[3], "email": r[4]} - - return user - - @style.queue - def removeUser(db, user): - db.c.execute('DELETE FROM users WHERE name=?', (user,)) - -DatabaseBackend.registerSub(UserMethods) diff --git a/pyload/database/__init__.py b/pyload/database/__init__.py deleted file mode 100644 index 64f049be1..000000000 --- a/pyload/database/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.database.DatabaseBackend import DatabaseBackend, style - -from pyload.database.File import FileHandler -from pyload.database.User import UserMethods -from pyload.database.Storage import StorageMethods diff --git a/pyload/datatype/File.py b/pyload/datatype/File.py deleted file mode 100644 index 1df0a8590..000000000 --- a/pyload/datatype/File.py +++ /dev/null @@ -1,270 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN, mkaay - -from pyload.manager.Event import UpdateEvent -from pyload.utils import formatSize, lock - -from time import sleep, time - -from threading import RLock - -statusMap = { - "finished": 0, - "offline": 1, - "online": 2, - "queued": 3, - "skipped": 4, - "waiting": 5, - "temp. offline": 6, - "starting": 7, - "failed": 8, - "aborted": 9, - "decrypting": 10, - "custom": 11, - "downloading": 12, - "processing": 13, - "unknown": 14, -} - - -def setSize(self, value): - self._size = int(value) - -class PyFile(object): - """ - Represents a file object at runtime - """ - __slots__ = ("m", "id", "url", "name", "size", "_size", "status", "plugin", - "packageid", "error", "order", "lock", "plugin", "waitUntil", - "active", "abort", "statusname", "reconnected", "progress", - "maxprogress", "pluginmodule", "pluginclass") - - def __init__(self, manager, id, url, name, size, status, error, plugin, package, order): - self.m = manager - - self.id = int(id) - self.url = url - self.name = name - self.size = size - self.status = status - self.plugin = self.plugintype, self.pluginname = plugin - self.packageid = package #should not be used, use package() instead - self.error = error - self.order = order - # database information ends here - - self.lock = RLock() - - self.plugin = None - #self.download = None - - self.waitUntil = 0 # time() + time to wait - - # status attributes - self.active = False #obsolete? - self.abort = False - self.reconnected = False - - self.statusname = None - - self.progress = 0 - self.maxprogress = 100 - - self.m.cache[int(id)] = self - - - # will convert all sizes to ints - size = property(lambda self: self._size, setSize) - - def __repr__(self): - return "PyFile %s: %s@%s" % (self.id, self.name, self.pluginname) - - @lock - def initPlugin(self): - """ inits plugin instance """ - if not self.plugin: - self.pluginmodule = self.m.core.pluginManager.getPlugin(self.plugintype, self.pluginname) - self.pluginclass = getattr(self.pluginmodule, self.m.core.pluginManager.getPluginName(self.plugintype, self.pluginname)) - self.plugin = self.pluginclass(self) - - @lock - def hasPlugin(self): - """Thread safe way to determine this file has initialized plugin attribute - - :return: - """ - return hasattr(self, "plugin") and self.plugin - - def package(self): - """ return package instance""" - return self.m.getPackage(self.packageid) - - def setStatus(self, status): - self.status = statusMap[status] - self.sync() #@TODO needed aslong no better job approving exists - - def setCustomStatus(self, msg, status="processing"): - self.statusname = msg - self.setStatus(status) - - def getStatusName(self): - if self.status not in (13, 14) or not self.statusname: - return self.m.statusMsg[self.status] - else: - return self.statusname - - def hasStatus(self, status): - return statusMap[status] == self.status - - def sync(self): - """sync PyFile instance with database""" - self.m.updateLink(self) - - @lock - def release(self): - """sync and remove from cache""" - # file has valid package - if self.packageid > 0: - self.sync() - - if hasattr(self, "plugin") and self.plugin: - self.plugin.clean() - del self.plugin - - self.m.releaseLink(self.id) - - def delete(self): - """delete pyfile from database""" - self.m.deleteLink(self.id) - - def toDict(self): - """return dict with all information for interface""" - return self.toDbDict() - - def toDbDict(self): - """return data as dict for databse - - format: - - { - id: {'url': url, 'name': name ... } - } - - """ - return { - self.id: { - 'id': self.id, - 'url': self.url, - 'name': self.name, - 'plugin': self.pluginname, - 'size': self.getSize(), - 'format_size': self.formatSize(), - 'status': self.status, - 'statusmsg': self.getStatusName(), - 'package': self.packageid, - 'error': self.error, - 'order': self.order - } - } - - def abortDownload(self): - """abort pyfile if possible""" - while self.id in self.m.core.threadManager.processingIds(): - self.abort = True - if self.plugin and self.plugin.req: - self.plugin.req.abortDownloads() - sleep(0.1) - - self.abort = False - if self.hasPlugin() and self.plugin.req: - self.plugin.req.abortDownloads() - - self.release() - - def finishIfDone(self): - """set status to finish and release file if every thread is finished with it""" - - if self.id in self.m.core.threadManager.processingIds(): - return False - - self.setStatus("finished") - self.release() - self.m.checkAllLinksFinished() - return True - - def checkIfProcessed(self): - self.m.checkAllLinksProcessed(self.id) - - def formatWait(self): - """ formats and return wait time in humanreadable format """ - seconds = self.waitUntil - time() - - if seconds < 0: return "00:00:00" - - hours, seconds = divmod(seconds, 3600) - minutes, seconds = divmod(seconds, 60) - return "%.2i:%.2i:%.2i" % (hours, minutes, seconds) - - def formatSize(self): - """ formats size to readable format """ - return formatSize(self.getSize()) - - def formatETA(self): - """ formats eta to readable format """ - seconds = self.getETA() - - if seconds < 0: return "00:00:00" - - hours, seconds = divmod(seconds, 3600) - minutes, seconds = divmod(seconds, 60) - return "%.2i:%.2i:%.2i" % (hours, minutes, seconds) - - def getSpeed(self): - """ calculates speed """ - try: - return self.plugin.req.speed - except Exception: - return 0 - - def getETA(self): - """ gets established time of arrival""" - try: - return self.getBytesLeft() / self.getSpeed() - except Exception: - return 0 - - def getBytesLeft(self): - """ gets bytes left """ - try: - return self.getSize() - self.plugin.req.arrived - except Exception: - return 0 - - def getPercent(self): - """ get % of download """ - if self.status == 12: - try: - return self.plugin.req.percent - except Exception: - return 0 - else: - return self.progress - - def getSize(self): - """ get size of download """ - try: - if self.plugin.req.size: - return self.plugin.req.size - else: - return self.size - except Exception: - return self.size - - def notifyChange(self): - e = UpdateEvent("file", self.id, "collector" if not self.package().queue else "queue") - self.m.core.pullManager.addEvent(e) - - def setProgress(self, value): - if not value == self.progress: - self.progress = value - self.notifyChange() diff --git a/pyload/datatype/Package.py b/pyload/datatype/Package.py deleted file mode 100644 index bf3edffea..000000000 --- a/pyload/datatype/Package.py +++ /dev/null @@ -1,64 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN, mkaay - -from pyload.manager.Event import UpdateEvent -from pyload.utils import safe_filename - -class PyPackage(object): - """ - Represents a package object at runtime - """ - def __init__(self, manager, id, name, folder, site, password, queue, order): - self.m = manager - self.m.packageCache[int(id)] = self - - self.id = int(id) - self.name = name - self._folder = folder - self.site = site - self.password = password - self.queue = queue - self.order = order - self.setFinished = False - - @property - def folder(self): - return safe_filename(self._folder) - - def toDict(self): - """ Returns a dictionary representation of the data. - - :return: dict: {id: { attr: value }} - """ - return { - self.id: { - 'id': self.id, - 'name': self.name, - 'folder': self.folder, - 'site': self.site, - 'password': self.password, - 'queue': self.queue, - 'order': self.order, - 'links': {} - } - } - - def getChildren(self): - """get information about contained links""" - return self.m.getPackageData(self.id)["links"] - - def sync(self): - """sync with db""" - self.m.updatePackage(self) - - def release(self): - """sync and delete from cache""" - self.sync() - self.m.releasePackage(self.id) - - def delete(self): - self.m.deletePackage(self.id) - - def notifyChange(self): - e = UpdateEvent("pack", self.id, "collector" if not self.queue else "queue") - self.m.core.pullManager.addEvent(e) diff --git a/pyload/datatype/__init__.py b/pyload/datatype/__init__.py deleted file mode 100644 index 40a96afc6..000000000 --- a/pyload/datatype/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/pyload/manager/Account.py b/pyload/manager/Account.py deleted file mode 100644 index 3acf70311..000000000 --- a/pyload/manager/Account.py +++ /dev/null @@ -1,191 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement - -from os.path import exists -from shutil import copy - -from threading import Lock - -from pyload.manager.Event import AccountUpdateEvent -from pyload.utils import chmod, lock - -ACC_VERSION = 1 - - -class AccountManager(object): - """manages all accounts""" - - #---------------------------------------------------------------------- - def __init__(self, core): - """Constructor""" - - self.core = core - self.lock = Lock() - - self.initPlugins() - self.saveAccounts() # save to add categories to conf - - - def initPlugins(self): - self.accounts = {} # key = ( plugin ) - self.plugins = {} - - self.initAccountPlugins() - self.loadAccounts() - - - def getAccountPlugin(self, plugin): - """get account instance for plugin or None if anonymous""" - try: - if plugin in self.accounts: - if plugin not in self.plugins: - klass = self.core.pluginManager.loadClass("accounts", plugin) - if klass: - self.plugins[plugin] = klass(self, self.accounts[plugin]) - else: #@NOTE: The account class no longer exists (blacklisted plugin). Skipping the account to avoid crash - raise - - return self.plugins[plugin] - else: - raise - except Exception: - return None - - - def getAccountPlugins(self): - """ get all account instances""" - - plugins = [] - for plugin in self.accounts.keys(): - plugins.append(self.getAccountPlugin(plugin)) - - return plugins - - - #---------------------------------------------------------------------- - def loadAccounts(self): - """loads all accounts available""" - - try: - with open("accounts.conf", "a+") as f: - content = f.readlines() - version = content[0].split(":")[1].strip() if content else "" - - if not version or int(version) < ACC_VERSION: - copy("accounts.conf", "accounts.backup") - f.seek(0) - f.write("version: " + str(ACC_VERSION)) - - self.core.log.warning(_("Account settings deleted, due to new config format")) - return - - except IOError, e: - self.core.log.error(str(e)) - return - - plugin = "" - name = "" - - for line in content[1:]: - line = line.strip() - - if not line: continue - if line.startswith("#"): continue - if line.startswith("version"): continue - - if line.endswith(":") and line.count(":") == 1: - plugin = line[:-1] - self.accounts[plugin] = {} - - elif line.startswith("@"): - try: - option = line[1:].split() - self.accounts[plugin][name]['options'][option[0]] = [] if len(option) < 2 else ([option[1]] if len(option) < 3 else option[1:]) - except Exception: - pass - - elif ":" in line: - name, sep, pw = line.partition(":") - self.accounts[plugin][name] = {"password": pw, "options": {}, "valid": True} - - - #---------------------------------------------------------------------- - def saveAccounts(self): - """save all account information""" - - try: - with open("accounts.conf", "wb") as f: - f.write("version: " + str(ACC_VERSION) + "\n") - - for plugin, accounts in self.accounts.iteritems(): - f.write("\n") - f.write(plugin + ":\n") - - for name,data in accounts.iteritems(): - f.write("\n\t%s:%s\n" % (name,data['password']) ) - if data['options']: - for option, values in data['options'].iteritems(): - f.write("\t@%s %s\n" % (option, " ".join(values))) - - chmod(f.name, 0600) - - except Exception, e: - self.core.log.error(str(e)) - - - #---------------------------------------------------------------------- - def initAccountPlugins(self): - """init names""" - for name in self.core.pluginManager.getAccountPlugins(): - self.accounts[name] = {} - - - @lock - def updateAccount(self, plugin , user, password=None, options={}): - """add or update account""" - if plugin in self.accounts: - p = self.getAccountPlugin(plugin) - updated = p.updateAccounts(user, password, options) - #since accounts is a ref in plugin self.accounts doesnt need to be updated here - - self.saveAccounts() - if updated: p.scheduleRefresh(user, force=False) - - - @lock - def removeAccount(self, plugin, user): - """remove account""" - - if plugin in self.accounts: - p = self.getAccountPlugin(plugin) - p.removeAccount(user) - - self.saveAccounts() - - - @lock - def getAccountInfos(self, force=True, refresh=False): - data = {} - - if refresh: - self.core.scheduler.addJob(0, self.core.accountManager.getAccountInfos) - force = False - - for p in self.accounts.keys(): - if self.accounts[p]: - p = self.getAccountPlugin(p) - if p: - data[p.__name__] = p.getAllAccounts(force) - else: #@NOTE: When an account has been skipped, p is None - data[p] = [] - else: - data[p] = [] - e = AccountUpdateEvent() - self.core.pullManager.addEvent(e) - return data - - - def sendChange(self): - e = AccountUpdateEvent() - self.core.pullManager.addEvent(e) diff --git a/pyload/manager/Addon.py b/pyload/manager/Addon.py deleted file mode 100644 index d293109c7..000000000 --- a/pyload/manager/Addon.py +++ /dev/null @@ -1,304 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN, mkaay -# @interface-version: 0.1 - -import __builtin__ - -import traceback -from threading import RLock, Thread - -from types import MethodType - -from pyload.manager.thread.Addon import AddonThread -from pyload.manager.Plugin import literal_eval -from pyload.utils import lock - - -class AddonManager(object): - """Manages addons, delegates and handles Events. - - Every plugin can define events, \ - but some very usefull events are called by the Core. - Contrary to overwriting addon methods you can use event listener, - which provides additional entry point in the control flow. - Only do very short tasks or use threads. - - **Known Events:** - Most addon methods exists as events. These are the additional known events. - - ======================= ============== ================================== - Name Arguments Description - ======================= ============== ================================== - download-preparing fid A download was just queued and will be prepared now. - download-start fid A plugin will immediately starts the download afterwards. - links-added links, pid Someone just added links, you are able to modify the links. - all_downloads-processed Every link was handled, pyload would idle afterwards. - all_downloads-finished Every download in queue is finished. - config-changed The config was changed via the api. - pluginConfigChanged The plugin config changed, due to api or internal process. - ======================= ============== ================================== - - | Notes: - | all_downloads-processed is *always* called before all_downloads-finished. - | config-changed is *always* called before pluginConfigChanged. - - - """ - - def __init__(self, core): - self.core = core - - __builtin__.addonManager = self #: needed to let addons register themself - - self.plugins = [] - self.pluginMap = {} - self.methods = {} #: dict of names and list of methods usable by rpc - - self.events = {} #: contains events - - # registering callback for config event - self.core.config.pluginCB = MethodType(self.dispatchEvent, "pluginConfigChanged", basestring) #@TODO: Rename event pluginConfigChanged - - self.addEvent("pluginConfigChanged", self.manageAddon) - - self.lock = RLock() - self.createIndex() - - - def try_catch(func): - - def new(*args): - try: - return func(*args) - except Exception, e: - args[0].log.error(_("Error executing addon: %s") % e) - if args[0].core.debug: - traceback.print_exc() - - return new - - - def addRPC(self, plugin, func, doc): - plugin = plugin.rpartition(".")[2] - doc = doc.strip() if doc else "" - - if plugin in self.methods: - self.methods[plugin][func] = doc - else: - self.methods[plugin] = {func: doc} - - - def callRPC(self, plugin, func, args, parse): - if not args: - args = tuple() - if parse: - args = tuple([literal_eval(x) for x in args]) - plugin = self.pluginMap[plugin] - f = getattr(plugin, func) - return f(*args) - - - def createIndex(self): - plugins = [] - active = [] - deactive = [] - - for pluginname in self.core.pluginManager.addonPlugins: - try: - # hookClass = getattr(plugin, plugin.__name__) - if self.core.config.getPlugin(pluginname, "activated"): - pluginClass = self.core.pluginManager.loadClass("addon", pluginname) - if not pluginClass: - continue - - plugin = pluginClass(self.core, self) - plugins.append(plugin) - self.pluginMap[pluginClass.__name__] = plugin - if plugin.isActivated(): - active.append(pluginClass.__name__) - else: - deactive.append(pluginname) - - except Exception: - self.core.log.warning(_("Failed activating %(name)s") % {"name": pluginname}) - if self.core.debug: - traceback.print_exc() - - self.core.log.info(_("Activated addons: %s") % ", ".join(sorted(active))) - self.core.log.info(_("Deactivated addons: %s") % ", ".join(sorted(deactive))) - - self.plugins = plugins - - - def manageAddon(self, plugin, name, value): - if name == "activated" and value: - self.activateAddon(plugin) - - elif name == "activated" and not value: - self.deactivateAddon(plugin) - - - def activateAddon(self, pluginname): - # check if already loaded - for inst in self.plugins: - if inst.__name__ == pluginname: - return - - pluginClass = self.core.pluginManager.loadClass("addon", pluginname) - - if not pluginClass: - return - - self.core.log.debug("Activate addon: %s" % pluginname) - - addon = pluginClass(self.core, self) - self.plugins.append(addon) - self.pluginMap[pluginClass.__name__] = addon - - addon.activate() - - - def deactivateAddon(self, pluginname): - for plugin in self.plugins: - if plugin.__name__ == pluginname: - addon = plugin - break - else: - return - - self.core.log.debug("Deactivate addon: %s" % pluginname) - - addon.deactivate() - - #remove periodic call - self.core.log.debug("Removed callback: %s" % self.core.scheduler.removeJob(addon.cb)) - - self.plugins.remove(addon) - del self.pluginMap[addon.__name__] - - - @try_catch - def coreReady(self): - for plugin in self.plugins: - if plugin.isActivated(): - plugin.activate() - - self.dispatchEvent("addon-start") - - - @try_catch - def coreExiting(self): - for plugin in self.plugins: - if plugin.isActivated(): - plugin.exit() - - self.dispatchEvent("addon-exit") - - - @lock - def downloadPreparing(self, pyfile): - for plugin in self.plugins: - if plugin.isActivated(): - plugin.downloadPreparing(pyfile) - - self.dispatchEvent("download-preparing", pyfile) - - - @lock - def downloadFinished(self, pyfile): - for plugin in self.plugins: - if plugin.isActivated(): - plugin.downloadFinished(pyfile) - - self.dispatchEvent("download-finished", pyfile) - - - @lock - @try_catch - def downloadFailed(self, pyfile): - for plugin in self.plugins: - if plugin.isActivated(): - plugin.downloadFailed(pyfile) - - self.dispatchEvent("download-failed", pyfile) - - - @lock - def packageFinished(self, package): - for plugin in self.plugins: - if plugin.isActivated(): - plugin.packageFinished(package) - - self.dispatchEvent("package-finished", package) - - - @lock - def beforeReconnecting(self, ip): - for plugin in self.plugins: - plugin.beforeReconnecting(ip) - - self.dispatchEvent("beforeReconnecting", ip) - - - @lock - def afterReconnecting(self, ip): - for plugin in self.plugins: - if plugin.isActivated(): - plugin.afterReconnecting(ip) - - self.dispatchEvent("afterReconnecting", ip) - - - def startThread(self, function, *args, **kwargs): - return AddonThread(self.core.threadManager, function, args, kwargs) - - - def activePlugins(self): - """ returns all active plugins """ - return [x for x in self.plugins if x.isActivated()] - - - def getAllInfo(self): - """returns info stored by addon plugins""" - info = {} - for name, plugin in self.pluginMap.iteritems(): - if plugin.info: - # copy and convert so str - info[name] = dict( - [(x, str(y) if not isinstance(y, basestring) else y) for x, y in plugin.info.iteritems()]) - return info - - - def getInfo(self, plugin): - info = {} - if plugin in self.pluginMap and self.pluginMap[plugin].info: - info = dict((x, str(y) if not isinstance(y, basestring) else y) - for x, y in self.pluginMap[plugin].info.iteritems()) - return info - - - def addEvent(self, event, func): - """Adds an event listener for event name""" - if event in self.events: - self.events[event].append(func) - else: - self.events[event] = [func] - - - def removeEvent(self, event, func): - """removes previously added event listener""" - if event in self.events: - self.events[event].remove(func) - - - def dispatchEvent(self, event, *args): - """dispatches event with args""" - if event in self.events: - for f in self.events[event]: - try: - f(*args) - except Exception, e: - self.core.log.warning("Error calling event handler %s: %s, %s, %s" - % (event, f, args, str(e))) - if self.core.debug: - traceback.print_exc() diff --git a/pyload/manager/Captcha.py b/pyload/manager/Captcha.py deleted file mode 100644 index e54eacf30..000000000 --- a/pyload/manager/Captcha.py +++ /dev/null @@ -1,138 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN, mkaay - -from time import time -from traceback import print_exc -from threading import Lock - -from pyload.utils import encode - - -class CaptchaManager(object): - def __init__(self, core): - self.lock = Lock() - self.core = core - self.tasks = [] # task store, for outgoing tasks only - self.ids = 0 # only for internal purpose - - def newTask(self, img, format, file, result_type): - task = CaptchaTask(self.ids, img, format, file, result_type) - self.ids += 1 - return task - - def removeTask(self, task): - self.lock.acquire() - if task in self.tasks: - self.tasks.remove(task) - self.lock.release() - - def getTask(self): - self.lock.acquire() - for task in self.tasks: - if task.status in ("waiting", "shared-user"): - self.lock.release() - return task - self.lock.release() - return None - - def getTaskByID(self, tid): - self.lock.acquire() - for task in self.tasks: - if task.id == str(tid): # task ids are strings - self.lock.release() - return task - self.lock.release() - return None - - def handleCaptcha(self, task, timeout=50): - cli = self.core.isClientConnected() - - if cli: #: client connected -> should solve the captcha - task.setWaiting(timeout) #wait 50 sec for response - - for plugin in self.core.addonManager.activePlugins(): - try: - plugin.captchaTask(task) - except Exception: - if self.core.debug: - print_exc() - - if task.handler or cli: #: the captcha was handled - self.tasks.append(task) - return True - task.error = _("No Client connected for captcha decrypting") - return False - - -class CaptchaTask(object): - def __init__(self, id, img, format, file, result_type='textual'): - self.id = str(id) - self.captchaImg = img - self.captchaFormat = format - self.captchaFile = file - self.captchaResultType = result_type - self.handler = [] #: the hook plugins that will take care of the solution - self.result = None - self.waitUntil = None - self.error = None # error message - self.status = "init" - self.data = {} # handler can store data here - - def getCaptcha(self): - return self.captchaImg, self.captchaFormat, self.captchaResultType - - def setResult(self, text): - if self.isTextual(): - self.result = text - if self.isPositional(): - try: - parts = text.split(',') - self.result = (int(parts[0]), int(parts[1])) - except Exception: - self.result = None - - def getResult(self): - return encode(self.result) - - def getStatus(self): - return self.status - - def setWaiting(self, sec): - """ let the captcha wait secs for the solution """ - self.waitUntil = max(time() + sec, self.waitUntil) - self.status = "waiting" - - def isWaiting(self): - if self.result or self.error or self.timedOut(): - return False - else: - return True - - def isTextual(self): - """ returns if text is written on the captcha """ - return self.captchaResultType == 'textual' - - def isPositional(self): - """ returns if user have to click a specific region on the captcha """ - return self.captchaResultType == 'positional' - - def setWatingForUser(self, exclusive): - if exclusive: - self.status = "user" - else: - self.status = "shared-user" - - def timedOut(self): - return time() > self.waitUntil - - def invalid(self): - """ indicates the captcha was not correct """ - for x in self.handler: - x.captchaInvalid(self) - - def correct(self): - for x in self.handler: - x.captchaCorrect(self) - - def __str__(self): - return "" % self.id diff --git a/pyload/manager/Event.py b/pyload/manager/Event.py deleted file mode 100644 index 20897290e..000000000 --- a/pyload/manager/Event.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: mkaay - -from time import time -from pyload.utils import uniqify - -class PullManager(object): - def __init__(self, core): - self.core = core - self.clients = [] - - def newClient(self, uuid): - self.clients.append(Client(uuid)) - - def clean(self): - for n, client in enumerate(self.clients): - if client.lastActive + 30 < time(): - del self.clients[n] - - def getEvents(self, uuid): - events = [] - validUuid = False - for client in self.clients: - if client.uuid == uuid: - client.lastActive = time() - validUuid = True - while client.newEvents(): - events.append(client.popEvent().toList()) - break - if not validUuid: - self.newClient(uuid) - events = [ReloadAllEvent("queue").toList(), ReloadAllEvent("collector").toList()] - return uniqify(events) - - def addEvent(self, event): - for client in self.clients: - client.addEvent(event) - -class Client(object): - def __init__(self, uuid): - self.uuid = uuid - self.lastActive = time() - self.events = [] - - def newEvents(self): - return len(self.events) > 0 - - def popEvent(self): - if not len(self.events): - return None - return self.events.pop(0) - - def addEvent(self, event): - self.events.append(event) - -class UpdateEvent(object): - def __init__(self, itype, iid, destination): - assert itype == "pack" or itype == "file" - assert destination == "queue" or destination == "collector" - self.type = itype - self.id = iid - self.destination = destination - - def toList(self): - return ["update", self.destination, self.type, self.id] - -class RemoveEvent(object): - def __init__(self, itype, iid, destination): - assert itype == "pack" or itype == "file" - assert destination == "queue" or destination == "collector" - self.type = itype - self.id = iid - self.destination = destination - - def toList(self): - return ["remove", self.destination, self.type, self.id] - -class InsertEvent(object): - def __init__(self, itype, iid, after, destination): - assert itype == "pack" or itype == "file" - assert destination == "queue" or destination == "collector" - self.type = itype - self.id = iid - self.after = after - self.destination = destination - - def toList(self): - return ["insert", self.destination, self.type, self.id, self.after] - -class ReloadAllEvent(object): - def __init__(self, destination): - assert destination == "queue" or destination == "collector" - self.destination = destination - - def toList(self): - return ["reload", self.destination] - -class AccountUpdateEvent(object): - def toList(self): - return ["account"] - -class ConfigUpdateEvent(object): - def toList(self): - return ["config"] diff --git a/pyload/manager/Plugin.py b/pyload/manager/Plugin.py deleted file mode 100644 index 879430be2..000000000 --- a/pyload/manager/Plugin.py +++ /dev/null @@ -1,404 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement - -import re -import sys - -from itertools import chain -from os import listdir, makedirs -from os.path import isdir, isfile, join, exists, abspath -from sys import version_info -from traceback import print_exc -from urllib import unquote - -from SafeEval import const_eval as literal_eval - - -class PluginManager(object): - ROOT = "pyload.plugin." - USERROOT = "userplugins." - TYPES = ["account", "addon", "container", "crypter", "hook", "hoster", "internal", "ocr"] - - PATTERN = re.compile(r'__pattern__\s*=\s*u?r("|\')([^"\']+)') - VERSION = re.compile(r'__version__\s*=\s*("|\')([\d.]+)') - CONFIG = re.compile(r'__config__\s*=\s*\[([^\]]+)', re.M) - DESC = re.compile(r'__description__\s*=\s*("|"""|\')([^"\']+)') - - - def __init__(self, core): - self.core = core - - self.plugins = {} - self.createIndex() - - #register for import addon - sys.meta_path.append(self) - - - def loadTypes(self): - rootdir = join(pypath, "pyload", "plugins") - userdir = "userplugins" - - types = set().union(*[[d for d in listdir(p) if isdir(join(p, d))] - for p in (rootdir, userdir) if exists(p)]) - - if not types: - self.log.critical(_("No plugins found!")) - - self.TYPES = list(set(self.TYPES) | types) - - - def createIndex(self): - """create information for all plugins available""" - - sys.path.append(abspath("")) - - self.loadTypes() - - for type in self.TYPES: - self.plugins[type] = self.parse(type) - setattr(self, "%sPlugins" % type, self.plugins[type]) - - self.plugins['addon'] = self.addonPlugins.update(self.hookPlugins) - - self.core.log.debug("Created index of plugins") - - - def parse(self, folder, rootplugins={}): - """ - returns dict with information - home contains parsed plugins from pyload. - """ - - plugins = {} - - if rootplugins: - try: - pfolder = join("userplugins", folder) - if not exists(pfolder): - makedirs(pfolder) - - for ifile in (join("userplugins", "__init__.py"), - join(pfolder, "__init__.py")): - if not exists(ifile): - f = open(ifile, "wb") - f.close() - - except IOError, e: - self.core.log.critical(str(e)) - return rootplugins - - else: - pfolder = join(pypath, "pyload", "plugins", folder) - - for f in listdir(pfolder): - if (isfile(join(pfolder, f)) and f.endswith(".py") or f.endswith("_25.pyc") or f.endswith( - "_26.pyc") or f.endswith("_27.pyc")) and not f.startswith("_"): - - try: - with open(join(pfolder, f)) as data: - content = data.read() - - except IOError, e: - self.core.log.error(str(e)) - continue - - if f.endswith("_25.pyc") and version_info[0:2] != (2, 5): #@TODO: Remove in 0.4.10 - continue - - elif f.endswith("_26.pyc") and version_info[0:2] != (2, 6): #@TODO: Remove in 0.4.10 - continue - - elif f.endswith("_27.pyc") and version_info[0:2] != (2, 7): #@TODO: Remove in 0.4.10 - continue - - name = f[:-3] - if name[-1] == ".": - name = name[:-4] - - version = self.VERSION.findall(content) - if version: - version = float(version[0][1]) - else: - version = 0 - - if rootplugins and name in rootplugins: - if rootplugins[name]['version'] >= version: - continue - - plugins[name] = {} - plugins[name]['version'] = version - - module = f.replace(".pyc", "").replace(".py", "") - - # the plugin is loaded from user directory - plugins[name]['user'] = True if rootplugins else False - plugins[name]['name'] = module - - pattern = self.PATTERN.findall(content) - - if pattern: - pattern = pattern[0][1] - - try: - regexp = re.compile(pattern) - except Exception: - self.core.log.error(_("%s has a invalid pattern") % name) - pattern = r'^unmatchable$' - regexp = re.compile(pattern) - - plugins[name]['pattern'] = pattern - plugins[name]['re'] = regexp - - # internals have no config - if folder == "internal": - self.core.config.deleteConfig(name) - continue - - config = self.CONFIG.findall(content) - if config: - try: - config = literal_eval(config[0].strip().replace("\n", "").replace("\r", "")) - desc = self.DESC.findall(content) - desc = desc[0][1] if desc else "" - - if type(config[0]) == tuple: - config = [list(x) for x in config] - else: - config = [list(config)] - - if folder not in ("account", "internal") and not [True for item in config if item[0] == "activated"]: - config.insert(0, ["activated", "bool", "Activated", False if folder in ("addon", "hook") else True]) - - self.core.config.addPluginConfig(name, config, desc) - except Exception: - self.core.log.error("Invalid config in %s: %s" % (name, config)) - - elif folder in ("addon", "hook"): #force config creation - desc = self.DESC.findall(content) - desc = desc[0][1] if desc else "" - config = (["activated", "bool", "Activated", False],) - - try: - self.core.config.addPluginConfig(name, config, desc) - except Exception: - self.core.log.error("Invalid config in %s: %s" % (name, config)) - - if not rootplugins and plugins: #: Double check - plugins.update(self.parse(folder, plugins)) - - return plugins - - - def parseUrls(self, urls): - """parse plugins for given list of urls""" - - last = None - res = [] #: tupels of (url, plugintype, pluginname) - - for url in urls: - if type(url) not in (str, unicode, buffer): - continue - - url = unquote(url) - - if last and last[2]['re'].match(url): - res.append((url, last[0], last[1])) - continue - - for type in self.TYPES: - for name, plugin in self.plugins[type]: - - m = None - try: - if 'pattern' in plugin: - m = plugin['re'].match(url) - - except KeyError: - self.core.log.error(_("Plugin [%(type)s] %(name)s skipped due broken pattern") - % {'name': name, 'type': type}) - - if m: - res.append((url, type, name)) - last = (type, name, plugin) - break - else: - res.append((url, "internal", "BasePlugin")) - - return res - - - def findPlugin(self, type, name): - if type not in self.plugins: - return None - - elif name not in self.plugins[type]: - self.core.log.warning(_("Plugin [%(type)s] %(name)s not found | Using plugin: [internal] BasePlugin") - % {'name': name, 'type': type}) - return self.internalPlugins["BasePlugin"] - - else: - return self.plugins[type][name] - - - def getPlugin(self, type, name, original=False): - """return plugin module from hoster|decrypter|container""" - plugin = self.findPlugin(type, name) - - if plugin is None: - return {} - - if "new_module" in plugin and not original: - return plugin['new_module'] - else: - return self.loadModule(type, name) - - - def getPluginName(self, type, name): - """ used to obtain new name if other plugin was injected""" - plugin = self.findPlugin(type, name) - - if plugin is None: - return "" - - if "new_name" in plugin: - return plugin['new_name'] - - return name - - - def loadModule(self, type, name): - """ Returns loaded module for plugin - - :param type: plugin type, subfolder of pyload.plugins - :param name: - """ - plugins = self.plugins[type] - - if name in plugins: - if "module" in plugins[name]: - return plugins[name]['module'] - - try: - module = __import__(self.ROOT + "%s.%s" % (type, plugins[name]['name']), globals(), locals(), - plugins[name]['name']) - - except Exception, e: - self.core.log.error(_("Error importing plugin: [%(type)s] %(name)s (v%(version).2f) | %(errmsg)s") - % {'name': name, 'type': type, 'version': plugins[name]['version'], "errmsg": str(e)}) - if self.core.debug: - print_exc() - - else: - plugins[name]['module'] = module #: cache import, maybe unneeded - - self.core.log.debug(_("Loaded plugin: [%(type)s] %(name)s (v%(version).2f)") - % {'name': name, 'type': type, 'version': plugins[name]['version']}) - return module - - - def loadClass(self, type, name): - """Returns the class of a plugin with the same name""" - module = self.loadModule(type, name) - if module: - return getattr(module, name) - else: - return None - - - def getAccountPlugins(self): - """return list of account plugin names""" - return self.accountPlugins.keys() - - - def find_module(self, fullname, path=None): - #redirecting imports if necesarry - if fullname.startswith(self.ROOT) or fullname.startswith(self.USERROOT): #seperate pyload plugins - if fullname.startswith(self.USERROOT): user = 1 - else: user = 0 #used as bool and int - - split = fullname.split(".") - if len(split) != 4 - user: return - type, name = split[2 - user:4 - user] - - if type in self.plugins and name in self.plugins[type]: - #userplugin is a newer version - if not user and self.plugins[type][name]['user']: - return self - #imported from userdir, but pyloads is newer - if user and not self.plugins[type][name]['user']: - return self - - - def load_module(self, name, replace=True): - if name not in sys.modules: #could be already in modules - if replace: - if self.ROOT in name: - newname = name.replace(self.ROOT, self.USERROOT) - else: - newname = name.replace(self.USERROOT, self.ROOT) - else: - newname = name - - base, plugin = newname.rsplit(".", 1) - - self.core.log.debug("Redirected import %s -> %s" % (name, newname)) - - module = __import__(newname, globals(), locals(), [plugin]) - #inject under new an old name - sys.modules[name] = module - sys.modules[newname] = module - - return sys.modules[name] - - - def reloadPlugins(self, type_plugins): - """ reload and reindex plugins """ - if not type_plugins: - return None - - self.core.log.debug("Request reload of plugins: %s" % type_plugins) - - reloaded = [] - - as_dict = {} - for t,n in type_plugins: - if t in as_dict: - as_dict[t].append(n) - else: - as_dict[t] = [n] - - for type in as_dict.iterkeys(): - if type in ("addon", "internal"): #: do not reload them because would cause to much side effects - self.core.log.debug("Skipping reload for plugin: [%(type)s] %(name)s" % {'name': plugin, 'type': type}) - continue - - for plugin in as_dict[type]: - if plugin in self.plugins[type] and "module" in self.plugins[type][plugin]: - self.core.log.debug(_("Reloading plugin: [%(type)s] %(name)s") % {'name': plugin, 'type': type}) - - try: - reload(self.plugins[type][plugin]['module']) - - except Exception, e: - self.core.log.error(_("Error when reloading plugin: [%(type)s] %(name)s") % {'name': plugin, 'type': type}, e) - continue - - else: - reloaded.append((type, plugin)) - - #index creation - self.plugins[type] = self.parse(type) - setattr(self, "%sPlugins" % type, self.plugins[type]) - - if "account" in as_dict: #: accounts needs to be reloaded - self.core.accountManager.initPlugins() - self.core.scheduler.addJob(0, self.core.accountManager.getAccountInfos) - - return reloaded #: return a list of the plugins successfully reloaded - - - def reloadPlugin(self, type_plugin): - """ reload and reindex ONE plugin """ - return True if self.reloadPlugins(type_plugin) else False diff --git a/pyload/manager/Remote.py b/pyload/manager/Remote.py deleted file mode 100644 index 910881164..000000000 --- a/pyload/manager/Remote.py +++ /dev/null @@ -1,76 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -from threading import Thread -from traceback import print_exc - -class BackendBase(Thread): - def __init__(self, manager): - Thread.__init__(self) - self.m = manager - self.core = manager.core - self.enabled = True - self.running = False - - def run(self): - self.running = True - try: - self.serve() - except Exception, e: - self.core.log.error(_("Remote backend error: %s") % e) - if self.core.debug: - print_exc() - finally: - self.running = False - - def setup(self, host, port): - pass - - def checkDeps(self): - return True - - def serve(self): - pass - - def shutdown(self): - pass - - def stop(self): - self.enabled = False# set flag and call shutdowm message, so thread can react - self.shutdown() - - -class RemoteManager(object): - available = [] - - def __init__(self, core): - self.core = core - self.backends = [] - - if self.core.remote: - self.available.append("ThriftBackend") -# else: -# self.available.append("SocketBackend") - - - def startBackends(self): - host = self.core.config["remote"]["listenaddr"] - port = self.core.config["remote"]["port"] - - for b in self.available: - klass = getattr(__import__("pyload.remote.%s" % b, globals(), locals(), [b], -1), b) - backend = klass(self) - if not backend.checkDeps(): - continue - try: - backend.setup(host, port) - self.core.log.info(_("Starting %(name)s: %(addr)s:%(port)s") % {"name": b, "addr": host, "port": port}) - except Exception, e: - self.core.log.error(_("Failed loading backend %(name)s | %(error)s") % {"name": b, "error": str(e)}) - if self.core.debug: - print_exc() - else: - backend.start() - self.backends.append(backend) - - port += 1 diff --git a/pyload/manager/Thread.py b/pyload/manager/Thread.py deleted file mode 100644 index 2ace9c789..000000000 --- a/pyload/manager/Thread.py +++ /dev/null @@ -1,302 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -from os.path import exists, join -import re -from subprocess import Popen -from threading import Event, Lock -from time import sleep, time -from traceback import print_exc -from random import choice - -import pycurl - -from pyload.manager.thread.Decrypter import DecrypterThread -from pyload.manager.thread.Download import DownloadThread -from pyload.manager.thread.Info import InfoThread -from pyload.datatype.File import PyFile -from pyload.network.RequestFactory import getURL -from pyload.utils import freeSpace, lock - - -class ThreadManager(object): - """manages the download threads, assign jobs, reconnect etc""" - - - def __init__(self, core): - """Constructor""" - self.core = core - - self.threads = [] #: thread list - self.localThreads = [] #: addon+decrypter threads - - self.pause = True - - self.reconnecting = Event() - self.reconnecting.clear() - self.downloaded = 0 #number of files downloaded since last cleanup - - self.lock = Lock() - - # some operations require to fetch url info from hoster, so we caching them so it wont be done twice - # contains a timestamp and will be purged after timeout - self.infoCache = {} - - # pool of ids for online check - self.resultIDs = 0 - - # threads which are fetching hoster results - self.infoResults = {} - #timeout for cache purge - self.timestamp = 0 - - pycurl.global_init(pycurl.GLOBAL_DEFAULT) - - for i in range(0, self.core.config.get("download", "max_downloads")): - self.createThread() - - - def createThread(self): - """create a download thread""" - - thread = DownloadThread(self) - self.threads.append(thread) - - def createInfoThread(self, data, pid): - """ - start a thread whichs fetches online status and other infos - data = [ .. () .. ] - """ - self.timestamp = time() + 5 * 60 - - InfoThread(self, data, pid) - - @lock - def createResultThread(self, data, add=False): - """ creates a thread to fetch online status, returns result id """ - self.timestamp = time() + 5 * 60 - - rid = self.resultIDs - self.resultIDs += 1 - - InfoThread(self, data, rid=rid, add=add) - - return rid - - - @lock - def getInfoResult(self, rid): - """returns result and clears it""" - self.timestamp = time() + 5 * 60 - - if rid in self.infoResults: - data = self.infoResults[rid] - self.infoResults[rid] = {} - return data - else: - return {} - - @lock - def setInfoResults(self, rid, result): - self.infoResults[rid].update(result) - - def getActiveFiles(self): - active = [x.active for x in self.threads if x.active and isinstance(x.active, PyFile)] - - for t in self.localThreads: - active.extend(t.getActiveFiles()) - - return active - - def processingIds(self): - """get a id list of all pyfiles processed""" - return [x.id for x in self.getActiveFiles()] - - - def work(self): - """run all task which have to be done (this is for repetivive call by core)""" - try: - self.tryReconnect() - except Exception, e: - self.core.log.error(_("Reconnect Failed: %s") % str(e) ) - self.reconnecting.clear() - if self.core.debug: - print_exc() - self.checkThreadCount() - - try: - self.assignJob() - except Exception, e: - self.core.log.warning("Assign job error", e) - if self.core.debug: - print_exc() - - sleep(0.5) - self.assignJob() - #it may be failed non critical so we try it again - - if (self.infoCache or self.infoResults) and self.timestamp < time(): - self.infoCache.clear() - self.infoResults.clear() - self.core.log.debug("Cleared Result cache") - - #-------------------------------------------------------------------------- - def tryReconnect(self): - """checks if reconnect needed""" - - if not (self.core.config["reconnect"]["activated"] and self.core.api.isTimeReconnect()): - return False - - active = [x.active.plugin.wantReconnect and x.active.plugin.waiting for x in self.threads if x.active] - - if not (0 < active.count(True) == len(active)): - return False - - if not exists(self.core.config['reconnect']['method']): - if exists(join(pypath, self.core.config['reconnect']['method'])): - self.core.config['reconnect']['method'] = join(pypath, self.core.config['reconnect']['method']) - else: - self.core.config["reconnect"]["activated"] = False - self.core.log.warning(_("Reconnect script not found!")) - return - - self.reconnecting.set() - - #Do reconnect - self.core.log.info(_("Starting reconnect")) - - while [x.active.plugin.waiting for x in self.threads if x.active].count(True) != 0: - sleep(0.25) - - ip = self.getIP() - - self.core.addonManager.beforeReconnecting(ip) - - self.core.log.debug("Old IP: %s" % ip) - - try: - reconn = Popen(self.core.config['reconnect']['method'], bufsize=-1, shell=True)#, stdout=subprocess.PIPE) - except Exception: - self.core.log.warning(_("Failed executing reconnect script!")) - self.core.config["reconnect"]["activated"] = False - self.reconnecting.clear() - if self.core.debug: - print_exc() - return - - reconn.wait() - sleep(1) - ip = self.getIP() - self.core.addonManager.afterReconnecting(ip) - - self.core.log.info(_("Reconnected, new IP: %s") % ip) - - self.reconnecting.clear() - - def getIP(self): - """retrieve current ip""" - services = [("http://automation.whatismyip.com/n09230945.asp", "(\S+)"), - ("http://checkip.dyndns.org/",".*Current IP Address: (\S+).*")] - - ip = "" - for i in range(10): - try: - sv = choice(services) - ip = getURL(sv[0]) - ip = re.match(sv[1], ip).group(1) - break - except Exception: - ip = "" - sleep(1) - - return ip - - #-------------------------------------------------------------------------- - def checkThreadCount(self): - """checks if there are need for increasing or reducing thread count""" - - if len(self.threads) == self.core.config.get("download", "max_downloads"): - return True - elif len(self.threads) < self.core.config.get("download", "max_downloads"): - self.createThread() - else: - free = [x for x in self.threads if not x.active] - if free: - free[0].put("quit") - - - def cleanPycurl(self): - """ make a global curl cleanup (currently ununused) """ - if self.processingIds(): - return False - pycurl.global_cleanup() - pycurl.global_init(pycurl.GLOBAL_DEFAULT) - self.downloaded = 0 - self.core.log.debug("Cleaned up pycurl") - return True - - #-------------------------------------------------------------------------- - def assignJob(self): - """assing a job to a thread if possible""" - - if self.pause or not self.core.api.isTimeDownload(): return - - #if self.downloaded > 20: - # if not self.cleanPyCurl(): return - - free = [x for x in self.threads if not x.active] - - inuse = set([(x.active.pluginname, self.getLimit(x)) for x in self.threads if x.active and x.active.hasPlugin() and x.active.plugin.account]) - inuse = map(lambda x: (x[0], x[1], len([y for y in self.threads if y.active and y.active.pluginname == x[0]])) ,inuse) - onlimit = [x[0] for x in inuse if x[1] > 0 and x[2] >= x[1]] - - occ = [x.active.pluginname for x in self.threads if x.active and x.active.hasPlugin() and not x.active.plugin.multiDL] + onlimit - - occ.sort() - occ = tuple(set(occ)) - job = self.core.files.getJob(occ) - if job: - try: - job.initPlugin() - except Exception, e: - self.core.log.critical(str(e)) - print_exc() - job.setStatus("failed") - job.error = str(e) - job.release() - return - - if job.plugin.__type__ == "hoster": - spaceLeft = freeSpace(self.core.config["general"]["download_folder"]) / 1024 / 1024 - if spaceLeft < self.core.config["general"]["min_free_space"]: - self.core.log.warning(_("Not enough space left on device")) - self.pause = True - - if free and not self.pause: - thread = free[0] - #self.downloaded += 1 - - thread.put(job) - else: - #put job back - if occ not in self.core.files.jobCache: - self.core.files.jobCache[occ] = [] - self.core.files.jobCache[occ].append(job.id) - - #check for decrypt jobs - job = self.core.files.getDecryptJob() - if job: - job.initPlugin() - thread = DecrypterThread(self, job) - - - else: - thread = DecrypterThread(self, job) - - def getLimit(self, thread): - limit = thread.active.plugin.account.getAccountData(thread.active.plugin.user)["options"].get("limitDL", ["0"])[0] - return int(limit) - - def cleanup(self): - """do global cleanup, should be called when finished with pycurl""" - pycurl.global_cleanup() diff --git a/pyload/manager/__init__.py b/pyload/manager/__init__.py deleted file mode 100644 index 40a96afc6..000000000 --- a/pyload/manager/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/pyload/manager/event/Scheduler.py b/pyload/manager/event/Scheduler.py deleted file mode 100644 index fd428a956..000000000 --- a/pyload/manager/event/Scheduler.py +++ /dev/null @@ -1,126 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: mkaay - -from time import time -from heapq import heappop, heappush -from threading import Lock, Thread - -class AlreadyCalled(Exception): - pass - - -class Deferred(object): - def __init__(self): - self.call = [] - self.result = () - - def addCallback(self, f, *cargs, **ckwargs): - self.call.append((f, cargs, ckwargs)) - - def callback(self, *args, **kwargs): - if self.result: - raise AlreadyCalled - self.result = (args, kwargs) - for f, cargs, ckwargs in self.call: - args += tuple(cargs) - kwargs.update(ckwargs) - f(*args ** kwargs) - - -class Scheduler(object): - def __init__(self, core): - self.core = core - - self.queue = PriorityQueue() - - def addJob(self, t, call, args=[], kwargs={}, threaded=True): - d = Deferred() - t += time() - j = Job(t, call, args, kwargs, d, threaded) - self.queue.put((t, j)) - return d - - - def removeJob(self, d): - """ - :param d: defered object - :return: if job was deleted - """ - index = -1 - - for i, j in enumerate(self.queue): - if j[1].deferred == d: - index = i - - if index >= 0: - del self.queue[index] - return True - - return False - - def work(self): - while True: - t, j = self.queue.get() - if not j: - break - else: - if t <= time(): - j.start() - else: - self.queue.put((t, j)) - break - - -class Job(object): - def __init__(self, time, call, args=[], kwargs={}, deferred=None, threaded=True): - self.time = float(time) - self.call = call - self.args = args - self.kwargs = kwargs - self.deferred = deferred - self.threaded = threaded - - def run(self): - ret = self.call(*self.args, **self.kwargs) - if self.deferred is None: - return - else: - self.deferred.callback(ret) - - def start(self): - if self.threaded: - t = Thread(target=self.run) - t.setDaemon(True) - t.start() - else: - self.run() - - -class PriorityQueue(object): - """ a non blocking priority queue """ - - def __init__(self): - self.queue = [] - self.lock = Lock() - - def __iter__(self): - return iter(self.queue) - - def __delitem__(self, key): - del self.queue[key] - - def put(self, element): - self.lock.acquire() - heappush(self.queue, element) - self.lock.release() - - def get(self): - """ return element or None """ - self.lock.acquire() - try: - el = heappop(self.queue) - return el - except IndexError: - return None, None - finally: - self.lock.release() diff --git a/pyload/manager/event/__init__.py b/pyload/manager/event/__init__.py deleted file mode 100644 index 40a96afc6..000000000 --- a/pyload/manager/event/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/pyload/manager/thread/Addon.py b/pyload/manager/thread/Addon.py deleted file mode 100644 index 7feec227e..000000000 --- a/pyload/manager/thread/Addon.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -from Queue import Queue -from threading import Thread -from os import listdir, stat -from os.path import join -from time import sleep, time, strftime, gmtime -from traceback import print_exc, format_exc -from pprint import pformat -from sys import exc_info, exc_clear -from copy import copy -from types import MethodType - -from pycurl import error - -from pyload.manager.thread.Plugin import PluginThread - - -class AddonThread(PluginThread): - """thread for addons""" - - #-------------------------------------------------------------------------- - def __init__(self, m, function, args, kwargs): - """Constructor""" - PluginThread.__init__(self, m) - - self.f = function - self.args = args - self.kwargs = kwargs - - self.active = [] - - m.localThreads.append(self) - - self.start() - - def getActiveFiles(self): - return self.active - - def addActive(self, pyfile): - """ Adds a pyfile to active list and thus will be displayed on overview""" - if pyfile not in self.active: - self.active.append(pyfile) - - def finishFile(self, pyfile): - if pyfile in self.active: - self.active.remove(pyfile) - - pyfile.finishIfDone() - - def run(self): - try: - try: - self.kwargs["thread"] = self - self.f(*self.args, **self.kwargs) - except TypeError, e: - #dirty method to filter out exceptions - if "unexpected keyword argument 'thread'" not in e.args[0]: - raise - - del self.kwargs["thread"] - self.f(*self.args, **self.kwargs) - finally: - local = copy(self.active) - for x in local: - self.finishFile(x) - - self.m.localThreads.remove(self) diff --git a/pyload/manager/thread/Decrypter.py b/pyload/manager/thread/Decrypter.py deleted file mode 100644 index 51544d1b9..000000000 --- a/pyload/manager/thread/Decrypter.py +++ /dev/null @@ -1,101 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -from Queue import Queue -from threading import Thread -from os import listdir, stat -from os.path import join -from time import sleep, time, strftime, gmtime -from traceback import print_exc, format_exc -from pprint import pformat -from sys import exc_info, exc_clear -from copy import copy -from types import MethodType - -from pycurl import error - -from pyload.manager.thread.Plugin import PluginThread -from pyload.plugin.Plugin import Abort, Fail, Retry - - -class DecrypterThread(PluginThread): - """thread for decrypting""" - - def __init__(self, manager, pyfile): - """constructor""" - PluginThread.__init__(self, manager) - - self.active = pyfile - manager.localThreads.append(self) - - pyfile.setStatus("decrypting") - - self.start() - - def getActiveFiles(self): - return [self.active] - - def run(self): - """run method""" - - pyfile = self.active - retry = False - - try: - self.m.log.info(_("Decrypting starts: %s") % pyfile.name) - pyfile.error = "" - pyfile.plugin.preprocessing(self) - - except NotImplementedError: - self.m.log.error(_("Plugin %s is missing a function.") % pyfile.pluginname) - return - - except Fail, e: - msg = e.args[0] - - if msg == "offline": - pyfile.setStatus("offline") - self.m.log.warning(_("Download is offline: %s") % pyfile.name) - else: - pyfile.setStatus("failed") - self.m.log.error(_("Decrypting failed: %(name)s | %(msg)s") % {"name": pyfile.name, "msg": msg}) - pyfile.error = msg - - if self.m.core.debug: - print_exc() - return - - except Abort: - self.m.log.info(_("Download aborted: %s") % pyfile.name) - pyfile.setStatus("aborted") - - if self.m.core.debug: - print_exc() - return - - except Retry: - self.m.log.info(_("Retrying %s") % pyfile.name) - retry = True - return self.run() - - except Exception, e: - pyfile.setStatus("failed") - self.m.log.error(_("Decrypting failed: %(name)s | %(msg)s") % {"name": pyfile.name, "msg": str(e)}) - pyfile.error = str(e) - - if self.m.core.debug: - print_exc() - self.writeDebugReport(pyfile) - - return - - finally: - if not retry: - pyfile.release() - self.active = False - self.m.core.files.save() - self.m.localThreads.remove(self) - exc_clear() - - if not retry: - pyfile.delete() diff --git a/pyload/manager/thread/Download.py b/pyload/manager/thread/Download.py deleted file mode 100644 index c7d21a4ba..000000000 --- a/pyload/manager/thread/Download.py +++ /dev/null @@ -1,213 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -from Queue import Queue -from threading import Thread -from os import listdir, stat -from os.path import join -from time import sleep, time, strftime, gmtime -from traceback import print_exc, format_exc -from pprint import pformat -from sys import exc_info, exc_clear -from copy import copy -from types import MethodType - -from pycurl import error - -from pyload.manager.thread.Plugin import PluginThread -from pyload.plugin.Plugin import Abort, Fail, Reconnect, Retry, SkipDownload - - -class DownloadThread(PluginThread): - """thread for downloading files from 'real' hoster plugins""" - - #-------------------------------------------------------------------------- - def __init__(self, manager): - """Constructor""" - PluginThread.__init__(self, manager) - - self.queue = Queue() #: job queue - self.active = False - - self.start() - - #-------------------------------------------------------------------------- - def run(self): - """run method""" - pyfile = None - - while True: - del pyfile - self.active = self.queue.get() - pyfile = self.active - - if self.active == "quit": - self.active = False - self.m.threads.remove(self) - return True - - try: - if not pyfile.hasPlugin(): - continue - #this pyfile was deleted while queueing - - pyfile.plugin.checkForSameFiles(starting=True) - self.m.log.info(_("Download starts: %s" % pyfile.name)) - - # start download - self.m.core.addonManager.downloadPreparing(pyfile) - pyfile.error = "" - pyfile.plugin.preprocessing(self) - - self.m.log.info(_("Download finished: %s") % pyfile.name) - self.m.core.addonManager.downloadFinished(pyfile) - self.m.core.files.checkPackageFinished(pyfile) - - except NotImplementedError: - self.m.log.error(_("Plugin %s is missing a function.") % pyfile.pluginname) - pyfile.setStatus("failed") - pyfile.error = "Plugin does not work" - self.clean(pyfile) - continue - - except Abort: - try: - self.m.log.info(_("Download aborted: %s") % pyfile.name) - except Exception: - pass - - pyfile.setStatus("aborted") - - if self.m.core.debug: - print_exc() - - self.clean(pyfile) - continue - - except Reconnect: - self.queue.put(pyfile) - #pyfile.req.clearCookies() - - while self.m.reconnecting.isSet(): - sleep(0.5) - - continue - - except Retry, e: - reason = e.args[0] - self.m.log.info(_("Download restarted: %(name)s | %(msg)s") % {"name": pyfile.name, "msg": reason}) - self.queue.put(pyfile) - continue - - except Fail, e: - msg = e.args[0] - - if msg == "offline": - pyfile.setStatus("offline") - self.m.log.warning(_("Download is offline: %s") % pyfile.name) - elif msg == "temp. offline": - pyfile.setStatus("temp. offline") - self.m.log.warning(_("Download is temporary offline: %s") % pyfile.name) - else: - pyfile.setStatus("failed") - self.m.log.warning(_("Download failed: %(name)s | %(msg)s") % {"name": pyfile.name, "msg": msg}) - pyfile.error = msg - - if self.m.core.debug: - print_exc() - - self.m.core.addonManager.downloadFailed(pyfile) - self.clean(pyfile) - continue - - except error, e: - if len(e.args) == 2: - code, msg = e.args - else: - code = 0 - msg = e.args - - self.m.log.debug("pycurl exception %s: %s" % (code, msg)) - - if code in (7, 18, 28, 52, 56): - self.m.log.warning(_("Couldn't connect to host or connection reset, waiting 1 minute and retry.")) - wait = time() + 60 - - pyfile.waitUntil = wait - pyfile.setStatus("waiting") - while time() < wait: - sleep(1) - if pyfile.abort: - break - - if pyfile.abort: - self.m.log.info(_("Download aborted: %s") % pyfile.name) - pyfile.setStatus("aborted") - - self.clean(pyfile) - else: - self.queue.put(pyfile) - - continue - - else: - pyfile.setStatus("failed") - self.m.log.error("pycurl error %s: %s" % (code, msg)) - if self.m.core.debug: - print_exc() - self.writeDebugReport(pyfile) - - self.m.core.addonManager.downloadFailed(pyfile) - - self.clean(pyfile) - continue - - except SkipDownload, e: - pyfile.setStatus("skipped") - - self.m.log.info( - _("Download skipped: %(name)s due to %(plugin)s") % {"name": pyfile.name, "plugin": e.message}) - - self.clean(pyfile) - - self.m.core.files.checkPackageFinished(pyfile) - - self.active = False - self.m.core.files.save() - - continue - - - except Exception, e: - pyfile.setStatus("failed") - self.m.log.warning(_("Download failed: %(name)s | %(msg)s") % {"name": pyfile.name, "msg": str(e)}) - pyfile.error = str(e) - - if self.m.core.debug: - print_exc() - self.writeDebugReport(pyfile) - - self.m.core.addonManager.downloadFailed(pyfile) - self.clean(pyfile) - continue - - finally: - self.m.core.files.save() - pyfile.checkIfProcessed() - exc_clear() - - #pyfile.plugin.req.clean() - - self.active = False - pyfile.finishIfDone() - self.m.core.files.save() - - - def put(self, job): - """assing job to thread""" - self.queue.put(job) - - - def stop(self): - """stops the thread""" - self.put("quit") diff --git a/pyload/manager/thread/Info.py b/pyload/manager/thread/Info.py deleted file mode 100644 index 4526a07ed..000000000 --- a/pyload/manager/thread/Info.py +++ /dev/null @@ -1,225 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -from Queue import Queue -from threading import Thread -from os import listdir, stat -from os.path import join -from time import sleep, time, strftime, gmtime -from traceback import print_exc, format_exc -from pprint import pformat -from sys import exc_info, exc_clear -from copy import copy -from types import MethodType - -from pycurl import error - -from pyload.datatype.File import PyFile -from pyload.manager.thread.Plugin import PluginThread -from pyload.api import OnlineStatus - - -class InfoThread(PluginThread): - - def __init__(self, manager, data, pid=-1, rid=-1, add=False): - """Constructor""" - PluginThread.__init__(self, manager) - - self.data = data - self.pid = pid # package id - # [ .. (name, plugin) .. ] - - self.rid = rid #result id - self.add = add #add packages instead of return result - - self.cache = [] #accumulated data - - self.start() - - def run(self): - """run method""" - - plugins = {} - container = [] - - for url, plugintype, pluginname in data: - try: - plugins[plugintype][pluginname].append(url) - except Exception: - plugins[plugintype][pluginname] = [url] - - # filter out container plugins - for name in self.m.core.pluginManager.containerPlugins: - if name in plugins: - container.extend([(name, url) for url in plugins[name]]) - - del plugins[name] - - #directly write to database - if self.pid > -1: - for plugintype, pluginname, urls in plugins.iteritems(): - plugin = self.m.core.pluginManager.getPlugin(plugintype, pluginname, True) - if hasattr(plugin, "getInfo"): - self.fetchForPlugin(pluginname, plugin, urls, self.updateDB) - self.m.core.files.save() - - elif self.add: - for plugintype, pluginname, urls in plugins.iteritems(): - plugin = self.m.core.pluginManager.getPlugin(plugintype, pluginname, True) - if hasattr(plugin, "getInfo"): - self.fetchForPlugin(pluginname, plugin, urls, self.updateCache, True) - - else: - #generate default result - result = [(url, 0, 3, url) for url in urls] - - self.updateCache(pluginname, result) - - packs = parseNames([(name, url) for name, x, y, url in self.cache]) - - self.m.log.debug("Fetched and generated %d packages" % len(packs)) - - for k, v in packs: - self.m.core.api.addPackage(k, v) - - #empty cache - del self.cache[:] - - else: #post the results - - - for name, url in container: - #attach container content - try: - data = self.decryptContainer(name, url) - except Exception: - print_exc() - self.m.log.error("Could not decrypt container.") - data = [] - - for url, plugintype, pluginname in data: - try: - plugins[plugintype][pluginname].append(url) - except Exception: - plugins[plugintype][pluginname] = [url] - - self.m.infoResults[self.rid] = {} - - for plugintype, pluginname, urls in plugins.iteritems(): - plugin = self.m.core.pluginManager.getPlugin(plugintype, pluginname, True) - if hasattr(plugin, "getInfo"): - self.fetchForPlugin(pluginname, plugin, urls, self.updateResult, True) - - #force to process cache - if self.cache: - self.updateResult(pluginname, [], True) - - else: - #generate default result - result = [(url, 0, 3, url) for url in urls] - - self.updateResult(pluginname, result, True) - - self.m.infoResults[self.rid]["ALL_INFO_FETCHED"] = {} - - self.m.timestamp = time() + 5 * 60 - - - def updateDB(self, plugin, result): - self.m.core.files.updateFileInfo(result, self.pid) - - def updateResult(self, plugin, result, force=False): - #parse package name and generate result - #accumulate results - - self.cache.extend(result) - - if len(self.cache) >= 20 or force: - #used for package generating - tmp = [(name, (url, OnlineStatus(name, plugin, "unknown", status, int(size)))) - for name, size, status, url in self.cache] - - data = parseNames(tmp) - result = {} - for k, v in data.iteritems(): - for url, status in v: - status.packagename = k - result[url] = status - - self.m.setInfoResults(self.rid, result) - - self.cache = [] - - def updateCache(self, plugin, result): - self.cache.extend(result) - - def fetchForPlugin(self, pluginname, plugin, urls, cb, err=None): - try: - result = [] #result loaded from cache - process = [] #urls to process - for url in urls: - if url in self.m.infoCache: - result.append(self.m.infoCache[url]) - else: - process.append(url) - - if result: - self.m.log.debug("Fetched %d values from cache for %s" % (len(result), pluginname)) - cb(pluginname, result) - - if process: - self.m.log.debug("Run Info Fetching for %s" % pluginname) - for result in plugin.getInfo(process): - #result = [ .. (name, size, status, url) .. ] - if not type(result) == list: - result = [result] - - for res in result: - self.m.infoCache[res[3]] = res #: why don't assign res dict directly? - - cb(pluginname, result) - - self.m.log.debug("Finished Info Fetching for %s" % pluginname) - except Exception, e: - self.m.log.warning(_("Info Fetching for %(name)s failed | %(err)s") % - {"name": pluginname, "err": str(e)}) - if self.m.core.debug: - print_exc() - - # generate default results - if err: - result = [(url, 0, 3, url) for url in urls] - cb(pluginname, result) - - - def decryptContainer(self, plugin, url): - data = [] - # only works on container plugins - - self.m.log.debug("Pre decrypting %s with %s" % (url, plugin)) - - # dummy pyfile - pyfile = PyFile(self.m.core.files, -1, url, url, 0, 0, "", plugin, -1, -1) - - pyfile.initPlugin() - - # little plugin lifecycle - try: - pyfile.plugin.setup() - pyfile.plugin.loadToDisk() - pyfile.plugin.decrypt(pyfile) - pyfile.plugin.deleteTmp() - - for pack in pyfile.plugin.packages: - pyfile.plugin.urls.extend(pack[1]) - - data = self.m.core.pluginManager.parseUrls(pyfile.plugin.urls) - - self.m.log.debug("Got %d links." % len(data)) - - except Exception, e: - self.m.log.debug("Pre decrypting error: %s" % str(e)) - finally: - pyfile.release() - - return data diff --git a/pyload/manager/thread/Plugin.py b/pyload/manager/thread/Plugin.py deleted file mode 100644 index 20d57c933..000000000 --- a/pyload/manager/thread/Plugin.py +++ /dev/null @@ -1,130 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -from Queue import Queue -from threading import Thread -from os import listdir, stat -from os.path import join -from time import sleep, time, strftime, gmtime -from traceback import print_exc, format_exc -from pprint import pformat -from sys import exc_info, exc_clear -from copy import copy -from types import MethodType - -from pycurl import error - -from pyload.datatype.File import PyFile -from pyload.plugin.Plugin import Abort, Fail, Reconnect, Retry, SkipDownload -from pyload.utils.packagetools import parseNames -from pyload.utils import safe_join -from pyload.api import OnlineStatus - -class PluginThread(Thread): - """abstract base class for thread types""" - - #-------------------------------------------------------------------------- - def __init__(self, manager): - """Constructor""" - Thread.__init__(self) - self.setDaemon(True) - self.m = manager #thread manager - - - def writeDebugReport(self, pyfile): - """ writes a - :return: - """ - - dump_name = "debug_%s_%s.zip" % (pyfile.pluginname, strftime("%d-%m-%Y_%H-%M-%S")) - dump = self.getDebugDump(pyfile) - - try: - import zipfile - - zip = zipfile.ZipFile(dump_name, "w") - - for f in listdir(join("tmp", pyfile.pluginname)): - try: - # avoid encoding errors - zip.write(join("tmp", pyfile.pluginname, f), safe_join(pyfile.pluginname, f)) - except Exception: - pass - - info = zipfile.ZipInfo(safe_join(pyfile.pluginname, "debug_Report.txt"), gmtime()) - info.external_attr = 0644 << 16L # change permissions - - zip.writestr(info, dump) - zip.close() - - if not stat(dump_name).st_size: - raise Exception("Empty Zipfile") - - except Exception, e: - self.m.log.debug("Error creating zip file: %s" % e) - - dump_name = dump_name.replace(".zip", ".txt") - f = open(dump_name, "wb") - f.write(dump) - f.close() - - self.m.core.log.info("Debug Report written to %s" % dump_name) - - def getDebugDump(self, pyfile): - dump = "pyLoad %s Debug Report of %s %s \n\nTRACEBACK:\n %s \n\nFRAMESTACK:\n" % ( - self.m.core.api.getServerVersion(), pyfile.pluginname, pyfile.plugin.__version__, format_exc()) - - tb = exc_info()[2] - stack = [] - while tb: - stack.append(tb.tb_frame) - tb = tb.tb_next - - for frame in stack[1:]: - dump += "\nFrame %s in %s at line %s\n" % (frame.f_code.co_name, - frame.f_code.co_filename, - frame.f_lineno) - - for key, value in frame.f_locals.items(): - dump += "\t%20s = " % key - try: - dump += pformat(value) + "\n" - except Exception, e: - dump += " " + str(e) + "\n" - - del frame - - del stack #delete it just to be sure... - - dump += "\n\nPLUGIN OBJECT DUMP: \n\n" - - for name in dir(pyfile.plugin): - attr = getattr(pyfile.plugin, name) - if not name.endswith("__") and type(attr) != MethodType: - dump += "\t%20s = " % name - try: - dump += pformat(attr) + "\n" - except Exception, e: - dump += " " + str(e) + "\n" - - dump += "\nPYFILE OBJECT DUMP: \n\n" - - for name in dir(pyfile): - attr = getattr(pyfile, name) - if not name.endswith("__") and type(attr) != MethodType: - dump += "\t%20s = " % name - try: - dump += pformat(attr) + "\n" - except Exception, e: - dump += " " + str(e) + "\n" - - if pyfile.pluginname in self.m.core.config.plugin: - dump += "\n\nCONFIG: \n\n" - dump += pformat(self.m.core.config.plugin[pyfile.pluginname]) + "\n" - - return dump - - def clean(self, pyfile): - """ set thread unactive and release pyfile """ - self.active = False - pyfile.release() diff --git a/pyload/manager/thread/Server.py b/pyload/manager/thread/Server.py deleted file mode 100644 index f3f174e74..000000000 --- a/pyload/manager/thread/Server.py +++ /dev/null @@ -1,111 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement - -from os.path import exists - -import os -import threading -import logging - -core = None -setup = None -log = logging.getLogger("log") - -class WebServer(threading.Thread): - def __init__(self, pycore): - global core - threading.Thread.__init__(self) - self.core = pycore - core = pycore - self.running = True - self.server = pycore.config['webinterface']['server'] - self.https = pycore.config['webinterface']['https'] - self.cert = pycore.config["ssl"]["cert"] - self.key = pycore.config["ssl"]["key"] - self.host = pycore.config['webinterface']['host'] - self.port = pycore.config['webinterface']['port'] - - self.setDaemon(True) - - def run(self): - import pyload.webui as webinterface - global webinterface - - reset = False - - if self.https and (not exists(self.cert) or not exists(self.key)): - log.warning(_("SSL certificates not found.")) - self.https = False - - if self.server in ("lighttpd", "nginx"): - log.warning(_("Sorry, we dropped support for starting %s directly within pyLoad") % self.server) - log.warning(_("You can use the threaded server which offers good performance and ssl,")) - log.warning(_("of course you can still use your existing %s with pyLoads fastcgi server") % self.server) - log.warning(_("sample configs are located in the pyload/web/servers directory")) - reset = True - elif self.server == "fastcgi": - try: - import flup - except Exception: - log.warning(_("Can't use %(server)s, python-flup is not installed!") % { - "server": self.server}) - reset = True - - if reset or self.server == "lightweight": - if os.name != "nt": - try: - import bjoern - except Exception, e: - log.error(_("Error importing lightweight server: %s") % e) - log.warning(_("You need to download and compile bjoern, https://github.com/jonashaag/bjoern")) - log.warning(_("Copy the boern.so to the lib folder or use setup.py install")) - log.warning(_("Of course you need to be familiar with linux and know how to compile software")) - self.server = "builtin" - else: - self.core.log.info(_("Server set to threaded, due to known performance problems on windows.")) - self.core.config['webinterface']['server'] = "threaded" - self.server = "threaded" - - if self.server == "threaded": - self.start_threaded() - elif self.server == "fastcgi": - self.start_fcgi() - elif self.server == "lightweight": - self.start_lightweight() - else: - self.start_builtin() - - def start_builtin(self): - - if self.https: - log.warning(_("This server offers no SSL, please consider using threaded instead")) - - self.core.log.info(_("Starting builtin webserver: %(host)s:%(port)d") % {"host": self.host, "port": self.port}) - webinterface.run_simple(host=self.host, port=self.port) - - def start_threaded(self): - if self.https: - self.core.log.info(_("Starting threaded SSL webserver: %(host)s:%(port)d") % {"host": self.host, "port": self.port}) - else: - self.cert = "" - self.key = "" - self.core.log.info(_("Starting threaded webserver: %(host)s:%(port)d") % {"host": self.host, "port": self.port}) - - webinterface.run_threaded(host=self.host, port=self.port, cert=self.cert, key=self.key) - - def start_fcgi(self): - - self.core.log.info(_("Starting fastcgi server: %(host)s:%(port)d") % {"host": self.host, "port": self.port}) - webinterface.run_fcgi(host=self.host, port=self.port) - - - def start_lightweight(self): - if self.https: - log.warning(_("This server offers no SSL, please consider using threaded instead")) - - self.core.log.info(_("Starting lightweight webserver (bjoern): %(host)s:%(port)d") % {"host": self.host, "port": self.port}) - webinterface.run_lightweight(host=self.host, port=self.port) - - def quit(self): - self.running = False diff --git a/pyload/manager/thread/__init__.py b/pyload/manager/thread/__init__.py deleted file mode 100644 index 40a96afc6..000000000 --- a/pyload/manager/thread/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/pyload/network/Browser.py b/pyload/network/Browser.py deleted file mode 100644 index 89341ff25..000000000 --- a/pyload/network/Browser.py +++ /dev/null @@ -1,132 +0,0 @@ -# -*- coding: utf-8 -*- - -from logging import getLogger - -from pyload.network.HTTPRequest import HTTPRequest -from pyload.network.HTTPDownload import HTTPDownload - - -class Browser(object): - __slots__ = ("log", "options", "bucket", "cj", "_size", "http", "dl") - - def __init__(self, bucket=None, options={}): - self.log = getLogger("log") - - self.options = options #holds pycurl options - self.bucket = bucket - - self.cj = None # needs to be setted later - self._size = 0 - - self.renewHTTPRequest() - self.dl = None - - - def renewHTTPRequest(self): - if hasattr(self, "http"): self.http.close() - self.http = HTTPRequest(self.cj, self.options) - - def setLastURL(self, val): - self.http.lastURL = val - - # tunnel some attributes from HTTP Request to Browser - lastEffectiveURL = property(lambda self: self.http.lastEffectiveURL) - lastURL = property(lambda self: self.http.lastURL, setLastURL) - code = property(lambda self: self.http.code) - cookieJar = property(lambda self: self.cj) - - def setCookieJar(self, cj): - self.cj = cj - self.http.cj = cj - - @property - def speed(self): - if self.dl: - return self.dl.speed - return 0 - - @property - def size(self): - if self._size: - return self._size - if self.dl: - return self.dl.size - return 0 - - @property - def arrived(self): - if self.dl: - return self.dl.arrived - return 0 - - @property - def percent(self): - if not self.size: return 0 - return (self.arrived * 100) / self.size - - def clearCookies(self): - if self.cj: - self.cj.clear() - self.http.clearCookies() - - def clearReferer(self): - self.http.lastURL = None - - def abortDownloads(self): - self.http.abort = True - if self.dl: - self._size = self.dl.size - self.dl.abort = True - - def httpDownload(self, url, filename, get={}, post={}, ref=True, cookies=True, chunks=1, resume=False, - progressNotify=None, disposition=False): - """ this can also download ftp """ - self._size = 0 - self.dl = HTTPDownload(url, filename, get, post, self.lastEffectiveURL if ref else None, - self.cj if cookies else None, self.bucket, self.options, progressNotify, disposition) - name = self.dl.download(chunks, resume) - self._size = self.dl.size - - self.dl = None - - return name - - def load(self, *args, **kwargs): - """ retrieves page """ - return self.http.load(*args, **kwargs) - - def putHeader(self, name, value): - """ add a header to the request """ - self.http.putHeader(name, value) - - def addAuth(self, pwd): - """Adds user and pw for http auth - - :param pwd: string, user:password - """ - self.options["auth"] = pwd - self.renewHTTPRequest() #we need a new request - - def removeAuth(self): - if "auth" in self.options: del self.options["auth"] - self.renewHTTPRequest() - - def setOption(self, name, value): - """Adds an option to the request, see HTTPRequest for existing ones""" - self.options[name] = value - - def deleteOption(self, name): - if name in self.options: del self.options[name] - - def clearHeaders(self): - self.http.clearHeaders() - - def close(self): - """ cleanup """ - if hasattr(self, "http"): - self.http.close() - del self.http - if hasattr(self, "dl"): - del self.dl - if hasattr(self, "cj"): - del self.cj diff --git a/pyload/network/Bucket.py b/pyload/network/Bucket.py deleted file mode 100644 index 408a1e240..000000000 --- a/pyload/network/Bucket.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -from time import time -from threading import Lock - -MIN_RATE = 10240 #: 10kb minimum rate - - -class Bucket(object): - - def __init__(self): - self.rate = 0 # bytes per second, maximum targeted throughput - self.tokens = 0 - self.timestamp = time() - self.lock = Lock() - - - def __nonzero__(self): - return False if self.rate < MIN_RATE else True - - - def setRate(self, rate): - self.lock.acquire() - self.rate = int(rate) - self.lock.release() - - - def consumed(self, amount): - """ return the time the process has to sleep, after it consumed a specified amount """ - if self.rate < MIN_RATE: - return 0 #: May become unresponsive otherwise - - self.lock.acquire() - self.calc_tokens() - self.tokens -= amount - - if self.tokens < 0: - time = -self.tokens/float(self.rate) - else: - time = 0 - - self.lock.release() - return time - - - def calc_tokens(self): - if self.tokens < self.rate: - now = time() - delta = self.rate * (now - self.timestamp) - self.tokens = min(self.rate, self.tokens + delta) - self.timestamp = now diff --git a/pyload/network/CookieJar.py b/pyload/network/CookieJar.py deleted file mode 100644 index a2b302776..000000000 --- a/pyload/network/CookieJar.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -import Cookie - -from datetime import datetime, timedelta -from time import time - - -# monkey patch for 32 bit systems -def _getdate(future=0, weekdayname=Cookie._weekdayname, monthname=Cookie._monthname): - dt = datetime.now() + timedelta(seconds=int(future)) - return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % \ - (weekdayname[dt.weekday()], dt.day, monthname[dt.month], dt.year, dt.hour, dt.minute, dt.second) - -Cookie._getdate = _getdate - - -class CookieJar(Cookie.SimpleCookie): - - def getCookie(self, name): - return self[name].value - - def setCookie(self, domain, name, value, path="/", exp=None, secure="FALSE"): - self[name] = value - self[name]["domain"] = domain - self[name]["path"] = path - - # Value of expires should be integer if possible - # otherwise the cookie won't be used - if not exp: - expires = time() + 3600 * 24 * 180 - else: - try: - expires = int(exp) - except ValueError: - expires = exp - - self[name]["expires"] = expires - - if secure == "TRUE": - self[name]["secure"] = secure diff --git a/pyload/network/HTTPChunk.py b/pyload/network/HTTPChunk.py deleted file mode 100644 index 41752b940..000000000 --- a/pyload/network/HTTPChunk.py +++ /dev/null @@ -1,294 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -from os import remove, stat, fsync -from os.path import exists -from time import sleep -from re import search -from pyload.utils import fs_encode -import codecs -import pycurl -import urllib - -from pyload.network.HTTPRequest import HTTPRequest - -class WrongFormat(Exception): - pass - - -class ChunkInfo(object): - def __init__(self, name): - self.name = unicode(name) - self.size = 0 - self.resume = False - self.chunks = [] - - def __repr__(self): - ret = "ChunkInfo: %s, %s\n" % (self.name, self.size) - for i, c in enumerate(self.chunks): - ret += "%s# %s\n" % (i, c[1]) - - return ret - - def setSize(self, size): - self.size = int(size) - - def addChunk(self, name, range): - self.chunks.append((name, range)) - - def clear(self): - self.chunks = [] - - def createChunks(self, chunks): - self.clear() - chunk_size = self.size / chunks - - current = 0 - for i in range(chunks): - end = self.size - 1 if (i == chunks - 1) else current + chunk_size - self.addChunk("%s.chunk%s" % (self.name, i), (current, end)) - current += chunk_size + 1 - - - def save(self): - fs_name = fs_encode("%s.chunks" % self.name) - fh = codecs.open(fs_name, "w", "utf_8") - fh.write("name:%s\n" % self.name) - fh.write("size:%s\n" % self.size) - for i, c in enumerate(self.chunks): - fh.write("#%d:\n" % i) - fh.write("\tname:%s\n" % c[0]) - fh.write("\trange:%i-%i\n" % c[1]) - fh.close() - - @staticmethod - def load(name): - fs_name = fs_encode("%s.chunks" % name) - if not exists(fs_name): - raise IOError() - fh = codecs.open(fs_name, "r", "utf_8") - name = fh.readline()[:-1] - size = fh.readline()[:-1] - if name.startswith("name:") and size.startswith("size:"): - name = name[5:] - size = size[5:] - else: - fh.close() - raise WrongFormat() - ci = ChunkInfo(name) - ci.loaded = True - ci.setSize(size) - while True: - if not fh.readline(): #skip line - break - name = fh.readline()[1:-1] - range = fh.readline()[1:-1] - if name.startswith("name:") and range.startswith("range:"): - name = name[5:] - range = range[6:].split("-") - else: - raise WrongFormat() - - ci.addChunk(name, (long(range[0]), long(range[1]))) - fh.close() - return ci - - def remove(self): - fs_name = fs_encode("%s.chunks" % self.name) - if exists(fs_name): remove(fs_name) - - def getCount(self): - return len(self.chunks) - - def getChunkName(self, index): - return self.chunks[index][0] - - def getChunkRange(self, index): - return self.chunks[index][1] - - -class HTTPChunk(HTTPRequest): - def __init__(self, id, parent, range=None, resume=False): - self.id = id - self.p = parent # HTTPDownload instance - self.range = range # tuple (start, end) - self.resume = resume - self.log = parent.log - - self.size = range[1] - range[0] if range else -1 - self.arrived = 0 - self.lastURL = self.p.referer - - self.c = pycurl.Curl() - - self.header = "" - self.headerParsed = False #indicates if the header has been processed - - self.fp = None #file handle - - self.initHandle() - self.setInterface(self.p.options) - - self.BOMChecked = False # check and remove byte order mark - - self.rep = None - - self.sleep = 0.000 - self.lastSize = 0 - - def __repr__(self): - return "" % (self.id, self.size, self.arrived) - - @property - def cj(self): - return self.p.cj - - def getHandle(self): - """ returns a Curl handle ready to use for perform/multiperform """ - - self.setRequestContext(self.p.url, self.p.get, self.p.post, self.p.referer, self.p.cj) - self.c.setopt(pycurl.WRITEFUNCTION, self.writeBody) - self.c.setopt(pycurl.HEADERFUNCTION, self.writeHeader) - - # request all bytes, since some servers in russia seems to have a defect arihmetic unit - - fs_name = fs_encode(self.p.info.getChunkName(self.id)) - if self.resume: - self.fp = open(fs_name, "ab") - self.arrived = self.fp.tell() - if not self.arrived: - self.arrived = stat(fs_name).st_size - - if self.range: - #do nothing if chunk already finished - if self.arrived + self.range[0] >= self.range[1]: return None - - if self.id == len(self.p.info.chunks) - 1: #as last chunk dont set end range, so we get everything - range = "%i-" % (self.arrived + self.range[0]) - else: - range = "%i-%i" % (self.arrived + self.range[0], min(self.range[1] + 1, self.p.size - 1)) - - self.log.debug("Chunked resume with range %s" % range) - self.c.setopt(pycurl.RANGE, range) - else: - self.log.debug("Resume File from %i" % self.arrived) - self.c.setopt(pycurl.RESUME_FROM, self.arrived) - - else: - if self.range: - if self.id == len(self.p.info.chunks) - 1: # see above - range = "%i-" % self.range[0] - else: - range = "%i-%i" % (self.range[0], min(self.range[1] + 1, self.p.size - 1)) - - self.log.debug("Chunked with range %s" % range) - self.c.setopt(pycurl.RANGE, range) - - self.fp = open(fs_name, "wb") - - return self.c - - def writeHeader(self, buf): - self.header += buf - #@TODO forward headers?, this is possibly unneeeded, when we just parse valid 200 headers - # as first chunk, we will parse the headers - if not self.range and self.header.endswith("\r\n\r\n"): - self.parseHeader() - elif not self.range and buf.startswith("150") and "data connection" in buf.lower(): #: ftp file size parsing - size = search(r"(\d+) bytes", buf) - if size: - self.p.size = int(size.group(1)) - self.p.chunkSupport = True - - self.headerParsed = True - - def writeBody(self, buf): - #ignore BOM, it confuses unrar - if not self.BOMChecked: - if [ord(b) for b in buf[:3]] == [239, 187, 191]: - buf = buf[3:] - self.BOMChecked = True - - size = len(buf) - - self.arrived += size - - self.fp.write(buf) - - if self.p.bucket: - sleep(self.p.bucket.consumed(size)) - else: - # Avoid small buffers, increasing sleep time slowly if buffer size gets smaller - # otherwise reduce sleep time percentual (values are based on tests) - # So in general cpu time is saved without reducing bandwith too much - - if size < self.lastSize: - self.sleep += 0.002 - else: - self.sleep *= 0.7 - - self.lastSize = size - - sleep(self.sleep) - - if self.range and self.arrived > self.size: - return 0 #close if we have enough data - - - def parseHeader(self): - """parse data from recieved header""" - for orgline in self.decodeResponse(self.header).splitlines(): - line = orgline.strip().lower() - - if line.startswith("accept-ranges") and "bytes" in line: - self.p.chunkSupport = True - - if line.startswith("content-disposition") and ("filename=" in line or "filename*=" in line): - if "filename*=" in line: - # extended version according to RFC 6266 and RFC 5987. - encoding = line.partition("*=")[2].partition("''")[0] - name = orgline.partition("''")[2] - name = urllib.unquote(str(name)).decode(charEnc(encoding)) - else: - # basic version, US-ASCII only - name = orgline.partition("filename=")[2] - - name = name.replace('"', "").replace("'", "").replace(";", "").replace("/", "_").strip() - self.p.nameDisposition = name - - self.log.debug("Content-Disposition: %s" % name) - - if not self.resume and line.startswith("content-length"): - self.p.size = int(line.split(":")[1]) - - self.headerParsed = True - - def stop(self): - """The download will not proceed after next call of writeBody""" - self.range = [0, 0] - self.size = 0 - - def resetRange(self): - """ Reset the range, so the download will load all data available """ - self.range = None - - def setRange(self, range): - self.range = range - self.size = range[1] - range[0] - - def flushFile(self): - """ flush and close file """ - self.fp.flush() - fsync(self.fp.fileno()) #make sure everything was written to disk - self.fp.close() #needs to be closed, or merging chunks will fail - - def close(self): - """ closes everything, unusable after this """ - if self.fp: self.fp.close() - self.c.close() - if hasattr(self, "p"): del self.p - - -def charEnc(enc): - return {'utf-8' : "utf_8", - 'iso-8859-1': "latin_1"}.get(enc, "unknown") diff --git a/pyload/network/HTTPDownload.py b/pyload/network/HTTPDownload.py deleted file mode 100644 index 3b2bf26ca..000000000 --- a/pyload/network/HTTPDownload.py +++ /dev/null @@ -1,312 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -from os import remove, fsync -from os.path import dirname -from time import sleep, time -from shutil import move -from logging import getLogger - -import pycurl - -from pyload.network.HTTPChunk import ChunkInfo, HTTPChunk -from pyload.network.HTTPRequest import BadHeader - -from pyload.plugin.Plugin import Abort -from pyload.utils import safe_join, fs_encode - - -class HTTPDownload(object): - """ loads a url http + ftp """ - - def __init__(self, url, filename, get={}, post={}, referer=None, cj=None, bucket=None, - options={}, progress=None, disposition=False): - self.url = url - self.filename = filename #complete file destination, not only name - self.get = get - self.post = post - self.referer = referer - self.cj = cj #cookiejar if cookies are needed - self.bucket = bucket - self.options = options - self.disposition = disposition - # all arguments - - self.abort = False - self.size = 0 - self.nameDisposition = None #will be parsed from content disposition - - self.chunks = [] - - self.log = getLogger("log") - - try: - self.info = ChunkInfo.load(filename) - self.info.resume = True #resume is only possible with valid info file - self.size = self.info.size - self.infoSaved = True - except IOError: - self.info = ChunkInfo(filename) - - self.chunkSupport = True - self.m = pycurl.CurlMulti() - - #needed for speed calculation - self.lastArrived = [] - self.speeds = [] - self.lastSpeeds = [0, 0] - - self.progress = progress - - @property - def speed(self): - last = [sum(x) for x in self.lastSpeeds if x] - return (sum(self.speeds) + sum(last)) / (1 + len(last)) - - @property - def arrived(self): - return sum([c.arrived for c in self.chunks]) - - @property - def percent(self): - if not self.size: return 0 - return (self.arrived * 100) / self.size - - def _copyChunks(self): - init = fs_encode(self.info.getChunkName(0)) #initial chunk name - - if self.info.getCount() > 1: - fo = open(init, "rb+") #first chunkfile - for i in range(1, self.info.getCount()): - #input file - fo.seek( - self.info.getChunkRange(i - 1)[1] + 1) #seek to beginning of chunk, to get rid of overlapping chunks - fname = fs_encode("%s.chunk%d" % (self.filename, i)) - fi = open(fname, "rb") - buf = 32 * 1024 - while True: #copy in chunks, consumes less memory - data = fi.read(buf) - if not data: - break - fo.write(data) - fi.close() - if fo.tell() < self.info.getChunkRange(i)[1]: - fo.close() - remove(init) - self.info.remove() #there are probably invalid chunks - raise Exception("Downloaded content was smaller than expected. Try to reduce download connections.") - remove(fname) #remove chunk - fo.close() - - if self.nameDisposition and self.disposition: - self.filename = safe_join(dirname(self.filename), self.nameDisposition) - - move(init, fs_encode(self.filename)) - self.info.remove() #remove info file - - def download(self, chunks=1, resume=False): - """ returns new filename or None """ - - chunks = max(1, chunks) - resume = self.info.resume and resume - - try: - self._download(chunks, resume) - except pycurl.error, e: - #code 33 - no resume - code = e.args[0] - if resume is True and code == 33: - # try again without resume - self.log.debug("Errno 33 -> Restart without resume") - - #remove old handles - for chunk in self.chunks: - self.closeChunk(chunk) - - return self._download(chunks, False) - else: - raise - finally: - self.close() - - if self.nameDisposition and self.disposition: return self.nameDisposition - return None - - def _download(self, chunks, resume): - if not resume: - self.info.clear() - self.info.addChunk("%s.chunk0" % self.filename, (0, 0)) #create an initial entry - self.info.save() - - self.chunks = [] - - init = HTTPChunk(0, self, None, resume) #initial chunk that will load complete file (if needed) - - self.chunks.append(init) - self.m.add_handle(init.getHandle()) - - lastFinishCheck = 0 - lastTimeCheck = 0 - chunksDone = set() # list of curl handles that are finished - chunksCreated = False - done = False - if self.info.getCount() is 0: # This is a resume, if we were chunked originally assume still can - self.chunkSupport = False - - while 1: - #need to create chunks - if not chunksCreated and self.chunkSupport and self.size: #will be setted later by first chunk - - if not resume: - self.info.setSize(self.size) - self.info.createChunks(chunks) - self.info.save() - - chunks = self.info.getCount() - - init.setRange(self.info.getChunkRange(0)) - - for i in range(1, chunks): - c = HTTPChunk(i, self, self.info.getChunkRange(i), resume) - - handle = c.getHandle() - if handle: - self.chunks.append(c) - self.m.add_handle(handle) - else: - #close immediatly - self.log.debug("Invalid curl handle -> closed") - c.close() - - chunksCreated = True - - while 1: - ret, num_handles = self.m.perform() - if ret != pycurl.E_CALL_MULTI_PERFORM: - break - - t = time() - - # reduce these calls - while lastFinishCheck + 0.5 < t: - # list of failed curl handles - failed = [] - ex = None # save only last exception, we can only raise one anyway - - num_q, ok_list, err_list = self.m.info_read() - for c in ok_list: - chunk = self.findChunk(c) - try: # check if the header implies success, else add it to failed list - chunk.verifyHeader() - except BadHeader, e: - self.log.debug("Chunk %d failed: %s" % (chunk.id + 1, str(e))) - failed.append(chunk) - ex = e - else: - chunksDone.add(c) - - for c in err_list: - curl, errno, msg = c - chunk = self.findChunk(curl) - #test if chunk was finished - if errno != 23 or "0 !=" not in msg: - failed.append(chunk) - ex = pycurl.error(errno, msg) - self.log.debug("Chunk %d failed: %s" % (chunk.id + 1, str(ex))) - continue - - try: # check if the header implies success, else add it to failed list - chunk.verifyHeader() - except BadHeader, e: - self.log.debug("Chunk %d failed: %s" % (chunk.id + 1, str(e))) - failed.append(chunk) - ex = e - else: - chunksDone.add(curl) - if not num_q: # no more infos to get - - # check if init is not finished so we reset download connections - # note that other chunks are closed and downloaded with init too - if failed and init not in failed and init.c not in chunksDone: - self.log.error(_("Download chunks failed, fallback to single connection | %s" % (str(ex)))) - - #list of chunks to clean and remove - to_clean = filter(lambda x: x is not init, self.chunks) - for chunk in to_clean: - self.closeChunk(chunk) - self.chunks.remove(chunk) - remove(fs_encode(self.info.getChunkName(chunk.id))) - - #let first chunk load the rest and update the info file - init.resetRange() - self.info.clear() - self.info.addChunk("%s.chunk0" % self.filename, (0, self.size)) - self.info.save() - elif failed: - raise ex - - lastFinishCheck = t - - if len(chunksDone) >= len(self.chunks): - if len(chunksDone) > len(self.chunks): - self.log.warning("Finished download chunks size incorrect, please report bug.") - done = True #all chunks loaded - - break - - if done: - break #all chunks loaded - - # calc speed once per second, averaging over 3 seconds - if lastTimeCheck + 1 < t: - diff = [c.arrived - (self.lastArrived[i] if len(self.lastArrived) > i else 0) for i, c in - enumerate(self.chunks)] - - self.lastSpeeds[1] = self.lastSpeeds[0] - self.lastSpeeds[0] = self.speeds - self.speeds = [float(a) / (t - lastTimeCheck) for a in diff] - self.lastArrived = [c.arrived for c in self.chunks] - lastTimeCheck = t - self.updateProgress() - - if self.abort: - raise Abort - - #sleep(0.003) #supress busy waiting - limits dl speed to (1 / x) * buffersize - self.m.select(1) - - for chunk in self.chunks: - chunk.flushFile() #make sure downloads are written to disk - - self._copyChunks() - - def updateProgress(self): - if self.progress: - self.progress(self.percent) - - def findChunk(self, handle): - """ linear search to find a chunk (should be ok since chunk size is usually low) """ - for chunk in self.chunks: - if chunk.c == handle: return chunk - - def closeChunk(self, chunk): - try: - self.m.remove_handle(chunk.c) - except pycurl.error, e: - self.log.debug("Error removing chunk: %s" % str(e)) - finally: - chunk.close() - - def close(self): - """ cleanup """ - for chunk in self.chunks: - self.closeChunk(chunk) - - self.chunks = [] - if hasattr(self, "m"): - self.m.close() - del self.m - if hasattr(self, "cj"): - del self.cj - if hasattr(self, "info"): - del self.info diff --git a/pyload/network/HTTPRequest.py b/pyload/network/HTTPRequest.py deleted file mode 100644 index eac03a365..000000000 --- a/pyload/network/HTTPRequest.py +++ /dev/null @@ -1,302 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN - -from __future__ import with_statement - -import pycurl - -from codecs import getincrementaldecoder, lookup, BOM_UTF8 -from urllib import quote, urlencode -from httplib import responses -from logging import getLogger -from cStringIO import StringIO - -from pyload.plugin.Plugin import Abort, Fail - -from pyload.utils import encode - - -def myquote(url): - return quote(encode(url), safe="%/:=&?~#+!$,;'@()*[]") - -def myurlencode(data): - data = dict(data) - return urlencode(dict((encode(x), encode(y)) for x, y in data.iteritems())) - -bad_headers = range(400, 404) + range(405, 418) + range(500, 506) - -class BadHeader(Exception): - def __init__(self, code, content=""): - Exception.__init__(self, "Bad server response: %s %s" % (code, responses[int(code)])) - self.code = code - self.content = content - - -class HTTPRequest(object): - def __init__(self, cookies=None, options=None): - self.c = pycurl.Curl() - self.rep = StringIO() - - self.cj = cookies #cookiejar - - self.lastURL = None - self.lastEffectiveURL = None - self.abort = False - self.code = 0 # last http code - - self.header = "" - - self.headers = [] #temporary request header - - self.initHandle() - self.setInterface(options) - - self.c.setopt(pycurl.WRITEFUNCTION, self.write) - self.c.setopt(pycurl.HEADERFUNCTION, self.writeHeader) - - self.log = getLogger("log") - - - def initHandle(self): - """ sets common options to curl handle """ - self.c.setopt(pycurl.FOLLOWLOCATION, 1) - self.c.setopt(pycurl.MAXREDIRS, 5) - self.c.setopt(pycurl.CONNECTTIMEOUT, 30) - self.c.setopt(pycurl.NOSIGNAL, 1) - self.c.setopt(pycurl.NOPROGRESS, 1) - if hasattr(pycurl, "AUTOREFERER"): - self.c.setopt(pycurl.AUTOREFERER, 1) - self.c.setopt(pycurl.SSL_VERIFYPEER, 0) - self.c.setopt(pycurl.LOW_SPEED_TIME, 60) - self.c.setopt(pycurl.LOW_SPEED_LIMIT, 5) - self.c.setopt(pycurl.USE_SSL, pycurl.CURLUSESSL_TRY) - - #self.c.setopt(pycurl.VERBOSE, 1) - - self.c.setopt(pycurl.USERAGENT, - "Mozilla/5.0 (Windows NT 6.1; Win64; x64;en; rv:5.0) Gecko/20110619 Firefox/5.0") - if pycurl.version_info()[7]: - self.c.setopt(pycurl.ENCODING, "gzip, deflate") - self.c.setopt(pycurl.HTTPHEADER, ["Accept: */*", - "Accept-Language: en-US, en", - "Accept-Charset: ISO-8859-1, utf-8;q=0.7,*;q=0.7", - "Connection: keep-alive", - "Keep-Alive: 300", - "Expect:"]) - - def setInterface(self, options): - - interface, proxy, ipv6 = options["interface"], options["proxies"], options["ipv6"] - - if interface and interface.lower() != "none": - self.c.setopt(pycurl.INTERFACE, str(interface)) - - if proxy: - if proxy["type"] == "socks4": - self.c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS4) - elif proxy["type"] == "socks5": - self.c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS5) - else: - self.c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_HTTP) - - self.c.setopt(pycurl.PROXY, str(proxy["address"])) - self.c.setopt(pycurl.PROXYPORT, proxy["port"]) - - if proxy["username"]: - self.c.setopt(pycurl.PROXYUSERPWD, str("%s:%s" % (proxy["username"], proxy["password"]))) - - if ipv6: - self.c.setopt(pycurl.IPRESOLVE, pycurl.IPRESOLVE_WHATEVER) - else: - self.c.setopt(pycurl.IPRESOLVE, pycurl.IPRESOLVE_V4) - - if "auth" in options: - self.c.setopt(pycurl.USERPWD, str(options["auth"])) - - if "timeout" in options: - self.c.setopt(pycurl.LOW_SPEED_TIME, options["timeout"]) - - - def addCookies(self): - """ put cookies from curl handle to cj """ - if self.cj: - self.cj.addCookies(self.c.getinfo(pycurl.INFO_COOKIELIST)) - - def getCookies(self): - """ add cookies from cj to curl handle """ - if self.cj: - for c in self.cj.getCookies(): - self.c.setopt(pycurl.COOKIELIST, c) - return - - def clearCookies(self): - self.c.setopt(pycurl.COOKIELIST, "") - - def setRequestContext(self, url, get, post, referer, cookies, multipart=False): - """ sets everything needed for the request """ - - url = myquote(url) - - if get: - get = urlencode(get) - url = "%s?%s" % (url, get) - - self.c.setopt(pycurl.URL, url) - self.c.lastUrl = url - - if post: - self.c.setopt(pycurl.POST, 1) - if not multipart: - if type(post) == unicode: - post = str(post) #unicode not allowed - elif type(post) == str: - pass - else: - post = myurlencode(post) - - self.c.setopt(pycurl.POSTFIELDS, post) - else: - post = [(x, encode(y)) for x, y in post.iteritems()] - self.c.setopt(pycurl.HTTPPOST, post) - else: - self.c.setopt(pycurl.POST, 0) - - if referer and self.lastURL: - self.c.setopt(pycurl.REFERER, str(self.lastURL)) - - if cookies: - self.c.setopt(pycurl.COOKIEFILE, "") - self.c.setopt(pycurl.COOKIEJAR, "") - self.getCookies() - - - def load(self, url, get={}, post={}, referer=True, cookies=True, just_header=False, multipart=False, decode=False, follow_location=True, save_cookies=True): - """ load and returns a given page """ - - self.setRequestContext(url, get, post, referer, cookies, multipart) - - self.header = "" - - self.c.setopt(pycurl.HTTPHEADER, self.headers) - - if post: - self.c.setopt(pycurl.POST, 1) - else: - self.c.setopt(pycurl.HTTPGET, 1) - - if not follow_location: - self.c.setopt(pycurl.FOLLOWLOCATION, 0) - - if just_header: - self.c.setopt(pycurl.NOBODY, 1) - - self.c.perform() - rep = self.header if just_header else self.getResponse() - - if not follow_location: - self.c.setopt(pycurl.FOLLOWLOCATION, 1) - - if just_header: - self.c.setopt(pycurl.NOBODY, 0) - - self.c.setopt(pycurl.POSTFIELDS, "") - self.lastEffectiveURL = self.c.getinfo(pycurl.EFFECTIVE_URL) - self.code = self.verifyHeader() - - if save_cookies: - self.addCookies() - - if decode: - rep = self.decodeResponse(rep) - - return rep - - def verifyHeader(self): - """ raise an exceptions on bad headers """ - code = int(self.c.getinfo(pycurl.RESPONSE_CODE)) - if code in bad_headers: - #404 will NOT raise an exception - raise BadHeader(code, self.getResponse()) - return code - - def checkHeader(self): - """ check if header indicates failure""" - return int(self.c.getinfo(pycurl.RESPONSE_CODE)) not in bad_headers - - def getResponse(self): - """ retrieve response from string io """ - if self.rep is None: - return "" - else: - value = self.rep.getvalue() - self.rep.close() - self.rep = StringIO() - return value - - def decodeResponse(self, rep): - """ decode with correct encoding, relies on header """ - header = self.header.splitlines() - encoding = "utf8" # default encoding - - for line in header: - line = line.lower().replace(" ", "") - if not line.startswith("content-type:") or\ - ("text" not in line and "application" not in line): - continue - - none, delemiter, charset = line.rpartition("charset=") - if delemiter: - charset = charset.split(";") - if charset: - encoding = charset[0] - - try: - #self.log.debug("Decoded %s" % encoding ) - if lookup(encoding).name == 'utf-8' and rep.startswith(BOM_UTF8): - encoding = 'utf-8-sig' - - decoder = getincrementaldecoder(encoding)("replace") - rep = decoder.decode(rep, True) - - #TODO: html_unescape as default - - except LookupError: - self.log.debug("No Decoder foung for %s" % encoding) - - except Exception: - self.log.debug("Error when decoding string from %s." % encoding) - - return rep - - def write(self, buf): - """ writes response """ - if self.rep.tell() > 1000000 or self.abort: - rep = self.getResponse() - - if self.abort: - raise Abort - - with open("response.dump", "wb") as f: - f.write(rep) - raise Fail("Loaded url exceeded size limit") - else: - self.rep.write(buf) - - def writeHeader(self, buf): - """ writes header """ - self.header += buf - - def putHeader(self, name, value): - self.headers.append("%s: %s" % (name, value)) - - def clearHeaders(self): - self.headers = [] - - def close(self): - """ cleanup, unusable after this """ - self.rep.close() - if hasattr(self, "cj"): - del self.cj - if hasattr(self, "c"): - self.c.close() - del self.c diff --git a/pyload/network/JsEngine.py b/pyload/network/JsEngine.py deleted file mode 100644 index 2e98fa37d..000000000 --- a/pyload/network/JsEngine.py +++ /dev/null @@ -1,256 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: vuolter - -import subprocess -import sys - -from os import path -from urllib import quote - -from pyload.utils import encode, decode, uniqify - - -class JsEngine(object): - """ JS Engine superclass """ - - def __init__(self, core, engine=None): - self.core = core - self.engine = None #: Engine Instance - - if not engine: - engine = self.core.config.get("general", "jsengine") - - if engine != "auto" and self.set(engine) is False: - engine = "auto" - self.core.log.warning("JS Engine set to \"auto\" for safely") - - if engine == "auto": - for E in self.find(): - if self.set(E) is True: - break - else: - self.core.log.error("No JS Engine available") - - - @classmethod - def find(cls): - """ Check if there is any engine available """ - return [E for E in ENGINES if E.find()] - - - def get(self, engine=None): - """ Convert engine name (string) to relative JSE class (AbstractEngine extended) """ - if not engine: - JSE = self.engine - - elif isinstance(engine, basestring): - engine_name = engine.lower() - for E in ENGINES: - if E.__name == engine_name: #: doesn't check if E(NGINE) is available, just convert string to class - JSE = E - break - else: - raise ValueError("JSE") - - elif issubclass(engine, AbstractEngine): - JSE = engine - - else: - raise TypeError("engine") - - return JSE - - - def set(self, engine): - """ Set engine name (string) or JSE class (AbstractEngine extended) as default engine """ - if isinstance(engine, basestring): - return self.set(self.get(engine)) - - elif issubclass(engine, AbstractEngine) and engine.find(): - self.engine = engine - return True - - else: - return False - - - def eval(self, script, engine=None): #: engine can be a jse name """string""" or an AbstractEngine """class""" - JSE = self.get(engine) - - if not JSE: - raise TypeError("engine") - - script = encode(script) - - out, err = JSE.eval(script) - - results = [out] - - if self.core.config.get("general", "debug"): - if err: - self.core.log.debug(JSE.__name + ":", err) - - engines = self.find() - engines.remove(JSE) - for E in engines: - out, err = E.eval(script) - res = err or out - self.core.log.debug(E.__name + ":", res) - results.append(res) - - if len(results) > 1 and len(uniqify(results)) > 1: - self.core.log.warning("JS output of two or more engines mismatch") - - return results[0] - - -class AbstractEngine(object): - """ JSE base class """ - - __name = "" - - - def __init__(self): - self.setup() - self.available = self.find() - - - def setup(self): - pass - - - @classmethod - def find(cls): - """ Check if the engine is available """ - try: - __import__(cls.__name) - except Exception: - try: - out, err = cls().eval("print(23+19)") - except Exception: - res = False - else: - res = out == "42" - else: - res = True - - return res - - - def _eval(args): - if not self.available: - return None, "JS Engine \"%s\" not found" % self.__name - - try: - p = subprocess.Popen(args, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - bufsize=-1) - return map(lambda x: x.strip(), p.communicate()) - except Exception, e: - return None, e - - - def eval(script): - raise NotImplementedError - - -class Pyv8Engine(AbstractEngine): - - __name = "pyv8" - - - def eval(self, script): - if not self.available: - return None, "JS Engine \"%s\" not found" % self.__name - - try: - rt = PyV8.JSContext() - rt.enter() - res = rt.eval(script), None #@TODO: parse stderr - except Exception, e: - res = None, e - - return res - - -class CommonEngine(AbstractEngine): - - __name = "js" - - - def setup(self): - subprocess.Popen(["js", "-v"], bufsize=-1).communicate() - - - def eval(self, script): - script = "print(eval(unescape('%s')))" % quote(script) - args = ["js", "-e", script] - return self._eval(args) - - -class NodeEngine(AbstractEngine): - - __name = "nodejs" - - - def setup(self): - subprocess.Popen(["node", "-v"], bufsize=-1).communicate() - - - def eval(self, script): - script = "console.log(eval(unescape('%s')))" % quote(script) - args = ["node", "-e", script] - return self._eval(args) - - -class RhinoEngine(AbstractEngine): - - __name = "rhino" - - - def setup(self): - jspath = [ - "/usr/share/java*/js.jar", - "js.jar", - path.join(pypath, "js.jar") - ] - for p in jspath: - if path.exists(p): - self.path = p - break - else: - self.path = "" - - - def eval(self, script): - script = "print(eval(unescape('%s')))" % quote(script) - args = ["java", "-cp", self.path, "org.mozilla.javascript.tools.shell.Main", "-e", script] - res = decode(self._eval(args)) - try: - return res.encode("ISO-8859-1") - finally: - return res - - -class JscEngine(AbstractEngine): - - __name = "javascriptcore" - - - def setup(self): - jspath = "/System/Library/Frameworks/JavaScriptCore.framework/Resources/jsc" - self.path = jspath if path.exists(jspath) else "" - - - def eval(self, script): - script = "print(eval(unescape('%s')))" % quote(script) - args = [self.path, "-e", script] - return self._eval(args) - - -#@NOTE: Priority ordered -ENGINES = [CommonEngine, Pyv8Engine, NodeEngine, RhinoEngine] - -if sys.platform == "darwin": - ENGINES.insert(JscEngine) diff --git a/pyload/network/RequestFactory.py b/pyload/network/RequestFactory.py deleted file mode 100644 index 579eafea7..000000000 --- a/pyload/network/RequestFactory.py +++ /dev/null @@ -1,121 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: RaNaN, mkaay - -from threading import Lock - -from pyload.network.Browser import Browser -from pyload.network.Bucket import Bucket -from pyload.network.HTTPRequest import HTTPRequest -from pyload.network.CookieJar import CookieJar - -from pyload.network.XDCCRequest import XDCCRequest - -class RequestFactory(object): - def __init__(self, core): - self.lock = Lock() - self.core = core - self.bucket = Bucket() - self.updateBucket() - self.cookiejars = {} - - def iface(self): - return self.core.config["download"]["interface"] - - def getRequest(self, pluginName, account=None, type="HTTP"): - self.lock.acquire() - - if type == "XDCC": - return XDCCRequest(proxies=self.getProxies()) - - req = Browser(self.bucket, self.getOptions()) - - if account: - cj = self.getCookieJar(pluginName, account) - req.setCookieJar(cj) - else: - req.setCookieJar(CookieJar(pluginName)) - - self.lock.release() - return req - - def getHTTPRequest(self, **kwargs): - """ returns a http request, dont forget to close it ! """ - options = self.getOptions() - options.update(kwargs) # submit kwargs as additional options - return HTTPRequest(CookieJar(None), options) - - def getURL(self, *args, **kwargs): - """ see HTTPRequest for argument list """ - cj = None - - if 'cookies' in kwargs: - if isinstance(kwargs['cookies'], CookieJar): - cj = kwargs['cookies'] - elif isinstance(kwargs['cookies'], list): - cj = CookieJar(None) - for cookie in kwargs['cookies']: - if isinstance(cookie, tuple) and len(cookie) == 3: - cj.setCookie(*cookie) - - h = HTTPRequest(cj, self.getOptions()) - try: - rep = h.load(*args, **kwargs) - finally: - h.close() - - return rep - - def getCookieJar(self, pluginName, account=None): - if (pluginName, account) in self.cookiejars: - return self.cookiejars[(pluginName, account)] - - cj = CookieJar(pluginName, account) - self.cookiejars[(pluginName, account)] = cj - return cj - - def getProxies(self): - """ returns a proxy list for the request classes """ - if not self.core.config["proxy"]["proxy"]: - return {} - else: - type = "http" - setting = self.core.config["proxy"]["type"].lower() - if setting == "socks4": type = "socks4" - elif setting == "socks5": type = "socks5" - - username = None - if self.core.config["proxy"]["username"] and self.core.config["proxy"]["username"].lower() != "none": - username = self.core.config["proxy"]["username"] - - pw = None - if self.core.config["proxy"]["password"] and self.core.config["proxy"]["password"].lower() != "none": - pw = self.core.config["proxy"]["password"] - - return { - "type": type, - "address": self.core.config["proxy"]["address"], - "port": self.core.config["proxy"]["port"], - "username": username, - "password": pw, - } - - def getOptions(self): - """returns options needed for pycurl""" - return {"interface": self.iface(), - "proxies": self.getProxies(), - "ipv6": self.core.config["download"]["ipv6"]} - - def updateBucket(self): - """ set values in the bucket according to settings""" - if not self.core.config["download"]["limit_speed"]: - self.bucket.setRate(-1) - else: - self.bucket.setRate(self.core.config["download"]["max_speed"] * 1024) - -# needs pyreq in global namespace -def getURL(*args, **kwargs): - return pyreq.getURL(*args, **kwargs) - - -def getRequest(*args, **kwargs): - return pyreq.getHTTPRequest() diff --git a/pyload/network/XDCCRequest.py b/pyload/network/XDCCRequest.py deleted file mode 100644 index c49f418c4..000000000 --- a/pyload/network/XDCCRequest.py +++ /dev/null @@ -1,144 +0,0 @@ -# -*- coding: utf-8 -*- -# @author: jeix - -import socket -import re - -from os import remove -from os.path import exists - -from time import time - -import struct -from select import select - -from pyload.plugin.Plugin import Abort - - -class XDCCRequest(object): - def __init__(self, timeout=30, proxies={}): - - self.proxies = proxies - self.timeout = timeout - - self.filesize = 0 - self.recv = 0 - self.speed = 0 - - self.abort = False - - def createSocket(self): - # proxytype = None - # proxy = None - # if self.proxies.has_key("socks5"): - # proxytype = socks.PROXY_TYPE_SOCKS5 - # proxy = self.proxies["socks5"] - # elif self.proxies.has_key("socks4"): - # proxytype = socks.PROXY_TYPE_SOCKS4 - # proxy = self.proxies["socks4"] - # if proxytype: - # sock = socks.socksocket() - # t = _parse_proxy(proxy) - # sock.setproxy(proxytype, addr=t[3].split(":")[0], port=int(t[3].split(":")[1]), username=t[1], password=t[2]) - # else: - # sock = socket.socket() - # return sock - - return socket.socket() - - def download(self, ip, port, filename, irc, progress=None): - - ircbuffer = "" - lastUpdate = time() - cumRecvLen = 0 - - dccsock = self.createSocket() - - dccsock.settimeout(self.timeout) - dccsock.connect((ip, port)) - - if exists(filename): - i = 0 - nameParts = filename.rpartition(".") - while True: - newfilename = "%s-%d%s%s" % (nameParts[0], i, nameParts[1], nameParts[2]) - i += 1 - - if not exists(newfilename): - filename = newfilename - break - - fh = open(filename, "wb") - - # recv loop for dcc socket - while True: - if self.abort: - dccsock.close() - fh.close() - remove(filename) - raise Abort - - self._keepAlive(irc, ircbuffer) - - data = dccsock.recv(4096) - dataLen = len(data) - self.recv += dataLen - - cumRecvLen += dataLen - - now = time() - timespan = now - lastUpdate - if timespan > 1: - self.speed = cumRecvLen / timespan - cumRecvLen = 0 - lastUpdate = now - - if progress: - progress(self.percent) - - if not data: - break - - fh.write(data) - - # acknowledge data by sending number of recceived bytes - dccsock.send(struct.pack('!I', self.recv)) - - dccsock.close() - fh.close() - - return filename - - def _keepAlive(self, sock, *readbuffer): - fdset = select([sock], [], [], 0) - if sock not in fdset[0]: - return - - readbuffer += sock.recv(1024) - temp = readbuffer.split("\n") - readbuffer = temp.pop() - - for line in temp: - line = line.rstrip() - first = line.split() - if first[0] == "PING": - sock.send("PONG %s\r\n" % first[1]) - - def abortDownloads(self): - self.abort = True - - @property - def size(self): - return self.filesize - - @property - def arrived(self): - return self.recv - - @property - def percent(self): - if not self.filesize: return 0 - return (self.recv * 100) / self.filesize - - def close(self): - pass diff --git a/pyload/network/__init__.py b/pyload/network/__init__.py deleted file mode 100644 index 40a96afc6..000000000 --- a/pyload/network/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/pyload/plugin/Account.py b/pyload/plugin/Account.py deleted file mode 100644 index f8014908f..000000000 --- a/pyload/plugin/Account.py +++ /dev/null @@ -1,307 +0,0 @@ -# -*- coding: utf-8 -*- - -from random import choice -from time import time -from traceback import print_exc -from threading import RLock - -from pyload.plugin.Plugin import Base -from pyload.utils import compare_time, parseFileSize, lock - - -class WrongPassword(Exception): - pass - - -class Account(Base): - """ - Base class for every Account plugin. - Just overwrite `login` and cookies will be stored and account becomes accessible in\ - associated hoster plugin. Plugin should also provide `loadAccountInfo` - """ - __name__ = "Account" - __type__ = "account" - __version__ = "0.03" - - __description__ = """Base account plugin""" - __license__ = "GPLv3" - __authors__ = [("mkaay", "mkaay@mkaay.de")] - - - #: after that time (in minutes) pyload will relogin the account - login_timeout = 10 * 60 - #: after that time (in minutes) account data will be reloaded - info_threshold = 10 * 60 - - - def __init__(self, manager, accounts): - Base.__init__(self, manager.core) - - self.manager = manager - self.accounts = {} - self.infos = {} #: cache for account information - self.lock = RLock() - self.timestamps = {} - - self.init() - - self.setAccounts(accounts) - - - def init(self): - pass - - - def login(self, user, data, req): - """login into account, the cookies will be saved so user can be recognized - - :param user: loginname - :param data: data dictionary - :param req: `Request` instance - """ - pass - - - @lock - def _login(self, user, data): - # set timestamp for login - self.timestamps[user] = time() - - req = self.getAccountRequest(user) - try: - self.login(user, data, req) - except WrongPassword: - self.logWarning( - _("Could not login with account %(user)s | %(msg)s") % {"user": user, - "msg": _("Wrong Password")}) - success = data['valid'] = False - except Exception, e: - self.logWarning( - _("Could not login with account %(user)s | %(msg)s") % {"user": user, - "msg": e}) - success = data['valid'] = False - if self.core.debug: - print_exc() - else: - success = True - finally: - if req: - req.close() - return success - - - def relogin(self, user): - req = self.getAccountRequest(user) - if req: - req.cj.clear() - req.close() - if user in self.infos: - del self.infos[user] #delete old information - - return self._login(user, self.accounts[user]) - - - def setAccounts(self, accounts): - self.accounts = accounts - for user, data in self.accounts.iteritems(): - self._login(user, data) - self.infos[user] = {} - - - def updateAccounts(self, user, password=None, options={}): - """ updates account and return true if anything changed """ - - if user in self.accounts: - self.accounts[user]['valid'] = True #do not remove or accounts will not login - if password: - self.accounts[user]['password'] = password - self.relogin(user) - return True - if options: - before = self.accounts[user]['options'] - self.accounts[user]['options'].update(options) - return self.accounts[user]['options'] != before - else: - self.accounts[user] = {"password": password, "options": options, "valid": True} - self._login(user, self.accounts[user]) - return True - - - def removeAccount(self, user): - if user in self.accounts: - del self.accounts[user] - if user in self.infos: - del self.infos[user] - if user in self.timestamps: - del self.timestamps[user] - - - @lock - def getAccountInfo(self, name, force=False): - """retrieve account infos for an user, do **not** overwrite this method!\\ - just use it to retrieve infos in hoster plugins. see `loadAccountInfo` - - :param name: username - :param force: reloads cached account information - :return: dictionary with information - """ - data = Account.loadAccountInfo(self, name) - - if force or name not in self.infos: - self.logDebug("Get Account Info for %s" % name) - req = self.getAccountRequest(name) - - try: - infos = self.loadAccountInfo(name, req) - if not type(infos) == dict: - raise Exception("Wrong return format") - except Exception, e: - infos = {"error": str(e)} - print_exc() - - if req: - req.close() - - self.logDebug("Account Info: %s" % infos) - - infos['timestamp'] = time() - self.infos[name] = infos - elif "timestamp" in self.infos[name] and self.infos[name][ - "timestamp"] + self.info_threshold * 60 < time(): - self.logDebug("Reached timeout for account data") - self.scheduleRefresh(name) - - data.update(self.infos[name]) - return data - - - def isPremium(self, user): - info = self.getAccountInfo(user) - return info['premium'] - - - def loadAccountInfo(self, name, req=None): - """this should be overwritten in account plugin,\ - and retrieving account information for user - - :param name: - :param req: `Request` instance - :return: - """ - return {"validuntil" : None, #: -1 for unlimited - "login" : name, - # "password" : self.accounts[name]['password'], #: commented due security reason - "options" : self.accounts[name]['options'], - "valid" : self.accounts[name]['valid'], - "trafficleft": None, #: in bytes, -1 for unlimited - "maxtraffic" : None, - "premium" : None, - "timestamp" : 0, #: time this info was retrieved - "type" : self.__name__} - - - def getAllAccounts(self, force=False): - return [self.getAccountInfo(user, force) for user, data in self.accounts.iteritems()] - - - def getAccountRequest(self, user=None): - if not user: - user, data = self.selectAccount() - if not user: - return None - - req = self.core.requestFactory.getRequest(self.__name__, user) - return req - - - def getAccountCookies(self, user=None): - if not user: - user, data = self.selectAccount() - if not user: - return None - - cj = self.core.requestFactory.getCookieJar(self.__name__, user) - return cj - - - def getAccountData(self, user): - return self.accounts[user] - - - def selectAccount(self): - """ returns an valid account name and data""" - usable = [] - for user, data in self.accounts.iteritems(): - if not data['valid']: continue - - if "time" in data['options'] and data['options']['time']: - time_data = "" - try: - time_data = data['options']['time'][0] - start, end = time_data.split("-") - if not compare_time(start.split(":"), end.split(":")): - continue - except Exception: - self.logWarning(_("Your Time %s has wrong format, use: 1:22-3:44") % time_data) - - if user in self.infos: - if "validuntil" in self.infos[user]: - if self.infos[user]['validuntil'] > 0 and time() > self.infos[user]['validuntil']: - continue - if "trafficleft" in self.infos[user]: - if self.infos[user]['trafficleft'] == 0: - continue - - usable.append((user, data)) - - if not usable: return None, None - return choice(usable) - - - def canUse(self): - return False if self.selectAccount() == (None, None) else True - - - def parseTraffic(self, value, unit=None): #: return bytes - if not unit and not isinstance(value, basestring): - unit = "KB" - return parseFileSize(value, unit) - - - def wrongPassword(self): - raise WrongPassword - - - def empty(self, user): - if user in self.infos: - self.logWarning(_("Account %s has not enough traffic, checking again in 30min") % user) - - self.infos[user].update({"trafficleft": 0}) - self.scheduleRefresh(user, 30 * 60) - - - def expired(self, user): - if user in self.infos: - self.logWarning(_("Account %s is expired, checking again in 1h") % user) - - self.infos[user].update({"validuntil": time() - 1}) - self.scheduleRefresh(user, 60 * 60) - - - def scheduleRefresh(self, user, time=0, force=True): - """ add task to refresh account info to sheduler """ - self.logDebug("Scheduled Account refresh for %s in %s seconds." % (user, time)) - self.core.scheduler.addJob(time, self.getAccountInfo, [user, force]) - - - @lock - def checkLogin(self, user): - """ checks if user is still logged in """ - if user in self.timestamps: - if self.login_timeout > 0 and self.timestamps[user] + self.login_timeout * 60 < time(): - self.logDebug("Reached login timeout for %s" % user) - return self.relogin(user) - else: - return True - else: - return False diff --git a/pyload/plugin/Addon.py b/pyload/plugin/Addon.py deleted file mode 100644 index ca36fe4ae..000000000 --- a/pyload/plugin/Addon.py +++ /dev/null @@ -1,185 +0,0 @@ -# -*- coding: utf-8 -*- - -from traceback import print_exc - -from pyload.plugin.Plugin import Base -from pyload.utils import has_method - - -class Expose(object): - """ used for decoration to declare rpc services """ - - def __new__(cls, f, *args, **kwargs): - addonManager.addRPC(f.__module__, f.func_name, f.func_doc) - return f - - -def threaded(fn): - - def run(*args,**kwargs): - addonManager.startThread(fn, *args, **kwargs) - - return run - - -class Addon(Base): - """ - Base class for addon plugins. - """ - __name__ = "Addon" - __type__ = "addon" - __version__ = "0.03" - - __config__ = [] #: [("name", "type", "desc", "default")] - - __description__ = """Base addon/hook plugin""" - __license__ = "GPLv3" - __authors__ = [("mkaay", "mkaay@mkaay.de"), - ("RaNaN", "RaNaN@pyload.org")] - - - #: automatically register event listeners for functions, attribute will be deleted dont use it yourself - event_map = {} - - # Deprecated alternative to event_map - #: List of events the plugin can handle, name the functions exactly like eventname. - event_list = [] #@NOTE: dont make duplicate entries in event_map - - - def __init__(self, core, manager): - Base.__init__(self, core) - - #: Provide information in dict here, usable by API `getInfo` - self.info = {} - - #: Callback of periodical job task, used by AddonManager - self.cb = None - self.interval = 60 - - #: `AddonManager` - self.manager = manager - - #register events - if self.event_map: - for event, funcs in self.event_map.iteritems(): - if type(funcs) in (list, tuple): - for f in funcs: - self.manager.addEvent(event, getattr(self,f)) - else: - self.manager.addEvent(event, getattr(self,funcs)) - - #delete for various reasons - self.event_map = None - - if self.event_list: - for f in self.event_list: - self.manager.addEvent(f, getattr(self,f)) - - self.event_list = None - - self.setup() - - # self.initPeriodical() - - - def initPeriodical(self, delay=0, threaded=False): - self.cb = self.core.scheduler.addJob(delay, self._periodical, args=[threaded], threaded=threaded) - - - def _periodical(self, threaded): - if self.interval < 0: - self.cb = None - return - - try: - self.periodical() - - except Exception, e: - self.logError(_("Error executing addon: %s") % e) - if self.core.debug: - print_exc() - - self.cb = self.core.scheduler.addJob(self.interval, self._periodical, threaded=threaded) - - - def __repr__(self): - return "" % self.__name__ - - - def setup(self): - """ more init stuff if needed """ - pass - - - def deactivate(self): - """ called when addon was deactivated """ - if has_method(self.__class__, "unload"): - self.unload() - - def unload(self): # Deprecated, use method deactivate() instead - pass - - - def isActivated(self): - """ checks if addon is activated""" - return self.core.config.getPlugin(self.__name__, "activated") - - - # Event methods - overwrite these if needed - def activate(self): - """ called when addon was activated """ - if has_method(self.__class__, "coreReady"): - self.coreReady() - - def coreReady(self): # Deprecated, use method activate() instead - pass - - - def exit(self): - """ called by core.shutdown just before pyLoad exit """ - if has_method(self.__class__, "coreExiting"): - self.coreExiting() - - def coreExiting(self): # Deprecated, use method exit() instead - pass - - - def downloadPreparing(self, pyfile): - pass - - - def downloadFinished(self, pyfile): - pass - - - def downloadFailed(self, pyfile): - pass - - - def packageFinished(self, pypack): - pass - - - def beforeReconnecting(self, ip): - pass - - - def afterReconnecting(self, ip): - pass - - - def periodical(self): - pass - - - def captchaTask(self, task): - """ new captcha task for the plugin, it MUST set the handler and timeout or will be ignored """ - pass - - - def captchaCorrect(self, task): - pass - - - def captchaInvalid(self, task): - pass diff --git a/pyload/plugin/Captcha.py b/pyload/plugin/Captcha.py deleted file mode 100644 index ace488994..000000000 --- a/pyload/plugin/Captcha.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pyload.plugin.Plugin import Plugin - - -class Captcha(Plugin): - __name__ = "Captcha" - __type__ = "captcha" - __version__ = "0.14" - - __description__ = """Base captcha service plugin""" - __license__ = "GPLv3" - __authors__ = [("pyLoad Team", "admin@pyload.org")] - - - KEY_PATTERN = None - - key = None #: last key detected - - - def __init__(self, plugin): - self.plugin = plugin - - - def detect_key(self, html=None): - if not html: - if hasattr(self.plugin, "html") and self.plugin.html: - html = self.plugin.html - else: - errmsg = _("%s html not found") % self.__name__ - self.plugin.error(errmsg) - raise TypeError(errmsg) - - m = re.search(self.KEY_PATTERN, html) - if m: - self.key = m.group("KEY") - self.plugin.logDebug("%s key: %s" % (self.__name__, self.key)) - return self.key - else: - self.plugin.logDebug("%s key not found" % self.__name__) - return None - - - def challenge(self, key=None): - raise NotImplementedError - - - def result(self, server, challenge): - raise NotImplementedError diff --git a/pyload/plugin/Container.py b/pyload/plugin/Container.py deleted file mode 100644 index bfc5713a7..000000000 --- a/pyload/plugin/Container.py +++ /dev/null @@ -1,66 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement - -import re - -from os import remove -from os.path import basename, exists - -from pyload.plugin.internal.Crypter import Crypter -from pyload.utils import safe_join - - -class Container(Crypter): - __name__ = "Container" - __type__ = "container" - __version__ = "0.01" - - __pattern__ = r'^unmatchable$' - __config__ = [] #: [("name", "type", "desc", "default")] - - __description__ = """Base container decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("mkaay", "mkaay@mkaay.de")] - - - def preprocessing(self, thread): - """prepare""" - - self.setup() - self.thread = thread - - self.loadToDisk() - - self.decrypt(self.pyfile) - self.deleteTmp() - - self.createPackages() - - - def loadToDisk(self): - """loads container to disk if its stored remotely and overwrite url, - or check existent on several places at disk""" - - if self.pyfile.url.startswith("http"): - self.pyfile.name = re.findall("([^\/=]+)", self.pyfile.url)[-1] - content = self.load(self.pyfile.url) - self.pyfile.url = safe_join(self.core.config['general']['download_folder'], self.pyfile.name) - try: - with open(self.pyfile.url, "wb") as f: - f.write(content) - except IOError, e: - self.fail(str(e)) - - else: - self.pyfile.name = basename(self.pyfile.url) - if not exists(self.pyfile.url): - if exists(safe_join(pypath, self.pyfile.url)): - self.pyfile.url = safe_join(pypath, self.pyfile.url) - else: - self.fail(_("File not exists")) - - - def deleteTmp(self): - if self.pyfile.name.startswith("tmp_"): - remove(self.pyfile.url) diff --git a/pyload/plugin/Crypter.py b/pyload/plugin/Crypter.py deleted file mode 100644 index f93ee254a..000000000 --- a/pyload/plugin/Crypter.py +++ /dev/null @@ -1,107 +0,0 @@ -# -*- coding: utf-8 -*- - -from urlparse import urlparse - -from pyload.plugin.Plugin import Plugin -from pyload.utils import decode, safe_filename - - -class Crypter(Plugin): - __name__ = "Crypter" - __type__ = "crypter" - __version__ = "0.05" - - __pattern__ = r'^unmatchable$' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config['general']['folder_per_package'] - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """Base decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - html = None #: last html loaded - - - def __init__(self, pyfile): - #: Put all packages here. It's a list of tuples like: ( name, [list of links], folder ) - self.packages = [] - - #: List of urls, pyLoad will generate packagenames - self.urls = [] - - Plugin.__init__(self, pyfile) - - - def process(self, pyfile): - """ main method """ - - self.decrypt(pyfile) - - if self.urls: - self.generatePackages() - - elif not self.packages: - self.error(_("No link extracted"), "decrypt") - - self.createPackages() - - - def decrypt(self, pyfile): - raise NotImplementedError - - - def generatePackages(self): - """ generate new packages from self.urls """ - - packages = map(lambda name, links: (name, links, None), self.core.api.generatePackages(self.urls).iteritems()) - self.packages.extend(packages) - - - def createPackages(self): - """ create new packages from self.packages """ - - package_folder = self.pyfile.package().folder - package_password = self.pyfile.package().password - package_queue = self.pyfile.package().queue - - folder_per_package = self.core.config['general']['folder_per_package'] - try: - use_subfolder = self.getConfig('use_subfolder') - except Exception: - use_subfolder = folder_per_package - try: - subfolder_per_package = self.getConfig('subfolder_per_package') - except Exception: - subfolder_per_package = True - - for pack in self.packages: - name, links, folder = pack - - self.logDebug("Parsed package: %s" % name, - "%d links" % len(links), - "Saved to folder: %s" % folder if folder else "Saved to download folder") - - links = map(decode, links) - - pid = self.core.api.addPackage(name, links, package_queue) - - if package_password: - self.core.api.setPackageData(pid, {"password": package_password}) - - setFolder = lambda x: self.core.api.setPackageData(pid, {"folder": x or ""}) #: Workaround to do not break API addPackage method - - if use_subfolder: - if not subfolder_per_package: - setFolder(package_folder) - self.logDebug("Set package %(name)s folder to: %(folder)s" % {"name": name, "folder": folder}) - - elif not folder_per_package or name != folder: - if not folder: - folder = urlparse(name).path.split("/")[-1] - - setFolder(safe_filename(folder)) - self.logDebug("Set package %(name)s folder to: %(folder)s" % {"name": name, "folder": folder}) - - elif folder_per_package: - setFolder(None) diff --git a/pyload/plugin/Hoster.py b/pyload/plugin/Hoster.py deleted file mode 100644 index 2d43ee845..000000000 --- a/pyload/plugin/Hoster.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Plugin import Plugin - - -def getInfo(self): - #result = [ .. (name, size, status, url) .. ] - return - - -class Hoster(Plugin): - __name__ = "Hoster" - __type__ = "hoster" - __version__ = "0.02" - - __pattern__ = r'^unmatchable$' - __config__ = [] #: [("name", "type", "desc", "default")] - - __description__ = """Base hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("mkaay", "mkaay@mkaay.de")] diff --git a/pyload/plugin/OCR.py b/pyload/plugin/OCR.py deleted file mode 100644 index 8e60737b6..000000000 --- a/pyload/plugin/OCR.py +++ /dev/null @@ -1,315 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement - -try: - from PIL import Image, GifImagePlugin, JpegImagePlugin, PngImagePlugin, TiffImagePlugin -except ImportError: - import Image, GifImagePlugin, JpegImagePlugin, PngImagePlugin, TiffImagePlugin - -import logging -import subprocess - -from os.path import abspath, join - - -class OCR(object): - __name__ = "OCR" - __type__ = "ocr" - __version__ = "0.10" - - __description__ = """Base OCR plugin""" - __license__ = "GPLv3" - __authors__ = [("pyLoad Team", "admin@pyload.org")] - - - def __init__(self): - self.logger = logging.getLogger("log") - - - def load_image(self, image): - self.image = Image.open(image) - self.pixels = self.image.load() - self.result_captcha = '' - - - def unload(self): - """delete all tmp images""" - pass - - - def threshold(self, value): - self.image = self.image.point(lambda a: a * value + 10) - - - def run(self, command): - """Run a command""" - - popen = subprocess.Popen(command, bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - popen.wait() - output = popen.stdout.read() + " | " + popen.stderr.read() - popen.stdout.close() - popen.stderr.close() - self.logger.debug("Tesseract ReturnCode %s Output: %s" % (popen.returncode, output)) - - - def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True): - #tmpTif = tempfile.NamedTemporaryFile(suffix=".tif") - try: - tmpTif = open(join("tmp", "tmpTif_%s.tif" % self.__name__), "wb") - tmpTif.close() - - #tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") - tmpTxt = open(join("tmp", "tmpTxt_%s.txt" % self.__name__), "wb") - tmpTxt.close() - - except IOError, e: - self.logError(e) - return - - self.logger.debug("save tiff") - self.image.save(tmpTif.name, 'TIFF') - - if os.name == "nt": - tessparams = [join(pypath, "tesseract", "tesseract.exe")] - else: - tessparams = ['tesseract'] - - tessparams.extend([abspath(tmpTif.name), abspath(tmpTxt.name).replace(".txt", "")] ) - - if subset and (digits or lowercase or uppercase): - #tmpSub = tempfile.NamedTemporaryFile(suffix=".subset") - with open(join("tmp", "tmpSub_%s.subset" % self.__name__), "wb") as tmpSub: - tmpSub.write("tessedit_char_whitelist ") - - if digits: - tmpSub.write("0123456789") - if lowercase: - tmpSub.write("abcdefghijklmnopqrstuvwxyz") - if uppercase: - tmpSub.write("ABCDEFGHIJKLMNOPQRSTUVWXYZ") - - tmpSub.write("\n") - tessparams.append("nobatch") - tessparams.append(abspath(tmpSub.name)) - - self.logger.debug("run tesseract") - self.run(tessparams) - self.logger.debug("read txt") - - try: - with open(tmpTxt.name, 'r') as f: - self.result_captcha = f.read().replace("\n", "") - except Exception: - self.result_captcha = "" - - self.logger.debug(self.result_captcha) - try: - os.remove(tmpTif.name) - os.remove(tmpTxt.name) - if subset and (digits or lowercase or uppercase): - os.remove(tmpSub.name) - except Exception: - pass - - - def get_captcha(self, name): - raise NotImplementedError - - - def to_greyscale(self): - if self.image.mode != 'L': - self.image = self.image.convert('L') - - self.pixels = self.image.load() - - - def eval_black_white(self, limit): - self.pixels = self.image.load() - w, h = self.image.size - for x in xrange(w): - for y in xrange(h): - if self.pixels[x, y] > limit: - self.pixels[x, y] = 255 - else: - self.pixels[x, y] = 0 - - - def clean(self, allowed): - pixels = self.pixels - - w, h = self.image.size - - for x in xrange(w): - for y in xrange(h): - if pixels[x, y] == 255: - continue - # No point in processing white pixels since we only want to remove black pixel - count = 0 - - try: - if pixels[x - 1, y - 1] != 255: - count += 1 - if pixels[x - 1, y] != 255: - count += 1 - if pixels[x - 1, y + 1] != 255: - count += 1 - if pixels[x, y + 1] != 255: - count += 1 - if pixels[x + 1, y + 1] != 255: - count += 1 - if pixels[x + 1, y] != 255: - count += 1 - if pixels[x + 1, y - 1] != 255: - count += 1 - if pixels[x, y - 1] != 255: - count += 1 - except Exception: - pass - - # not enough neighbors are dark pixels so mark this pixel - # to be changed to white - if count < allowed: - pixels[x, y] = 1 - - # second pass: this time set all 1's to 255 (white) - for x in xrange(w): - for y in xrange(h): - if pixels[x, y] == 1: - pixels[x, y] = 255 - - self.pixels = pixels - - - def derotate_by_average(self): - """rotate by checking each angle and guess most suitable""" - - w, h = self.image.size - pixels = self.pixels - - for x in xrange(w): - for y in xrange(h): - if pixels[x, y] == 0: - pixels[x, y] = 155 - - highest = {} - counts = {} - - for angle in xrange(-45, 45): - - tmpimage = self.image.rotate(angle) - - pixels = tmpimage.load() - - w, h = self.image.size - - for x in xrange(w): - for y in xrange(h): - if pixels[x, y] == 0: - pixels[x, y] = 255 - - count = {} - - for x in xrange(w): - count[x] = 0 - for y in xrange(h): - if pixels[x, y] == 155: - count[x] += 1 - - sum = 0 - cnt = 0 - - for x in count.values(): - if x != 0: - sum += x - cnt += 1 - - avg = sum / cnt - counts[angle] = cnt - highest[angle] = 0 - for x in count.values(): - if x > highest[angle]: - highest[angle] = x - - highest[angle] = highest[angle] - avg - - hkey = 0 - hvalue = 0 - - for key, value in highest.iteritems(): - if value > hvalue: - hkey = key - hvalue = value - - self.image = self.image.rotate(hkey) - pixels = self.image.load() - - for x in xrange(w): - for y in xrange(h): - if pixels[x, y] == 0: - pixels[x, y] = 255 - - if pixels[x, y] == 155: - pixels[x, y] = 0 - - self.pixels = pixels - - - def split_captcha_letters(self): - captcha = self.image - started = False - letters = [] - width, height = captcha.size - bottomY, topY = 0, height - pixels = captcha.load() - - for x in xrange(width): - black_pixel_in_col = False - for y in xrange(height): - if pixels[x, y] != 255: - if not started: - started = True - firstX = x - lastX = x - - if y > bottomY: - bottomY = y - if y < topY: - topY = y - if x > lastX: - lastX = x - - black_pixel_in_col = True - - if black_pixel_in_col is False and started is True: - rect = (firstX, topY, lastX, bottomY) - new_captcha = captcha.crop(rect) - - w, h = new_captcha.size - if w > 5 and h > 5: - letters.append(new_captcha) - - started = False - bottomY, topY = 0, height - - return letters - - - def correct(self, values, var=None): - if var: - result = var - else: - result = self.result_captcha - - for key, item in values.iteritems(): - - if key.__class__ == str: - result = result.replace(key, item) - else: - for expr in key: - result = result.replace(expr, item) - - if var: - return result - else: - self.result_captcha = result diff --git a/pyload/plugin/Plugin.py b/pyload/plugin/Plugin.py deleted file mode 100644 index 0a9c647fb..000000000 --- a/pyload/plugin/Plugin.py +++ /dev/null @@ -1,753 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement - -from time import time, sleep -from random import randint - -import os -from os import remove, makedirs, chmod, stat -from os.path import exists, join - -if os.name != "nt": - from os import chown - from pwd import getpwnam - from grp import getgrnam - -from itertools import islice -from traceback import print_exc -from urlparse import urlparse - -from pyload.utils import fs_decode, fs_encode, safe_filename, safe_join - - -def chunks(iterable, size): - it = iter(iterable) - item = list(islice(it, size)) - while item: - yield item - item = list(islice(it, size)) - - -class Abort(Exception): - """ raised when aborted """ - - -class Fail(Exception): - """ raised when failed """ - - -class Reconnect(Exception): - """ raised when reconnected """ - - -class Retry(Exception): - """ raised when start again from beginning """ - - -class SkipDownload(Exception): - """ raised when download should be skipped """ - - -class Base(object): - """ - A Base class with log/config/db methods *all* plugin types can use - """ - - def __init__(self, core): - #: Core instance - self.core = core - - - def _log(self, type, args): - msg = " | ".join([encode(a).strip() for a in args if a]) - logger = getattr(self.core.log, type) - logger("%s: %s" % (self.__name__, msg or _("%s MARK" % type.upper()))) - - - def logDebug(self, *args): - if self.core.debug: - return self._log("debug", args) - - - def logInfo(self, *args): - return self._log("info", args) - - - def logWarning(self, *args): - return self._log("warning", args) - - - def logError(self, *args): - return self._log("error", args) - - - def logCritical(self, *args): - return self._log("critical", args) - - - #: Deprecated method - def setConf(self, option, value): - """ see `setConfig` """ - self.setConfig(option, value) - - - def setConfig(self, option, value): - """ Set config value for current plugin - - :param option: - :param value: - :return: - """ - self.core.config.setPlugin(self.__name__, option, value) - - - #: Deprecated method - def getConf(self, option): - """ see `getConfig` """ - return self.getConfig(option) - - - def getConfig(self, option): - """ Returns config value for current plugin - - :param option: - :return: - """ - return self.core.config.getPlugin(self.__name__, option) - - - def setStorage(self, key, value): - """ Saves a value persistently to the database """ - self.core.db.setStorage(self.__name__, key, value) - - - def store(self, key, value): - """ same as `setStorage` """ - self.core.db.setStorage(self.__name__, key, value) - - - def getStorage(self, key=None, default=None): - """ Retrieves saved value or dict of all saved entries if key is None """ - if key: - return self.core.db.getStorage(self.__name__, key) or default - return self.core.db.getStorage(self.__name__, key) - - - def retrieve(self, *args, **kwargs): - """ same as `getStorage` """ - return self.getStorage(*args, **kwargs) - - - def delStorage(self, key): - """ Delete entry in db """ - self.core.db.delStorage(self.__name__, key) - - -class Plugin(Base): - """ - Base plugin for hoster/crypter. - Overwrite `process` / `decrypt` in your subclassed plugin. - """ - __name__ = "Plugin" - __type__ = "hoster" - __version__ = "0.07" - - __pattern__ = r'^unmatchable$' - __config__ = [] #: [("name", "type", "desc", "default")] - - __description__ = """Base plugin""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("spoob", "spoob@pyload.org"), - ("mkaay", "mkaay@mkaay.de")] - - - info = {} #: file info dict - - - def __init__(self, pyfile): - Base.__init__(self, pyfile.m.core) - - #: engage wan reconnection - self.wantReconnect = False - - #: enable simultaneous processing of multiple downloads - self.multiDL = True - self.limitDL = 0 - - #: chunk limit - self.chunkLimit = 1 - self.resumeDownload = False - - #: time() + wait in seconds - self.waitUntil = 0 - self.waiting = False - - #: captcha reader instance - self.ocr = None - - #: account handler instance, see :py:class:`Account` - self.account = pyfile.m.core.accountManager.getAccountPlugin(self.__name__) - - #: premium status - self.premium = False - #: username/login - self.user = None - - if self.account and not self.account.canUse(): - self.account = None - - if self.account: - self.user, data = self.account.selectAccount() - #: Browser instance, see `network.Browser` - self.req = self.account.getAccountRequest(self.user) - self.chunkLimit = -1 # chunk limit, -1 for unlimited - #: enables resume (will be ignored if server dont accept chunks) - self.resumeDownload = True - self.multiDL = True #every hoster with account should provide multiple downloads - #: premium status - self.premium = self.account.isPremium(self.user) - else: - self.req = pyfile.m.core.requestFactory.getRequest(self.__name__) - - #: associated pyfile instance, see `PyFile` - self.pyfile = pyfile - - self.thread = None # holds thread in future - - #: location where the last call to download was saved - self.lastDownload = "" - #: re match of the last call to `checkDownload` - self.lastCheck = None - - #: js engine, see `JsEngine` - self.js = self.core.js - - #: captcha task - self.cTask = None - - self.html = None #@TODO: Move to hoster class in 0.4.10 - self.retries = 0 - - self.init() - - - def getChunkCount(self): - if self.chunkLimit <= 0: - return self.core.config['download']['chunks'] - return min(self.core.config['download']['chunks'], self.chunkLimit) - - - def __call__(self): - return self.__name__ - - - def init(self): - """initialize the plugin (in addition to `__init__`)""" - pass - - - def setup(self): - """ setup for enviroment and other things, called before downloading (possibly more than one time)""" - pass - - - def preprocessing(self, thread): - """ handles important things to do before starting """ - self.thread = thread - - if self.account: - self.account.checkLogin(self.user) - else: - self.req.clearCookies() - - self.setup() - - self.pyfile.setStatus("starting") - - return self.process(self.pyfile) - - - def process(self, pyfile): - """the 'main' method of every plugin, you **have to** overwrite it""" - raise NotImplementedError - - - def resetAccount(self): - """ dont use account and retry download """ - self.account = None - self.req = self.core.requestFactory.getRequest(self.__name__) - self.retry() - - - def checksum(self, local_file=None): - """ - return codes: - 0 - checksum ok - 1 - checksum wrong - 5 - can't get checksum - 10 - not implemented - 20 - unknown error - """ - #@TODO checksum check addon - - return True, 10 - - - def setReconnect(self, reconnect): - reconnect = bool(reconnect) - self.logDebug("Set wantReconnect to: %s (previous: %s)" % (reconnect, self.wantReconnect)) - self.wantReconnect = reconnect - - - def setWait(self, seconds, reconnect=None): - """Set a specific wait time later used with `wait` - - :param seconds: wait time in seconds - :param reconnect: True if a reconnect would avoid wait time - """ - wait_time = int(seconds) + 1 - wait_until = time() + wait_time - - self.logDebug("Set waitUntil to: %f (previous: %f)" % (wait_until, self.pyfile.waitUntil), - "Wait: %d seconds" % wait_time) - - self.pyfile.waitUntil = wait_until - - if reconnect is not None: - self.setReconnect(reconnect) - - - def wait(self, seconds=None, reconnect=None): - """ waits the time previously set """ - - pyfile = self.pyfile - - if seconds is not None: - self.setWait(seconds) - - if reconnect is not None: - self.setReconnect(reconnect) - - self.waiting = True - - status = pyfile.status - pyfile.setStatus("waiting") - - self.logInfo(_("Wait: %d seconds") % (pyfile.waitUntil - time()), - _("Reconnect: %s") % self.wantReconnect) - - if self.account: - self.logDebug("Ignore reconnection due account logged") - - while pyfile.waitUntil > time(): - if pyfile.abort: - self.abort() - - sleep(1) - else: - while pyfile.waitUntil > time(): - self.thread.m.reconnecting.wait(2) - - if pyfile.abort: - self.abort() - - if self.thread.m.reconnecting.isSet(): - self.waiting = False - self.wantReconnect = False - raise Reconnect - - sleep(1) - - self.waiting = False - - pyfile.status = status - - - def fail(self, reason): - """ fail and give reason """ - raise Fail(reason) - - - def abort(self, reason=""): - """ abort and give reason """ - if reason: - self.pyfile.error = str(reason) - raise Abort - - - def error(self, reason="", type=""): - if not reason and not type: - type = "unknown" - - msg = _("%s error") % _(type.strip().capitalize()) if type else _("Error") - msg += ": " + reason.strip() if reason else "" - msg += _(" | Plugin may be out of date") - - raise Fail(msg) - - - def offline(self, reason=""): - """ fail and indicate file is offline """ - if reason: - self.pyfile.error = str(reason) - raise Fail("offline") - - - def tempOffline(self, reason=""): - """ fail and indicates file ist temporary offline, the core may take consequences """ - if reason: - self.pyfile.error = str(reason) - raise Fail("temp. offline") - - - def retry(self, max_tries=5, wait_time=1, reason=""): - """Retries and begin again from the beginning - - :param max_tries: number of maximum retries - :param wait_time: time to wait in seconds - :param reason: reason for retrying, will be passed to fail if max_tries reached - """ - if 0 < max_tries <= self.retries: - self.error(reason or _("Max retries reached"), "retry") - - self.wait(wait_time, False) - - self.retries += 1 - raise Retry(reason) - - - def invalidCaptcha(self): - self.logError(_("Invalid captcha")) - if self.cTask: - self.cTask.invalid() - - - def correctCaptcha(self): - self.logInfo(_("Correct captcha")) - if self.cTask: - self.cTask.correct() - - - def decryptCaptcha(self, url, get={}, post={}, cookies=False, forceUser=False, imgtype='jpg', - result_type='textual', timeout=290): - """ Loads a captcha and decrypts it with ocr, plugin, user input - - :param url: url of captcha image - :param get: get part for request - :param post: post part for request - :param cookies: True if cookies should be enabled - :param forceUser: if True, ocr is not used - :param imgtype: Type of the Image - :param result_type: 'textual' if text is written on the captcha\ - or 'positional' for captcha where the user have to click\ - on a specific region on the captcha - - :return: result of decrypting - """ - - img = self.load(url, get=get, post=post, cookies=cookies) - - id = ("%.2f" % time())[-6:].replace(".", "") - - with open(join("tmp", "tmpCaptcha_%s_%s.%s" % (self.__name__, id, imgtype)), "wb") as tmpCaptcha: - tmpCaptcha.write(img) - - has_plugin = self.__name__ in self.core.pluginManager.ocrPlugins - - if self.core.captcha: - Ocr = self.core.pluginManager.loadClass("ocr", self.__name__) - else: - Ocr = None - - if Ocr and not forceUser: - sleep(randint(3000, 5000) / 1000.0) - if self.pyfile.abort: - self.abort() - - ocr = Ocr() - result = ocr.get_captcha(tmpCaptcha.name) - else: - captchaManager = self.core.captchaManager - task = captchaManager.newTask(img, imgtype, tmpCaptcha.name, result_type) - self.cTask = task - captchaManager.handleCaptcha(task, timeout) - - while task.isWaiting(): - if self.pyfile.abort: - captchaManager.removeTask(task) - self.abort() - sleep(1) - - captchaManager.removeTask(task) - - if task.error and has_plugin: #ignore default error message since the user could use OCR - self.fail(_("Pil and tesseract not installed and no Client connected for captcha decrypting")) - elif task.error: - self.fail(task.error) - elif not task.result: - self.fail(_("No captcha result obtained in appropiate time by any of the plugins")) - - result = task.result - self.logDebug("Received captcha result: %s" % result) - - if not self.core.debug: - try: - remove(tmpCaptcha.name) - except Exception: - pass - - return result - - - def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, decode=False, follow_location=True, save_cookies=True): - """Load content at url and returns it - - :param url: - :param get: - :param post: - :param ref: - :param cookies: - :param just_header: If True only the header will be retrieved and returned as dict - :param decode: Wether to decode the output according to http header, should be True in most cases - :param follow_location: If True follow location else not - :param save_cookies: If True saves received cookies else discard them - :return: Loaded content - """ - if self.pyfile.abort: - self.abort() - - if not url: - self.fail(_("No url given")) - - url = encode(url).strip() #@NOTE: utf8 vs decode -> please use decode attribute in all future plugins - - if self.core.debug: - self.logDebug("Load url: " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")]) - - res = self.req.load(url, get, post, ref, cookies, just_header, decode=decode, follow_location=follow_location, save_cookies=save_cookies) - - if decode: - res = encode(res) - - if self.core.debug: - from inspect import currentframe - - frame = currentframe() - framefile = safe_join("tmp", self.__name__, "%s_line%s.dump.html" % (frame.f_back.f_code.co_name, frame.f_back.f_lineno)) - try: - if not exists(join("tmp", self.__name__)): - makedirs(join("tmp", self.__name__)) - - with open(framefile, "wb") as f: - del frame #: delete the frame or it wont be cleaned - f.write(res) - except IOError, e: - self.logError(e) - - if just_header: - #parse header - header = {"code": self.req.code} - for line in res.splitlines(): - line = line.strip() - if not line or ":" not in line: continue - - key, none, value = line.partition(":") - key = key.strip().lower() - value = value.strip() - - if key in header: - if type(header[key]) == list: - header[key].append(value) - else: - header[key] = [header[key], value] - else: - header[key] = value - res = header - - return res - - - def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=False): - """Downloads the content at url to download folder - - :param url: - :param get: - :param post: - :param ref: - :param cookies: - :param disposition: if True and server provides content-disposition header\ - the filename will be changed if needed - :return: The location where the file was saved - """ - if self.pyfile.abort: - self.abort() - - if not url: - self.fail(_("No url given")) - - url = encode(url).strip() - - if self.core.debug: - self.logDebug("Download url: " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")]) - - self.checkForSameFiles() - - self.pyfile.setStatus("downloading") - - download_folder = self.core.config['general']['download_folder'] - - location = safe_join(download_folder, self.pyfile.package().folder) - - if not exists(location): - try: - makedirs(location, int(self.core.config['permission']['folder'], 8)) - - if self.core.config['permission']['change_dl'] and os.name != "nt": - uid = getpwnam(self.core.config['permission']['user'])[2] - gid = getgrnam(self.core.config['permission']['group'])[2] - chown(location, uid, gid) - - except Exception, e: - self.fail(e) - - # convert back to unicode - location = fs_decode(location) - name = safe_filename(self.pyfile.name) - - filename = join(location, name) - - self.core.addonManager.dispatchEvent("download-start", self.pyfile, url, filename) - - try: - newname = self.req.httpDownload(url, filename, get=get, post=post, ref=ref, cookies=cookies, - chunks=self.getChunkCount(), resume=self.resumeDownload, - progressNotify=self.pyfile.setProgress, disposition=disposition) - finally: - self.pyfile.size = self.req.size - - if newname: - newname = urlparse(newname).path.split("/")[-1] - - if disposition and newname != name: - self.logInfo(_("%(name)s saved as %(newname)s") % {"name": name, "newname": newname}) - self.pyfile.name = newname - filename = join(location, newname) - - fs_filename = fs_encode(filename) - - if self.core.config['permission']['change_file']: - try: - chmod(fs_filename, int(self.core.config['permission']['file'], 8)) - except Exception, e: - self.logWarning(_("Setting file mode failed"), e) - - if self.core.config['permission']['change_dl'] and os.name != "nt": - try: - uid = getpwnam(self.core.config['permission']['user'])[2] - gid = getgrnam(self.core.config['permission']['group'])[2] - chown(fs_filename, uid, gid) - - except Exception, e: - self.logWarning(_("Setting User and Group failed"), e) - - self.lastDownload = filename - return self.lastDownload - - - def checkDownload(self, rules, api_size=0, max_size=50000, delete=True, read_size=0): - """ checks the content of the last downloaded file, re match is saved to `lastCheck` - - :param rules: dict with names and rules to match (compiled regexp or strings) - :param api_size: expected file size - :param max_size: if the file is larger then it wont be checked - :param delete: delete if matched - :param read_size: amount of bytes to read from files larger then max_size - :return: dictionary key of the first rule that matched - """ - lastDownload = fs_encode(self.lastDownload) - if not exists(lastDownload): - return None - - size = stat(lastDownload) - size = size.st_size - - if api_size and api_size <= size: return None - elif size > max_size and not read_size: return None - self.logDebug("Download Check triggered") - - with open(lastDownload, "rb") as f: - content = f.read(read_size if read_size else -1) - - #produces encoding errors, better log to other file in the future? - #self.logDebug("Content: %s" % content) - for name, rule in rules.iteritems(): - if isinstance(rule, basestring): - if rule in content: - if delete: - remove(lastDownload) - return name - elif hasattr(rule, "search"): - m = rule.search(content) - if m: - if delete: - remove(lastDownload) - self.lastCheck = m - return name - - - def getPassword(self): - """ get the password the user provided in the package""" - password = self.pyfile.package().password - if not password: return "" - return password - - - def checkForSameFiles(self, starting=False): - """ checks if same file was/is downloaded within same package - - :param starting: indicates that the current download is going to start - :raises SkipDownload: - """ - - pack = self.pyfile.package() - - for pyfile in self.core.files.cache.values(): - if pyfile != self.pyfile and pyfile.name == self.pyfile.name and pyfile.package().folder == pack.folder: - if pyfile.status in (0, 12): #finished or downloading - raise SkipDownload(pyfile.pluginname) - elif pyfile.status in ( - 5, 7) and starting: #a download is waiting/starting and was appenrently started before - raise SkipDownload(pyfile.pluginname) - - download_folder = self.core.config['general']['download_folder'] - location = safe_join(download_folder, pack.folder, self.pyfile.name) - - if starting and self.core.config['download']['skip_existing'] and exists(location): - size = os.stat(location).st_size - if size >= self.pyfile.size: - raise SkipDownload("File exists") - - pyfile = self.core.db.findDuplicates(self.pyfile.id, self.pyfile.package().folder, self.pyfile.name) - if pyfile: - if exists(location): - raise SkipDownload(pyfile[0]) - - self.logDebug("File %s not skipped, because it does not exists." % self.pyfile.name) - - - def clean(self): - """ clean everything and remove references """ - if hasattr(self, "pyfile"): - del self.pyfile - - if hasattr(self, "req"): - self.req.close() - del self.req - - if hasattr(self, "thread"): - del self.thread - - if hasattr(self, "html"): - del self.html diff --git a/pyload/plugin/__init__.py b/pyload/plugin/__init__.py deleted file mode 100644 index 40a96afc6..000000000 --- a/pyload/plugin/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/pyload/plugin/account/AlldebridCom.py b/pyload/plugin/account/AlldebridCom.py deleted file mode 100644 index f9906bd9d..000000000 --- a/pyload/plugin/account/AlldebridCom.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -import xml.dom.minidom as dom - -from time import time -from urllib import urlencode - -from BeautifulSoup import BeautifulSoup - -from pyload.plugin.Account import Account - - -class AlldebridCom(Account): - __name__ = "AlldebridCom" - __type__ = "account" - __version__ = "0.22" - - __description__ = """AllDebrid.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("Andy Voigt", "spamsales@online.de")] - - - def loadAccountInfo(self, user, req): - data = self.getAccountData(user) - page = req.load("http://www.alldebrid.com/account/") - soup = BeautifulSoup(page) - #Try to parse expiration date directly from the control panel page (better accuracy) - try: - time_text = soup.find('div', attrs={'class': 'remaining_time_text'}).strong.string - self.logDebug("Account expires in: %s" % time_text) - p = re.compile('\d+') - exp_data = p.findall(time_text) - exp_time = time() + int(exp_data[0]) * 24 * 60 * 60 + int( - exp_data[1]) * 60 * 60 + (int(exp_data[2]) - 1) * 60 - #Get expiration date from API - except Exception: - data = self.getAccountData(user) - page = req.load("http://www.alldebrid.com/api.php", - get={'action': "info_user", 'login': user, 'pw': data['password']}) - self.logDebug(page) - xml = dom.parseString(page) - exp_time = time() + int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue) * 24 * 60 * 60 - account_info = {"validuntil": exp_time, "trafficleft": -1} - return account_info - - - def login(self, user, data, req): - urlparams = urlencode({'action': 'login', 'login_login': user, 'login_password': data['password']}) - page = req.load("http://www.alldebrid.com/register/?%s" % urlparams) - - if "This login doesn't exist" in page: - self.wrongPassword() - - if "The password is not valid" in page: - self.wrongPassword() - - if "Invalid captcha" in page: - self.wrongPassword() diff --git a/pyload/plugin/account/BayfilesCom.py b/pyload/plugin/account/BayfilesCom.py deleted file mode 100644 index 760c29d4e..000000000 --- a/pyload/plugin/account/BayfilesCom.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- coding: utf-8 -*- - -from time import time - -from pyload.plugin.Account import Account -from pyload.utils import json_loads - - -class BayfilesCom(Account): - __name__ = "BayfilesCom" - __type__ = "account" - __version__ = "0.03" - - __description__ = """Bayfiles.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - def loadAccountInfo(self, user, req): - for _i in xrange(2): - res = json_loads(req.load("http://api.bayfiles.com/v1/account/info")) - self.logDebug(res) - if not res['error']: - break - self.logWarning(res['error']) - self.relogin(user) - - return {"premium": bool(res['premium']), "trafficleft": -1, - "validuntil": res['expires'] if res['expires'] >= int(time()) else -1} - - - def login(self, user, data, req): - res = json_loads(req.load("http://api.bayfiles.com/v1/account/login/%s/%s" % (user, data['password']))) - self.logDebug(res) - if res['error']: - self.logError(res['error']) - self.wrongPassword() diff --git a/pyload/plugin/account/BillionuploadsCom.py b/pyload/plugin/account/BillionuploadsCom.py deleted file mode 100644 index a3325c427..000000000 --- a/pyload/plugin/account/BillionuploadsCom.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class BillionuploadsCom(XFSAccount): - __name__ = "BillionuploadsCom" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Billionuploads.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "billionuploads.com" diff --git a/pyload/plugin/account/BitshareCom.py b/pyload/plugin/account/BitshareCom.py deleted file mode 100644 index aabab9e19..000000000 --- a/pyload/plugin/account/BitshareCom.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account - - -class BitshareCom(Account): - __name__ = "BitshareCom" - __type__ = "account" - __version__ = "0.12" - - __description__ = """Bitshare account plugin""" - __license__ = "GPLv3" - __authors__ = [("Paul King", "")] - - - def loadAccountInfo(self, user, req): - page = req.load("http://bitshare.com/mysettings.html") - - if "\"http://bitshare.com/myupgrade.html\">Free" in page: - return {"validuntil": -1, "trafficleft": -1, "premium": False} - - if not '' in page: - self.logWarning(_("Activate direct Download in your Bitshare Account")) - - return {"validuntil": -1, "trafficleft": -1, "premium": True} - - - def login(self, user, data, req): - page = req.load("http://bitshare.com/login.html", - post={"user": user, "password": data['password'], "submit": "Login"}, cookies=True) - if "login" in req.lastEffectiveURL: - self.wrongPassword() diff --git a/pyload/plugin/account/CatShareNet.py b/pyload/plugin/account/CatShareNet.py deleted file mode 100644 index 4c1cd00d7..000000000 --- a/pyload/plugin/account/CatShareNet.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from time import mktime, strptime - -from pyload.plugin.Account import Account - - -class CatShareNet(Account): - __name__ = "CatShareNet" - __type__ = "account" - __version__ = "0.01" - - __description__ = """CatShareNet account plugin""" - __license__ = "GPLv3" - __authors__ = [("prOq", "")] - - - PREMIUM_PATTERN = r'class="nav-collapse collapse pull-right">[\s\w<>=-."/:]*\sz.\s*
  • .*\s*(.*?)[\s\w<>/]*href="/logout"' - VALID_UNTIL_PATTERN = r'
    [\s\w<>=-":;]*.*?(.*?)' - - - def loadAccountInfo(self, user, req): - premium = False - validuntil = -1 - - html = req.load("http://catshare.net/", decode=True) - - try: - m = re.search(self.PREMIUM_PATTERN, html) - if "Premium" in m.group(1): - premium = True - except Exception: - pass - - try: - m = re.search(self.VALID_UNTIL_PATTERN, html) - expiredate = m.group(1) - if "-" not in expiredate: - validuntil = mktime(strptime(expiredate, "%d.%m.%Y")) - except Exception: - pass - - return {'premium': premium, 'trafficleft': -1, 'validuntil': validuntil} - - - def login(self, user, data, req): - html = req.load("http://catshare.net/login", - post={'user_email': user, - 'user_password': data['password'], - 'remindPassword': 0, - 'user[submit]': "Login"}) - - if not 'Wyloguj' in html: - self.wrongPassword() diff --git a/pyload/plugin/account/CramitIn.py b/pyload/plugin/account/CramitIn.py deleted file mode 100644 index 21503f625..000000000 --- a/pyload/plugin/account/CramitIn.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class CramitIn(XFSAccount): - __name__ = "CramitIn" - __type__ = "account" - __version__ = "0.03" - - __description__ = """Cramit.in account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - HOSTER_DOMAIN = "cramit.in" diff --git a/pyload/plugin/account/CzshareCom.py b/pyload/plugin/account/CzshareCom.py deleted file mode 100644 index 6608efd90..000000000 --- a/pyload/plugin/account/CzshareCom.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -from time import mktime, strptime -import re - -from pyload.plugin.Account import Account - - -class CzshareCom(Account): - __name__ = "CzshareCom" - __type__ = "account" - __version__ = "0.14" - - __description__ = """Czshare.com account plugin, now Sdilej.cz""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] - - - CREDIT_LEFT_PATTERN = r'\s*([\d ,]+) (KiB|MiB|GiB)\s*([^<]*)\s*' - - - def loadAccountInfo(self, user, req): - html = req.load("http://sdilej.cz/prehled_kreditu/") - - m = re.search(self.CREDIT_LEFT_PATTERN, html) - if m is None: - return {"validuntil": 0, "trafficleft": 0} - else: - credits = float(m.group(1).replace(' ', '').replace(',', '.')) - credits = credits * 1024 ** {'KiB': 0, 'MiB': 1, 'GiB': 2}[m.group(2)] - validuntil = mktime(strptime(m.group(3), '%d.%m.%y %H:%M')) - return {"validuntil": validuntil, "trafficleft": credits} - - - def login(self, user, data, req): - html = req.load('https://sdilej.cz/index.php', post={ - "Prihlasit": "Prihlasit", - "login-password": data['password'], - "login-name": user - }) - - if '", html).group(1) - - validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S"))) - - return {"validuntil": validuntil, "trafficleft": -1} - - - def login(self, user, data, req): - html = req.load("https://dfiles.eu/de/login.php", get={"return": "/de/gold/payment.php"}, - post={"login": user, "password": data['password']}) - if r'
    Sie haben eine falsche Benutzername-Passwort-Kombination verwendet.
    ' in html: - self.wrongPassword() diff --git a/pyload/plugin/account/DropboxCom.py b/pyload/plugin/account/DropboxCom.py deleted file mode 100644 index 341bb761d..000000000 --- a/pyload/plugin/account/DropboxCom.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo - - -class DropboxCom(SimpleHoster): - __name__ = "DropboxCom" - __type__ = "hoster" - __version__ = "0.03" - - __pattern__ = r'https?://(?:www\.)?dropbox\.com/.+' - - __description__ = """Dropbox.com hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - - - NAME_PATTERN = r'Dropbox - (?P<N>.+?)<' - SIZE_PATTERN = r' ·  (?P<S>[\d.,]+) (?P<U>[\w^_]+)' - - OFFLINE_PATTERN = r'<title>Dropbox - (404|Shared link error)<' - - COOKIES = [("dropbox.com", "lang", "en")] - - - def setup(self): - self.multiDL = True - self.chunkLimit = 1 - self.resumeDownload = True - - - def handleFree(self): - self.download(self.pyfile.url, get={'dl': "1"}) - - check = self.checkDownload({'html': re.compile("html")}) - if check == "html": - self.error(_("Downloaded file is an html page")) - - -getInfo = create_getInfo(DropboxCom) diff --git a/pyload/plugin/account/EasybytezCom.py b/pyload/plugin/account/EasybytezCom.py deleted file mode 100644 index c7d717474..000000000 --- a/pyload/plugin/account/EasybytezCom.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class EasybytezCom(XFSAccount): - __name__ = "EasybytezCom" - __type__ = "account" - __version__ = "0.12" - - __description__ = """EasyBytez.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("guidobelix", "guidobelix@hotmail.it")] - - - HOSTER_DOMAIN = "easybytez.com" diff --git a/pyload/plugin/account/EuroshareEu.py b/pyload/plugin/account/EuroshareEu.py deleted file mode 100644 index 2d9288ba8..000000000 --- a/pyload/plugin/account/EuroshareEu.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -from time import mktime, strptime -import re - -from pyload.plugin.Account import Account - - -class EuroshareEu(Account): - __name__ = "EuroshareEu" - __type__ = "account" - __version__ = "0.01" - - __description__ = """Euroshare.eu account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - def loadAccountInfo(self, user, req): - self.relogin(user) - html = req.load("http://euroshare.eu/customer-zone/settings/") - - m = re.search('id="input_expire_date" value="(\d+\.\d+\.\d+ \d+:\d+)"', html) - if m is None: - premium, validuntil = False, -1 - else: - premium = True - validuntil = mktime(strptime(m.group(1), "%d.%m.%Y %H:%M")) - - return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} - - - def login(self, user, data, req): - html = req.load('http://euroshare.eu/customer-zone/login/', post={ - "trvale": "1", - "login": user, - "password": data['password'] - }, decode=True) - - if u">Nesprávne prihlasovacie meno alebo heslo" in html: - self.wrongPassword() diff --git a/pyload/plugin/account/FastixRu.py b/pyload/plugin/account/FastixRu.py deleted file mode 100644 index 0f2ac71ce..000000000 --- a/pyload/plugin/account/FastixRu.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account -from pyload.utils import json_loads - - -class FastixRu(Account): - __name__ = "FastixRu" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Fastix account plugin""" - __license__ = "GPLv3" - __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] - - - def loadAccountInfo(self, user, req): - data = self.getAccountData(user) - page = json_loads(req.load("http://fastix.ru/api_v2/", get={'apikey': data['api'], 'sub': "getaccountdetails"})) - - points = page['points'] - kb = float(points) * 1024 ** 2 / 1000 - - if points > 0: - account_info = {"validuntil": -1, "trafficleft": kb} - else: - account_info = {"validuntil": None, "trafficleft": None, "premium": False} - return account_info - - - def login(self, user, data, req): - page = req.load("http://fastix.ru/api_v2/", - get={'sub': "get_apikey", 'email': user, 'password': data['password']}) - api = json_loads(page) - api = api['apikey'] - data['api'] = api - if "error_code" in page: - self.wrongPassword() diff --git a/pyload/plugin/account/FastshareCz.py b/pyload/plugin/account/FastshareCz.py deleted file mode 100644 index 8fe98438b..000000000 --- a/pyload/plugin/account/FastshareCz.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pyload.plugin.Account import Account -from pyload.utils import parseFileSize - - -class FastshareCz(Account): - __name__ = "FastshareCz" - __type__ = "account" - __version__ = "0.05" - - __description__ = """Fastshare.cz account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] - - - CREDIT_PATTERN = r'My account\s*\((.+?)\)' - - - def loadAccountInfo(self, user, req): - validuntil = None - trafficleft = None - premium = None - - html = req.load("http://www.fastshare.cz/user", decode=True) - - m = re.search(self.CREDIT_PATTERN, html) - if m: - trafficleft = self.parseTraffic(m.group(1)) - - if trafficleft: - premium = True - validuntil = -1 - else: - premium = False - - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} - - - def login(self, user, data, req): - req.cj.setCookie("fastshare.cz", "lang", "en") - - req.load('http://www.fastshare.cz/login') # Do not remove or it will not login - - html = req.load("http://www.fastshare.cz/sql.php", - post={'login': user, 'heslo': data['password']}, - decode=True) - - if ">Wrong username or password" in html: - self.wrongPassword() diff --git a/pyload/plugin/account/File4SafeCom.py b/pyload/plugin/account/File4SafeCom.py deleted file mode 100644 index 4f311aa4c..000000000 --- a/pyload/plugin/account/File4SafeCom.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class File4safeCom(XFSAccount): - __name__ = "File4safeCom" - __type__ = "account" - __version__ = "0.04" - - __description__ = """File4safe.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - HOSTER_DOMAIN = "file4safe.com" - - LOGIN_FAIL_PATTERN = r'input_login' diff --git a/pyload/plugin/account/FileParadoxIn.py b/pyload/plugin/account/FileParadoxIn.py deleted file mode 100644 index 02b923519..000000000 --- a/pyload/plugin/account/FileParadoxIn.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class FileParadoxIn(XFSAccount): - __name__ = "FileParadoxIn" - __type__ = "account" - __version__ = "0.02" - - __description__ = """FileParadox.in account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "fileparadox.in" diff --git a/pyload/plugin/account/FilecloudIo.py b/pyload/plugin/account/FilecloudIo.py deleted file mode 100644 index 8169bfdce..000000000 --- a/pyload/plugin/account/FilecloudIo.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account -from pyload.utils import json_loads - - -class FilecloudIo(Account): - __name__ = "FilecloudIo" - __type__ = "account" - __version__ = "0.02" - - __description__ = """FilecloudIo account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] - - - def loadAccountInfo(self, user, req): - # It looks like the first API request always fails, so we retry 5 times, it should work on the second try - for _i in xrange(5): - rep = req.load("https://secure.filecloud.io/api-fetch_apikey.api", - post={"username": user, "password": self.accounts[user]['password']}) - rep = json_loads(rep) - if rep['status'] == 'ok': - break - elif rep['status'] == 'error' and rep['message'] == 'no such user or wrong password': - self.logError(_("Wrong username or password")) - return {"valid": False, "premium": False} - else: - return {"premium": False} - - akey = rep['akey'] - self.accounts[user]['akey'] = akey # Saved for hoster plugin - rep = req.load("http://api.filecloud.io/api-fetch_account_details.api", - post={"akey": akey}) - rep = json_loads(rep) - - if rep['is_premium'] == 1: - return {"validuntil": int(rep['premium_until']), "trafficleft": -1} - else: - return {"premium": False} - - - def login(self, user, data, req): - req.cj.setCookie("secure.filecloud.io", "lang", "en") - html = req.load('https://secure.filecloud.io/user-login.html') - - if not hasattr(self, "form_data"): - self.form_data = {} - - self.form_data['username'] = user - self.form_data['password'] = data['password'] - - html = req.load('https://secure.filecloud.io/user-login_p.html', - post=self.form_data, - multipart=True) - - self.logged_in = True if "you have successfully logged in - filecloud.io" in html else False - self.form_data = {} diff --git a/pyload/plugin/account/FilefactoryCom.py b/pyload/plugin/account/FilefactoryCom.py deleted file mode 100644 index 6b7399db6..000000000 --- a/pyload/plugin/account/FilefactoryCom.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -from time import mktime, strptime - -from pycurl import REFERER - -from pyload.plugin.Account import Account - - -class FilefactoryCom(Account): - __name__ = "FilefactoryCom" - __type__ = "account" - __version__ = "0.14" - - __description__ = """Filefactory.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] - - - VALID_UNTIL_PATTERN = r'Premium valid until: <strong>(?P<d>\d{1,2})\w{1,2} (?P<m>\w{3}), (?P<y>\d{4})</strong>' - - - def loadAccountInfo(self, user, req): - html = req.load("http://www.filefactory.com/account/") - - m = re.search(self.VALID_UNTIL_PATTERN, html) - if m: - premium = True - validuntil = re.sub(self.VALID_UNTIL_PATTERN, '\g<d> \g<m> \g<y>', m.group(0)) - validuntil = mktime(strptime(validuntil, "%d %b %Y")) - else: - premium = False - validuntil = -1 - - return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} - - - def login(self, user, data, req): - req.http.c.setopt(REFERER, "http://www.filefactory.com/member/login.php") - - html = req.load("http://www.filefactory.com/member/signin.php", post={ - "loginEmail": user, - "loginPassword": data['password'], - "Submit": "Sign In"}) - - if req.lastEffectiveURL != "http://www.filefactory.com/account/": - self.wrongPassword() diff --git a/pyload/plugin/account/FilejungleCom.py b/pyload/plugin/account/FilejungleCom.py deleted file mode 100644 index 5734f1638..000000000 --- a/pyload/plugin/account/FilejungleCom.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -from time import mktime, strptime - -from pyload.plugin.Account import Account - - -class FilejungleCom(Account): - __name__ = "FilejungleCom" - __type__ = "account" - __version__ = "0.11" - - __description__ = """Filejungle.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - login_timeout = 60 - - URL = "http://filejungle.com/" - TRAFFIC_LEFT_PATTERN = r'"/extend_premium\.php">Until (\d+ \w+ \d+)<br' - LOGIN_FAILED_PATTERN = r'<span htmlfor="loginUser(Name|Password)" generated="true" class="fail_info">' - - - def loadAccountInfo(self, user, req): - html = req.load(self.URL + "dashboard.php") - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - if m: - premium = True - validuntil = mktime(strptime(m.group(1), "%d %b %Y")) - else: - premium = False - validuntil = -1 - - return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} - - - def login(self, user, data, req): - html = req.load(self.URL + "login.php", post={ - "loginUserName": user, - "loginUserPassword": data['password'], - "loginFormSubmit": "Login", - "recaptcha_challenge_field": "", - "recaptcha_response_field": "", - "recaptcha_shortencode_field": ""}) - - if re.search(self.LOGIN_FAILED_PATTERN, html): - self.wrongPassword() diff --git a/pyload/plugin/account/FileomCom.py b/pyload/plugin/account/FileomCom.py deleted file mode 100644 index 36a11e411..000000000 --- a/pyload/plugin/account/FileomCom.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class FileomCom(XFSAccount): - __name__ = "FileomCom" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Fileom.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "fileom.com" diff --git a/pyload/plugin/account/FilerNet.py b/pyload/plugin/account/FilerNet.py deleted file mode 100644 index 679a9dc40..000000000 --- a/pyload/plugin/account/FilerNet.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -import time - -from pyload.plugin.Account import Account - - -class FilerNet(Account): - __name__ = "FilerNet" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Filer.net account plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - TOKEN_PATTERN = r'_csrf_token" value="([^"]+)" />' - WALID_UNTIL_PATTERN = r'Der Premium-Zugang ist gültig bis (.+)\.\s*</td>' - TRAFFIC_PATTERN = r'Traffic</th>\s*<td>([^<]+)</td>' - FREE_PATTERN = r'Account Status</th>\s*<td>\s*Free' - - - def loadAccountInfo(self, user, req): - html = req.load("https://filer.net/profile") - - # Free user - if re.search(self.FREE_PATTERN, html): - return {"premium": False, "validuntil": None, "trafficleft": None} - - until = re.search(self.WALID_UNTIL_PATTERN, html) - traffic = re.search(self.TRAFFIC_PATTERN, html) - if until and traffic: - validuntil = int(time.mktime(time.strptime(until.group(1), "%d.%m.%Y %H:%M:%S"))) - trafficleft = self.parseTraffic(traffic.group(1)) - return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} - else: - self.logError(_("Unable to retrieve account information")) - return {"premium": False, "validuntil": None, "trafficleft": None} - - - def login(self, user, data, req): - html = req.load("https://filer.net/login") - token = re.search(self.TOKEN_PATTERN, html).group(1) - html = req.load("https://filer.net/login_check", - post={"_username": user, "_password": data['password'], - "_remember_me": "on", "_csrf_token": token, "_target_path": "https://filer.net/"}) - if 'Logout' not in html: - self.wrongPassword() diff --git a/pyload/plugin/account/FilerioCom.py b/pyload/plugin/account/FilerioCom.py deleted file mode 100644 index 1d9f8744b..000000000 --- a/pyload/plugin/account/FilerioCom.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class FilerioCom(XFSAccount): - __name__ = "FilerioCom" - __type__ = "account" - __version__ = "0.03" - - __description__ = """FileRio.in account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - HOSTER_DOMAIN = "filerio.in" diff --git a/pyload/plugin/account/FilesMailRu.py b/pyload/plugin/account/FilesMailRu.py deleted file mode 100644 index bbff7311c..000000000 --- a/pyload/plugin/account/FilesMailRu.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account - - -class FilesMailRu(Account): - __name__ = "FilesMailRu" - __type__ = "account" - __version__ = "0.10" - - __description__ = """Filesmail.ru account plugin""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] - - - def loadAccountInfo(self, user, req): - return {"validuntil": None, "trafficleft": None} - - - def login(self, user, data, req): - user, domain = user.split("@") - - page = req.load("http://swa.mail.ru/cgi-bin/auth", None, - {"Domain": domain, "Login": user, "Password": data['password'], - "Page": "http://files.mail.ru/"}, cookies=True) - - if "Неверное имя пользователя или пароль" in page: # @TODO seems not to work - self.wrongPassword() diff --git a/pyload/plugin/account/FileserveCom.py b/pyload/plugin/account/FileserveCom.py deleted file mode 100644 index 7557450be..000000000 --- a/pyload/plugin/account/FileserveCom.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -from time import mktime, strptime - -from pyload.plugin.Account import Account -from pyload.utils import json_loads - - -class FileserveCom(Account): - __name__ = "FileserveCom" - __type__ = "account" - __version__ = "0.20" - - __description__ = """Fileserve.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("mkaay", "mkaay@mkaay.de")] - - - def loadAccountInfo(self, user, req): - data = self.getAccountData(user) - - page = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], - "submit": "Submit+Query"}) - res = json_loads(page) - - if res['type'] == "premium": - validuntil = mktime(strptime(res['expireTime'], "%Y-%m-%d %H:%M:%S")) - return {"trafficleft": res['traffic'], "validuntil": validuntil} - else: - return {"premium": False, "trafficleft": None, "validuntil": None} - - - def login(self, user, data, req): - page = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], - "submit": "Submit+Query"}) - res = json_loads(page) - - if not res['type']: - self.wrongPassword() - - #login at fileserv page - req.load("http://www.fileserve.com/login.php", - post={"loginUserName": user, "loginUserPassword": data['password'], "autoLogin": "checked", - "loginFormSubmit": "Login"}) diff --git a/pyload/plugin/account/FourSharedCom.py b/pyload/plugin/account/FourSharedCom.py deleted file mode 100644 index 3ef865a91..000000000 --- a/pyload/plugin/account/FourSharedCom.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account -from pyload.utils import json_loads - - -class FourSharedCom(Account): - __name__ = "FourSharedCom" - __type__ = "account" - __version__ = "0.03" - - __description__ = """FourShared.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] - - - def loadAccountInfo(self, user, req): - # Free mode only for now - return {"premium": False} - - - def login(self, user, data, req): - req.cj.setCookie("4shared.com", "4langcookie", "en") - res = req.load('http://www.4shared.com/web/login', - post={'login': user, - 'password': data['password'], - 'remember': "on", - '_remember': "on", - 'returnTo': "http://www.4shared.com/account/home.jsp"}) - - if 'Please log in to access your 4shared account' in res: - self.wrongPassword() diff --git a/pyload/plugin/account/FreakshareCom.py b/pyload/plugin/account/FreakshareCom.py deleted file mode 100644 index 9905e3f55..000000000 --- a/pyload/plugin/account/FreakshareCom.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from time import strptime, mktime - -from pyload.plugin.Account import Account - - -class FreakshareCom(Account): - __name__ = "FreakshareCom" - __type__ = "account" - __version__ = "0.11" - - __description__ = """Freakshare.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] - - - def loadAccountInfo(self, user, req): - page = req.load("http://freakshare.com/") - - validuntil = r'ltig bis:</td>\s*<td><b>([\d.:-]+)</b></td>' - validuntil = re.search(validuntil, page, re.M) - validuntil = validuntil.group(1).strip() - validuntil = mktime(strptime(validuntil, "%d.%m.%Y - %H:%M")) - - traffic = r'Traffic verbleibend:</td>\s*<td>([^<]+)' - traffic = re.search(traffic, page, re.M) - traffic = traffic.group(1).strip() - traffic = self.parseTraffic(traffic) - - return {"validuntil": validuntil, "trafficleft": traffic} - - - def login(self, user, data, req): - req.load("http://freakshare.com/index.php?language=EN") - - page = req.load("http://freakshare.com/login.html", None, - {"submit": "Login", "user": user, "pass": data['password']}, cookies=True) - - if ">Wrong Username or Password" in page: - self.wrongPassword() diff --git a/pyload/plugin/account/FreeWayMe.py b/pyload/plugin/account/FreeWayMe.py deleted file mode 100644 index 7b57cc6a0..000000000 --- a/pyload/plugin/account/FreeWayMe.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account -from pyload.utils import json_loads - - -class FreeWayMe(Account): - __name__ = "FreeWayMe" - __type__ = "account" - __version__ = "0.11" - - __description__ = """FreeWayMe account plugin""" - __license__ = "GPLv3" - __authors__ = [("Nicolas Giese", "james@free-way.me")] - - - def loadAccountInfo(self, user, req): - status = self.getAccountStatus(user, req) - if not status: - return False - self.logDebug(status) - - account_info = {"validuntil": -1, "premium": False} - if status['premium'] == "Free": - account_info['trafficleft'] = int(status['guthaben']) * 1024 - elif status['premium'] == "Spender": - account_info['trafficleft'] = -1 - elif status['premium'] == "Flatrate": - account_info = {"validuntil": int(status['Flatrate']), - "trafficleft": -1, - "premium": True} - - return account_info - - - def getpw(self, user): - return self.accounts[user]['password'] - - - def login(self, user, data, req): - status = self.getAccountStatus(user, req) - - # Check if user and password are valid - if not status: - self.wrongPassword() - - - def getAccountStatus(self, user, req): - answer = req.load("https://www.free-way.me/ajax/jd.php", - get={"id": 4, "user": user, "pass": self.accounts[user]['password']}) - self.logDebug("Login: %s" % answer) - if answer == "Invalid login": - self.wrongPassword() - return False - return json_loads(answer) diff --git a/pyload/plugin/account/FshareVn.py b/pyload/plugin/account/FshareVn.py deleted file mode 100644 index c84ce6648..000000000 --- a/pyload/plugin/account/FshareVn.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- - -from time import mktime, strptime -from pycurl import REFERER -import re - -from pyload.plugin.Account import Account - - -class FshareVn(Account): - __name__ = "FshareVn" - __type__ = "account" - __version__ = "0.07" - - __description__ = """Fshare.vn account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] - - - VALID_UNTIL_PATTERN = ur'<dt>Thời hạn dùng:</dt>\s*<dd>([^<]+)</dd>' - LIFETIME_PATTERN = ur'<dt>Lần đăng nhập trước:</dt>\s*<dd>[^<]+</dd>' - TRAFFIC_LEFT_PATTERN = ur'<dt>Tổng Dung Lượng Tài Khoản</dt>\s*<dd[^>]*>([\d.]+) ([kKMG])B</dd>' - DIRECT_DOWNLOAD_PATTERN = ur'<input type="checkbox"\s*([^=>]*)[^>]*/>Kích hoạt download trực tiếp</dt>' - - - def loadAccountInfo(self, user, req): - html = req.load("http://www.fshare.vn/account_info.php", decode=True) - - if re.search(self.LIFETIME_PATTERN, html): - self.logDebug("Lifetime membership detected") - trafficleft = self.getTrafficLeft() - return {"validuntil": -1, "trafficleft": trafficleft, "premium": True} - - m = re.search(self.VALID_UNTIL_PATTERN, html) - if m: - premium = True - validuntil = mktime(strptime(m.group(1), '%I:%M:%S %p %d-%m-%Y')) - trafficleft = self.getTrafficLeft() - else: - premium = False - validuntil = None - trafficleft = None - - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} - - - def login(self, user, data, req): - req.http.c.setopt(REFERER, "https://www.fshare.vn/login.php") - - html = req.load('https://www.fshare.vn/login.php', post={ - "login_password": data['password'], - "login_useremail": user, - "url_refe": "http://www.fshare.vn/index.php" - }, referer=True, decode=True) - - if not re.search(r'<img\s+alt="VIP"', html): - self.wrongPassword() - - - def getTrafficLeft(self): - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - return float(m.group(1)) * 1024 ** {'k': 0, 'K': 0, 'M': 1, 'G': 2}[m.group(2)] if m else 0 diff --git a/pyload/plugin/account/Ftp.py b/pyload/plugin/account/Ftp.py deleted file mode 100644 index 67cde2cdd..000000000 --- a/pyload/plugin/account/Ftp.py +++ /dev/null @@ -1,17 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account - - -class Ftp(Account): - __name__ = "Ftp" - __type__ = "account" - __version__ = "0.01" - - __description__ = """Ftp dummy account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - login_timeout = -1 #: Unlimited - info_threshold = -1 #: Unlimited diff --git a/pyload/plugin/account/HellshareCz.py b/pyload/plugin/account/HellshareCz.py deleted file mode 100644 index 6f160fa11..000000000 --- a/pyload/plugin/account/HellshareCz.py +++ /dev/null @@ -1,76 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -import time - -from pyload.plugin.Account import Account - - -class HellshareCz(Account): - __name__ = "HellshareCz" - __type__ = "account" - __version__ = "0.14" - - __description__ = """Hellshare.cz account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - CREDIT_LEFT_PATTERN = r'<div class="credit-link">\s*<table>\s*<tr>\s*<th>(\d+|\d\d\.\d\d\.)</th>' - - - def loadAccountInfo(self, user, req): - self.relogin(user) - html = req.load("http://www.hellshare.com/") - - m = re.search(self.CREDIT_LEFT_PATTERN, html) - if m is None: - trafficleft = None - validuntil = None - premium = False - else: - credit = m.group(1) - premium = True - try: - if "." in credit: - #Time-based account - vt = [int(x) for x in credit.split('.')[:2]] - lt = time.localtime() - year = lt.tm_year + int(vt[1] < lt.tm_mon or (vt[1] == lt.tm_mon and vt[0] < lt.tm_mday)) - validuntil = time.mktime(time.strptime("%s%d 23:59:59" % (credit, year), "%d.%m.%Y %H:%M:%S")) - trafficleft = -1 - else: - #Traffic-based account - trafficleft = int(credit) * 1024 - validuntil = -1 - except Exception, e: - self.logError(_("Unable to parse credit info"), e) - validuntil = -1 - trafficleft = -1 - - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} - - - def login(self, user, data, req): - html = req.load('http://www.hellshare.com/') - if req.lastEffectiveURL != 'http://www.hellshare.com/': - #Switch to English - self.logDebug("Switch lang - URL: %s" % req.lastEffectiveURL) - json = req.load("%s?do=locRouter-show" % req.lastEffectiveURL) - hash = re.search(r"(\-\-[0-9a-f]+\-)", json).group(1) - self.logDebug("Switch lang - HASH: %s" % hash) - html = req.load('http://www.hellshare.com/%s/' % hash) - - if re.search(self.CREDIT_LEFT_PATTERN, html): - self.logDebug("Already logged in") - return - - html = req.load('http://www.hellshare.com/login?do=loginForm-submit', post={ - "login": "Log in", - "password": data['password'], - "username": user, - "perm_login": "on" - }) - - if "<p>You input a wrong user name or wrong password</p>" in html: - self.wrongPassword() diff --git a/pyload/plugin/account/Http.py b/pyload/plugin/account/Http.py deleted file mode 100644 index 2571ef712..000000000 --- a/pyload/plugin/account/Http.py +++ /dev/null @@ -1,17 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account - - -class Http(Account): - __name__ = "Http" - __type__ = "account" - __version__ = "0.01" - - __description__ = """Http dummy account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - login_timeout = -1 #: Unlimited - info_threshold = -1 #: Unlimited diff --git a/pyload/plugin/account/HugefilesNet.py b/pyload/plugin/account/HugefilesNet.py deleted file mode 100644 index eb383fb17..000000000 --- a/pyload/plugin/account/HugefilesNet.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class HugefilesNet(XFSAccount): - __name__ = "HugefilesNet" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Hugefiles.net account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "hugefiles.net" diff --git a/pyload/plugin/account/HundredEightyUploadCom.py b/pyload/plugin/account/HundredEightyUploadCom.py deleted file mode 100644 index 79b5ee033..000000000 --- a/pyload/plugin/account/HundredEightyUploadCom.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class HundredEightyUploadCom(XFSAccount): - __name__ = "HundredEightyUploadCom" - __type__ = "account" - __version__ = "0.02" - - __description__ = """180upload.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "180upload.com" diff --git a/pyload/plugin/account/JunocloudMe.py b/pyload/plugin/account/JunocloudMe.py deleted file mode 100644 index 0ffa92eb6..000000000 --- a/pyload/plugin/account/JunocloudMe.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class JunocloudMe(XFSAccount): - __name__ = "JunocloudMe" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Junocloud.me account plugin""" - __license__ = "GPLv3" - __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - - - HOSTER_DOMAIN = "junocloud.me" diff --git a/pyload/plugin/account/Keep2ShareCc.py b/pyload/plugin/account/Keep2ShareCc.py deleted file mode 100644 index 7ed15dc62..000000000 --- a/pyload/plugin/account/Keep2ShareCc.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from time import gmtime, mktime, strptime - -from pyload.plugin.Account import Account - - -class Keep2shareCc(Account): - __name__ = "Keep2shareCc" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Keep2share.cc account plugin""" - __license__ = "GPLv3" - __authors__ = [("aeronaut", "aeronaut@pianoguy.de")] - - - VALID_UNTIL_PATTERN = r'Premium expires: <b>(.+?)</b>' - TRAFFIC_LEFT_PATTERN = r'Available traffic \(today\):<b><a href="/user/statistic.html">(.+?)</a>' - - LOGIN_FAIL_PATTERN = r'Please fix the following input errors' - - - def loadAccountInfo(self, user, req): - validuntil = None - trafficleft = None - premium = None - - html = req.load("http://keep2share.cc/site/profile.html", decode=True) - - m = re.search(self.VALID_UNTIL_PATTERN, html) - if m: - expiredate = m.group(1).strip() - self.logDebug("Expire date: " + expiredate) - - try: - validuntil = mktime(strptime(expiredate, "%Y.%m.%d")) - - except Exception, e: - self.logError(e) - - else: - if validuntil > mktime(gmtime()): - premium = True - else: - premium = False - validuntil = None - - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - if m: - try: - trafficleft = self.parseTraffic(m.group(1)) - - except Exception, e: - self.logError(e) - - return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - - - def login(self, user, data, req): - req.cj.setCookie("keep2share.cc", "lang", "en") - - html = req.load("http://keep2share.cc/login.html", - post={'LoginForm[username]': user, 'LoginForm[password]': data['password']}) - - if re.search(self.LOGIN_FAIL_PATTERN, html): - self.wrongPassword() diff --git a/pyload/plugin/account/LetitbitNet.py b/pyload/plugin/account/LetitbitNet.py deleted file mode 100644 index c7615dd56..000000000 --- a/pyload/plugin/account/LetitbitNet.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account -# from pyload.utils import json_loads, json_dumps - - -class LetitbitNet(Account): - __name__ = "LetitbitNet" - __type__ = "account" - __version__ = "0.01" - - __description__ = """Letitbit.net account plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - def loadAccountInfo(self, user, req): - ## DISABLED BECAUSE IT GET 'key exausted' EVEN IF VALID ## - # api_key = self.accounts[user]['password'] - # json_data = [api_key, ['key/info']] - # api_rep = req.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) - # self.logDebug("API Key Info: " + api_rep) - # api_rep = json_loads(api_rep) - # - # if api_rep['status'] == 'FAIL': - # self.logWarning(api_rep['data']) - # return {'valid': False, 'premium': False} - - return {"premium": True} - - - def login(self, user, data, req): - # API_KEY is the username and the PREMIUM_KEY is the password - self.logInfo(_("You must use your API KEY as username and the PREMIUM KEY as password")) diff --git a/pyload/plugin/account/LinestorageCom.py b/pyload/plugin/account/LinestorageCom.py deleted file mode 100644 index 6a9991b17..000000000 --- a/pyload/plugin/account/LinestorageCom.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class LinestorageCom(XFSAccount): - __name__ = "LinestorageCom" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Linestorage.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "linestorage.com" diff --git a/pyload/plugin/account/LinksnappyCom.py b/pyload/plugin/account/LinksnappyCom.py deleted file mode 100644 index 968271dd7..000000000 --- a/pyload/plugin/account/LinksnappyCom.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- - -from hashlib import md5 - -from pyload.plugin.Account import Account -from pyload.utils import json_loads - - -class LinksnappyCom(Account): - __name__ = "LinksnappyCom" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Linksnappy.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - def loadAccountInfo(self, user, req): - data = self.getAccountData(user) - r = req.load('http://gen.linksnappy.com/lseAPI.php', - get={'act': 'USERDETAILS', 'username': user, 'password': md5(data['password']).hexdigest()}) - self.logDebug("JSON data: " + r) - j = json_loads(r) - - if j['error']: - return {"premium": False} - - validuntil = j['return']['expire'] - if validuntil == 'lifetime': - validuntil = -1 - elif validuntil == 'expired': - return {"premium": False} - else: - validuntil = float(validuntil) - - if 'trafficleft' not in j['return'] or isinstance(j['return']['trafficleft'], str): - trafficleft = -1 - else: - trafficleft = int(j['return']['trafficleft']) * 1024 - - return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} - - - def login(self, user, data, req): - r = req.load('http://gen.linksnappy.com/lseAPI.php', - get={'act': 'USERDETAILS', 'username': user, 'password': md5(data['password']).hexdigest()}) - - if 'Invalid Account Details' in r: - self.wrongPassword() diff --git a/pyload/plugin/account/LomafileCom.py b/pyload/plugin/account/LomafileCom.py deleted file mode 100644 index 24f988ac1..000000000 --- a/pyload/plugin/account/LomafileCom.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class LomafileCom(XFSAccount): - __name__ = "LomafileCom" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Lomafile.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - - - HOSTER_DOMAIN = "lomafile.com" diff --git a/pyload/plugin/account/MegaDebridEu.py b/pyload/plugin/account/MegaDebridEu.py deleted file mode 100644 index c2e64bcc7..000000000 --- a/pyload/plugin/account/MegaDebridEu.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account -from pyload.utils import json_loads - - -class MegaDebridEu(Account): - __name__ = "MegaDebridEu" - __type__ = "account" - __version__ = "0.20" - - __description__ = """mega-debrid.eu account plugin""" - __license__ = "GPLv3" - __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] - - - # Define the base URL of MegaDebrid api - API_URL = "https://www.mega-debrid.eu/api.php" - - - def loadAccountInfo(self, user, req): - data = self.getAccountData(user) - jsonResponse = req.load(self.API_URL, - get={'action': 'connectUser', 'login': user, 'password': data['password']}) - res = json_loads(jsonResponse) - - if res['response_code'] == "ok": - return {"premium": True, "validuntil": float(res['vip_end']), "status": True} - else: - self.logError(res) - return {"status": False, "premium": False} - - - def login(self, user, data, req): - jsonResponse = req.load(self.API_URL, - get={'action': 'connectUser', 'login': user, 'password': data['password']}) - res = json_loads(jsonResponse) - if res['response_code'] != "ok": - self.wrongPassword() diff --git a/pyload/plugin/account/MegaRapidCz.py b/pyload/plugin/account/MegaRapidCz.py deleted file mode 100644 index 5ceee1301..000000000 --- a/pyload/plugin/account/MegaRapidCz.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from time import mktime, strptime -from pyload.plugin.Account import Account - - -class MegaRapidCz(Account): - __name__ = "MegaRapidCz" - __type__ = "account" - __version__ = "0.34" - - __description__ = """MegaRapid.cz account plugin""" - __license__ = "GPLv3" - __authors__ = [("MikyWoW", "mikywow@seznam.cz"), - ("zoidberg", "zoidberg@mujmail.cz")] - - - login_timeout = 60 - - LIMITDL_PATTERN = ur'<td>Max. počet paralelních stahování: </td><td>(\d+)' - VALID_UNTIL_PATTERN = ur'<td>Paušální stahování aktivní. Vyprší </td><td><strong>(.*?)</strong>' - TRAFFIC_LEFT_PATTERN = r'<tr><td>Kredit</td><td>(.*?) GiB' - - - def loadAccountInfo(self, user, req): - html = req.load("http://megarapid.cz/mujucet/", decode=True) - - m = re.search(self.LIMITDL_PATTERN, html) - if m: - data = self.getAccountData(user) - data['options']['limitDL'] = [int(m.group(1))] - - m = re.search(self.VALID_UNTIL_PATTERN, html) - if m: - validuntil = mktime(strptime(m.group(1), "%d.%m.%Y - %H:%M")) - return {"premium": True, "trafficleft": -1, "validuntil": validuntil} - - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - if m: - trafficleft = float(m.group(1)) * (1 << 20) - return {"premium": True, "trafficleft": trafficleft, "validuntil": -1} - - return {"premium": False, "trafficleft": None, "validuntil": None} - - - def login(self, user, data, req): - htm = req.load("http://megarapid.cz/prihlaseni/") - if "Heslo:" in htm: - start = htm.index('id="inp_hash" name="hash" value="') - htm = htm[start + 33:] - hashes = htm[0:32] - htm = req.load("http://megarapid.cz/prihlaseni/", - post={"hash": hashes, - "login": user, - "pass1": data['password'], - "remember": 0, - "sbmt": u"Přihlásit"}) diff --git a/pyload/plugin/account/MegasharesCom.py b/pyload/plugin/account/MegasharesCom.py deleted file mode 100644 index 352e0abd5..000000000 --- a/pyload/plugin/account/MegasharesCom.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -from time import mktime, strptime - -from pyload.plugin.Account import Account - - -class MegasharesCom(Account): - __name__ = "MegasharesCom" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Megashares.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - VALID_UNTIL_PATTERN = r'<p class="premium_info_box">Period Ends: (\w{3} \d{1,2}, \d{4})</p>' - - - def loadAccountInfo(self, user, req): - #self.relogin(user) - html = req.load("http://d01.megashares.com/myms.php", decode=True) - - premium = False if '>Premium Upgrade<' in html else True - - validuntil = trafficleft = -1 - try: - timestr = re.search(self.VALID_UNTIL_PATTERN, html).group(1) - self.logDebug(timestr) - validuntil = mktime(strptime(timestr, "%b %d, %Y")) - except Exception, e: - self.logError(e) - - return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} - - - def login(self, user, data, req): - html = req.load('http://d01.megashares.com/myms_login.php', post={ - "httpref": "", - "myms_login": "Login", - "mymslogin_name": user, - "mymspassword": data['password'] - }, decode=True) - - if not '<span class="b ml">%s</span>' % user in html: - self.wrongPassword() diff --git a/pyload/plugin/account/MovReelCom.py b/pyload/plugin/account/MovReelCom.py deleted file mode 100644 index 4d2855de1..000000000 --- a/pyload/plugin/account/MovReelCom.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class MovReelCom(XFSAccount): - __name__ = "MovReelCom" - __type__ = "account" - __version__ = "0.03" - - __description__ = """Movreel.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("t4skforce", "t4skforce1337[AT]gmail[DOT]com")] - - - login_timeout = 60 - info_threshold = 30 - - HOSTER_DOMAIN = "movreel.com" diff --git a/pyload/plugin/account/MultishareCz.py b/pyload/plugin/account/MultishareCz.py deleted file mode 100644 index 62b48c546..000000000 --- a/pyload/plugin/account/MultishareCz.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pyload.plugin.Account import Account - - -class MultishareCz(Account): - __name__ = "MultishareCz" - __type__ = "account" - __version__ = "0.03" - - __description__ = """Multishare.cz account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - TRAFFIC_LEFT_PATTERN = r'<span class="profil-zvyrazneni">Kredit:</span>\s*<strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' - ACCOUNT_INFO_PATTERN = r'<input type="hidden" id="(u_ID|u_hash)" name="[^"]*" value="([^"]+)">' - - - def loadAccountInfo(self, user, req): - #self.relogin(user) - html = req.load("http://www.multishare.cz/profil/", decode=True) - - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - trafficleft = self.parseTraffic(m.group('S'), m.group('U')) if m else 0 - self.premium = True if trafficleft else False - - html = req.load("http://www.multishare.cz/", decode=True) - mms_info = dict(re.findall(self.ACCOUNT_INFO_PATTERN, html)) - - return dict(mms_info, **{"validuntil": -1, "trafficleft": trafficleft}) - - - def login(self, user, data, req): - html = req.load('http://www.multishare.cz/html/prihlaseni_process.php', post={ - "akce": "Přihlásit", - "heslo": data['password'], - "jmeno": user - }, decode=True) - - if '<div class="akce-chyba akce">' in html: - self.wrongPassword() diff --git a/pyload/plugin/account/MyfastfileCom.py b/pyload/plugin/account/MyfastfileCom.py deleted file mode 100644 index 01caf5c69..000000000 --- a/pyload/plugin/account/MyfastfileCom.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -from time import time - -from pyload.plugin.Account import Account -from pyload.utils import json_loads - - -class MyfastfileCom(Account): - __name__ = "MyfastfileCom" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Myfastfile.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - def loadAccountInfo(self, user, req): - if 'days_left' in self.json_data: - validuntil = int(time() + self.json_data['days_left'] * 24 * 60 * 60) - return {"premium": True, "validuntil": validuntil, "trafficleft": -1} - else: - self.logError(_("Unable to get account information")) - - - def login(self, user, data, req): - # Password to use is the API-Password written in http://myfastfile.com/myaccount - html = req.load("http://myfastfile.com/api.php", - get={"user": user, "pass": data['password']}) - self.logDebug("JSON data: " + html) - self.json_data = json_loads(html) - if self.json_data['status'] != 'ok': - self.logError(_('Invalid login. The password to use is the API-Password you find in your "My Account" page')) - self.wrongPassword() diff --git a/pyload/plugin/account/NetloadIn.py b/pyload/plugin/account/NetloadIn.py deleted file mode 100644 index d0d48315a..000000000 --- a/pyload/plugin/account/NetloadIn.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -from time import time - -from pyload.plugin.Account import Account - - -class NetloadIn(Account): - __name__ = "NetloadIn" - __type__ = "account" - __version__ = "0.22" - - __description__ = """Netload.in account plugin""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("CryNickSystems", "webmaster@pcProfil.de")] - - - def loadAccountInfo(self, user, req): - page = req.load("http://netload.in/index.php", get={'id': 2, 'lang': "de"}) - left = r'>(\d+) (Tag|Tage), (\d+) Stunden<' - left = re.search(left, page) - if left: - validuntil = time() + int(left.group(1)) * 24 * 60 * 60 + int(left.group(3)) * 60 * 60 - trafficleft = -1 - premium = True - else: - validuntil = None - premium = False - trafficleft = None - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} - - - def login(self, user, data, req): - page = req.load("http://netload.in/index.php", None, - {"txtuser": user, "txtpass": data['password'], "txtcheck": "login", "txtlogin": "Login"}, - cookies=True) - if "password or it might be invalid!" in page: - self.wrongPassword() diff --git a/pyload/plugin/account/NosuploadCom.py b/pyload/plugin/account/NosuploadCom.py deleted file mode 100644 index 7fc8b49de..000000000 --- a/pyload/plugin/account/NosuploadCom.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class NosuploadCom(XFSAccount): - __name__ = "NosuploadCom" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Nosupload.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "nosupload.com" diff --git a/pyload/plugin/account/NovafileCom.py b/pyload/plugin/account/NovafileCom.py deleted file mode 100644 index 71a7dc2dc..000000000 --- a/pyload/plugin/account/NovafileCom.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class NovafileCom(XFSAccount): - __name__ = "NovafileCom" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Novafile.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "novafile.com" diff --git a/pyload/plugin/account/NowVideoSx.py b/pyload/plugin/account/NowVideoSx.py deleted file mode 100644 index d2527d635..000000000 --- a/pyload/plugin/account/NowVideoSx.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from time import gmtime, mktime, strptime - -from pyload.plugin.Account import Account - - -class NowVideoAt(Account): - __name__ = "NowVideoAt" - __type__ = "account" - __version__ = "0.01" - - __description__ = """NowVideo.at account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - VALID_UNTIL_PATTERN = r'>Your premium membership expires on: (.+?)<' - - - def loadAccountInfo(self, user, req): - validuntil = None - trafficleft = -1 - premium = None - - html = req.load("http://www.nowvideo.at/premium.php") - - m = re.search(self.VALID_UNTIL_PATTERN, html) - if m: - expiredate = m.group(1).strip() - self.logDebug("Expire date: " + expiredate) - - try: - validuntil = mktime(strptime(expiredate, "%Y-%b-%d")) - - except Exception, e: - self.logError(e) - - else: - if validuntil > mktime(gmtime()): - premium = True - else: - premium = False - validuntil = -1 - - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} - - - def login(self, user, data, req): - html = req.load("http://www.nowvideo.at/login.php", - post={'user': user, 'pass': data['password']}) - - if ">Invalid login details" is html: - self.wrongPassword() diff --git a/pyload/plugin/account/OboomCom.py b/pyload/plugin/account/OboomCom.py deleted file mode 100644 index a40783535..000000000 --- a/pyload/plugin/account/OboomCom.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- - -import time - -from beaker.crypto.pbkdf2 import PBKDF2 - -from pyload.utils import json_loads -from pyload.plugin.Account import Account - - -class OboomCom(Account): - __name__ = "OboomCom" - __type__ = "account" - __version__ = "0.21" - - __description__ = """Oboom.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("stanley", "stanley.foerster@gmail.com")] - - - def loadAccountData(self, user, req): - passwd = self.getAccountData(user)['password'] - salt = passwd[::-1] - pbkdf2 = PBKDF2(passwd, salt, 1000).hexread(16) - result = json_loads(req.load("https://www.oboom.com/1/login", get={"auth": user, "pass": pbkdf2})) - if not result[0] == 200: - self.logWarning(_("Failed to log in: %s") % result[1]) - self.wrongPassword() - return result[1] - - - def loadAccountInfo(self, name, req): - accountData = self.loadAccountData(name, req) - - userData = accountData['user'] - - if userData['premium'] == "null": - premium = False - else: - premium = True - - if userData['premium_unix'] == "null": - validUntil = -1 - else: - validUntil = int(userData['premium_unix']) - - traffic = userData['traffic'] - - trafficLeft = traffic['current'] - maxTraffic = traffic['max'] - - session = accountData['session'] - - return {'premium' : premium, - 'validuntil' : validUntil, - 'trafficleft': trafficLeft / 1024, #@TODO: Remove / 1024 in 0.4.10 - 'maxtraffic' : maxTraffic / 1024, #@TODO: Remove / 1024 in 0.4.10 - 'session' : session} - - - def login(self, user, data, req): - self.loadAccountData(user, req) diff --git a/pyload/plugin/account/OneFichierCom.py b/pyload/plugin/account/OneFichierCom.py deleted file mode 100644 index 5d4a037f0..000000000 --- a/pyload/plugin/account/OneFichierCom.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from time import strptime, mktime - -from pycurl import REFERER - -from pyload.plugin.Account import Account - - -class OneFichierCom(Account): - __name__ = "OneFichierCom" - __type__ = "account" - __version__ = "0.11" - - __description__ = """1fichier.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("Elrick69", "elrick69[AT]rocketmail[DOT]com"), - ("Walter Purcaro", "vuolter@gmail.com")] - - - VALID_UNTIL_PATTERN = r'Your Premium Status will end the (\d+/\d+/\d+)' - - - def loadAccountInfo(self, user, req): - validuntil = None - trafficleft = -1 - premium = None - - html = req.load("https://1fichier.com/console/abo.pl") - - m = re.search(self.VALID_UNTIL_PATTERN, html) - if m: - expiredate = m.group(1) - self.logDebug("Expire date: " + expiredate) - - try: - validuntil = mktime(strptime(expiredate, "%d/%m/%Y")) - except Exception, e: - self.logError(e) - else: - premium = True - - return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium or False} - - - def login(self, user, data, req): - req.http.c.setopt(REFERER, "https://1fichier.com/login.pl?lg=en") - - html = req.load("https://1fichier.com/login.pl?lg=en", - post={'mail': user, 'pass': data['password'], 'It': "on", 'purge': "off", 'valider': "Send"}) - - if '>Invalid email address' in html or '>Invalid password' in html: - self.wrongPassword() diff --git a/pyload/plugin/account/OverLoadMe.py b/pyload/plugin/account/OverLoadMe.py deleted file mode 100644 index 27ed9eb98..000000000 --- a/pyload/plugin/account/OverLoadMe.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account -from pyload.utils import json_loads - - -class OverLoadMe(Account): - __name__ = "OverLoadMe" - __type__ = "account" - __version__ = "0.01" - - __description__ = """Over-Load.me account plugin""" - __license__ = "GPLv3" - __authors__ = [("marley", "marley@over-load.me")] - - - def loadAccountInfo(self, user, req): - data = self.getAccountData(user) - page = req.load("https://api.over-load.me/account.php", get={"user": user, "auth": data['password']}).strip() - data = json_loads(page) - - # Check for premium - if data['membership'] == "Free": - return {"premium": False} - - account_info = {"validuntil": data['expirationunix'], "trafficleft": -1} - return account_info - - - def login(self, user, data, req): - jsondata = req.load("https://api.over-load.me/account.php", - get={"user": user, "auth": data['password']}).strip() - data = json_loads(jsondata) - - if data['err'] == 1: - self.wrongPassword() diff --git a/pyload/plugin/account/PremiumTo.py b/pyload/plugin/account/PremiumTo.py deleted file mode 100644 index 7f15e8a86..000000000 --- a/pyload/plugin/account/PremiumTo.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account - - -class PremiumTo(Account): - __name__ = "PremiumTo" - __type__ = "account" - __version__ = "0.04" - - __description__ = """Premium.to account plugin""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] - - - - def loadAccountInfo(self, user, req): - api_r = req.load("http://premium.to/api/straffic.php", - get={'username': self.username, 'password': self.password}) - traffic = sum(map(int, api_r.split(';'))) - - return {"trafficleft": int(traffic) / 1024, "validuntil": -1} #@TODO: Remove / 1024 in 0.4.10 - - - def login(self, user, data, req): - self.username = user - self.password = data['password'] - authcode = req.load("http://premium.to/api/getauthcode.php", - get={'username': user, 'password': self.password}).strip() - - if "wrong username" in authcode: - self.wrongPassword() diff --git a/pyload/plugin/account/PremiumizeMe.py b/pyload/plugin/account/PremiumizeMe.py deleted file mode 100644 index 75fc22198..000000000 --- a/pyload/plugin/account/PremiumizeMe.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account - -from pyload.utils import json_loads - - -class PremiumizeMe(Account): - __name__ = "PremiumizeMe" - __type__ = "account" - __version__ = "0.11" - - __description__ = """Premiumize.me account plugin""" - __license__ = "GPLv3" - __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] - - - def loadAccountInfo(self, user, req): - # Get user data from premiumize.me - status = self.getAccountStatus(user, req) - self.logDebug(status) - - # Parse account info - account_info = {"validuntil": float(status['result']['expires']), - "trafficleft": max(0, status['result']['trafficleft_bytes'])} - - if status['result']['type'] == 'free': - account_info['premium'] = False - - return account_info - - - def login(self, user, data, req): - # Get user data from premiumize.me - status = self.getAccountStatus(user, req) - - # Check if user and password are valid - if status['status'] != 200: - self.wrongPassword() - - - def getAccountStatus(self, user, req): - # Use premiumize.me API v1 (see https://secure.premiumize.me/?show=api) - # to retrieve account info and return the parsed json answer - answer = req.load("https://api.premiumize.me/pm-api/v1.php", - get={'method' : "accountstatus", - 'params[login]': user, - 'params[pass]' : self.accounts[user]['password']}) - return json_loads(answer) diff --git a/pyload/plugin/account/QuickshareCz.py b/pyload/plugin/account/QuickshareCz.py deleted file mode 100644 index c3d69e0c3..000000000 --- a/pyload/plugin/account/QuickshareCz.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pyload.plugin.Account import Account - - -class QuickshareCz(Account): - __name__ = "QuickshareCz" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Quickshare.cz account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - TRAFFIC_LEFT_PATTERN = r'Stav kreditu: <strong>(.+?)</strong>' - - - def loadAccountInfo(self, user, req): - html = req.load("http://www.quickshare.cz/premium", decode=True) - - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - if m: - trafficleft = self.parseTraffic(m.group(1)) - premium = True if trafficleft else False - else: - trafficleft = None - premium = False - - return {"validuntil": -1, "trafficleft": trafficleft, "premium": premium} - - - def login(self, user, data, req): - html = req.load('http://www.quickshare.cz/html/prihlaseni_process.php', post={ - "akce": u'Přihlásit', - "heslo": data['password'], - "jmeno": user - }, decode=True) - - if u'>Takový uživatel neexistuje.<' in html or u'>Špatné heslo.<' in html: - self.wrongPassword() diff --git a/pyload/plugin/account/RPNetBiz.py b/pyload/plugin/account/RPNetBiz.py deleted file mode 100644 index bb529b19c..000000000 --- a/pyload/plugin/account/RPNetBiz.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account -from pyload.utils import json_loads - - -class RPNetBiz(Account): - __name__ = "RPNetBiz" - __type__ = "account" - __version__ = "0.10" - - __description__ = """RPNet.biz account plugin""" - __license__ = "GPLv3" - __authors__ = [("Dman", "dmanugm@gmail.com")] - - - def loadAccountInfo(self, user, req): - # Get account information from rpnet.biz - res = self.getAccountStatus(user, req) - try: - if res['accountInfo']['isPremium']: - # Parse account info. Change the trafficleft later to support per host info. - account_info = {"validuntil": int(res['accountInfo']['premiumExpiry']), - "trafficleft": -1, "premium": True} - else: - account_info = {"validuntil": None, "trafficleft": None, "premium": False} - - except KeyError: - #handle wrong password exception - account_info = {"validuntil": None, "trafficleft": None, "premium": False} - - return account_info - - - def login(self, user, data, req): - # Get account information from rpnet.biz - res = self.getAccountStatus(user, req) - - # If we have an error in the res, we have wrong login information - if 'error' in res: - self.wrongPassword() - - - def getAccountStatus(self, user, req): - # Using the rpnet API, check if valid premium account - res = req.load("https://premium.rpnet.biz/client_api.php", - get={"username": user, "password": self.accounts[user]['password'], - "action": "showAccountInformation"}) - self.logDebug("JSON data: %s" % res) - - return json_loads(res) diff --git a/pyload/plugin/account/RapidfileshareNet.py b/pyload/plugin/account/RapidfileshareNet.py deleted file mode 100644 index ec0bf8db4..000000000 --- a/pyload/plugin/account/RapidfileshareNet.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class RapidfileshareNet(XFSAccount): - __name__ = "RapidfileshareNet" - __type__ = "account" - __version__ = "0.05" - - __description__ = """Rapidfileshare.net account plugin""" - __license__ = "GPLv3" - __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - - - HOSTER_DOMAIN = "rapidfileshare.net" - - TRAFFIC_LEFT_PATTERN = r'>Traffic available today:</TD><TD><label for="name">\s*(?P<S>[\d.,]+)\s*(?:(?P<U>[\w^_]+))?' diff --git a/pyload/plugin/account/RapidgatorNet.py b/pyload/plugin/account/RapidgatorNet.py deleted file mode 100644 index 693b78547..000000000 --- a/pyload/plugin/account/RapidgatorNet.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account -from pyload.utils import json_loads - - -class RapidgatorNet(Account): - __name__ = "RapidgatorNet" - __type__ = "account" - __version__ = "0.04" - - __description__ = """Rapidgator.net account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - API_URL = 'http://rapidgator.net/api/user' - - - def loadAccountInfo(self, user, req): - try: - sid = self.getAccountData(user).get('SID') - assert sid - - json = req.load("%s/info?sid=%s" % (self.API_URL, sid)) - self.logDebug("API:USERINFO", json) - json = json_loads(json) - - if json['response_status'] == 200: - if "reset_in" in json['response']: - self.scheduleRefresh(user, json['response']['reset_in']) - - return {"validuntil": json['response']['expire_date'], - "trafficleft": int(json['response']['traffic_left']), - "premium": True} - else: - self.logError(json['response_details']) - except Exception, e: - self.logError(e) - - return {"validuntil": None, "trafficleft": None, "premium": False} - - - def login(self, user, data, req): - try: - json = req.load('%s/login' % self.API_URL, post={"username": user, "password": data['password']}) - self.logDebug("API:LOGIN", json) - json = json_loads(json) - - if json['response_status'] == 200: - data['SID'] = str(json['response']['session_id']) - return - else: - self.logError(json['response_details']) - except Exception, e: - self.logError(e) - - self.wrongPassword() diff --git a/pyload/plugin/account/RapiduNet.py b/pyload/plugin/account/RapiduNet.py deleted file mode 100644 index 2c6fe04f8..000000000 --- a/pyload/plugin/account/RapiduNet.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pyload.plugin.Account import Account -from pyload.utils import json_loads - - -class RapiduNet(Account): - __name__ = "RapiduNet" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Rapidu.net account plugin""" - __license__ = "GPLv3" - __authors__ = [("prOq", "")] - - - PREMIUM_PATTERN = r'<a href="premium/" style="padding-left: 0px;">Account: <b>Premium</b></a>' - - - def loadAccountInfo(self, user, req): - info = {'validuntil': None, 'trafficleft': None, 'premium': False} - - req.load("https://rapidu.net/ajax.php", get={'a': "getChangeLang"}, post={"_go": "", "lang": "en"}) - html = req.load("https://rapidu.net/", decode=True) - - if re.search(self.PREMIUM_PATTERN, html): - info['premium'] = True - - return info - - - def login(self, user, data, req): - try: - json = json_loads(req.load("https://rapidu.net/ajax.php?a=getUserLogin", - post={'_go': "", - 'login': user, - 'pass': data['password'], - 'member': "1"})) - - self.logDebug(json) - - if not json['message'] == "success": - self.wrongPassword() - - except Exception, e: - self.logError(e) diff --git a/pyload/plugin/account/RarefileNet.py b/pyload/plugin/account/RarefileNet.py deleted file mode 100644 index 1dc93681c..000000000 --- a/pyload/plugin/account/RarefileNet.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class RarefileNet(XFSAccount): - __name__ = "RarefileNet" - __type__ = "account" - __version__ = "0.04" - - __description__ = """RareFile.net account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - HOSTER_DOMAIN = "rarefile.net" diff --git a/pyload/plugin/account/RealdebridCom.py b/pyload/plugin/account/RealdebridCom.py deleted file mode 100644 index d5aa2163c..000000000 --- a/pyload/plugin/account/RealdebridCom.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- - -import xml.dom.minidom as dom - -from pyload.plugin.Account import Account - - -class RealdebridCom(Account): - __name__ = "RealdebridCom" - __type__ = "account" - __version__ = "0.43" - - __description__ = """Real-Debrid.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] - - - def loadAccountInfo(self, user, req): - if self.pin_code: - return {"premium": False} - page = req.load("https://real-debrid.com/api/account.php") - xml = dom.parseString(page) - account_info = {"validuntil": int(xml.getElementsByTagName("expiration")[0].childNodes[0].nodeValue), - "trafficleft": -1} - - return account_info - - - def login(self, user, data, req): - self.pin_code = False - page = req.load("https://real-debrid.com/ajax/login.php", get={"user": user, "pass": data['password']}) - if "Your login informations are incorrect" in page: - self.wrongPassword() - elif "PIN Code required" in page: - self.logWarning(_("PIN code required. Please login to https://real-debrid.com using the PIN or disable the double authentication in your control panel on https://real-debrid.com")) - self.pin_code = True diff --git a/pyload/plugin/account/RehostTo.py b/pyload/plugin/account/RehostTo.py deleted file mode 100644 index bcc34d47f..000000000 --- a/pyload/plugin/account/RehostTo.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account - - -class RehostTo(Account): - __name__ = "RehostTo" - __type__ = "account" - __version__ = "0.10" - - __description__ = """Rehost.to account plugin""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] - - - def loadAccountInfo(self, user, req): - data = self.getAccountData(user) - page = req.load("http://rehost.to/api.php", - get={'cmd': "login", 'user': user, 'pass': data['password']}) - data = [x.split("=") for x in page.split(",")] - ses = data[0][1] - long_ses = data[1][1] - - page = req.load("http://rehost.to/api.php", - get={'cmd': "get_premium_credits", 'long_ses': long_ses}) - traffic, valid = page.split(",") - - account_info = {"trafficleft": int(traffic) * 1024, - "validuntil": int(valid), - "long_ses": long_ses, - "ses": ses} - - return account_info - - - def login(self, user, data, req): - page = req.load("http://rehost.to/api.php", - get={'cmd': "login", 'user': user, 'pass': data['password']}) - - if "Login failed." in page: - self.wrongPassword() diff --git a/pyload/plugin/account/RyushareCom.py b/pyload/plugin/account/RyushareCom.py deleted file mode 100644 index fcef2d634..000000000 --- a/pyload/plugin/account/RyushareCom.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class RyushareCom(XFSAccount): - __name__ = "RyushareCom" - __type__ = "account" - __version__ = "0.05" - - __description__ = """Ryushare.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("trance4us", "")] - - - HOSTER_DOMAIN = "ryushare.com" - - - def login(self, user, data, req): - req.lastURL = "http://ryushare.com/login.python" - html = req.load("http://ryushare.com/login.python", - post={"login": user, "password": data['password'], "op": "login"}) - if 'Incorrect Login or Password' in html or '>Error<' in html: - self.wrongPassword() diff --git a/pyload/plugin/account/SafesharingEu.py b/pyload/plugin/account/SafesharingEu.py deleted file mode 100644 index f5cbf050e..000000000 --- a/pyload/plugin/account/SafesharingEu.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class SafesharingEu(XFSAccount): - __name__ = "SafesharingEu" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Safesharing.eu account plugin""" - __license__ = "GPLv3" - __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - - - HOSTER_DOMAIN = "safesharing.eu" diff --git a/pyload/plugin/account/SecureUploadEu.py b/pyload/plugin/account/SecureUploadEu.py deleted file mode 100644 index bb47bcba3..000000000 --- a/pyload/plugin/account/SecureUploadEu.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class SecureUploadEu(XFSAccount): - __name__ = "SecureUploadEu" - __type__ = "account" - __version__ = "0.02" - - __description__ = """SecureUpload.eu account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "secureupload.eu" diff --git a/pyload/plugin/account/SendmywayCom.py b/pyload/plugin/account/SendmywayCom.py deleted file mode 100644 index d64658de3..000000000 --- a/pyload/plugin/account/SendmywayCom.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class SendmywayCom(XFSAccount): - __name__ = "SendmywayCom" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Sendmyway.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "sendmyway.com" diff --git a/pyload/plugin/account/ShareonlineBiz.py b/pyload/plugin/account/ShareonlineBiz.py deleted file mode 100644 index 17425ac07..000000000 --- a/pyload/plugin/account/ShareonlineBiz.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account - - -class ShareonlineBiz(Account): - __name__ = "ShareonlineBiz" - __type__ = "account" - __version__ = "0.24" - - __description__ = """Share-online.biz account plugin""" - __license__ = "GPLv3" - __authors__ = [("mkaay", "mkaay@mkaay.de"), - ("zoidberg", "zoidberg@mujmail.cz")] - - - def getUserAPI(self, user, req): - return req.load("http://api.share-online.biz/account.php", - {"username": user, "password": self.accounts[user]['password'], "act": "userDetails"}) - - - def loadAccountInfo(self, user, req): - html = self.getUserAPI(user, req) - - info = {} - for line in html.splitlines(): - if "=" in line: - key, value = line.split("=") - info[key] = value - self.logDebug(info) - - if "dl" in info and info['dl'].lower() != "not_available": - req.cj.setCookie("share-online.biz", "dl", info['dl']) - if "a" in info and info['a'].lower() != "not_available": - req.cj.setCookie("share-online.biz", "a", info['a']) - - return {"validuntil": int(info['expire_date']) if "expire_date" in info else -1, - "trafficleft": -1, - "premium": True if ("dl" in info or "a" in info) and (info['group'] != "Sammler") else False} - - - def login(self, user, data, req): - html = self.getUserAPI(user, req) - if "EXCEPTION" in html: - self.wrongPassword() diff --git a/pyload/plugin/account/SimplyPremiumCom.py b/pyload/plugin/account/SimplyPremiumCom.py deleted file mode 100644 index 0872e10f5..000000000 --- a/pyload/plugin/account/SimplyPremiumCom.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.utils import json_loads -from pyload.plugin.Account import Account - - -class SimplyPremiumCom(Account): - __name__ = "SimplyPremiumCom" - __type__ = "account" - __version__ = "0.01" - - __description__ = """Simply-Premium.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("EvolutionClip", "evolutionclip@live.de")] - - - def loadAccountInfo(self, user, req): - json_data = req.load('http://www.simply-premium.com/api/user.php?format=json') - self.logDebug("JSON data: " + json_data) - json_data = json_loads(json_data) - - if 'vip' in json_data['result'] and json_data['result']['vip'] == 0: - return {"premium": False} - - #Time package - validuntil = float(json_data['result']['timeend']) - #Traffic package - # {"trafficleft": int(traffic), "validuntil": -1} - #trafficleft = int(json_data['result']['traffic']) - - #return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} - return {"premium": True, "validuntil": validuntil} - - - def login(self, user, data, req): - req.cj.setCookie("simply-premium.com", "lang", "EN") - - if data['password'] == '' or data['password'] == '0': - post_data = {"key": user} - else: - post_data = {"login_name": user, "login_pass": data['password']} - - html = req.load("http://www.simply-premium.com/login.php", post=post_data) - - if 'logout' not in html: - self.wrongPassword() diff --git a/pyload/plugin/account/SimplydebridCom.py b/pyload/plugin/account/SimplydebridCom.py deleted file mode 100644 index 38ff90737..000000000 --- a/pyload/plugin/account/SimplydebridCom.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- - -from time import mktime, strptime - -from pyload.plugin.Account import Account - - -class SimplydebridCom(Account): - __name__ = "SimplydebridCom" - __type__ = "account" - __version__ = "0.10" - - __description__ = """Simply-Debrid.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] - - - def loadAccountInfo(self, user, req): - get_data = {'login': 2, 'u': self.loginname, 'p': self.password} - res = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) - data = [x.strip() for x in res.split(";")] - if str(data[0]) != "1": - return {"premium": False} - else: - return {"trafficleft": -1, "validuntil": mktime(strptime(str(data[2]), "%d/%m/%Y"))} - - - def login(self, user, data, req): - self.loginname = user - self.password = data['password'] - get_data = {'login': 1, 'u': self.loginname, 'p': self.password} - res = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) - if res != "02: loggin success": - self.wrongPassword() diff --git a/pyload/plugin/account/StahnuTo.py b/pyload/plugin/account/StahnuTo.py deleted file mode 100644 index adc7ab789..000000000 --- a/pyload/plugin/account/StahnuTo.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pyload.plugin.Account import Account - - -class StahnuTo(Account): - __name__ = "StahnuTo" - __type__ = "account" - __version__ = "0.03" - - __description__ = """StahnuTo account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - def loadAccountInfo(self, user, req): - html = req.load("http://www.stahnu.to/") - - m = re.search(r'>VIP: (\d+.*)<', html) - trafficleft = self.parseTraffic(m.group(1)) * 1024 if m else 0 - - return {"premium": trafficleft > (512 * 1024), "trafficleft": trafficleft, "validuntil": -1} - - - def login(self, user, data, req): - html = req.load("http://www.stahnu.to/login.php", post={ - "username": user, - "password": data['password'], - "submit": "Login"}) - - if not '<a href="logout.php">' in html: - self.wrongPassword() diff --git a/pyload/plugin/account/StreamcloudEu.py b/pyload/plugin/account/StreamcloudEu.py deleted file mode 100644 index 3ac74fbd0..000000000 --- a/pyload/plugin/account/StreamcloudEu.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class StreamcloudEu(XFSAccount): - __name__ = "StreamcloudEu" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Streamcloud.eu account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "streamcloud.eu" diff --git a/pyload/plugin/account/TurbobitNet.py b/pyload/plugin/account/TurbobitNet.py deleted file mode 100644 index 1086ede2a..000000000 --- a/pyload/plugin/account/TurbobitNet.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -from time import mktime, strptime - -from pyload.plugin.Account import Account - - -class TurbobitNet(Account): - __name__ = "TurbobitNet" - __type__ = "account" - __version__ = "0.01" - - __description__ = """TurbobitNet account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - def loadAccountInfo(self, user, req): - html = req.load("http://turbobit.net") - - m = re.search(r'<u>Turbo Access</u> to ([\d.]+)', html) - if m: - premium = True - validuntil = mktime(strptime(m.group(1), "%d.%m.%Y")) - else: - premium = False - validuntil = -1 - - return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} - - - def login(self, user, data, req): - req.cj.setCookie("turbobit.net", "user_lang", "en") - - html = req.load("http://turbobit.net/user/login", post={ - "user[login]": user, - "user[pass]": data['password'], - "user[submit]": "Login"}) - - if not '<div class="menu-item user-name">' in html: - self.wrongPassword() diff --git a/pyload/plugin/account/TusfilesNet.py b/pyload/plugin/account/TusfilesNet.py deleted file mode 100644 index 84e9ef9c6..000000000 --- a/pyload/plugin/account/TusfilesNet.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from time import mktime, strptime, gmtime - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class TusfilesNet(XFSAccount): - __name__ = "TusfilesNet" - __type__ = "account" - __version__ = "0.06" - - __description__ = """Tusfile.net account plugin""" - __license__ = "GPLv3" - __authors__ = [("guidobelix", "guidobelix@hotmail.it")] - - - HOSTER_DOMAIN = "tusfiles.net" - - VALID_UNTIL_PATTERN = r'<span class="label label-default">([^<]+)</span>' - TRAFFIC_LEFT_PATTERN = r'<td><img src="//www\.tusfiles\.net/i/icon/meter\.png" alt=""/></td>\n<td> (?P<S>[\d.,]+)' diff --git a/pyload/plugin/account/UlozTo.py b/pyload/plugin/account/UlozTo.py deleted file mode 100644 index 57031ce1f..000000000 --- a/pyload/plugin/account/UlozTo.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from urlparse import urljoin - -from pyload.plugin.Account import Account - - -class UlozTo(Account): - __name__ = "UlozTo" - __type__ = "account" - __version__ = "0.07" - - __description__ = """Uloz.to account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("pulpe", "")] - - - TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a href="/kredit" title="[^"]*?GB = ([\d.]+) MB"' - - - def loadAccountInfo(self, user, req): - self.phpsessid = req.cj.getCookie("ULOSESSID") #@NOTE: this cookie gets lost somehow after each request - - html = req.load("http://www.ulozto.net/", decode=True) - - req.cj.setCookie("ulozto.net", "ULOSESSID", self.phpsessid) - - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - trafficleft = int(float(m.group(1).replace(' ', '').replace(',', '.')) * 1000 * 1.048) if m else 0 - self.premium = True if trafficleft else False - - return {"validuntil": -1, "trafficleft": trafficleft} - - - def login(self, user, data, req): - login_page = req.load('http://www.ulozto.net/?do=web-login', decode=True) - action = re.findall('<form action="(.+?)"', login_page)[1].replace('&', '&') - token = re.search('_token_" value="(.+?)"', login_page).group(1) - - html = req.load(urljoin("http://www.ulozto.net/", action), - post={'_token_' : token, - 'do' : "loginForm-submit", - 'login' : u"Přihlásit", - 'password': data['password'], - 'username': user}, - decode=True) - - if '<div class="flash error">' in html: - self.wrongPassword() diff --git a/pyload/plugin/account/UnrestrictLi.py b/pyload/plugin/account/UnrestrictLi.py deleted file mode 100644 index 07e7d3e17..000000000 --- a/pyload/plugin/account/UnrestrictLi.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Account import Account -from pyload.utils import json_loads - - -class UnrestrictLi(Account): - __name__ = "UnrestrictLi" - __type__ = "account" - __version__ = "0.03" - - __description__ = """Unrestrict.li account plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - def loadAccountInfo(self, user, req): - json_data = req.load('http://unrestrict.li/api/jdownloader/user.php?format=json') - self.logDebug("JSON data: " + json_data) - json_data = json_loads(json_data) - - if 'vip' in json_data['result'] and json_data['result']['vip'] == 0: - return {"premium": False} - - validuntil = json_data['result']['expires'] - trafficleft = int(json_data['result']['traffic']) - - return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} - - - def login(self, user, data, req): - req.cj.setCookie("unrestrict.li", "lang", "EN") - html = req.load("https://unrestrict.li/sign_in") - - if 'solvemedia' in html: - self.logError(_("A Captcha is required. Go to http://unrestrict.li/sign_in and login, then retry")) - return - - post_data = {"username": user, "password": data['password'], - "remember_me": "remember", "signin": "Sign in"} - html = req.load("https://unrestrict.li/sign_in", post=post_data) - - if 'sign_out' not in html: - self.wrongPassword() diff --git a/pyload/plugin/account/UploadcCom.py b/pyload/plugin/account/UploadcCom.py deleted file mode 100644 index 66863c456..000000000 --- a/pyload/plugin/account/UploadcCom.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class UploadcCom(XFSAccount): - __name__ = "UploadcCom" - __type__ = "account" - __version__ = "0.02" - - __description__ = """Uploadc.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "uploadc.com" diff --git a/pyload/plugin/account/UploadedTo.py b/pyload/plugin/account/UploadedTo.py deleted file mode 100644 index 91cdba2c1..000000000 --- a/pyload/plugin/account/UploadedTo.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -from time import time - -from pyload.plugin.Account import Account - - -class UploadedTo(Account): - __name__ = "UploadedTo" - __type__ = "account" - __version__ = "0.27" - - __description__ = """Uploaded.to account plugin""" - __license__ = "GPLv3" - __authors__ = [("mkaay", "mkaay@mkaay.de")] - - - PREMIUM_PATTERN = r'<em>Premium</em>' - VALID_UNTIL_PATTERN = r'<td>Duration:</td>\s*<th>([^<]+)' - TRAFFIC_LEFT_PATTERN = r'<th colspan="2"><b class="cB">([^<]+)' - - - def loadAccountInfo(self, user, req): - validuntil = None - trafficleft = None - premium = None - - html = req.load("http://uploaded.net/me") - - premium = True if re.search(self.PREMIUM_PATTERN, html) else False - - m = re.search(self.VALID_UNTIL_PATTERN, html, re.M) - if m: - expiredate = m.group(1).strip() - - if expiredate == "unlimited": - validuntil = -1 - else: - m = re.findall(r'(\d+) (Week|weeks|day|hour)', expiredate) - if m: - validuntil = time() - for n, u in m: - validuntil += int(n) * 60 * 60 * {'Week': 168, 'weeks': 168, 'day': 24, 'hour': 1}[u] - - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - if m: - trafficleft = self.parseTraffic(m.group(1).replace('.', '')) - - return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - - - def login(self, user, data, req): - req.cj.setCookie("uploaded.net", "lang", "en") - - page = req.load("http://uploaded.net/io/login", - post={'id': user, 'pw': data['password'], '_': ""}) - - if "User and password do not match" in page: - self.wrongPassword() diff --git a/pyload/plugin/account/UploadheroCom.py b/pyload/plugin/account/UploadheroCom.py deleted file mode 100644 index c7b05bc94..000000000 --- a/pyload/plugin/account/UploadheroCom.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -import datetime -import time - -from pyload.plugin.Account import Account - - -class UploadheroCom(Account): - __name__ = "UploadheroCom" - __type__ = "account" - __version__ = "0.20" - - __description__ = """Uploadhero.co account plugin""" - __license__ = "GPLv3" - __authors__ = [("mcmyst", "mcmyst@hotmail.fr")] - - - def loadAccountInfo(self, user, req): - premium_pattern = re.compile('Il vous reste <span class="bleu">(\d+)</span> jours premium') - - data = self.getAccountData(user) - page = req.load("http://uploadhero.co/my-account") - - if premium_pattern.search(page): - end_date = datetime.date.today() + datetime.timedelta(days=int(premium_pattern.search(page).group(1))) - end_date = time.mktime(future.timetuple()) - account_info = {"validuntil": end_date, "trafficleft": -1, "premium": True} - else: - account_info = {"validuntil": -1, "trafficleft": -1, "premium": False} - - return account_info - - - def login(self, user, data, req): - page = req.load("http://uploadhero.co/lib/connexion.php", - post={"pseudo_login": user, "password_login": data['password']}) - - if "mot de passe invalide" in page: - self.wrongPassword() diff --git a/pyload/plugin/account/UploadingCom.py b/pyload/plugin/account/UploadingCom.py deleted file mode 100644 index 6d54469e8..000000000 --- a/pyload/plugin/account/UploadingCom.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from time import time, strptime, mktime - -from pyload.plugin.Account import Account -from pyload.plugin.internal.SimpleHoster import set_cookies - - -class UploadingCom(Account): - __name__ = "UploadingCom" - __type__ = "account" - __version__ = "0.11" - - __description__ = """Uploading.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("mkaay", "mkaay@mkaay.de")] - - - PREMIUM_PATTERN = r'UPGRADE TO PREMIUM' - VALID_UNTIL_PATTERN = r'Valid Until:(.+?)<' - - - def loadAccountInfo(self, user, req): - validuntil = None - trafficleft = None - premium = None - - html = req.load("http://uploading.com/") - - premium = False if re.search(self.PREMIUM_PATTERN, html) else True - - m = re.search(self.VALID_UNTIL_PATTERN, html) - if m: - expiredate = m.group(1).strip() - self.logDebug("Expire date: " + expiredate) - - try: - validuntil = mktime(strptime(expiredate, "%b %d, %Y")) - - except Exception, e: - self.logError(e) - - else: - if validuntil > mktime(gmtime()): - premium = True - else: - premium = False - validuntil = None - - return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} - - - def login(self, user, data, req): - set_cookies([("uploading.com", "lang", "1"), - ("uploading.com", "language", "1"), - ("uploading.com", "setlang", "en"), - ("uploading.com", "_lang", "en")] - - req.load("http://uploading.com/") - req.load("http://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time() * 1000), - post={'email': user, 'password': data['password'], 'remember': "on"}) diff --git a/pyload/plugin/account/UptoboxCom.py b/pyload/plugin/account/UptoboxCom.py deleted file mode 100644 index 2d0b49957..000000000 --- a/pyload/plugin/account/UptoboxCom.py +++ /dev/null @@ -1,17 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class UptoboxCom(XFSAccount): - __name__ = "UptoboxCom" - __type__ = "account" - __version__ = "0.07" - - __description__ = """DDLStorage.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - HOSTER_DOMAIN = "uptobox.com" - HOSTER_URL = "https://uptobox.com/" diff --git a/pyload/plugin/account/VidPlayNet.py b/pyload/plugin/account/VidPlayNet.py deleted file mode 100644 index 390520a00..000000000 --- a/pyload/plugin/account/VidPlayNet.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class VidPlayNet(XFSAccount): - __name__ = "VidPlayNet" - __type__ = "account" - __version__ = "0.02" - - __description__ = """VidPlay.net account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "vidplay.net" diff --git a/pyload/plugin/account/XFileSharingPro.py b/pyload/plugin/account/XFileSharingPro.py deleted file mode 100644 index 9d938c4c5..000000000 --- a/pyload/plugin/account/XFileSharingPro.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSAccount import XFSAccount - - -class XFileSharingPro(XFSAccount): - __name__ = "XFileSharingPro" - __type__ = "account" - __version__ = "0.05" - - __description__ = """XFileSharingPro multi-purpose account plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = None - - - def init(self): - if self.HOSTER_DOMAIN: - return super(XFileSharingPro, self).init() - - - def loadAccountInfo(self, user, req): - return super(XFileSharingPro if self.HOSTER_DOMAIN else XFSAccount, self).loadAccountInfo(user, req) - - - def login(self, user, data, req): - if self.HOSTER_DOMAIN: - return super(XFileSharingPro, self).login(user, data, req) diff --git a/pyload/plugin/account/YibaishiwuCom.py b/pyload/plugin/account/YibaishiwuCom.py deleted file mode 100644 index e169a5901..000000000 --- a/pyload/plugin/account/YibaishiwuCom.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pyload.plugin.Account import Account - - -class YibaishiwuCom(Account): - __name__ = "YibaishiwuCom" - __type__ = "account" - __version__ = "0.01" - - __description__ = """115.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - ACCOUNT_INFO_PATTERN = r'var USER_PERMISSION = {(.*?)}' - - - def loadAccountInfo(self, user, req): - #self.relogin(user) - html = req.load("http://115.com/", decode=True) - - m = re.search(self.ACCOUNT_INFO_PATTERN, html, re.S) - premium = True if (m and 'is_vip: 1' in m.group(1)) else False - validuntil = trafficleft = (-1 if m else 0) - return dict({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}) - - - def login(self, user, data, req): - html = req.load('http://passport.115.com/?ac=login', post={ - "back": "http://www.115.com/", - "goto": "http://115.com/", - "login[account]": user, - "login[passwd]": data['password'] - }, decode=True) - - if not 'var USER_PERMISSION = {' in html: - self.wrongPassword() diff --git a/pyload/plugin/account/ZeveraCom.py b/pyload/plugin/account/ZeveraCom.py deleted file mode 100644 index 2eee62ac1..000000000 --- a/pyload/plugin/account/ZeveraCom.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- - -from time import mktime, strptime - -from pyload.plugin.Account import Account - - -class ZeveraCom(Account): - __name__ = "ZeveraCom" - __type__ = "account" - __version__ = "0.21" - - __description__ = """Zevera.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - def loadAccountInfo(self, user, req): - data = self.getAPIData(req) - if data == "No traffic": - account_info = {"trafficleft": 0, "validuntil": 0, "premium": False} - else: - account_info = { - "trafficleft": int(data['availabletodaytraffic']) * 1024, - "validuntil": mktime(strptime(data['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")), - "premium": True - } - return account_info - - - def login(self, user, data, req): - self.loginname = user - self.password = data['password'] - if self.getAPIData(req) == "No traffic": - self.wrongPassword() - - - def getAPIData(self, req, just_header=False, **kwargs): - get_data = { - 'cmd': 'accountinfo', - 'login': self.loginname, - 'pass': self.password - } - get_data.update(kwargs) - - res = req.load("http://www.zevera.com/jDownloader.ashx", get=get_data, - decode=True, just_header=just_header) - self.logDebug(res) - - if ':' in res: - if not just_header: - res = res.replace(',', '\n') - return dict((y.strip().lower(), z.strip()) for (y, z) in - [x.split(':', 1) for x in res.splitlines() if ':' in x]) - else: - return res diff --git a/pyload/plugin/account/__init__.py b/pyload/plugin/account/__init__.py deleted file mode 100644 index 40a96afc6..000000000 --- a/pyload/plugin/account/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/pyload/plugin/addon/Checksum.py b/pyload/plugin/addon/Checksum.py deleted file mode 100644 index 0589bd55a..000000000 --- a/pyload/plugin/addon/Checksum.py +++ /dev/null @@ -1,186 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement - -import hashlib -import re -import zlib - -from os import remove -from os.path import getsize, isfile, splitext - -from pyload.plugin.Addon import Addon -from pyload.utils import safe_join, fs_encode - - -def computeChecksum(local_file, algorithm): - if algorithm in getattr(hashlib, "algorithms", ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")): - h = getattr(hashlib, algorithm)() - - with open(local_file, 'rb') as f: - for chunk in iter(lambda: f.read(128 * h.block_size), ''): - h.update(chunk) - - return h.hexdigest() - - elif algorithm in ("adler32", "crc32"): - hf = getattr(zlib, algorithm) - last = 0 - - with open(local_file, 'rb') as f: - for chunk in iter(lambda: f.read(8192), ''): - last = hf(chunk, last) - - return "%x" % last - - else: - return None - - -class Checksum(Addon): - __name__ = "Checksum" - __type__ = "addon" - __version__ = "0.15" - - __config__ = [("activated" , "bool" , "Activated" , True ), - ("check_checksum", "bool" , "Check checksum? (If False only size will be verified)", True ), - ("check_action" , "fail;retry;nothing", "What to do if check fails?" , "retry"), - ("max_tries" , "int" , "Number of retries" , 2 ), - ("retry_action" , "fail;nothing" , "What to do if all retries fail?" , "fail" ), - ("wait_time" , "int" , "Time to wait before each retry (seconds)" , 1 )] - - __description__ = """Verify downloaded file size and checksum""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com"), - ("stickell", "l.stickell@yahoo.it")] - - - methods = {'sfv': 'crc32', 'crc': 'crc32', 'hash': 'md5'} - regexps = {'sfv': r'^(?P<name>[^;].+)\s+(?P<hash>[0-9A-Fa-f]{8})$', - 'md5': r'^(?P<name>[0-9A-Fa-f]{32}) (?P<file>.+)$', - 'crc': r'filename=(?P<name>.+)\nsize=(?P<size>\d+)\ncrc32=(?P<hash>[0-9A-Fa-f]{8})$', - 'default': r'^(?P<hash>[0-9A-Fa-f]+)\s+\*?(?P<name>.+)$'} - - - def activate(self): - if not self.getConfig("check_checksum"): - self.logInfo(_("Checksum validation is disabled in plugin configuration")) - - - def setup(self): - self.algorithms = sorted( - getattr(hashlib, "algorithms", ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")), reverse=True) - self.algorithms.extend(["crc32", "adler32"]) - self.formats = self.algorithms + ["sfv", "crc", "hash"] - - - def downloadFinished(self, pyfile): - """ - Compute checksum for the downloaded file and compare it with the hash provided by the hoster. - pyfile.plugin.check_data should be a dictionary which can contain: - a) if known, the exact filesize in bytes (e.g. "size": 123456789) - b) hexadecimal hash string with algorithm name as key (e.g. "md5": "d76505d0869f9f928a17d42d66326307") - """ - if hasattr(pyfile.plugin, "check_data") and isinstance(pyfile.plugin.check_data, dict): - data = pyfile.plugin.check_data.copy() - - elif hasattr(pyfile.plugin, "api_data") and isinstance(pyfile.plugin.api_data, dict): - data = pyfile.plugin.api_data.copy() - - # elif hasattr(pyfile.plugin, "info") and isinstance(pyfile.plugin.info, dict): - # data = pyfile.plugin.info.copy() - - else: - return - - self.logDebug(data) - - if not pyfile.plugin.lastDownload: - self.checkFailed(pyfile, None, "No file downloaded") - - local_file = fs_encode(pyfile.plugin.lastDownload) - #download_folder = self.config['general']['download_folder'] - #local_file = fs_encode(safe_join(download_folder, pyfile.package().folder, pyfile.name)) - - if not isfile(local_file): - self.checkFailed(pyfile, None, "File does not exist") - - # validate file size - if "size" in data: - api_size = int(data['size']) - file_size = getsize(local_file) - if api_size != file_size: - self.logWarning(_("File %s has incorrect size: %d B (%d expected)") % (pyfile.name, file_size, api_size)) - self.checkFailed(pyfile, local_file, "Incorrect file size") - del data['size'] - - # validate checksum - if data and self.getConfig("check_checksum"): - if "checksum" in data: - data['md5'] = data['checksum'] - - for key in self.algorithms: - if key in data: - checksum = computeChecksum(local_file, key.replace("-", "").lower()) - if checksum: - if checksum == data[key].lower(): - self.logInfo(_('File integrity of "%s" verified by %s checksum (%s)') % - (pyfile.name, key.upper(), checksum)) - break - else: - self.logWarning(_("%s checksum for file %s does not match (%s != %s)") % - (key.upper(), pyfile.name, checksum, data[key])) - self.checkFailed(pyfile, local_file, "Checksums do not match") - else: - self.logWarning(_("Unsupported hashing algorithm"), key.upper()) - else: - self.logWarning(_("Unable to validate checksum for file: ") + pyfile.name) - - - def checkFailed(self, pyfile, local_file, msg): - check_action = self.getConfig("check_action") - if check_action == "retry": - max_tries = self.getConfig("max_tries") - retry_action = self.getConfig("retry_action") - if pyfile.plugin.retries < max_tries: - if local_file: - remove(local_file) - pyfile.plugin.retry(max_tries, self.getConfig("wait_time"), msg) - elif retry_action == "nothing": - return - elif check_action == "nothing": - return - pyfile.plugin.fail(reason=msg) - - - def packageFinished(self, pypack): - download_folder = safe_join(self.config['general']['download_folder'], pypack.folder, "") - - for link in pypack.getChildren().itervalues(): - file_type = splitext(link['name'])[1][1:].lower() - - if file_type not in self.formats: - continue - - hash_file = fs_encode(safe_join(download_folder, link['name'])) - if not isfile(hash_file): - self.logWarning(_("File not found"), link['name']) - continue - - with open(hash_file) as f: - text = f.read() - - for m in re.finditer(self.regexps.get(file_type, self.regexps['default']), text): - data = m.groupdict() - self.logDebug(link['name'], data) - - local_file = fs_encode(safe_join(download_folder, data['name'])) - algorithm = self.methods.get(file_type, file_type) - checksum = computeChecksum(local_file, algorithm) - if checksum == data['hash']: - self.logInfo(_('File integrity of "%s" verified by %s checksum (%s)') % - (data['name'], algorithm, checksum)) - else: - self.logWarning(_("%s checksum for file %s does not match (%s != %s)") % - (algorithm, data['name'], checksum, data['hash'])) diff --git a/pyload/plugin/addon/ClickAndLoad.py b/pyload/plugin/addon/ClickAndLoad.py deleted file mode 100644 index 5fe6e4bec..000000000 --- a/pyload/plugin/addon/ClickAndLoad.py +++ /dev/null @@ -1,74 +0,0 @@ -# -*- coding: utf-8 -*- - -from socket import socket, error -from threading import Thread - -from pyload.plugin.Addon import Addon - - -def forward(source, destination): - string = ' ' - while string: - string = source.recv(1024) - if string: - destination.sendall(string) - else: - #source.shutdown(socket.SHUT_RD) - destination.shutdown(socket.SHUT_WR) - - -class ClickAndLoad(Addon): - __name__ = "ClickAndLoad" - __type__ = "addon" - __version__ = "0.23" - - __config__ = [("activated", "bool", "Activated" , True ), - ("port" , "int" , "Port" , 9666 ), - ("extern" , "bool", "Allow external link adding", False)] - - __description__ = """Click'N'Load hook plugin""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.de"), - ("mkaay", "mkaay@mkaay.de"), - ("Walter Purcaro", "vuolter@gmail.com")] - - - def setup(self): - self.interval = 300 - - - def activate(self): - self.initPeriodical() - - - def periodical(self): - webip = "0.0.0.0" if self.getConfig("extern") else "127.0.0.1" - webport = self.config['webinterface']['port'] - cnlport = self.getConfig("port")) - - try: - s = socket() - s.bind((webip, cnlport)) - s.listen(5) - - client = s.accept()[0] - server = socket() - - server.connect(("127.0.0.1", webport)) - - except error, e: - if hasattr(e, "errno"): - errno = e.errno - else: - errno = e.args[0] - - if errno == 98: - self.logWarning(_("Port %d already in use") % cnlport) - else: - self.logDebug(e) - - else: - self.core.scheduler.removeJob(self.cb) - t = Thread(target=forward, args=[client, server]) - t.setDaemon(True) - t.start() diff --git a/pyload/plugin/addon/DeleteFinished.py b/pyload/plugin/addon/DeleteFinished.py deleted file mode 100644 index 59f2e3321..000000000 --- a/pyload/plugin/addon/DeleteFinished.py +++ /dev/null @@ -1,79 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.database import style -from pyload.plugin.Addon import Addon - - -class DeleteFinished(Addon): - __name__ = "DeleteFinished" - __type__ = "addon" - __version__ = "1.11" - - __config__ = [('interval' , 'int' , 'Delete every (hours)' , '72' ), - ('deloffline', 'bool', 'Delete packages with offline links', 'False')] - - __description__ = """Automatically delete all finished packages from queue""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - # event_list = ["pluginConfigChanged"] - - - ## overwritten methods ## - def periodical(self): - if not self.info['sleep']: - deloffline = self.getConfig('deloffline') - mode = '0,1,4' if deloffline else '0,4' - msg = _('delete all finished packages in queue list (%s packages with offline links)') - self.logInfo(msg % (_('including') if deloffline else _('excluding'))) - self.deleteFinished(mode) - self.info['sleep'] = True - self.addEvent('packageFinished', self.wakeup) - - - def pluginConfigChanged(self, plugin, name, value): - if name == "interval" and value != self.interval: - self.interval = value * 3600 - self.initPeriodical() - - - def deactivate(self): - self.removeEvent('packageFinished', self.wakeup) - - - def activate(self): - self.info = {'sleep': True} - interval = self.getConfig('interval') - self.pluginConfigChanged(self.__name__, 'interval', interval) - self.addEvent('packageFinished', self.wakeup) - - - ## own methods ## - @style.queue - def deleteFinished(self, mode): - self.c.execute('DELETE FROM packages WHERE NOT EXISTS(SELECT 1 FROM links WHERE package=packages.id AND status NOT IN (%s))' % mode) - self.c.execute('DELETE FROM links WHERE NOT EXISTS(SELECT 1 FROM packages WHERE id=links.package)') - - - def wakeup(self, pypack): - self.removeEvent('packageFinished', self.wakeup) - self.info['sleep'] = False - - - ## event managing ## - def addEvent(self, event, func): - """Adds an event listener for event name""" - if event in self.m.events: - if func in self.m.events[event]: - self.logDebug("Function already registered", func) - else: - self.m.events[event].append(func) - else: - self.m.events[event] = [func] - - - def setup(self): - self.interval = 0 - self.m = self.manager - self.removeEvent = self.m.removeEvent diff --git a/pyload/plugin/addon/DownloadScheduler.py b/pyload/plugin/addon/DownloadScheduler.py deleted file mode 100644 index e5e25e389..000000000 --- a/pyload/plugin/addon/DownloadScheduler.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from time import localtime - -from pyload.plugin.Addon import Addon - - -class DownloadScheduler(Addon): - __name__ = "DownloadScheduler" - __type__ = "addon" - __version__ = "0.22" - - __config__ = [("timetable", "str" , "List time periods as hh:mm full or number(kB/s)" , "0:00 full, 7:00 250, 10:00 0, 17:00 150"), - ("abort" , "bool", "Abort active downloads when start period with speed 0", False )] - - __description__ = """Download Scheduler""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] - - - def setup(self): - self.cb = None #: callback to scheduler job; will be by removed AddonManager when addon unloaded - - - def activate(self): - self.updateSchedule() - - - def updateSchedule(self, schedule=None): - if schedule is None: - schedule = self.getConfig("timetable") - - schedule = re.findall("(\d{1,2}):(\d{2})[\s]*(-?\d+)", - schedule.lower().replace("full", "-1").replace("none", "0")) - if not schedule: - self.logError(_("Invalid schedule")) - return - - t0 = localtime() - now = (t0.tm_hour, t0.tm_min, t0.tm_sec, "X") - schedule = sorted([(int(x[0]), int(x[1]), 0, int(x[2])) for x in schedule] + [now]) - - self.logDebug("Schedule", schedule) - - for i, v in enumerate(schedule): - if v[3] == "X": - last, next = schedule[i - 1], schedule[(i + 1) % len(schedule)] - self.logDebug("Now/Last/Next", now, last, next) - - self.setDownloadSpeed(last[3]) - - next_time = (((24 + next[0] - now[0]) * 60 + next[1] - now[1]) * 60 + next[2] - now[2]) % 86400 - self.core.scheduler.removeJob(self.cb) - self.cb = self.core.scheduler.addJob(next_time, self.updateSchedule, threaded=False) - - - def setDownloadSpeed(self, speed): - if speed == 0: - abort = self.getConfig("abort") - self.logInfo(_("Stopping download server. (Running downloads will %sbe aborted.)") % '' if abort else _('not ')) - self.core.api.pauseServer() - if abort: - self.core.api.stopAllDownloads() - else: - self.core.api.unpauseServer() - - if speed > 0: - self.logInfo(_("Setting download speed to %d kB/s") % speed) - self.core.api.setConfigValue("download", "limit_speed", 1) - self.core.api.setConfigValue("download", "max_speed", speed) - else: - self.logInfo(_("Setting download speed to FULL")) - self.core.api.setConfigValue("download", "limit_speed", 0) - self.core.api.setConfigValue("download", "max_speed", -1) diff --git a/pyload/plugin/addon/ExternalScripts.py b/pyload/plugin/addon/ExternalScripts.py deleted file mode 100644 index 31283afc2..000000000 --- a/pyload/plugin/addon/ExternalScripts.py +++ /dev/null @@ -1,145 +0,0 @@ -# -*- coding: utf-8 -*- - -import subprocess - -from itertools import chain -from os import listdir, access, X_OK, makedirs -from os.path import join, exists, basename, abspath - -from pyload.plugin.Addon import Addon -from pyload.utils import safe_join - - -class ExternalScripts(Addon): - __name__ = "ExternalScripts" - __type__ = "addon" - __version__ = "0.25" - - __config__ = [("activated", "bool", "Activated", True)] - - __description__ = """Run external scripts""" - __license__ = "GPLv3" - __authors__ = [("mkaay", "mkaay@mkaay.de"), - ("RaNaN", "ranan@pyload.org"), - ("spoob", "spoob@pyload.org"), - ("Walter Purcaro", "vuolter@gmail.com")] - - - event_map = {'archive-extracted' : "archive_extracted", - 'package-extracted' : "package_extracted", - 'all_archives-extracted' : "all_archives_extracted", - 'all_archives-processed' : "all_archives_processed", - 'all_downloads-finished' : "allDownloadsFinished", - 'all_downloads-processed': "allDownloadsProcessed"} - - - def setup(self): - self.scripts = {} - - folders = ["download_preparing", "download_finished", "all_downloads_finished", "all_downloads_processed", - "before_reconnect", "after_reconnect", - "package_finished", "package_extracted", - "archive_extracted", "all_archives_extracted", "all_archives_processed", - # deprecated folders - "unrar_finished", "all_dls_finished", "all_dls_processed"] - - for folder in folders: - self.scripts[folder] = [] - - self.initPluginType(folder, join(pypath, 'scripts', folder)) - self.initPluginType(folder, join('scripts', folder)) - - for script_type, names in self.scripts.iteritems(): - if names: - self.logInfo(_("Installed scripts for"), script_type, ", ".join([basename(x) for x in names])) - - - def initPluginType(self, folder, path): - if not exists(path): - try: - makedirs(path) - except Exception: - self.logDebug("Script folder %s not created" % folder) - return - - for f in listdir(path): - if f.startswith("#") or f.startswith(".") or f.startswith("_") or f.endswith("~") or f.endswith(".swp"): - continue - - if not access(join(path, f), X_OK): - self.logWarning(_("Script not executable:") + " %s/%s" % (folder, f)) - - self.scripts[folder].append(join(path, f)) - - - def callScript(self, script, *args): - try: - cmd = [script] + [str(x) if not isinstance(x, basestring) else x for x in args] - self.logDebug("Executing", abspath(script), " ".join(cmd)) - #output goes to pyload - subprocess.Popen(cmd, bufsize=-1) - except Exception, e: - self.logError(_("Error in %(script)s: %(error)s") % {"script": basename(script), "error": e}) - - - def downloadPreparing(self, pyfile): - for script in self.scripts['download_preparing']: - self.callScript(script, pyfile.pluginname, pyfile.url, pyfile.id) - - - def downloadFinished(self, pyfile): - download_folder = self.config['general']['download_folder'] - for script in self.scripts['download_finished']: - filename = safe_join(download_folder, pyfile.package().folder, pyfile.name) - self.callScript(script, pyfile.pluginname, pyfile.url, pyfile.name, filename, pyfile.id) - - - def packageFinished(self, pypack): - download_folder = self.config['general']['download_folder'] - for script in self.scripts['package_finished']: - folder = safe_join(download_folder, pypack.folder) - self.callScript(script, pypack.name, folder, pypack.password, pypack.id) - - - def beforeReconnecting(self, ip): - for script in self.scripts['before_reconnect']: - self.callScript(script, ip) - - - def afterReconnecting(self, ip): - for script in self.scripts['after_reconnect']: - self.callScript(script, ip) - - - def archive_extracted(self, pyfile, folder, filename, files): - for script in self.scripts['archive_extracted']: - self.callScript(script, folder, filename, files) - for script in self.scripts['unrar_finished']: #: deprecated - self.callScript(script, folder, filename) - - - def package_extracted(self, pypack): - download_folder = self.config['general']['download_folder'] - for script in self.scripts['package_extracted']: - folder = safe_join(download_folder, pypack.folder) - self.callScript(script, pypack.name, folder, pypack.password, pypack.id) - - - def all_archives_extracted(self): - for script in self.scripts['all_archives_extracted']: - self.callScript(script) - - - def all_archives_processed(self): - for script in self.scripts['all_archives_processed']: - self.callScript(script) - - - def allDownloadsFinished(self): - for script in chain(self.scripts['all_downloads_finished'], self.scripts['all_dls_finished']): - self.callScript(script) - - - def allDownloadsProcessed(self): - for script in chain(self.scripts['all_downloads_processed'], self.scripts['all_dls_processed']): - self.callScript(script) diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py deleted file mode 100644 index b24bb37a2..000000000 --- a/pyload/plugin/addon/ExtractArchive.py +++ /dev/null @@ -1,363 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement - -import os -import sys - -from copy import copy -from os import remove, chmod, makedirs -from os.path import exists, basename, isfile, isdir -from traceback import print_exc - -# monkey patch bug in python 2.6 and lower -# http://bugs.python.org/issue6122 , http://bugs.python.org/issue1236 , http://bugs.python.org/issue1731717 -if sys.version_info < (2, 7) and os.name != "nt": - import errno - from subprocess import Popen - - - def _eintr_retry_call(func, *args): - while True: - try: - return func(*args) - except OSError, e: - if e.errno == errno.EINTR: - continue - raise - - - # unsued timeout option for older python version - def wait(self, timeout=0): - """Wait for child process to terminate. Returns returncode - attribute.""" - if self.returncode is None: - try: - pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0) - except OSError, e: - if e.errno != errno.ECHILD: - raise - # This happens if SIGCLD is set to be ignored or waiting - # for child processes has otherwise been disabled for our - # process. This child is dead, we can't get the status. - sts = 0 - self._handle_exitstatus(sts) - return self.returncode - - Popen.wait = wait - -if os.name != "nt": - from grp import getgrnam - from os import chown - from pwd import getpwnam - -from pyload.plugin.Addon import Addon, threaded, Expose -from pyload.plugin.internal.AbstractExtractor import ArchiveError, CRCError, WrongPassword -from pyload.utils import safe_join, fs_encode - - -class ExtractArchive(Addon): - __name__ = "ExtractArchive" - __type__ = "addon" - __version__ = "0.19" - - __config__ = [("activated" , "bool" , "Activated" , True ), - ("fullpath" , "bool" , "Extract full path" , True ), - ("overwrite" , "bool" , "Overwrite files" , True ), - ("passwordfile" , "file" , "password file" , "archive_password.txt"), - ("deletearchive", "bool" , "Delete archives when done" , False ), - ("subfolder" , "bool" , "Create subfolder for each package" , False ), - ("destination" , "folder", "Extract files to" , "" ), - ("excludefiles" , "str" , "Exclude files from unpacking (seperated by ;)", "" ), - ("recursive" , "bool" , "Extract archives in archvies" , True ), - ("queue" , "bool" , "Wait for all downloads to be finished" , True ), - ("renice" , "int" , "CPU Priority" , 0 )] - - __description__ = """Extract different kind of archives""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "ranan@pyload.org"), - ("AndroKev", ""), - ("Walter Purcaro", "vuolter@gmail.com")] - - - event_map = {'all_downloads-processed': "allDownloadsProcessed"} - - - def setup(self): - self.plugins = [] - self.passwords = [] - names = [] - - for p in ("UnRar", "UnZip"): - try: - module = self.core.pluginManager.loadModule("internal", p) - klass = getattr(module, p) - if klass.checkDeps(): - names.append(p) - self.plugins.append(klass) - - except OSError, e: - if e.errno == 2: - self.logInfo(_("No %s installed") % p) - else: - self.logWarning(_("Could not activate %s") % p, e) - if self.core.debug: - print_exc() - - except Exception, e: - self.logWarning(_("Could not activate %s") % p, e) - if self.core.debug: - print_exc() - - if names: - self.logInfo(_("Activated") + " " + " ".join(names)) - else: - self.logInfo(_("No Extract plugins activated")) - - # queue with package ids - self.queue = [] - - - @Expose - def extractPackage(self, id): - """ Extract package with given id""" - self.manager.startThread(self.extract, [id]) - - - def packageFinished(self, pypack): - pid = pypack.id - if self.getConfig("queue"): - self.logInfo(_("Package %s queued for later extracting") % pypack.name) - self.queue.append(pid) - else: - self.manager.startThread(self.extract, [pid]) - - - @threaded - def allDownloadsProcessed(self, thread): - local = copy(self.queue) - del self.queue[:] - if self.extract(local, thread): #: check only if all gone fine, no failed reporting for now - self.manager.dispatchEvent("all_archives-extracted") - self.manager.dispatchEvent("all_archives-processed") - - - def extract(self, ids, thread=None): - processed = [] - extracted = [] - failed = [] - - destination = self.getConfig("destination") - subfolder = self.getConfig("subfolder") - fullpath = self.getConfig("fullpath") - overwrite = self.getConfig("overwrite") - excludefiles = self.getConfig("excludefiles") - renice = self.getConfig("renice") - recursive = self.getConfig("recursive") - - # reload from txt file - self.reloadPasswords() - - # dl folder - dl = self.config['general']['download_folder'] - - #iterate packages -> plugins -> targets - for pid in ids: - p = self.core.files.getPackage(pid) - self.logInfo(_("Check package %s") % p.name) - if not p: - continue - - # determine output folder - out = safe_join(dl, p.folder, "") - - out = safe_join(dl, p.folder, self.getConfig("destination"), "") - if subfolder: - out = safe_join(out, fs_encode(p.folder)) - - if not exists(out): - makedirs(out) - - files_ids = [(safe_join(dl, p.folder, x['name']), x['id']) for x in p.getChildren().itervalues()] - matched = False - success = True - - # check as long there are unseen files - while files_ids: - new_files_ids = [] - - for plugin in self.plugins: - targets = plugin.getTargets(files_ids) - if targets: - self.logDebug("Targets for %s: %s" % (plugin.__name__, targets)) - matched = True - for target, fid in targets: - if target in processed: - self.logDebug(basename(target), "skipped") - continue - - processed.append(target) # prevent extracting same file twice - - self.logInfo(basename(target), _("Extract to %s") % out) - try: - klass = plugin(self, target, out, fullpath, overwrite, excludefiles, renice) - klass.init() - password = p.password.strip().splitlines() - new_files = self._extract(klass, fid, password, thread) - except Exception, e: - self.logError(basename(target), e) - success = False - continue - - self.logDebug("Extracted", new_files) - self.setPermissions(new_files) - - for file in new_files: - if not exists(file): - self.logDebug("New file %s does not exists" % file) - continue - if recursive and isfile(file): - new_files_ids.append((file, fid)) # append as new target - - files_ids = new_files_ids # also check extracted files - - if matched: - if success: - extracted.append(pid) - self.manager.dispatchEvent("package-extracted", p) - else: - failed.append(pid) - self.manager.dispatchEvent("package-extract_failed", p) - else: - self.logInfo(_("No files found to extract")) - - return True if not failed else False - - - def _extract(self, plugin, fid, passwords, thread): - pyfile = self.core.files.getFile(fid) - deletearchive = self.getConfig("deletearchive") - - pyfile.setCustomStatus(_("extracting")) - thread.addActive(pyfile) # keep this file until everything is done - - try: - progress = lambda x: pyfile.setProgress(x) - success = False - - if not plugin.checkArchive(): - plugin.extract(progress) - success = True - else: - self.logInfo(basename(plugin.file), _("Password protected")) - self.logDebug("Passwords", passwords) - - pwlist = copy(self.getPasswords()) - # remove already supplied pws from list (only local) - for pw in passwords: - if pw in pwlist: - pwlist.remove(pw) - - for pw in passwords + pwlist: - try: - self.logDebug("Try password", pw) - if plugin.checkPassword(pw): - plugin.extract(progress, pw) - self.addPassword(pw) - success = True - break - except WrongPassword: - self.logDebug("Password was wrong") - - if not success: - raise Exception(_("Wrong password")) - - if self.core.debug: - self.logDebug("Would delete", ", ".join(plugin.getDeleteFiles())) - - if deletearchive: - files = plugin.getDeleteFiles() - self.logInfo(_("Deleting %s files") % len(files)) - for f in files: - if exists(f): - remove(f) - else: - self.logDebug("%s does not exists" % f) - - self.logInfo(basename(plugin.file), _("Extracting finished")) - - extracted_files = plugin.getExtractedFiles() - self.manager.dispatchEvent("archive-extracted", pyfile, plugin.out, plugin.file, extracted_files) - - return extracted_files - - except ArchiveError, e: - self.logError(basename(plugin.file), _("Archive Error"), e) - except CRCError: - self.logError(basename(plugin.file), _("CRC Mismatch")) - except Exception, e: - if self.core.debug: - print_exc() - self.logError(basename(plugin.file), _("Unknown Error"), e) - - self.manager.dispatchEvent("archive-extract_failed", pyfile) - raise Exception(_("Extract failed")) - - - @Expose - def getPasswords(self): - """ List of saved passwords """ - return self.passwords - - - def reloadPasswords(self): - passwordfile = self.getConfig("passwordfile") - - try: - passwords = [] - with open(passwordfile, "a+") as f: - for pw in f.read().splitlines(): - passwords.append(pw) - - except IOError, e: - self.logError(e) - - else: - self.passwords = passwords - - - @Expose - def addPassword(self, pw): - """ Adds a password to saved list""" - passwordfile = self.getConfig("passwordfile") - - if pw in self.passwords: - self.passwords.remove(pw) - - self.passwords.insert(0, pw) - - try: - with open(passwordfile, "wb") as f: - for pw in self.passwords: - f.write(pw + "\n") - except IOError, e: - self.logError(e) - - - def setPermissions(self, files): - for f in files: - if not exists(f): - continue - try: - if self.config['permission']['change_file']: - if isfile(f): - chmod(f, int(self.config['permission']['file'], 8)) - elif isdir(f): - chmod(f, int(self.config['permission']['folder'], 8)) - - if self.config['permission']['change_dl'] and os.name != "nt": - uid = getpwnam(self.config['permission']['user'])[2] - gid = getgrnam(self.config['permission']['group'])[2] - chown(f, uid, gid) - except Exception, e: - self.logWarning(_("Setting User and Group failed"), e) diff --git a/pyload/plugin/addon/HotFolder.py b/pyload/plugin/addon/HotFolder.py deleted file mode 100644 index 3bbafd5ed..000000000 --- a/pyload/plugin/addon/HotFolder.py +++ /dev/null @@ -1,70 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement - -import time - -from os import listdir, makedirs -from os.path import exists, isfile, join -from shutil import move - -from pyload.plugin.Addon import Addon -from pyload.utils import fs_encode, safe_join - - -class HotFolder(Addon): - __name__ = "HotFolder" - __type__ = "addon" - __version__ = "0.12" - - __config__ = [("folder" , "str" , "Folder to observe" , "container"), - ("watch_file", "bool", "Observe link file" , False ), - ("keep" , "bool", "Keep added containers", True ), - ("file" , "str" , "Link file" , "links.txt")] - - __description__ = """Observe folder and file for changes and add container and links""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.de")] - - - def setup(self): - self.interval = 10 - - - def activate(self): - self.initPeriodical() - - - def periodical(self): - folder = fs_encode(self.getConfig("folder")) - - try: - if not exists(join(folder, "finished")): - makedirs(join(folder, "finished")) - - if self.getConfig("watch_file"): - with open(fs_encode(self.getConfig("file")), "a+") as f: - content = f.read().strip() - - if content: - name = "%s_%s.txt" % (self.getConfig("file"), time.strftime("%H-%M-%S_%d%b%Y")) - - with open(safe_join(folder, "finished", name), "wb") as f: - f.write(content) - - self.core.api.addPackage(f.name, [f.name], 1) - - for f in listdir(folder): - path = join(folder, f) - - if not isfile(path) or f.endswith("~") or f.startswith("#") or f.startswith("."): - continue - - newpath = join(folder, "finished", f if self.getConfig("keep") else "tmp_" + f) - move(path, newpath) - - self.logInfo(_("Added %s from HotFolder") % f) - self.core.api.addPackage(f, [newpath], 1) - - except IOError, e: - self.logError(e) diff --git a/pyload/plugin/addon/IRCInterface.py b/pyload/plugin/addon/IRCInterface.py deleted file mode 100644 index a4d466319..000000000 --- a/pyload/plugin/addon/IRCInterface.py +++ /dev/null @@ -1,431 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -import socket -import ssl -import time - -from pycurl import FORM_FILE -from select import select -from threading import Thread -from time import sleep -from traceback import print_exc - -from pyload.api import PackageDoesNotExists, FileDoesNotExists -from pyload.network.RequestFactory import getURL -from pyload.plugin.Addon import Addon -from pyload.utils import formatSize - - -class IRCInterface(Thread, Addon): - __name__ = "IRCInterface" - __type__ = "addon" - __version__ = "0.13" - - __config__ = [("host" , "str" , "IRC-Server Address" , "Enter your server here!"), - ("port" , "int" , "IRC-Server Port" , 6667 ), - ("ident" , "str" , "Clients ident" , "pyload-irc" ), - ("realname" , "str" , "Realname" , "pyload-irc" ), - ("ssl" , "bool", "Use SSL" , False ), - ("nick" , "str" , "Nickname the Client will take" , "pyLoad-IRC" ), - ("owner" , "str" , "Nickname the Client will accept commands from", "Enter your nick here!" ), - ("info_file", "bool", "Inform about every file finished" , False ), - ("info_pack", "bool", "Inform about every package finished" , True ), - ("captcha" , "bool", "Send captcha requests" , True )] - - __description__ = """Connect to irc and let owner perform different tasks""" - __license__ = "GPLv3" - __authors__ = [("Jeix", "Jeix@hasnomail.com")] - - - def __init__(self, core, manager): - Thread.__init__(self) - Addon.__init__(self, core, manager) - self.setDaemon(True) - - - def activate(self): - self.abort = False - self.more = [] - self.new_package = {} - - self.start() - - - def packageFinished(self, pypack): - try: - if self.getConfig("info_pack"): - self.response(_("Package finished: %s") % pypack.name) - except Exception: - pass - - - def downloadFinished(self, pyfile): - try: - if self.getConfig("info_file"): - self.response( - _("Download finished: %(name)s @ %(plugin)s ") % {"name": pyfile.name, "plugin": pyfile.pluginname}) - except Exception: - pass - - - def captchaTask(self, task): - if self.getConfig("captcha") and task.isTextual(): - task.handler.append(self) - task.setWaiting(60) - - page = getURL("http://www.freeimagehosting.net/upload.php", - post={"attached": (FORM_FILE, task.captchaFile)}, multipart=True) - - url = re.search(r"\[img\]([^\[]+)\[/img\]\[/url\]", page).group(1) - self.response(_("New Captcha Request: %s") % url) - self.response(_("Answer with 'c %s text on the captcha'") % task.id) - - - def run(self): - # connect to IRC etc. - self.sock = socket.socket() - host = self.getConfig("host") - self.sock.connect((host, self.getConfig("port"))) - - if self.getConfig("ssl"): - self.sock = ssl.wrap_socket(self.sock, cert_reqs=ssl.CERT_NONE) #@TODO: support custom certificate - - nick = self.getConfig("nick") - self.sock.send("NICK %s\r\n" % nick) - self.sock.send("USER %s %s bla :%s\r\n" % (nick, host, nick)) - for t in self.getConfig("owner").split(): - if t.strip().startswith("#"): - self.sock.send("JOIN %s\r\n" % t.strip()) - self.logInfo(_("Connected to"), host) - self.logInfo(_("Switching to listening mode!")) - try: - self.main_loop() - - except IRCError, ex: - self.sock.send("QUIT :byebye\r\n") - print_exc() - self.sock.close() - - - def main_loop(self): - readbuffer = "" - while True: - sleep(1) - fdset = select([self.sock], [], [], 0) - if self.sock not in fdset[0]: - continue - - if self.abort: - raise IRCError("quit") - - readbuffer += self.sock.recv(1024) - temp = readbuffer.split("\n") - readbuffer = temp.pop() - - for line in temp: - line = line.rstrip() - first = line.split() - - if first[0] == "PING": - self.sock.send("PONG %s\r\n" % first[1]) - - if first[0] == "ERROR": - raise IRCError(line) - - msg = line.split(None, 3) - if len(msg) < 4: - continue - - msg = { - "origin": msg[0][1:], - "action": msg[1], - "target": msg[2], - "text": msg[3][1:] - } - - self.handle_events(msg) - - - def handle_events(self, msg): - if not msg['origin'].split("!", 1)[0] in self.getConfig("owner").split(): - return - - if msg['target'].split("!", 1)[0] != self.getConfig("nick"): - return - - if msg['action'] != "PRIVMSG": - return - - # HANDLE CTCP ANTI FLOOD/BOT PROTECTION - if msg['text'] == "\x01VERSION\x01": - self.logDebug("Sending CTCP VERSION") - self.sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface")) - return - elif msg['text'] == "\x01TIME\x01": - self.logDebug("Sending CTCP TIME") - self.sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time())) - return - elif msg['text'] == "\x01LAG\x01": - self.logDebug("Received CTCP LAG") #: don't know how to answer - return - - trigger = "pass" - args = None - - try: - temp = msg['text'].split() - trigger = temp[0] - if len(temp) > 1: - args = temp[1:] - except Exception: - pass - - handler = getattr(self, "event_%s" % trigger, self.event_pass) - try: - res = handler(args) - for line in res: - self.response(line, msg['origin']) - except Exception, e: - self.logError(e) - - - def response(self, msg, origin=""): - if origin == "": - for t in self.getConfig("owner").split(): - self.sock.send("PRIVMSG %s :%s\r\n" % (t.strip(), msg)) - else: - self.sock.send("PRIVMSG %s :%s\r\n" % (origin.split("!", 1)[0], msg)) - - - #### Events - - def event_pass(self, args): - return [] - - - def event_status(self, args): - downloads = self.core.api.statusDownloads() - if not downloads: - return ["INFO: There are no active downloads currently."] - - temp_progress = "" - lines = ["ID - Name - Status - Speed - ETA - Progress"] - for data in downloads: - - if data.status == 5: - temp_progress = data.format_wait - else: - temp_progress = "%d%% (%s)" % (data.percent, data.format_size) - - lines.append("#%d - %s - %s - %s - %s - %s" % - ( - data.fid, - data.name, - data.statusmsg, - "%s/s" % formatSize(data.speed), - "%s" % data.format_eta, - temp_progress - )) - return lines - - - def event_queue(self, args): - ps = self.core.api.getQueueData() - - if not ps: - return ["INFO: There are no packages in queue."] - - lines = [] - for pack in ps: - lines.append('PACKAGE #%s: "%s" with %d links.' % (pack.pid, pack.name, len(pack.links))) - - return lines - - - def event_collector(self, args): - ps = self.core.api.getCollectorData() - if not ps: - return ["INFO: No packages in collector!"] - - lines = [] - for pack in ps: - lines.append('PACKAGE #%s: "%s" with %d links.' % (pack.pid, pack.name, len(pack.links))) - - return lines - - - def event_info(self, args): - if not args: - return ["ERROR: Use info like this: info <id>"] - - info = None - try: - info = self.core.api.getFileData(int(args[0])) - - except FileDoesNotExists: - return ["ERROR: Link doesn't exists."] - - return ['LINK #%s: %s (%s) [%s][%s]' % (info.fid, info.name, info.format_size, info.statusmsg, info.plugin)] - - - def event_packinfo(self, args): - if not args: - return ["ERROR: Use packinfo like this: packinfo <id>"] - - lines = [] - pack = None - try: - pack = self.core.api.getPackageData(int(args[0])) - - except PackageDoesNotExists: - return ["ERROR: Package doesn't exists."] - - id = args[0] - - self.more = [] - - lines.append('PACKAGE #%s: "%s" with %d links' % (id, pack.name, len(pack.links))) - for pyfile in pack.links: - self.more.append('LINK #%s: %s (%s) [%s][%s]' % (pyfile.fid, pyfile.name, pyfile.format_size, - pyfile.statusmsg, pyfile.plugin)) - - if len(self.more) < 6: - lines.extend(self.more) - self.more = [] - else: - lines.extend(self.more[:6]) - self.more = self.more[6:] - lines.append("%d more links do display." % len(self.more)) - - return lines - - - def event_more(self, args): - if not self.more: - return ["No more information to display."] - - lines = self.more[:6] - self.more = self.more[6:] - lines.append("%d more links do display." % len(self.more)) - - return lines - - - def event_start(self, args): - self.core.api.unpauseServer() - return ["INFO: Starting downloads."] - - - def event_stop(self, args): - self.core.api.pauseServer() - return ["INFO: No new downloads will be started."] - - - def event_add(self, args): - if len(args) < 2: - return ['ERROR: Add links like this: "add <packagename|id> links". ', - "This will add the link <link> to to the package <package> / the package with id <id>!"] - - pack = args[0].strip() - links = [x.strip() for x in args[1:]] - - count_added = 0 - count_failed = 0 - try: - id = int(pack) - pack = self.core.api.getPackageData(id) - if not pack: - return ["ERROR: Package doesn't exists."] - - #TODO add links - - return ["INFO: Added %d links to Package %s [#%d]" % (len(links), pack['name'], id)] - - except Exception: - # create new package - id = self.core.api.addPackage(pack, links, 1) - return ["INFO: Created new Package %s [#%d] with %d links." % (pack, id, len(links))] - - - def event_del(self, args): - if len(args) < 2: - return ["ERROR: Use del command like this: del -p|-l <id> [...] (-p indicates that the ids are from packages, -l indicates that the ids are from links)"] - - if args[0] == "-p": - ret = self.core.api.deletePackages(map(int, args[1:])) - return ["INFO: Deleted %d packages!" % len(args[1:])] - - elif args[0] == "-l": - ret = self.core.api.delLinks(map(int, args[1:])) - return ["INFO: Deleted %d links!" % len(args[1:])] - - else: - return ["ERROR: Use del command like this: del <-p|-l> <id> [...] (-p indicates that the ids are from packages, -l indicates that the ids are from links)"] - - - def event_push(self, args): - if not args: - return ["ERROR: Push package to queue like this: push <package id>"] - - id = int(args[0]) - try: - info = self.core.api.getPackageInfo(id) - except PackageDoesNotExists: - return ["ERROR: Package #%d does not exist." % id] - - self.core.api.pushToQueue(id) - return ["INFO: Pushed package #%d to queue." % id] - - - def event_pull(self, args): - if not args: - return ["ERROR: Pull package from queue like this: pull <package id>."] - - id = int(args[0]) - if not self.core.api.getPackageData(id): - return ["ERROR: Package #%d does not exist." % id] - - self.core.api.pullFromQueue(id) - return ["INFO: Pulled package #%d from queue to collector." % id] - - - def event_c(self, args): - """ captcha answer """ - if not args: - return ["ERROR: Captcha ID missing."] - - task = self.core.captchaManager.getTaskByID(args[0]) - if not task: - return ["ERROR: Captcha Task with ID %s does not exists." % args[0]] - - task.setResult(" ".join(args[1:])) - return ["INFO: Result %s saved." % " ".join(args[1:])] - - - def event_help(self, args): - lines = ["The following commands are available:", - "add <package|packid> <links> [...] Adds link to package. (creates new package if it does not exist)", - "queue Shows all packages in the queue", - "collector Shows all packages in collector", - "del -p|-l <id> [...] Deletes all packages|links with the ids specified", - "info <id> Shows info of the link with id <id>", - "packinfo <id> Shows info of the package with id <id>", - "more Shows more info when the result was truncated", - "start Starts all downloads", - "stop Stops the download (but not abort active downloads)", - "push <id> Push package to queue", - "pull <id> Pull package from queue", - "status Show general download status", - "help Shows this help message"] - return lines - - -class IRCError(Exception): - - def __init__(self, value): - self.value = value - - - def __str__(self): - return repr(self.value) diff --git a/pyload/plugin/addon/MergeFiles.py b/pyload/plugin/addon/MergeFiles.py deleted file mode 100644 index 18836f6ac..000000000 --- a/pyload/plugin/addon/MergeFiles.py +++ /dev/null @@ -1,85 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement - -import os -import re - -from traceback import print_exc - -from pyload.plugin.Addon import Addon, threaded -from pyload.utils import safe_join, fs_encode - - -class MergeFiles(Addon): - __name__ = "MergeFiles" - __type__ = "addon" - __version__ = "0.13" - - __config__ = [("activated", "bool", "Activated", True)] - - __description__ = """Merges parts splitted with hjsplit""" - __license__ = "GPLv3" - __authors__ = [("and9000", "me@has-no-mail.com")] - - - BUFFER_SIZE = 4096 - - - def setup(self): - pass - - - @threaded - def packageFinished(self, pack): - files = {} - fid_dict = {} - for fid, data in pack.getChildren().iteritems(): - if re.search("\.\d{3}$", data['name']): - if data['name'][:-4] not in files: - files[data['name'][:-4]] = [] - files[data['name'][:-4]].append(data['name']) - files[data['name'][:-4]].sort() - fid_dict[data['name']] = fid - - download_folder = self.config['general']['download_folder'] - - if self.config['general']['folder_per_package']: - download_folder = safe_join(download_folder, pack.folder) - - for name, file_list in files.iteritems(): - self.logInfo(_("Starting merging of"), name) - - final_file = open(safe_join(download_folder, name), "wb") - for splitted_file in file_list: - self.logDebug("Merging part", splitted_file) - - pyfile = self.core.files.getFile(fid_dict[splitted_file]) - - pyfile.setStatus("processing") - - try: - with open(os.path.join(download_folder, splitted_file), "rb") as s_file: - size_written = 0 - s_file_size = int(os.path.getsize(os.path.join(download_folder, splitted_file))) - - while True: - f_buffer = s_file.read(self.BUFFER_SIZE) - if f_buffer: - final_file.write(f_buffer) - size_written += self.BUFFER_SIZE - pyfile.setProgress((size_written * 100) / s_file_size) - else: - break - - self.logDebug("Finished merging part", splitted_file) - - except Exception, e: - print_exc() - - finally: - pyfile.setProgress(100) - pyfile.setStatus("finished") - pyfile.release() - - self.logInfo(_("Finished merging of"), name) diff --git a/pyload/plugin/addon/MultiHome.py b/pyload/plugin/addon/MultiHome.py deleted file mode 100644 index 84b1e6ab7..000000000 --- a/pyload/plugin/addon/MultiHome.py +++ /dev/null @@ -1,81 +0,0 @@ -# -*- coding: utf-8 -*- - -from time import time - -from pyload.plugin.Addon import Addon - - -class MultiHome(Addon): - __name__ = "MultiHome" - __type__ = "addon" - __version__ = "0.12" - - __config__ = [("interfaces", "str", "Interfaces", "None")] - - __description__ = """Ip address changer""" - __license__ = "GPLv3" - __authors__ = [("mkaay", "mkaay@mkaay.de")] - - - def setup(self): - self.register = {} - self.interfaces = [] - self.parseInterfaces(self.getConfig("interfaces").split(";")) - if not self.interfaces: - self.parseInterfaces([self.config['download']['interface']]) - self.setConfig("interfaces", self.toConfig()) - - - def toConfig(self): - return ";".join([i.adress for i in self.interfaces]) - - - def parseInterfaces(self, interfaces): - for interface in interfaces: - if not interface or str(interface).lower() == "none": - continue - self.interfaces.append(Interface(interface)) - - - def activate(self): - requestFactory = self.core.requestFactory - oldGetRequest = requestFactory.getRequest - - def getRequest(pluginName, account=None): - iface = self.bestInterface(pluginName, account) - if iface: - iface.useFor(pluginName, account) - requestFactory.iface = lambda: iface.adress - self.logDebug("Using address", iface.adress) - return oldGetRequest(pluginName, account) - - requestFactory.getRequest = getRequest - - - def bestInterface(self, pluginName, account): - best = None - for interface in self.interfaces: - if not best or interface.lastPluginAccess(pluginName, account) < best.lastPluginAccess(pluginName, account): - best = interface - return best - - -class Interface(object): - - def __init__(self, adress): - self.adress = adress - self.history = {} - - - def lastPluginAccess(self, pluginName, account): - if (pluginName, account) in self.history: - return self.history[(pluginName, account)] - return 0 - - - def useFor(self, pluginName, account): - self.history[(pluginName, account)] = time() - - - def __repr__(self): - return "<Interface - %s>" % self.adress diff --git a/pyload/plugin/addon/RestartFailed.py b/pyload/plugin/addon/RestartFailed.py deleted file mode 100644 index 2fe5f13bf..000000000 --- a/pyload/plugin/addon/RestartFailed.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.Addon import Addon - - -class RestartFailed(Addon): - __name__ = "RestartFailed" - __type__ = "addon" - __version__ = "1.57" - - __config__ = [("activated", "bool", "Activated" , True), - ("interval" , "int" , "Check interval in minutes", 90 )] - - __description__ = """Periodically restart all failed downloads in queue""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - # event_list = ["pluginConfigChanged"] - - MIN_INTERVAL = 15 * 60 #: 15m minimum check interval (value is in seconds) - - - def pluginConfigChanged(self, plugin, name, value): - if name == "interval": - interval = value * 60 - if self.MIN_INTERVAL <= interval != self.interval: - self.core.scheduler.removeJob(self.cb) - self.interval = interval - self.initPeriodical() - else: - self.logDebug("Invalid interval value, kept current") - - - def periodical(self): - self.logDebug(_("Restart failed downloads")) - self.core.api.restartFailed() - - - def setup(self): - self.interval = 0 - - - def activate(self): - self.pluginConfigChanged(self.__name__, "interval", self.getConfig("interval")) diff --git a/pyload/plugin/addon/RestartSlow.py b/pyload/plugin/addon/RestartSlow.py deleted file mode 100644 index 8621ed80d..000000000 --- a/pyload/plugin/addon/RestartSlow.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -import pycurl - -from pyload.plugin.Addon import Addon - - -class RestartSlow(Addon): - __name__ = "RestartSlow" - __type__ = "addon" - __version__ = "0.02" - - __config__ = [("free_limit" , "int" , "Transfer speed threshold in kilobytes" , 100 ), - ("free_time" , "int" , "Sample interval in minutes" , 5 ), - ("premium_limit", "int" , "Transfer speed threshold for premium download in kilobytes", 300 ), - ("premium_time" , "int" , "Sample interval for premium download in minutes" , 2 ), - ("safe_mode" , "bool", "Don't restart if download is not resumable" , True)] - - __description__ = """Restart slow downloads""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - event_map = {'download-start': "downloadStarts"} - - - def setup(self): - self.info = {'chunk': {}} - - - def periodical(self): - if not self.pyfile.req.dl: - return - - if self.getConfig("safe_mode") and not self.pyfile.plugin.resumeDownload: - time = 30 - limit = 5 - else: - type = "premium" if self.pyfile.plugin.premium else "free" - time = max(30, self.getConfig("%s_time" % type) * 60) - limit = max(5, self.getConfig("%s_limit" % type) * 1024) - - chunks = [chunk for chunk in self.pyfile.req.dl.chunks \ - if chunk.id not in self.info['chunk'] or self.info['chunk'][chunk.id] not is (time, limit)] - - for chunk in chunks: - chunk.c.setopt(pycurl.LOW_SPEED_TIME , time) - chunk.c.setopt(pycurl.LOW_SPEED_LIMIT, limit) - - self.info['chunk'][chunk.id] = (time, limit) - - - def downloadStarts(self, pyfile, url, filename): - if self.cb or (self.getConfig("safe_mode") and not pyfile.plugin.resumeDownload): - return - - self.initPeriodical() diff --git a/pyload/plugin/addon/SkipRev.py b/pyload/plugin/addon/SkipRev.py deleted file mode 100644 index d6908614d..000000000 --- a/pyload/plugin/addon/SkipRev.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding: utf-8 -*- - -from urllib import unquote -from urlparse import urlparse - -from pyload.plugin.Addon import Addon -from pyload.plugin.Plugin import SkipDownload - - -class SkipRev(Adoon): - __name__ = "SkipRev" - __type__ = "addon" - __version__ = "0.15" - - __config__ = [("tokeep", "int", "Number of rev files to keep for package (-1 to auto)", -1)] - - __description__ = """Skip files ending with extension rev""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - def _setup(self): - super(self.pyfile.plugin, self).setup() - if self.pyfile.hasStatus("skipped"): - raise SkipDownload(self.pyfile.getStatusName() or self.pyfile.pluginname) - - - def pyname(self, pyfile): - url = pyfile.url - plugin = pyfile.plugin - - if hasattr(plugin, "info") and 'name' in plugin.info and plugin.info['name']: - name = plugin.info['name'] - - elif hasattr(plugin, "parseInfos"): - name = next(plugin.parseInfos([url]))['name'] - - elif hasattr(plugin, "getInfo"): #@NOTE: if parseInfos was not found, getInfo should be missing too - name = plugin.getInfo(url)['name'] - - else: - self.logWarning("Unable to grab file name") - name = urlparse(unquote(url)).path.split('/')[-1]) - - return name - - - def downloadPreparing(self, pyfile): - if pyfile.getStatusName() is "unskipped" or not pyname(pyfile).endswith(".rev"): - return - - tokeep = self.getConfig("tokeep") - - if tokeep: - saved = [True for link in pyfile.package().getChildren() \ - if link.name.endswith(".rev") and (link.hasStatus("finished") or link.hasStatus("downloading"))].count(True) - - if not saved or saved < tokeep: #: keep one rev at least in auto mode - return - - pyfile.setCustomStatus("SkipRev", "skipped") - pyfile.plugin.setup = _setup #: work-around: inject status checker inside the preprocessing routine of the plugin - - - def downloadFailed(self, pyfile): - tokeep = self.getConfig("tokeep") - - if not tokeep: - return - - for link in pyfile.package().getChildren(): - if link.hasStatus("skipped") and link.name.endswith(".rev"): - if tokeep > -1 or pyfile.name.endswith(".rev"): - link.setStatus("queued") - else: - link.setCustomStatus("unskipped", "queued") - return diff --git a/pyload/plugin/addon/UnSkipOnFail.py b/pyload/plugin/addon/UnSkipOnFail.py deleted file mode 100644 index bdbd4a5df..000000000 --- a/pyload/plugin/addon/UnSkipOnFail.py +++ /dev/null @@ -1,87 +0,0 @@ -# -*- coding: utf-8 -*- - -from os.path import basename - -from pyload.datatype.File import PyFile -from pyload.plugin.Addon import Addon -from pyload.utils import fs_encode - - -class UnSkipOnFail(Addon): - __name__ = "UnSkipOnFail" - __type__ = "addon" - __version__ = "0.02" - - __config__ = [("activated", "bool", "Activated", True)] - - __description__ = """When a download fails, restart skipped duplicates""" - __license__ = "GPLv3" - __authors__ = [("hagg", "")] - - - def downloadFailed(self, pyfile): - pyfile_name = basename(pyfile.name) - pid = pyfile.package().id - msg = _('look for skipped duplicates for %s (pid:%s)') - self.logInfo(msg % (pyfile_name, pid)) - dups = self.findDuplicates(pyfile) - for link in dups: - # check if link is "skipped"(=4) - if link.status == 4: - lpid = link.packageID - self.logInfo(_('restart "%s" (pid:%s)') % (pyfile_name, lpid)) - self.setLinkStatus(link, "queued") - - - def findDuplicates(self, pyfile): - """ Search all packages for duplicate links to "pyfile". - Duplicates are links that would overwrite "pyfile". - To test on duplicity the package-folder and link-name - of twolinks are compared (basename(link.name)). - So this method returns a list of all links with equal - package-folders and filenames as "pyfile", but except - the data for "pyfile" iotselöf. - It does MOT check the link's status. - """ - dups = [] - pyfile_name = fs_encode(basename(pyfile.name)) - # get packages (w/o files, as most file data is useless here) - queue = self.core.api.getQueue() - for package in queue: - # check if package-folder equals pyfile's package folder - if fs_encode(package.folder) == fs_encode(pyfile.package().folder): - # now get packaged data w/ files/links - pdata = self.core.api.getPackageData(package.pid) - if pdata.links: - for link in pdata.links: - link_name = fs_encode(basename(link.name)) - # check if link name collides with pdata's name - if link_name == pyfile_name: - # at last check if it is not pyfile itself - if link.fid != pyfile.id: - dups.append(link) - return dups - - - def setLinkStatus(self, link, new_status): - """ Change status of "link" to "new_status". - "link" has to be a valid FileData object, - "new_status" has to be a valid status name - (i.e. "queued" for this Plugin) - It creates a temporary PyFile object using - "link" data, changes its status, and tells - the core.files-manager to save its data. - """ - pyfile = PyFile(self.core.files, - link.fid, - link.url, - link.name, - link.size, - link.status, - link.error, - link.plugin, - link.packageID, - link.order) - pyfile.setStatus(new_status) - self.core.files.save() - pyfile.release() diff --git a/pyload/plugin/addon/UpdateManager.py b/pyload/plugin/addon/UpdateManager.py deleted file mode 100644 index e31612c23..000000000 --- a/pyload/plugin/addon/UpdateManager.py +++ /dev/null @@ -1,305 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement - -import re -import sys - -from operator import itemgetter -from os import path, remove, stat - -from pyload.network.RequestFactory import getURL -from pyload.plugin.Addon import Expose, Addon, threaded -from pyload.utils import safe_join - - -class UpdateManager(Addon): - __name__ = "UpdateManager" - __type__ = "addon" - __version__ = "0.42" - - __config__ = [("activated" , "bool" , "Activated" , True ), - ("mode" , "pyLoad + plugins;plugins only", "Check updates for" , "pyLoad + plugins"), - ("interval" , "int" , "Check interval in hours" , 8 ), - ("autorestart" , "bool" , "Automatically restart pyLoad when required" , True ), - ("reloadplugins", "bool" , "Monitor plugins for code changes in debug mode", True ), - ("nodebugupdate", "bool" , "Don't check for updates in debug mode" , True )] - - __description__ = """Check for updates""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - # event_list = ["pluginConfigChanged"] - - SERVER_URL = "http://updatemanager.pyload.org" - VERSION = re.compile(r'__version__.*=.*("|\')([\d.]+)') - MIN_INTERVAL = 3 * 60 * 60 #: 3h minimum check interval (value is in seconds) - - - def pluginConfigChanged(self, plugin, name, value): - if name == "interval": - interval = value * 60 * 60 - if self.MIN_INTERVAL <= interval != self.interval: - self.core.scheduler.removeJob(self.cb) - self.interval = interval - self.initPeriodical() - else: - self.logDebug("Invalid interval value, kept current") - - elif name == "reloadplugins": - if self.cb2: - self.core.scheduler.removeJob(self.cb2) - if value is True and self.core.debug: - self.periodical2() - - - def activate(self): - self.pluginConfigChanged(self.__name__, "interval", self.getConfig("interval")) - x = lambda: self.pluginConfigChanged(self.__name__, "reloadplugins", self.getConfig("reloadplugins")) - self.core.scheduler.addJob(10, x, threaded=False) - - - def deactivate(self): - self.pluginConfigChanged(self.__name__, "reloadplugins", False) - - - def setup(self): - self.cb2 = None - self.interval = 0 - self.updating = False - self.info = {'pyload': False, 'version': None, 'plugins': False} - self.mtimes = {} #: store modification time for each plugin - - - def periodical2(self): - if not self.updating: - self.autoreloadPlugins() - - self.cb2 = self.core.scheduler.addJob(4, self.periodical2, threaded=False) - - - @Expose - def autoreloadPlugins(self): - """ reload and reindex all modified plugins """ - modules = filter( - lambda m: m and (m.__name__.startswith("pyload.plugin.") or - m.__name__.startswith("userplugins.")) and - m.__name__.count(".") >= 2, sys.modules.itervalues() - ) - - reloads = [] - - for m in modules: - root, type, name = m.__name__.rsplit(".", 2) - id = (type, name) - if type in self.core.pluginManager.plugins: - f = m.__file__.replace(".pyc", ".py") - if not path.isfile(f): - continue - - mtime = stat(f).st_mtime - - if id not in self.mtimes: - self.mtimes[id] = mtime - elif self.mtimes[id] < mtime: - reloads.append(id) - self.mtimes[id] = mtime - - return True if self.core.pluginManager.reloadPlugins(reloads) else False - - - def periodical(self): - if self.info['pyload'] or self.getConfig("nodebugupdate") and self.core.debug: - return - - self.updateThread() - - - def server_request(self): - try: - return getURL(self.SERVER_URL, get={'v': self.core.api.getServerVersion()}).splitlines() - except Exception: - self.logWarning(_("Unable to contact server to get updates")) - - - @threaded - def updateThread(self): - self.updating = True - - status = self.update(onlyplugin=self.getConfig("mode") == "plugins only") - - if status is 2 and self.getConfig("autorestart"): - self.core.api.restart() - else: - self.updating = False - - - @Expose - def updatePlugins(self): - """ simple wrapper for calling plugin update quickly """ - return self.update(onlyplugin=True) - - - @Expose - def update(self, onlyplugin=False): - """ check for updates """ - data = self.server_request() - - if not data: - exitcode = 0 - - elif data[0] == "None": - self.logInfo(_("No new pyLoad version available")) - updates = data[1:] - exitcode = self._updatePlugins(updates) - - elif onlyplugin: - exitcode = 0 - - else: - newversion = data[0] - self.logInfo(_("*** New pyLoad Version %s available ***") % newversion) - self.logInfo(_("*** Get it here: https://github.com/pyload/pyload/releases ***")) - exitcode = 3 - self.info['pyload'] = True - self.info['version'] = newversion - - return exitcode #: 0 = No plugins updated; 1 = Plugins updated; 2 = Plugins updated, but restart required; 3 = No plugins updated, new pyLoad version available - - - def _updatePlugins(self, updates): - """ check for plugin updates """ - - if self.info['plugins']: - return False #: plugins were already updated - - exitcode = 0 - updated = [] - - url = updates[0] - schema = updates[1].split('|') - - if "BLACKLIST" in updates: - blacklist = updates[updates.index('BLACKLIST') + 1:] - updates = updates[2:updates.index('BLACKLIST')] - else: - blacklist = None - updates = updates[2:] - - upgradable = [dict(zip(schema, x.split('|'))) for x in updates] - blacklisted = [(x.split('|')[0], x.split('|')[1].rsplit('.', 1)[0]) for x in blacklist] if blacklist else [] - - if blacklist: - # Protect internal plugins against removing - for i, t, n in enumerate(blacklisted): - if t == "internal": - blacklisted.pop(i) - continue - - for idx, plugin in enumerate(upgradable): - if n == plugin['name'] and t == plugin['type']: - upgradable.pop(idx) - break - - for t, n in self.removePlugins(sorted(blacklisted)): - self.logInfo(_("Removed blacklisted plugin [%(type)s] %(name)s") % { - 'type': t, - 'name': n, - }) - - for plugin in sorted(upgradable, key=itemgetter("type", "name")): - filename = plugin['name'] - type = plugin['type'] - version = plugin['version'] - - if filename.endswith(".pyc"): - name = filename[:filename.find("_")] - else: - name = filename.replace(".py", "") - - plugins = getattr(self.core.pluginManager, "%sPlugins" % type) - - oldver = float(plugins[name]['version']) if name in plugins else None - newver = float(version) - - if not oldver: - msg = "New plugin: [%(type)s] %(name)s (v%(newver).2f)" - elif newver > oldver: - msg = "New version of plugin: [%(type)s] %(name)s (v%(oldver).2f -> v%(newver).2f)" - else: - continue - - self.logInfo(_(msg) % {'type' : type, - 'name' : name, - 'oldver': oldver, - 'newver': newver}) - try: - content = getURL(url % plugin) - m = self.VERSION.search(content) - - if m and m.group(2) == version: - with open(safe_join("userplugins", prefix, filename), "wb") as f: - f.write(content) - - updated.append((prefix, name)) - else: - raise Exception, _("Version mismatch") - - except Exception, e: - self.logError(_("Error updating plugin: %s") % filename, str(e)) - - if updated: - reloaded = self.core.pluginManager.reloadPlugins(updated) - if reloaded: - self.logInfo(_("Plugins updated and reloaded")) - exitcode = 1 - else: - self.logInfo(_("*** Plugins have been updated, but need a pyLoad restart to be reloaded ***")) - self.info['plugins'] = True - exitcode = 2 - else: - self.logInfo(_("No plugin updates available")) - - return exitcode #: 0 = No plugins updated; 1 = Plugins updated; 2 = Plugins updated, but restart required - - - @Expose - def removePlugins(self, type_plugins): - """ delete plugins from disk """ - - if not type_plugins: - return - - self.logDebug("Requested deletion of plugins: %s" % type_plugins) - - removed = [] - - for type, name in type_plugins: - err = False - file = name + ".py" - - for root in ("userplugins", path.join(pypath, "pyload", "plugins")): - - filename = safe_join(root, type, file) - try: - remove(filename) - except Exception, e: - self.logDebug("Error deleting: %s" % path.basename(filename), e) - err = True - - filename += "c" - if path.isfile(filename): - try: - if type == "addon": - self.manager.deactivateAddon(name) - remove(filename) - except Exception, e: - self.logDebug("Error deleting: %s" % path.basename(filename), e) - err = True - - if not err: - id = (type, name) - removed.append(id) - - return removed #: return a list of the plugins successfully removed diff --git a/pyload/plugin/addon/WindowsPhoneToastNotify.py b/pyload/plugin/addon/WindowsPhoneToastNotify.py deleted file mode 100644 index 0ac6719e1..000000000 --- a/pyload/plugin/addon/WindowsPhoneToastNotify.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -import httplib -import time - -from pyload.plugin.Addon import Addon - - -class WindowsPhoneToastNotify(Addon): - __name__ = "WindowsPhoneToastNotify" - __type__ = "addon" - __version__ = "0.03" - - __config__ = [("force" , "bool", "Force even if client is connected" , False), - ("pushId" , "str" , "pushId" , "" ), - ("pushUrl" , "str" , "pushUrl" , "" ), - ("pushTimeout", "int" , "Timeout between notifications in seconds", 0 )] - - __description__ = """Send push notifications to Windows Phone""" - __license__ = "GPLv3" - __authors__ = [("Andy Voigt", "phone-support@hotmail.de")] - - - def getXmlData(self): - myxml = ("<?xml version='1.0' encoding='utf-8'?> <wp:Notification xmlns:wp='WPNotification'> " - "<wp:Toast> <wp:Text1>Pyload Mobile</wp:Text1> <wp:Text2>Captcha waiting!</wp:Text2> " - "</wp:Toast> </wp:Notification>") - return myxml - - - def doRequest(self): - URL = self.getConfig("pushUrl") - request = self.getXmlData() - webservice = httplib.HTTP(URL) - webservice.putrequest("POST", self.getConfig("pushId")) - webservice.putheader("Host", URL) - webservice.putheader("Content-type", "text/xml") - webservice.putheader("X-NotificationClass", "2") - webservice.putheader("X-WindowsPhone-Target", "toast") - webservice.putheader("Content-length", "%d" % len(request)) - webservice.endheaders() - webservice.send(request) - webservice.close() - self.setStorage("LAST_NOTIFY", time.time()) - - - def captchaTask(self, task): - if not self.getConfig("pushId") or not self.getConfig("pushUrl"): - return False - - if self.core.isClientConnected() and not self.getConfig("force"): - return False - - if (time.time() - float(self.getStorage("LAST_NOTIFY", 0))) < self.getConf("pushTimeout"): - return False - - self.doRequest() diff --git a/pyload/plugin/addon/XMPPInterface.py b/pyload/plugin/addon/XMPPInterface.py deleted file mode 100644 index 77a49af6f..000000000 --- a/pyload/plugin/addon/XMPPInterface.py +++ /dev/null @@ -1,252 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyxmpp import streamtls -from pyxmpp.all import JID, Message -from pyxmpp.interface import implements -from pyxmpp.interfaces import * -from pyxmpp.jabber.client import JabberClient - -from pyload.plugin.addon.IRCInterface import IRCInterface - - -class XMPPInterface(IRCInterface, JabberClient): - __name__ = "XMPPInterface" - __type__ = "addon" - __version__ = "0.11" - - __config__ = [("jid" , "str" , "Jabber ID" , "user@exmaple-jabber-server.org" ), - ("pw" , "str" , "Password" , "" ), - ("tls" , "bool", "Use TLS" , False ), - ("owners" , "str" , "List of JIDs accepting commands from", "me@icq-gateway.org;some@msn-gateway.org"), - ("info_file", "bool", "Inform about every file finished" , False ), - ("info_pack", "bool", "Inform about every package finished" , True ), - ("captcha" , "bool", "Send captcha requests" , True )] - - __description__ = """Connect to jabber and let owner perform different tasks""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] - - - implements(IMessageHandlersProvider) - - - def __init__(self, core, manager): - IRCInterface.__init__(self, core, manager) - - self.jid = JID(self.getConfig("jid")) - password = self.getConfig("pw") - - # if bare JID is provided add a resource -- it is required - if not self.jid.resource: - self.jid = JID(self.jid.node, self.jid.domain, "pyLoad") - - if self.getConfig("tls"): - tls_settings = streamtls.TLSSettings(require=True, verify_peer=False) - auth = ("sasl:PLAIN", "sasl:DIGEST-MD5") - else: - tls_settings = None - auth = ("sasl:DIGEST-MD5", "digest") - - # setup client with provided connection information - # and identity data - JabberClient.__init__(self, self.jid, password, - disco_name="pyLoad XMPP Client", disco_type="bot", - tls_settings=tls_settings, auth_methods=auth) - - self.interface_providers = [ - VersionHandler(self), - self, - ] - - - def activate(self): - self.new_package = {} - - self.start() - - - def packageFinished(self, pypack): - try: - if self.getConfig("info_pack"): - self.announce(_("Package finished: %s") % pypack.name) - except Exception: - pass - - - def downloadFinished(self, pyfile): - try: - if self.getConfig("info_file"): - self.announce( - _("Download finished: %(name)s @ %(plugin)s") % {"name": pyfile.name, "plugin": pyfile.pluginname}) - except Exception: - pass - - - def run(self): - # connect to IRC etc. - self.connect() - try: - self.loop() - except Exception, ex: - self.logError(ex) - - - def stream_state_changed(self, state, arg): - """This one is called when the state of stream connecting the component - to a server changes. This will usually be used to let the user - know what is going on.""" - self.logDebug("*** State changed: %s %r ***" % (state, arg)) - - - def disconnected(self): - self.logDebug("Client was disconnected") - - - def stream_closed(self, stream): - self.logDebug("Stream was closed", stream) - - - def stream_error(self, err): - self.logDebug("Stream Error", err) - - - def get_message_handlers(self): - """Return list of (message_type, message_handler) tuples. - - The handlers returned will be called when matching message is received - in a client session.""" - return [("normal", self.message)] - - - def message(self, stanza): - """Message handler for the component.""" - subject = stanza.get_subject() - body = stanza.get_body() - t = stanza.get_type() - self.logDebug("Message from %s received." % unicode(stanza.get_from())) - self.logDebug("Body: %s Subject: %s Type: %s" % (body, subject, t)) - - if t == "headline": - # 'headline' messages should never be replied to - return True - if subject: - subject = u"Re: " + subject - - to_jid = stanza.get_from() - from_jid = stanza.get_to() - - #j = JID() - to_name = to_jid.as_utf8() - from_name = from_jid.as_utf8() - - names = self.getConfig("owners").split(";") - - if to_name in names or to_jid.node + "@" + to_jid.domain in names: - messages = [] - - trigger = "pass" - args = None - - try: - temp = body.split() - trigger = temp[0] - if len(temp) > 1: - args = temp[1:] - except Exception: - pass - - handler = getattr(self, "event_%s" % trigger, self.event_pass) - try: - res = handler(args) - for line in res: - m = Message( - to_jid=to_jid, - from_jid=from_jid, - stanza_type=stanza.get_type(), - subject=subject, - body=line) - - messages.append(m) - except Exception, e: - self.logError(e) - - return messages - - else: - return True - - - def response(self, msg, origin=""): - return self.announce(msg) - - - def announce(self, message): - """ send message to all owners""" - for user in self.getConfig("owners").split(";"): - self.logDebug("Send message to", user) - - to_jid = JID(user) - - m = Message(from_jid=self.jid, - to_jid=to_jid, - stanza_type="chat", - body=message) - - stream = self.get_stream() - if not stream: - self.connect() - stream = self.get_stream() - - stream.send(m) - - - def beforeReconnecting(self, ip): - self.disconnect() - - - def afterReconnecting(self, ip): - self.connect() - - -class VersionHandler(object): - """Provides handler for a version query. - - This class will answer version query and announce 'jabber:iq:version' namespace - in the client's disco#info results.""" - - implements(IIqHandlersProvider, IFeaturesProvider) - - - def __init__(self, client): - """Just remember who created this.""" - self.client = client - - - def get_features(self): - """Return namespace which should the client include in its reply to a - disco#info query.""" - return ["jabber:iq:version"] - - - def get_iq_get_handlers(self): - """Return list of tuples (element_name, namespace, handler) describing - handlers of <iq type='get'/> stanzas""" - return [("query", "jabber:iq:version", self.get_version)] - - - def get_iq_set_handlers(self): - """Return empty list, as this class provides no <iq type='set'/> stanza handler.""" - return [] - - - def get_version(self, iq): - """Handler for jabber:iq:version queries. - - jabber:iq:version queries are not supported directly by PyXMPP, so the - XML node is accessed directly through the libxml2 API. This should be - used very carefully!""" - iq = iq.make_result_response() - q = iq.new_query("jabber:iq:version") - q.newTextChild(q.ns(), "name", "Echo component") - q.newTextChild(q.ns(), "version", "1.0") - return iq diff --git a/pyload/plugin/addon/__init__.py b/pyload/plugin/addon/__init__.py deleted file mode 100644 index 40a96afc6..000000000 --- a/pyload/plugin/addon/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/pyload/plugin/captcha/AdYouLike.py b/pyload/plugin/captcha/AdYouLike.py deleted file mode 100644 index bfb8b5ccb..000000000 --- a/pyload/plugin/captcha/AdYouLike.py +++ /dev/null @@ -1,107 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pyload.plugin.Captcha import Captcha -from pyload.utils import json_loads - - -class AdYouLike(Captcha): - __name__ = "AdYouLike" - __type__ = "captcha" - __version__ = "0.02" - - __description__ = """AdYouLike captcha service plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - AYL_PATTERN = r'Adyoulike\.create\s*\((.+?)\)' - CALLBACK_PATTERN = r'(Adyoulike\.g\._jsonp_\d+)' - - - def detect_key(self, html=None): - if not html: - if hasattr(self.plugin, "html") and self.plugin.html: - html = self.plugin.html - else: - errmsg = _("AdYouLike html not found") - self.plugin.fail(errmsg) - raise TypeError(errmsg) - - m = re.search(self.AYL_PATTERN, html) - n = re.search(self.CALLBACK_PATTERN, html) - if m and n: - self.key = (m.group(1).strip(), n.group(1).strip()) - self.plugin.logDebug("AdYouLike ayl|callback: %s | %s" % self.key) - return self.key #: key is the tuple(ayl, callback) - else: - self.plugin.logDebug("AdYouLike ayl or callback not found") - return None - - - def challenge(self, key=None): - if not key: - if self.detect_key(): - key = self.key - else: - errmsg = _("AdYouLike key not found") - self.plugin.fail(errmsg) - raise TypeError(errmsg) - - ayl, callback = key - - # {"adyoulike":{"key":"P~zQ~O0zV0WTiAzC-iw0navWQpCLoYEP"}, - # "all":{"element_id":"ayl_private_cap_92300","lang":"fr","env":"prod"}} - ayl = json_loads(ayl) - - html = self.plugin.req.load("http://api-ayl.appspot.com/challenge", - get={'key' : ayl['adyoulike']['key'], - 'env' : ayl['all']['env'], - 'callback': callback}) - try: - challenge = json_loads(re.search(callback + r'\s*\((.+?)\)', html).group(1)) - except Exception: - errmsg = _("AdYouLike challenge pattern not found") - self.plugin.error(errmsg) - raise ValueError(errmsg) - - self.plugin.logDebug("AdYouLike challenge: %s" % challenge) - - return self.result(ayl, challenge) - - - def result(self, server, challenge): - # Adyoulike.g._jsonp_5579316662423138 - # ({"translations":{"fr":{"instructions_visual":"Recopiez « Soonnight » ci-dessous :"}}, - # "site_under":true,"clickable":true,"pixels":{"VIDEO_050":[],"DISPLAY":[],"VIDEO_000":[],"VIDEO_100":[], - # "VIDEO_025":[],"VIDEO_075":[]},"medium_type":"image/adyoulike", - # "iframes":{"big":"<iframe src=\"http://www.soonnight.com/campagn.html\" scrolling=\"no\" - # height=\"250\" width=\"300\" frameborder=\"0\"></iframe>"},"shares":{},"id":256, - # "token":"e6QuI4aRSnbIZJg02IsV6cp4JQ9~MjA1","formats":{"small":{"y":300,"x":0,"w":300,"h":60}, - # "big":{"y":0,"x":0,"w":300,"h":250},"hover":{"y":440,"x":0,"w":300,"h":60}}, - # "tid":"SqwuAdxT1EZoi4B5q0T63LN2AkiCJBg5"}) - - if isinstance(server, basestring): - server = json_loads(server) - - if isinstance(challenge, basestring): - challenge = json_loads(challenge) - - try: - instructions_visual = challenge['translations'][server['all']['lang']]['instructions_visual'] - result = re.search(u'«(.+?)»', instructions_visual).group(1).strip() - except Exception: - errmsg = _("AdYouLike result not found") - self.plugin.error(errmsg) - raise ValueError(errmsg) - - result = {'_ayl_captcha_engine' : "adyoulike", - '_ayl_env' : server['all']['env'], - '_ayl_tid' : challenge['tid'], - '_ayl_token_challenge': challenge['token'], - '_ayl_response' : response} - - self.plugin.logDebug("AdYouLike result: %s" % result) - - return result diff --git a/pyload/plugin/captcha/AdsCaptcha.py b/pyload/plugin/captcha/AdsCaptcha.py deleted file mode 100644 index 5c01a422e..000000000 --- a/pyload/plugin/captcha/AdsCaptcha.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from random import random - -from pyload.plugin.Captcha import Captcha - - -class AdsCaptcha(Captcha): - __name__ = "AdsCaptcha" - __type__ = "captcha" - __version__ = "0.06" - - __description__ = """AdsCaptcha captcha service plugin""" - __license__ = "GPLv3" - __authors__ = [("pyLoad Team", "admin@pyload.org")] - - - CAPTCHAID_PATTERN = r'api\.adscaptcha\.com/Get\.aspx\?[^"\']*CaptchaId=(\d+)' - PUBLICKEY_PATTERN = r'api\.adscaptcha\.com/Get\.aspx\?[^"\']*PublicKey=([\w-]+)' - - - def detect_key(self, html=None): - if not html: - if hasattr(self.plugin, "html") and self.plugin.html: - html = self.plugin.html - else: - errmsg = _("AdsCaptcha html not found") - self.plugin.fail(errmsg) - raise TypeError(errmsg) - - m = re.search(self.PUBLICKEY_PATTERN, html) - n = re.search(self.CAPTCHAID_PATTERN, html) - if m and n: - self.key = (m.group(1).strip(), n.group(1).strip()) #: key is the tuple(PublicKey, CaptchaId) - self.plugin.logDebug("AdsCaptcha key|id: %s | %s" % self.key) - return self.key - else: - self.plugin.logDebug("AdsCaptcha key or id not found") - return None - - - def challenge(self, key=None): - if not key: - if self.detect_key(): - key = self.key - else: - errmsg = _("AdsCaptcha key not found") - self.plugin.fail(errmsg) - raise TypeError(errmsg) - - PublicKey, CaptchaId = key - - html = self.plugin.req.load("http://api.adscaptcha.com/Get.aspx", get={'CaptchaId': CaptchaId, 'PublicKey': PublicKey}) - try: - challenge = re.search("challenge: '(.+?)',", html).group(1) - server = re.search("server: '(.+?)',", html).group(1) - except Exception: - errmsg = _("AdsCaptcha challenge pattern not found") - self.plugin.error(errmsg) - raise ValueError(errmsg) - - self.plugin.logDebug("AdsCaptcha challenge: %s" % challenge) - - return challenge, self.result(server, challenge) - - - def result(self, server, challenge): - result = self.plugin.decryptCaptcha("%sChallenge.aspx" % server, - get={'cid': challenge, 'dummy': random()}, - cookies=True, - imgtype="jpg") - - self.plugin.logDebug("AdsCaptcha result: %s" % result) - - return result diff --git a/pyload/plugin/captcha/ReCaptcha.py b/pyload/plugin/captcha/ReCaptcha.py deleted file mode 100644 index 4b900c57b..000000000 --- a/pyload/plugin/captcha/ReCaptcha.py +++ /dev/null @@ -1,73 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pyload.plugin.Captcha import Captcha - - -class ReCaptcha(Captcha): - __name__ = "ReCaptcha" - __type__ = "captcha" - __version__ = "0.08" - - __description__ = """ReCaptcha captcha service plugin""" - __license__ = "GPLv3" - __authors__ = [("pyLoad Team", "admin@pyload.org")] - - - KEY_PATTERN = r'recaptcha(?:/api|\.net)/(?:challenge|noscript)\?k=([\w-]+)' - KEY_AJAX_PATTERN = r'Recaptcha\.create\s*\(\s*["\']([\w-]+)' - - - def detect_key(self, html=None): - if not html: - if hasattr(self.plugin, "html") and self.plugin.html: - html = self.plugin.html - else: - errmsg = _("ReCaptcha html not found") - self.plugin.fail(errmsg) - raise TypeError(errmsg) - - m = re.search(self.KEY_PATTERN, html) or re.search(self.KEY_AJAX_PATTERN, html) - if m: - self.key = m.group(1).strip() - self.plugin.logDebug("ReCaptcha key: %s" % self.key) - return self.key - else: - self.plugin.logDebug("ReCaptcha key not found") - return None - - - def challenge(self, key=None): - if not key: - if self.detect_key(): - key = self.key - else: - errmsg = _("ReCaptcha key not found") - self.plugin.fail(errmsg) - raise TypeError(errmsg) - - html = self.plugin.req.load("http://www.google.com/recaptcha/api/challenge", get={'k': key}) - try: - challenge = re.search("challenge : '(.+?)',", html).group(1) - server = re.search("server : '(.+?)',", html).group(1) - except Exception: - errmsg = _("ReCaptcha challenge pattern not found") - self.plugin.error(errmsg) - raise ValueError(errmsg) - - self.plugin.logDebug("ReCaptcha challenge: %s" % challenge) - - return challenge, self.result(server, challenge) - - - def result(self, server, challenge): - result = self.plugin.decryptCaptcha("%simage" % server, - get={'c': challenge}, - cookies=True, - forceUser=True, - imgtype="jpg") - - self.plugin.logDebug("ReCaptcha result: %s" % result) - - return result diff --git a/pyload/plugin/captcha/SolveMedia.py b/pyload/plugin/captcha/SolveMedia.py deleted file mode 100644 index 6e2a6c362..000000000 --- a/pyload/plugin/captcha/SolveMedia.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pyload.plugin.Captcha import Captcha - - -class SolveMedia(Captcha): - __name__ = "SolveMedia" - __type__ = "captcha" - __version__ = "0.06" - - __description__ = """SolveMedia captcha service plugin""" - __license__ = "GPLv3" - __authors__ = [("pyLoad Team", "admin@pyload.org")] - - - KEY_PATTERN = r'api\.solvemedia\.com/papi/challenge\.(?:no)?script\?k=(.+?)["\']' - - - def challenge(self, key=None): - if not key: - if self.detect_key(): - key = self.key - else: - errmsg = _("SolveMedia key not found") - self.plugin.fail(errmsg) - raise TypeError(errmsg) - - html = self.plugin.req.load("http://api.solvemedia.com/papi/challenge.noscript", get={'k': key}) - try: - challenge = re.search(r'<input type=hidden name="adcopy_challenge" id="adcopy_challenge" value="([^"]+)">', - html).group(1) - server = "http://api.solvemedia.com/papi/media" - except Exception: - errmsg = _("SolveMedia challenge pattern not found") - self.plugin.error(errmsg) - raise ValueError(errmsg) - - self.plugin.logDebug("SolveMedia challenge: %s" % challenge) - - return challenge, self.result(server, challenge) - - - def result(self, server, challenge): - result = self.plugin.decryptCaptcha(server, get={'c': challenge}, imgtype="gif") - - self.plugin.logDebug("SolveMedia result: %s" % result) - - return result diff --git a/pyload/plugin/captcha/__init__.py b/pyload/plugin/captcha/__init__.py deleted file mode 100644 index 40a96afc6..000000000 --- a/pyload/plugin/captcha/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/pyload/plugin/container/CCF.py b/pyload/plugin/container/CCF.py deleted file mode 100644 index a27511358..000000000 --- a/pyload/plugin/container/CCF.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement - -import re - -from os import makedirs -from os.path import exists -from urllib2 import build_opener - -from MultipartPostHandler import MultipartPostHandler - -from pyload.plugin.Container import Container -from pyload.utils import safe_join - - -class CCF(Container): - __name__ = "CCF" - __version__ = "0.20" - - __pattern__ = r'.+\.ccf' - - __description__ = """CCF container decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("Willnix", "Willnix@pyload.org")] - - - def decrypt(self, pyfile): - infile = pyfile.url.replace("\n", "") - - opener = build_opener(MultipartPostHandler) - params = {"src": "ccf", - "filename": "test.ccf", - "upload": open(infile, "rb")} - tempdlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php', params).read() - - download_folder = self.config['general']['download_folder'] - - tempdlc_name = safe_join(download_folder, "tmp_%s.dlc" % pyfile.name) - with open(tempdlc_name, "w") as tempdlc: - tempdlc.write(re.search(r'<dlc>(.*)</dlc>', tempdlc_content, re.S).group(1)) - - self.urls = [tempdlc_name] diff --git a/pyload/plugin/container/LinkList.py b/pyload/plugin/container/LinkList.py deleted file mode 100644 index 305da8a38..000000000 --- a/pyload/plugin/container/LinkList.py +++ /dev/null @@ -1,71 +0,0 @@ -# -*- coding: utf-8 -*- - -import codecs - -from pyload.plugin.Container import Container -from pyload.utils import fs_encode - - -class LinkList(Container): - __name__ = "LinkList" - __version__ = "0.12" - - __pattern__ = r'.+\.txt' - __config__ = [("clear", "bool", "Clear Linklist after adding", False), - ("encoding", "string", "File encoding (default utf-8)", "")] - - __description__ = """Read link lists in txt format""" - __license__ = "GPLv3" - __authors__ = [("spoob", "spoob@pyload.org"), - ("jeix", "jeix@hasnomail.com")] - - - def decrypt(self, pyfile): - try: - file_enc = codecs.lookup(self.getConfig("encoding")).name - except Exception: - file_enc = "utf-8" - - file_name = fs_encode(pyfile.url) - - txt = codecs.open(file_name, 'r', file_enc) - links = txt.readlines() - curPack = "Parsed links from %s" % pyfile.name - - packages = {curPack:[],} - - for link in links: - link = link.strip() - if not link: - continue - - if link.startswith(";"): - continue - if link.startswith("[") and link.endswith("]"): - # new package - curPack = link[1:-1] - packages[curPack] = [] - continue - packages[curPack].append(link) - txt.close() - - # empty packages fix - - delete = [] - - for key,value in packages.iteritems(): - if not value: - delete.append(key) - - for key in delete: - del packages[key] - - if self.getConfig("clear"): - try: - txt = open(file_name, 'wb') - txt.close() - except Exception: - self.logWarning(_("LinkList could not be cleared")) - - for name, links in packages.iteritems(): - self.packages.append((name, links, name)) diff --git a/pyload/plugin/container/RSDF.py b/pyload/plugin/container/RSDF.py deleted file mode 100644 index 17f304f50..000000000 --- a/pyload/plugin/container/RSDF.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement - -import base64 -import binascii -import re - -from pyload.plugin.Container import Container -from pyload.utils import fs_encode - - -class RSDF(Container): - __name__ = "RSDF" - __version__ = "0.24" - - __pattern__ = r'.+\.rsdf' - - __description__ = """RSDF container decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), - ("spoob", "spoob@pyload.org")] - - - def decrypt(self, pyfile): - - from Crypto.Cipher import AES - - infile = fs_encode(pyfile.url.replace("\n", "")) - Key = binascii.unhexlify('8C35192D964DC3182C6F84F3252239EB4A320D2500000000') - - IV = binascii.unhexlify('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF') - IV_Cipher = AES.new(Key, AES.MODE_ECB) - IV = IV_Cipher.encrypt(IV) - - obj = AES.new(Key, AES.MODE_CFB, IV) - - try: - with open(infile, 'r') as rsdf: - data = rsdf.read() - except IOError, e: - self.fail(str(e)) - - if re.search(r"<title>404 - Not Found", data) is None: - data = binascii.unhexlify(''.join(data.split())) - data = data.splitlines() - - for link in data: - if not link: - continue - link = base64.b64decode(link) - link = obj.decrypt(link) - decryptedUrl = link.replace('CCF: ', '') - self.urls.append(decryptedUrl) - - self.logDebug("Adding package %s with %d links" % (pyfile.package().name, len(self.urls))) diff --git a/pyload/plugin/container/__init__.py b/pyload/plugin/container/__init__.py deleted file mode 100644 index 40a96afc6..000000000 --- a/pyload/plugin/container/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/pyload/plugin/crypter/BitshareCom.py b/pyload/plugin/crypter/BitshareCom.py deleted file mode 100644 index 524307127..000000000 --- a/pyload/plugin/crypter/BitshareCom.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.SimpleCrypter import SimpleCrypter - - -class BitshareCom(SimpleCrypter): - __name__ = "BitshareCom" - __type__ = "crypter" - __version__ = "0.03" - - __pattern__ = r'http://(?:www\.)?bitshare\.com/\?d=\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """Bitshare.com folder decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - LINK_PATTERN = r'.+' - NAME_PATTERN = r'View public folder "(?P.+)"' diff --git a/pyload/plugin/crypter/C1NeonCom.py b/pyload/plugin/crypter/C1NeonCom.py deleted file mode 100644 index a7973b041..000000000 --- a/pyload/plugin/crypter/C1NeonCom.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo - - -class C1neonCom(DeadCrypter): - __name__ = "C1neonCom" - __type__ = "crypter" - __version__ = "0.05" - - __pattern__ = r'http://(?:www\.)?c1neon\.com/.*?' - __config__ = [] - - __description__ = """C1neon.com decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("godofdream", "soilfiction@gmail.com")] - - -getInfo = create_getInfo(C1neonCom) diff --git a/pyload/plugin/crypter/ChipDe.py b/pyload/plugin/crypter/ChipDe.py deleted file mode 100644 index 3e00a7f66..000000000 --- a/pyload/plugin/crypter/ChipDe.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -from pyload.plugin.Crypter import Crypter - - -class ChipDe(Crypter): - __name__ = "ChipDe" - __type__ = "crypter" - __version__ = "0.10" - - __pattern__ = r'http://(?:www\.)?chip\.de/video/.*\.html' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """Chip.de decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("4Christopher", "4Christopher@gmx.de")] - - - def decrypt(self, pyfile): - self.html = self.load(pyfile.url) - try: - f = re.search(r'"(http://video\.chip\.de/.+)"', self.html) - except Exception: - self.fail(_("Failed to find the URL")) - else: - self.urls = [f.group(1)] - self.logDebug("The file URL is %s" % self.urls[0]) diff --git a/pyload/plugin/crypter/CrockoCom.py b/pyload/plugin/crypter/CrockoCom.py deleted file mode 100644 index 577433510..000000000 --- a/pyload/plugin/crypter/CrockoCom.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.SimpleCrypter import SimpleCrypter - - -class CrockoCom(SimpleCrypter): - __name__ = "CrockoCom" - __type__ = "crypter" - __version__ = "0.01" - - __pattern__ = r'http://(?:www\.)?crocko\.com/f/.*' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """Crocko.com folder decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - LINK_PATTERN = r'download' diff --git a/pyload/plugin/crypter/CryptItCom.py b/pyload/plugin/crypter/CryptItCom.py deleted file mode 100644 index cb3347f55..000000000 --- a/pyload/plugin/crypter/CryptItCom.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo - - -class CryptItCom(DeadCrypter): - __name__ = "CryptItCom" - __type__ = "crypter" - __version__ = "0.11" - - __pattern__ = r'http://(?:www\.)?crypt-it\.com/(s|e|d|c)/\w+' - __config__ = [] - - __description__ = """Crypt-it.com decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("jeix", "jeix@hasnomail.de")] - - -getInfo = create_getInfo(CryptItCom) diff --git a/pyload/plugin/crypter/CzshareCom.py b/pyload/plugin/crypter/CzshareCom.py deleted file mode 100644 index 71847ab48..000000000 --- a/pyload/plugin/crypter/CzshareCom.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -from pyload.plugin.Crypter import Crypter - - -class CzshareCom(Crypter): - __name__ = "CzshareCom" - __type__ = "crypter" - __version__ = "0.20" - - __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/folders/.*' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """Czshare.com folder decrypter plugin, now Sdilej.cz""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - FOLDER_PATTERN = r'\s*\s*(.*?)
    ' - LINK_PATTERN = r'info' - - - def decrypt(self, pyfile): - html = self.load(pyfile.url) - - m = re.search(self.FOLDER_PATTERN, html, re.S) - if m is None: - self.error(_("FOLDER_PATTERN not found")) - - self.urls.extend(re.findall(self.LINK_PATTERN, m.group(1))) diff --git a/pyload/plugin/crypter/DDLMusicOrg.py b/pyload/plugin/crypter/DDLMusicOrg.py deleted file mode 100644 index 2b6738799..000000000 --- a/pyload/plugin/crypter/DDLMusicOrg.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from time import sleep - -from pyload.plugin.Crypter import Crypter - - -class DDLMusicOrg(Crypter): - __name__ = "DDLMusicOrg" - __type__ = "crypter" - __version__ = "0.30" - - __pattern__ = r'http://(?:www\.)?ddl-music\.org/captcha/ddlm_cr\d\.php\?\d+\?\d+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """Ddl-music.org decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("mkaay", "mkaay@mkaay.de")] - - - def setup(self): - self.multiDL = False - - - def decrypt(self, pyfile): - html = self.load(pyfile.url, cookies=True) - - if re.search(r"Wer dies nicht rechnen kann", html) is not None: - self.offline() - - math = re.search(r"(\d+) ([+-]) (\d+) =\s+", htmlwithlink) - if m: - self.urls = [m.group(1)] - else: - self.retry() diff --git a/pyload/plugin/crypter/DailymotionBatch.py b/pyload/plugin/crypter/DailymotionBatch.py deleted file mode 100644 index a056c73a4..000000000 --- a/pyload/plugin/crypter/DailymotionBatch.py +++ /dev/null @@ -1,106 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from urlparse import urljoin - -from pyload.utils import json_loads -from pyload.plugin.Crypter import Crypter -from pyload.utils import safe_join - - -class DailymotionBatch(Crypter): - __name__ = "DailymotionBatch" - __type__ = "crypter" - __version__ = "0.01" - - __pattern__ = r'https?://(?:www\.)?dailymotion\.com/((playlists/)?(?Pplaylist|user)/)?(?P[\w^_]+)(?(TYPE)|#)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """Dailymotion.com channel & playlist decrypter""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - def api_response(self, ref, req=None): - url = urljoin("https://api.dailymotion.com/", ref) - page = self.load(url, get=req) - return json_loads(page) - - - def getPlaylistInfo(self, id): - ref = "playlist/" + id - req = {"fields": "name,owner.screenname"} - playlist = self.api_response(ref, req) - - if "error" in playlist: - return - - name = playlist['name'] - owner = playlist['owner.screenname'] - return name, owner - - - def _getPlaylists(self, user_id, page=1): - ref = "user/%s/playlists" % user_id - req = {"fields": "id", "page": page, "limit": 100} - user = self.api_response(ref, req) - - if "error" in user: - return - - for playlist in user['list']: - yield playlist['id'] - - if user['has_more']: - for item in self._getPlaylists(user_id, page + 1): - yield item - - - def getPlaylists(self, user_id): - return [(id,) + self.getPlaylistInfo(id) for id in self._getPlaylists(user_id)] - - - def _getVideos(self, id, page=1): - ref = "playlist/%s/videos" % id - req = {"fields": "url", "page": page, "limit": 100} - playlist = self.api_response(ref, req) - - if "error" in playlist: - return - - for video in playlist['list']: - yield video['url'] - - if playlist['has_more']: - for item in self._getVideos(id, page + 1): - yield item - - - def getVideos(self, playlist_id): - return list(self._getVideos(playlist_id))[::-1] - - - def decrypt(self, pyfile): - m = re.match(self.__pattern__, pyfile.url) - m_id = m.group("ID") - m_type = m.group("TYPE") - - if m_type == "playlist": - self.logDebug("Url recognized as Playlist") - p_info = self.getPlaylistInfo(m_id) - playlists = [(m_id,) + p_info] if p_info else None - else: - self.logDebug("Url recognized as Channel") - playlists = self.getPlaylists(m_id) - self.logDebug("%s playlist\s found on channel \"%s\"" % (len(playlists), m_id)) - - if not playlists: - self.fail(_("No playlist available")) - - for p_id, p_name, p_owner in playlists: - p_videos = self.getVideos(p_id) - p_folder = safe_join(self.config['general']['download_folder'], p_owner, p_name) - self.logDebug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) - self.packages.append((p_name, p_videos, p_folder)) #: folder is NOT recognized by pyload 0.4.9! diff --git a/pyload/plugin/crypter/DataHu.py b/pyload/plugin/crypter/DataHu.py deleted file mode 100644 index f69d6ee3e..000000000 --- a/pyload/plugin/crypter/DataHu.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from pyload.plugin.internal.SimpleCrypter import SimpleCrypter - - -class DataHu(SimpleCrypter): - __name__ = "DataHu" - __type__ = "crypter" - __version__ = "0.06" - - __pattern__ = r'http://(?:www\.)?data\.hu/dir/\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """Data.hu folder decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("crash", ""), - ("stickell", "l.stickell@yahoo.it")] - - - LINK_PATTERN = r'\1' - NAME_PATTERN = ur'(?P<N>.+) Let\xf6lt\xe9se' - - - def prepare(self): - super(DataHu, self).prepare() - - if u'K\xe9rlek add meg a jelsz\xf3t' in self.html: # Password protected - password = self.getPassword() - if not password: - self.fail(_("Password required")) - - self.logDebug("The folder is password protected', 'Using password: " + password) - - self.html = self.load(self.pyfile.url, post={'mappa_pass': password}, decode=True) - - if u'Hib\xe1s jelsz\xf3' in self.html: # Wrong password - self.fail(_("Wrong password")) diff --git a/pyload/plugin/crypter/DdlstorageCom.py b/pyload/plugin/crypter/DdlstorageCom.py deleted file mode 100644 index 1d87e975b..000000000 --- a/pyload/plugin/crypter/DdlstorageCom.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo - - -class DdlstorageCom(DeadCrypter): - __name__ = "DdlstorageCom" - __type__ = "crypter" - __version__ = "0.03" - - __pattern__ = r'https?://(?:www\.)?ddlstorage\.com/folder/\w+' - __config__ = [] - - __description__ = """DDLStorage.com folder decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("godofdream", "soilfiction@gmail.com"), - ("stickell", "l.stickell@yahoo.it")] - - -getInfo = create_getInfo(DdlstorageCom) diff --git a/pyload/plugin/crypter/DepositfilesCom.py b/pyload/plugin/crypter/DepositfilesCom.py deleted file mode 100644 index 24fa9134a..000000000 --- a/pyload/plugin/crypter/DepositfilesCom.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.SimpleCrypter import SimpleCrypter - - -class DepositfilesCom(SimpleCrypter): - __name__ = "DepositfilesCom" - __type__ = "crypter" - __version__ = "0.01" - - __pattern__ = r'http://(?:www\.)?depositfiles\.com/folders/\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """Depositfiles.com folder decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - LINK_PATTERN = r'
    ]*>\s*' diff --git a/pyload/plugin/crypter/Dereferer.py b/pyload/plugin/crypter/Dereferer.py deleted file mode 100644 index 598cba8bd..000000000 --- a/pyload/plugin/crypter/Dereferer.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from urllib import unquote - -from pyload.plugin.Crypter import Crypter - - -class Dereferer(Crypter): - __name__ = "Dereferer" - __type__ = "crypter" - __version__ = "0.10" - - __pattern__ = r'https?://([^/]+)/.*?(?P(ht|f)tps?(://|%3A%2F%2F).*)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """Crypter for dereferers""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - def decrypt(self, pyfile): - link = re.match(self.__pattern__, pyfile.url).group('url') - self.urls = [unquote(link).rstrip('+')] diff --git a/pyload/plugin/crypter/DevhostStFolder.py b/pyload/plugin/crypter/DevhostStFolder.py deleted file mode 100644 index 9c81879c6..000000000 --- a/pyload/plugin/crypter/DevhostStFolder.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Test links: -# http://d-h.st/users/shine/?fld_id=37263#files - -import re - -from urlparse import urljoin - -from pyload.plugin.internal.SimpleCrypter import SimpleCrypter - - -class DevhostStFolder(SimpleCrypter): - __name__ = "DevhostStFolder" - __type__ = "crypter" - __version__ = "0.03" - - __pattern__ = r'http://(?:www\.)?d-h\.st/users/(?P\w+)(/\?fld_id=(?P\d+))?' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """d-h.st folder decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de"), - ("Walter Purcaro", "vuolter@gmail.com")] - - - LINK_PATTERN = r'(?:/> |;">)Back to \w+<)' - OFFLINE_PATTERN = r'"/cHP">test\.png<' - - - def getFileInfo(self): - if re.search(self.OFFLINE_PATTERN, self.html): - self.offline() - - try: - id = re.match(self.__pattern__, self.pyfile.url).group('ID') - if id == "0": - raise - - p = r'href="(.+?)">Back to \w+<' - m = re.search(p, self.html) - html = self.load(urljoin("http://d-h.st", m.group(1)), - cookies=False) - - p = '\?fld_id=%s.*?">(.+?)<' % id - m = re.search(p, html) - name = folder = m.group(1) - - except Exception, e: - self.logDebug(e) - name = folder = re.match(self.__pattern__, self.pyfile.url).group('USER') - - return {'name': name, 'folder': folder} - - - def getLinks(self): - return [urljoin("http://d-h.st", link) for link in re.findall(self.LINK_PATTERN, self.html)] diff --git a/pyload/plugin/crypter/DlProtectCom.py b/pyload/plugin/crypter/DlProtectCom.py deleted file mode 100644 index 539cdc21c..000000000 --- a/pyload/plugin/crypter/DlProtectCom.py +++ /dev/null @@ -1,65 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from base64 import urlsafe_b64encode -from time import time - -from pyload.plugin.internal.SimpleCrypter import SimpleCrypter - - -class DlProtectCom(SimpleCrypter): - __name__ = "DlProtectCom" - __type__ = "crypter" - __version__ = "0.01" - - __pattern__ = r'http://(?:www\.)?dl-protect\.com/((en|fr)/)?(?P\w+)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """Dl-protect.com decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - OFFLINE_PATTERN = r'>Unfortunately, the link you are looking for is not found' - - - def getLinks(self): - # Direct link with redirect - if not re.match(r"http://(?:www\.)?dl-protect\.com", self.req.http.lastEffectiveURL): - return [self.req.http.lastEffectiveURL] - - #id = re.match(self.__pattern__, self.pyfile.url).group("ID") - key = re.search(r'name="id_key" value="(.+?)"', self.html).group(1) - - post_req = {"id_key": key, "submitform": ""} - - if self.OFFLINE_PATTERN in self.html: - self.offline() - elif ">Please click on continue to see the content" in self.html: - post_req.update({"submitform": "Continue"}) - else: - mstime = int(round(time() * 1000)) - b64time = "_" + urlsafe_b64encode(str(mstime)).replace("=", "%3D") - - post_req.update({"i": b64time, "submitform": "Decrypt+link"}) - - if ">Password :" in self.html: - post_req['pwd'] = self.getPassword() - - if ">Security Code" in self.html: - captcha_id = re.search(r'/captcha\.php\?uid=(.+?)"', self.html).group(1) - captcha_url = "http://www.dl-protect.com/captcha.php?uid=" + captcha_id - captcha_code = self.decryptCaptcha(captcha_url, imgtype="gif") - - post_req['secure'] = captcha_code - - self.html = self.load(self.pyfile.url, post=post_req) - - for errmsg in (">The password is incorrect", ">The security code is incorrect"): - if errmsg in self.html: - self.fail(_(errmsg[1:])) - - pattern = r'' - return re.findall(pattern, self.html) diff --git a/pyload/plugin/crypter/DontKnowMe.py b/pyload/plugin/crypter/DontKnowMe.py deleted file mode 100644 index c2b9649ed..000000000 --- a/pyload/plugin/crypter/DontKnowMe.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from urllib import unquote - -from pyload.plugin.Crypter import Crypter - - -class DontKnowMe(Crypter): - __name__ = "DontKnowMe" - __type__ = "crypter" - __version__ = "0.10" - - __pattern__ = r'http://(?:www\.)?dontknow\.me/at/\?.+$' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """DontKnow.me decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("selaux", "")] - - - LINK_PATTERN = r'http://dontknow\.me/at/\?(.+)$' - - - def decrypt(self, pyfile): - link = re.findall(self.LINK_PATTERN, pyfile.url)[0] - self.urls = [unquote(link)] diff --git a/pyload/plugin/crypter/DuckCryptInfo.py b/pyload/plugin/crypter/DuckCryptInfo.py deleted file mode 100644 index 55681fd5e..000000000 --- a/pyload/plugin/crypter/DuckCryptInfo.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from BeautifulSoup import BeautifulSoup - -from pyload.plugin.Crypter import Crypter - - -class DuckCryptInfo(Crypter): - __name__ = "DuckCryptInfo" - __type__ = "crypter" - __version__ = "0.02" - - __pattern__ = r'http://(?:www\.)?duckcrypt\.info/(folder|wait|link)/(\w+)/?(\w*)' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """DuckCrypt.info decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("godofdream", "soilfiction@gmail.com")] - - - TIMER_PATTERN = r'(.*)' - - - def decrypt(self, pyfile): - url = pyfile.url - - m = re.match(self.__pattern__, url) - if m is None: - self.fail(_("Weird error in link")) - if str(m.group(1)) == "link": - self.handleLink(url) - else: - self.handleFolder(m) - - - def handleFolder(self, m): - html = self.load("http://duckcrypt.info/ajax/auth.php?hash=" + str(m.group(2))) - m = re.match(self.__pattern__, html) - self.logDebug("Redirectet to " + str(m.group(0))) - html = self.load(str(m.group(0))) - soup = BeautifulSoup(html) - cryptlinks = soup.findAll("div", attrs={"class": "folderbox"}) - self.logDebug("Redirectet to " + str(cryptlinks)) - if not cryptlinks: - self.error(_("No link found")) - for clink in cryptlinks: - if clink.find("a"): - self.handleLink(clink.find("a")['href']) - - - def handleLink(self, url): - html = self.load(url) - soup = BeautifulSoup(html) - self.urls = [soup.find("iframe")['src']] - if not self.urls: - self.logInfo(_("No link found")) diff --git a/pyload/plugin/crypter/DuploadOrg.py b/pyload/plugin/crypter/DuploadOrg.py deleted file mode 100644 index 70745b550..000000000 --- a/pyload/plugin/crypter/DuploadOrg.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo - - -class DuploadOrg(DeadCrypter): - __name__ = "DuploadOrg" - __type__ = "crypter" - __version__ = "0.02" - - __pattern__ = r'http://(?:www\.)?dupload\.org/folder/\d+' - __config__ = [] - - __description__ = """Dupload.org folder decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - -getInfo = create_getInfo(DuploadOrg) diff --git a/pyload/plugin/crypter/EasybytezCom.py b/pyload/plugin/crypter/EasybytezCom.py deleted file mode 100644 index 9a4fca74a..000000000 --- a/pyload/plugin/crypter/EasybytezCom.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.XFSCrypter import XFSCrypter - - -class EasybytezCom(XFSCrypter): - __name__ = "EasybytezCom" - __type__ = "crypter" - __version__ = "0.10" - - __pattern__ = r'http://(?:www\.)?easybytez\.com/users/\d+/\d+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """Easybytez.com folder decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - HOSTER_DOMAIN = "easybytez.com" - - LOGIN_ACCOUNT = True diff --git a/pyload/plugin/crypter/EmbeduploadCom.py b/pyload/plugin/crypter/EmbeduploadCom.py deleted file mode 100644 index 3265a939e..000000000 --- a/pyload/plugin/crypter/EmbeduploadCom.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -from pyload.plugin.Crypter import Crypter -from pyload.network.HTTPRequest import BadHeader - - -class EmbeduploadCom(Crypter): - __name__ = "EmbeduploadCom" - __type__ = "crypter" - __version__ = "0.02" - - __pattern__ = r'http://(?:www\.)?embedupload\.com/\?d=.*' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True), - ("preferedHoster", "str", "Prefered hoster list (bar-separated)", "embedupload"), - ("ignoredHoster", "str", "Ignored hoster list (bar-separated)", "")] - - __description__ = """EmbedUpload.com decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - LINK_PATTERN = r'
    ]*>\s*' - - - def decrypt(self, pyfile): - self.html = self.load(pyfile.url, decode=True) - tmp_links = [] - - m = re.findall(self.LINK_PATTERN, self.html) - if m: - prefered_set = set(self.getConfig("preferedHoster").split('|')) - prefered_set = map(lambda s: s.lower().split('.')[0], prefered_set) - - self.logDebug("PF: %s" % prefered_set) - - tmp_links.extend([x[1] for x in m if x[0] in prefered_set]) - self.urls = self.getLocation(tmp_links) - - if not self.urls: - ignored_set = set(self.getConfig("ignoredHoster").split('|')) - ignored_set = map(lambda s: s.lower().split('.')[0], ignored_set) - - self.logDebug("IG: %s" % ignored_set) - - tmp_links.extend([x[1] for x in m if x[0] not in ignored_set]) - self.urls = self.getLocation(tmp_links) - - - def getLocation(self, tmp_links): - new_links = [] - for link in tmp_links: - try: - header = self.load(link, just_header=True) - if 'location' in header: - new_links.append(header['location']) - except BadHeader: - pass - return new_links diff --git a/pyload/plugin/crypter/FilebeerInfo.py b/pyload/plugin/crypter/FilebeerInfo.py deleted file mode 100644 index a6faa5cab..000000000 --- a/pyload/plugin/crypter/FilebeerInfo.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo - - -class FilebeerInfo(DeadCrypter): - __name__ = "FilebeerInfo" - __type__ = "crypter" - __version__ = "0.02" - - __pattern__ = r'http://(?:www\.)?filebeer\.info/(\d+~f).*' - __config__ = [] - - __description__ = """Filebeer.info folder decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - -getInfo = create_getInfo(FilebeerInfo) diff --git a/pyload/plugin/crypter/FilecloudIo.py b/pyload/plugin/crypter/FilecloudIo.py deleted file mode 100644 index f4c967a07..000000000 --- a/pyload/plugin/crypter/FilecloudIo.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugin.internal.SimpleCrypter import SimpleCrypter - - -class FilecloudIo(SimpleCrypter): - __name__ = "FilecloudIo" - __type__ = "crypter" - __version__ = "0.03" - - __pattern__ = r'https?://(?:www\.)?(filecloud\.io|ifile\.it)/_\w+' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - - __description__ = """Filecloud.io folder decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - LINK_PATTERN = r'href="(http://filecloud\.io/\w+)" title' - NAME_PATTERN = r'>(?P.+?) - filecloud\.io<' diff --git a/pyload/plugin/crypter/FilecryptCc.py b/pyload/plugin/crypter/FilecryptCc.py deleted file mode 100644 index 475c1503f..000000000 --- a/pyload/plugin/crypter/FilecryptCc.py +++ /dev/null @@ -1,148 +0,0 @@ -# -*- coding: utf-8 -*- - -import base64 -import binascii -import re - -from Crypto.Cipher import AES - -from pyload.plugin.Crypter import Crypter - - -class FilecryptCc(Crypter): - __name__ = "FilecryptCc" - __type__ = "crypter" - __version__ = "0.05" - - __pattern__ = r'https?://(?:www\.)?filecrypt\.cc/Container/\w+' - - __description__ = """Filecrypt.cc decrypter plugin""" - __license__ = "GPLv3" - __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] - - - # URL_REPLACEMENTS = [(r'.html$', ""), (r'$', ".html")] #@TODO: Extend SimpleCrypter - - DLC_LINK_PATTERN = r' - -{% endblock %} -{% block hidden %} -
    -
    -

    {{ _("Change Password") }}

    - -

    {{ _("Enter your current and desired Password.") }}

    - - - - - - - - - - - - - - - -
    - -
    - -
    -{% endblock %} diff --git a/pyload/webui/themes/Dark/tml/base.html b/pyload/webui/themes/Dark/tml/base.html deleted file mode 100644 index bebb0600d..000000000 --- a/pyload/webui/themes/Dark/tml/base.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - -{% block title %}pyLoad {{_("Webinterface")}}{% endblock %} - -{% block head %} -{% endblock %} - - - - -
    - - -
    - {% block headpanel %} - - {% if user.is_authenticated %} - - -{% if update %} - -{{_("pyLoad Update available!")}} - -{% endif %} - - -{% if plugins %} - -{{_("Plugins updated, please restart!")}} - -{% endif %} - - -Captcha: -{{_("Captcha waiting")}} - - - User:{{user.name}} - -{% else %} - {{_("Please Login!")}} -{% endif %} - - {% endblock %} -
    - - -{% if user.is_authenticated %} -
    - -
    {% endif %} - -
    -
    - -{% if perms.STATUS %} - -{% endif %} - -{% if perms.LIST %} - -{% endif %} - -{% block pageactions %} -{% endblock %} -
    - -
    - -
    - -

    {% block subtitle %}pyLoad - {{_("Webinterface")}}{% endblock %}

    - -{% block statusbar %} -{% endblock %} - - -
    - -
    -
    - - -{% for message in messages %} -

    {{message}}

    -{% endfor %} - -
    - - {{_("loading")}} -
    - -{% block content %} -{% endblock content %} - -
    - - -
    -
    - - - - diff --git a/pyload/webui/themes/Dark/tml/captcha.html b/pyload/webui/themes/Dark/tml/captcha.html deleted file mode 100644 index 731d97d11..000000000 --- a/pyload/webui/themes/Dark/tml/captcha.html +++ /dev/null @@ -1,42 +0,0 @@ - -
    - -
    - -

    {{_("Captcha reading")}}

    -

    {{_("Please read the text on the captcha.")}}

    - -
    - - - - - - - - - - - -
    - -
    - -
    - -
    - - - - -
    - -
    - -
    - -
    \ No newline at end of file diff --git a/pyload/webui/themes/Dark/tml/downloads.html b/pyload/webui/themes/Dark/tml/downloads.html deleted file mode 100644 index c6ff7a243..000000000 --- a/pyload/webui/themes/Dark/tml/downloads.html +++ /dev/null @@ -1,29 +0,0 @@ -{% extends '/Dark/tml/base.html' %} - -{% block title %}Downloads - {{super()}} {% endblock %} - -{% block subtitle %} -{{_("Downloads")}} -{% endblock %} - -{% block content %} - -
      - {% for folder in files.folder %} -
    • - {{ folder.name }} -
        - {% for file in folder.files %} -
      • {{file}}
      • - {% endfor %} -
      -
    • - {% endfor %} - - {% for file in files.files %} -
    • {{ file }}
    • - {% endfor %} - -
    - -{% endblock %} \ No newline at end of file diff --git a/pyload/webui/themes/Dark/tml/folder.html b/pyload/webui/themes/Dark/tml/folder.html deleted file mode 100644 index b57338d5e..000000000 --- a/pyload/webui/themes/Dark/tml/folder.html +++ /dev/null @@ -1,15 +0,0 @@ -
  • - - - - {{ name }} - - -    - -    - - - -
    {{ _("Folder is empty") }}
    -
  • \ No newline at end of file diff --git a/pyload/webui/themes/Dark/tml/home.html b/pyload/webui/themes/Dark/tml/home.html deleted file mode 100644 index 9131c640e..000000000 --- a/pyload/webui/themes/Dark/tml/home.html +++ /dev/null @@ -1,263 +0,0 @@ -{% extends '/Dark/tml/base.html' %} -{% block head %} - - - -{% endblock %} - -{% block subtitle %} -{{_("Active Downloads")}} -{% endblock %} - -{% block menu %} -
  • - {{_("Home")}} -
  • -
  • - {{_("Queue")}} -
  • -
  • - {{_("Collector")}} -
  • -
  • - {{_("Downloads")}} -
  • -
  • - {{_("Logs")}} -
  • -
  • - {{_("Config")}} -
  • -{% endblock %} - -{% block content %} - - - - - - - - - - - - - {% for link in content %} - - - - - - - - - - - {% endfor %} - - -
    {{_("Name")}}{{_("Status")}}{{_("Information")}}{{_("Size")}}{{_("Progress")}}
    -{% endblock %} \ No newline at end of file diff --git a/pyload/webui/themes/Dark/tml/info.html b/pyload/webui/themes/Dark/tml/info.html deleted file mode 100644 index 1c0a35e9f..000000000 --- a/pyload/webui/themes/Dark/tml/info.html +++ /dev/null @@ -1,76 +0,0 @@ -{% extends '/Dark/tml/base.html' %} - -{% block head %} -{% endblock %} - -{% block title %}{{ _("Information") }} - {{ super() }} {% endblock %} -{% block subtitle %}{{ _("Information") }}{% endblock %} - -{% block content %} -

    {{ _("News") }}

    - -
      - - - -

      {{ _("Support") }}

      - - - -

      {{ _("System") }}

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      {{ _("Python:") }}{{ python }}
      {{ _("OS:") }}{{ os }}
      {{ _("pyLoad version:") }}{{ version }}
      {{ _("Installation Folder:") }}{{ folder }}
      {{ _("Config Folder:") }}{{ config }}
      {{ _("Download Folder:") }}{{ download }}
      {{ _("Free Space:") }}{{ freespace }}
      {{ _("Language:") }}{{ language }}
      {{ _("Webinterface Port:") }}{{ webif }}
      {{ _("Remote Interface Port:") }}{{ remote }}
      - -{% endblock %} \ No newline at end of file diff --git a/pyload/webui/themes/Dark/tml/login.html b/pyload/webui/themes/Dark/tml/login.html deleted file mode 100644 index dcb3a18b8..000000000 --- a/pyload/webui/themes/Dark/tml/login.html +++ /dev/null @@ -1,37 +0,0 @@ -{% extends '/Dark/tml/base.html' %} - -{% block title %}{{_("Login")}} - {{super()}} {% endblock %} - -{% block content %} - -
      -
      -
      - -
      - Login -{% if errors %} -

      {{_("Your username and password didn't match. Please try again.")}}

      -{% endif %} - - - - - - - - - - - - - -
      {{_("Username")}}
      {{_("Password")}}
       
      -
      -
      -
      - -
      -
      - -{% endblock %} diff --git a/pyload/webui/themes/Dark/tml/logout.html b/pyload/webui/themes/Dark/tml/logout.html deleted file mode 100644 index 08adfcf6c..000000000 --- a/pyload/webui/themes/Dark/tml/logout.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends '/Dark/tml/base.html' %} - -{% block head %} - -{% endblock %} - -{% block content %} -

      {{_("You were successfully logged out.")}}

      -{% endblock %} \ No newline at end of file diff --git a/pyload/webui/themes/Dark/tml/logs.html b/pyload/webui/themes/Dark/tml/logs.html deleted file mode 100644 index e7fead2df..000000000 --- a/pyload/webui/themes/Dark/tml/logs.html +++ /dev/null @@ -1,41 +0,0 @@ -{% extends '/Dark/tml/base.html' %} - -{% block title %}{{_("Logs")}} - {{super()}} {% endblock %} -{% block subtitle %}{{_("Logs")}}{% endblock %} -{% block head %} - -{% endblock %} - -{% block content %} -
      - - -
      -
      - -   - - -
      -
      -
      {{warning}}
      -
      -
      - - {% for line in log %} - - {% endfor %} -
      {{line.line}}{{line.date}}{{line.level}}{{line.message}}
      -
      -
      -
      - - -
      -
      -
       
      -{% endblock %} \ No newline at end of file diff --git a/pyload/webui/themes/Dark/tml/pathchooser.html b/pyload/webui/themes/Dark/tml/pathchooser.html deleted file mode 100644 index 288af8bfa..000000000 --- a/pyload/webui/themes/Dark/tml/pathchooser.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - -
      -
      -
      - - -
      - - {% if type == 'folder' %} - {{_("Path")}}: {{_("absolute")}} | {{_("relative")}} - {% else %} - {{_("Path")}}: {{_("absolute")}} | {{_("relative")}} - {% endif %} -
      - - - - - - - - {% if parentdir %} - - - - {% endif %} -{% for file in files %} - - {% if type == 'folder' %} - - {% else %} - - {% endif %} - - - - - -{% endfor %} -
      {{_("name")}}{{_("size")}}{{_("type")}}{{_("last modified")}}
      - {{_("parent directory")}} -
      {% if file.type == 'dir' %}{{ file.name|truncate(25) }}{% else %}{{ file.name|truncate(25) }}{% endif %}{% if file.type == 'dir' %}{{ file.name|truncate(25) }}{% else %}{{ file.name|truncate(25) }}{% endif %}{{ file.size|float|filesizeformat }}{% if file.type == 'dir' %}directory{% else %}{{ file.ext|default("file") }}{% endif %}{{ file.modified|date("d.m.Y - H:i:s") }}
      -
      - - \ No newline at end of file diff --git a/pyload/webui/themes/Dark/tml/queue.html b/pyload/webui/themes/Dark/tml/queue.html deleted file mode 100644 index 1a61e2638..000000000 --- a/pyload/webui/themes/Dark/tml/queue.html +++ /dev/null @@ -1,104 +0,0 @@ -{% extends '/Dark/tml/base.html' %} -{% block head %} - - - - -{% endblock %} - -{% if target %} - {% set name = _("Queue") %} -{% else %} - {% set name = _("Collector") %} -{% endif %} - -{% block title %}{{name}} - {{super()}} {% endblock %} -{% block subtitle %}{{name}}{% endblock %} - -{% block pageactions %} - -{% endblock %} - -{% block content %} -{% autoescape true %} - -
        -{% for package in content %} -
      • -
        - - -
        - - {{package.name}} -    - - -    - -    - -    - - -
        - {% set progress = (package.linksdone * 100) / package.linkstotal %} - -
        -
        - - -
        -
        - - -
        -
      • -{% endfor %} -
      -{% endautoescape %} -{% endblock %} - -{% block hidden %} -
      -
      -

      {{_("Edit Package")}}

      -

      {{_("Edit the package detais below.")}}

      - - - - - - - - - - - - -
      - -
      - -
      -{% endblock %} \ No newline at end of file diff --git a/pyload/webui/themes/Dark/tml/settings.html b/pyload/webui/themes/Dark/tml/settings.html deleted file mode 100644 index cf0fe1745..000000000 --- a/pyload/webui/themes/Dark/tml/settings.html +++ /dev/null @@ -1,204 +0,0 @@ -{% extends '/Dark/tml/base.html' %} - -{% block title %}{{ _("Config") }} - {{ super() }} {% endblock %} -{% block subtitle %}{{ _("Config") }}{% endblock %} - -{% block head %} - - - - -{% endblock %} - -{% block content %} - - - -
      - -
      - - - - - - -
      - -
      -

         {{ _("Choose a section from the menu") }}

      -
      -
      - - -
      -
      - - - - - - -
      - - -
      -

         {{ _("Choose a section from the menu") }}

      -
      -
      - -
      - -
      - - - -
      - - - - - - - - - - - - - - - - - - - - {% for account in conf.accs %} - {% set plugin = account.type %} - - - - - - - - - - - - - - {% endfor %} -
      {{ _("Plugin") }}{{ _("Name") }}{{ _("Password") }}{{ _("Status") }}{{ _("Premium") }}{{ _("Valid until") }}{{ _("Traffic left") }}{{ _("Time") }}{{ _("Max Parallel") }}{{ _("Delete?") }}
      - {{ plugin }} - - - - {% if account.valid %} - - {{ _("valid") }} - {% else %} - - {{ _("not valid") }} - {% endif %} - - - {% if account.premium %} - - {{ _("yes") }} - {% else %} - - {{ _("no") }} - {% endif %} - - - - {{ account.validuntil }} - - - - {{ account.trafficleft }} - - - - - - - -
      - - - -
      -
      -
      -{% endblock %} -{% block hidden %} -
      -
      -

      {{_("Add Account")}}

      -

      {{_("Enter your account data to use premium features.")}}

      - - - - - - - - - - - -
      - -
      - -
      -{% endblock %} \ No newline at end of file diff --git a/pyload/webui/themes/Dark/tml/settings_item.html b/pyload/webui/themes/Dark/tml/settings_item.html deleted file mode 100644 index e417e564c..000000000 --- a/pyload/webui/themes/Dark/tml/settings_item.html +++ /dev/null @@ -1,48 +0,0 @@ - - {% if section.outline %} - - {% endif %} - {% for okey, option in section.iteritems() %} - {% if okey not in ("desc","outline") %} - - - - - {% endif %} - {% endfor %} -
      {{ section.outline }}
      - {% if option.type == "bool" %} - - {% elif ";" in option.type %} - - {% elif option.type == "folder" %} - - - {% elif option.type == "file" %} - - - {% elif option.type == "password" %} - - {% else %} - - {% endif %} -
      \ No newline at end of file diff --git a/pyload/webui/themes/Dark/tml/window.html b/pyload/webui/themes/Dark/tml/window.html deleted file mode 100644 index a518a7b95..000000000 --- a/pyload/webui/themes/Dark/tml/window.html +++ /dev/null @@ -1,52 +0,0 @@ - - -
      -
      -

      {{_("Add Package")}}

      -

      {{_("Paste your links or upload a container.")}}

      - - - - - - - - - - - - - - - - - - - - - - - -
      {{_("Queue")}}
      {{_("Collector")}}
      -
      - - - -
      - -
      - -
      \ No newline at end of file diff --git a/pyload/webui/themes/Default/css/MooDialog.css b/pyload/webui/themes/Default/css/MooDialog.css deleted file mode 100644 index 1e2ae68aa..000000000 --- a/pyload/webui/themes/Default/css/MooDialog.css +++ /dev/null @@ -1,91 +0,0 @@ -/* Created by Arian Stolwijk */ - -.MooDialog { -/* position: fixed;*/ - margin: 0 auto 0 -350px; - width:600px; - padding:14px; - left:50%; - top: 100px; - - position: absolute; - left: 50%; - z-index: 50000; - - background: #eef5f8; - color: black; - border-radius: 7px; - -moz-border-radius: 7px; - -webkit-border-radius: 7px; - border-radius: 7px; - -moz-box-shadow: 1px 1px 5px rgba(0,0,0,0.8); - -webkit-box-shadow: 1px 1px 5px rgba(0,0,0,0.8); - box-shadow: 1px 1px 5px rgba(0,0,0,0.8); -} - -.MooDialogTitle { - padding-top: 30px; -} - -.MooDialog .title { - position: absolute; - top: 0; - left: 0; - right: 0; - padding: 3px 20px; - background: #b7c4dc; - border-bottom: 1px solid #a1aec5; - font-weight: bold; - text-shadow: 1px 1px 0 #fff; - color: black; - border-radius: 7px; - -moz-border-radius: 7px; - -webkit-border-radius: 7px; -} - -.MooDialog .close { - background: url(../img/MooDialog/dialog-close.png) no-repeat; - width: 16px; - height: 16px; - display: block; - cursor: pointer; - top: -5px; - left: -5px; - position: absolute; -} - -.MooDialog .buttons { - text-align: right; - margin: 0; - padding: 0; - border: 0; - background: none; -} - -.MooDialog .iframe { - width: 100%; - height: 100%; -} - -.MooDialog .textInput { - width: 200px; - float: left; -} - -.MooDialog .MooDialogAlert, -.MooDialog .MooDialogConfirm, -.MooDialog .MooDialogPrompt, -.MooDialog .MooDialogError { - background: url(../img/MooDialog/dialog-warning.png) no-repeat; - padding-left: 40px; - min-height: 40px; -} - -.MooDialog .MooDialogConfirm, -.MooDialog .MooDialogPromt { - background: url(../img/MooDialog/dialog-question.png) no-repeat; -} - -.MooDialog .MooDialogError { - background: url(../img/MooDialog/dialog-error.png) no-repeat; -} diff --git a/pyload/webui/themes/Default/css/base.css b/pyload/webui/themes/Default/css/base.css deleted file mode 100644 index f5078bfbb..000000000 --- a/pyload/webui/themes/Default/css/base.css +++ /dev/null @@ -1,902 +0,0 @@ -.hidden { - display:none; -} -.leftalign { - text-align:left; -} -.centeralign { - text-align:center; -} -.rightalign { - text-align:right; -} - - -.dokuwiki div.plugin_translation ul li a.wikilink1:link, .dokuwiki div.plugin_translation ul li a.wikilink1:hover, .dokuwiki div.plugin_translation ul li a.wikilink1:active, .dokuwiki div.plugin_translation ul li a.wikilink1:visited { - background-color:#000080; - color:#fff !important; - text-decoration:none; - padding:0 0.2em; - margin:0.1em 0.2em; - border:none !important; -} -.dokuwiki div.plugin_translation ul li a.wikilink2:link, .dokuwiki div.plugin_translation ul li a.wikilink2:hover, .dokuwiki div.plugin_translation ul li a.wikilink2:active, .dokuwiki div.plugin_translation ul li a.wikilink2:visited { - background-color:#808080; - color:#fff !important; - text-decoration:none; - padding:0 0.2em; - margin:0.1em 0.2em; - border:none !important; -} - -.dokuwiki div.plugin_translation ul li a:hover img { - opacity:1.0; - height:15px; -} - -body { - margin:0; - padding:0; - background-color:white; - color:black; - font-size:12px; - font-family:Verdana, Helvetica, "Lucida Grande", Lucida, Arial, sans-serif; - font-family:sans-serif; - font-size:99, 96%; - font-size-adjust:none; - font-style:normal; - font-variant:normal; - font-weight:normal; - line-height:normal; -} -hr { - border-width:0; - border-bottom:1px #aaa dotted; -} -img { - border:none; -} -form { - margin:0px; - padding:0px; - border:none; - display:inline; - background:transparent; -} -ul li { - margin:5px; -} -textarea { - font-family:monospace; -} -table { - margin:0.5em 0; - border-collapse:collapse; -} -td { - padding:0.25em; - border:1pt solid #ADB9CC; -} -a { - color:#3465a4; - text-decoration:none; -} -a:hover { - text-decoration:underline; -} - -option { - border:0 none #fff; -} -strong.highlight { - background-color:#fc9; - padding:1pt; -} -#pagebottom { - clear:both; -} -hr { - height:1px; - color:#c0c0c0; - background-color:#c0c0c0; - border:none; - margin:.2em 0 .2em 0; -} - -.invisible { - margin:0px; - border:0px; - padding:0px; - height:0px; - visibility:hidden; -} -.left { - float:left !important; -} -.right { - float:right !important; -} -.center { - text-align:center; -} -div#body-wrapper { - padding:40px 40px 10px 40px; - font-size:127%; -} -div#content { - margin-top:-20px; - padding:0; - font-size:14px; - color:black; - line-height:1.5em; -} -h1, h2, h3, h4, h5, h6 { - background:transparent none repeat scroll 0 0; - border-bottom:1px solid #aaa; - color:black; - font-weight:normal; - margin:0; - padding:0; - padding-bottom:0.17em; - padding-top:0.5em; -} -h1 { - font-size:188%; - line-height:1.2em; - margin-bottom:0.1em; - padding-bottom:0; -} -h2 { - font-size:150%; -} -h3, h4, h5, h6 { - border-bottom:none; - font-weight:bold; -} -h3 { - font-size:132%; -} -h4 { - font-size:116%; -} -h5 { - font-size:100%; -} -h6 { - font-size:80%; -} -ul#page-actions, ul#page-actions-more { - float:right; - margin:10px 10px 0 10px; - padding:6px; - color:black; - background-color:#ececec; - list-style-type:none; - white-space: nowrap; - border-radius:5px; - -moz-border-radius:5px; -} -ul#user-actions { - padding:5px; - margin:0; - display:inline; - color:black; - background-color:#ececec; - list-style-type:none; - -moz-border-radius:3px; - border-radius:3px; -} -ul#page-actions li, ul#user-actions li, ul#page-actions-more li { - display:inline; -} -ul#page-actions a, ul#user-actions a, ul#page-actions-more a { - text-decoration:none; - color:black; - display:inline; - margin:0 3px; - padding:2px 0px 2px 18px; -} -ul#page-actions a:hover, ul#page-actions a:focus, ul#user-actions a:hover, ul#user-actions a:focus { - /*text-decoration:underline;*/ -} -/***************************/ -ul#page-actions2 { - float:left; - margin:10px 10px 0 10px; - padding:6px; - color:black; - background-color:#ececec; - list-style-type:none; - border-radius:5px; - -moz-border-radius:5px; -} -ul#user-actions2 { - padding:5px; - margin:0; - display:inline; - color:black; - background-color:#ececec; - list-style-type:none; - border-radius:3px; - -moz-border-radius:3px; -} -ul#page-actions2 li, ul#user-actions2 li { - display:inline; -} -ul#page-actions2 a, ul#user-actions2 a { - text-decoration:none; - color:black; - display:inline; - margin:0 3px; - padding:2px 0px 2px 18px; -} -ul#page-actions2 a:hover, ul#page-actions2 a:focus, ul#user-actions2 a:hover, ul#user-actions2 a:focus, -ul#page-actions-more a:hover, ul#page-actions-more a:focus{ - color: #4e7bb4; -} -/****************************/ -.hidden { - display:none; -} - -a.logout { - background:transparent url(../img/user-actions-logout.png) 0px 1px no-repeat; -} - -a.info { - background:transparent url(../img/user-info.png) 0px 1px no-repeat; -} - -a.admin { - background:transparent url(../img/user-actions-admin.png) 0px 1px no-repeat; -} -a.profile { - background:transparent url(../img/user-actions-profile.png) 0px 1px no-repeat; -} -a.create, a.edit { - background:transparent url(../img/page-tools-edit.png) 0px 1px no-repeat; -} -a.source, a.show { - background:transparent url(../img/page-tools-source.png) 0px 1px no-repeat; -} -a.revisions { - background:transparent url(../img/page-tools-revisions.png) 0px 1px no-repeat; -} -a.subscribe, a.unsubscribe { - background:transparent url(../img/page-tools-subscribe.png) 0px 1px no-repeat; -} -a.backlink { - background:transparent url(../img/page-tools-backlinks.png) 0px 1px no-repeat; -} -a.play { - background:transparent url(../img/control_play.png) 0px 1px no-repeat; -} -.time { - background:transparent url(../img/status_None.png) 0px 1px no-repeat; - padding: 2px 0px 2px 18px; - margin: 0px 3px; -} -.reconnect { - background:transparent url(../img/reconnect.png) 0px 1px no-repeat; - padding: 2px 0px 2px 18px; - margin: 0px 3px; -} -a.play:hover { - background:transparent url(../img/control_play_blue.png) 0px 1px no-repeat; -} -a.cancel { - background:transparent url(../img/control_cancel.png) 0px 1px no-repeat; -} -a.cancel:hover { - background:transparent url(../img/control_cancel_blue.png) 0px 1px no-repeat; -} -a.pause { - background:transparent url(../img/control_pause.png) 0px 1px no-repeat; -} -a.pause:hover { - background:transparent url(../img/control_pause_blue.png) 0px 1px no-repeat; - font-weight: bold; -} -a.stop { - background:transparent url(../img/control_stop.png) 0px 1px no-repeat; -} -a.stop:hover { - background:transparent url(../img/control_stop_blue.png) 0px 1px no-repeat; -} -a.add { - background:transparent url(../img/control_add.png) 0px 1px no-repeat; -} -a.add:hover { - background:transparent url(../img/control_add_blue.png) 0px 1px no-repeat; -} -a.cog { - background:transparent url(../img/cog.png) 0px 1px no-repeat; -} -#head-panel { - background:#525252 url(../img/head_bg1.png) bottom left repeat-x; -} -#head-panel h1 { - display:none; - margin:0; - text-decoration:none; - padding-top:0.8em; - padding-left:3.3em; - font-size:2.6em; - color:#eeeeec; -} -#head-panel #head-logo { - float:left; - margin:5px 0 -15px 5px; - padding:0; - overflow:visible; -} -#head-menu { - background:transparent url(../img/tabs-border-bottom.png) 0 100% repeat-x; - width:100%; - float:left; - margin:0; - padding:0; - padding-top:0.8em; -} -#head-menu ul { - list-style:none; - margin:0 1em 0 2em; -} -#head-menu ul li { - float:left; - margin:0; - margin-left:0.3em; - font-size:14px; - margin-bottom:4px; -} -#head-menu ul li.selected, #head-menu ul li:hover { - margin-bottom:0px; -} -#head-menu ul li a img { - height:22px; - width:22px; - vertical-align:middle; -} -#head-menu ul li a, #head-menu ul li a:link { - float:left; - text-decoration:none; - color:#555; - background:#eaeaea url(../img/tab-background.png) 0 100% repeat-x; - padding:3px 7px 3px 7px; - border:2px solid #ccc; - border-bottom:0px solid transparent; - padding-bottom:3px; - -moz-border-radius:5px; - border-radius:5px; -} -#head-menu ul li a:hover, #head-menu ul li a:focus { - color:#111; - padding-bottom:7px; - border-bottom:0px none transparent; - outline:none; - border-bottom-left-radius: 0px; - border-bottom-right-radius: 0px; - -moz-border-radius-bottomright:0px; - -moz-border-radius-bottomleft:0px; -} -#head-menu ul li a:focus { - margin-bottom:-4px; -} -#head-menu ul li.selected a { - color:#3566A5; - background:#fff; - padding-bottom:7px; - border-bottom:0px none transparent; - border-bottom-left-radius: 0px; - border-bottom-right-radius: 0px; - -moz-border-radius-bottomright:0px; - -moz-border-radius-bottomleft:0px; -} -#head-menu ul li.selected a:hover, #head-menu ul li.selected a:focus { - color:#111; -} -div#head-search-and-login { - float:right; - margin:0 1em 0 0; - background-color:#222; - padding:7px 7px 5px 5px; - color:white; - white-space: nowrap; - border-bottom-left-radius: 6px; - border-bottom-right-radius: 6px; - -moz-border-radius-bottomright:6px; - -moz-border-radius-bottomleft:6px; -} -div#head-search-and-login form { - display:inline; - padding:0 3px; -} -div#head-search-and-login form input { - border:2px solid #888; - background:#eee; - font-size:14px; - padding:2px; - border-radius:3px; - -moz-border-radius:3px; -} -div#head-search-and-login form input:focus { - background:#fff; -} -#head-search { - font-size:14px; -} -#head-username, #head-password { - width:80px; - font-size:14px; -} -#pageinfo { - clear:both; - color:#888; - padding:0.6em 0; - margin:0; -} -#foot { - font-style:normal; - color:#888; - text-align:center; -} -#foot a { - color:#aaf; -} -#foot img { - vertical-align:middle; -} -div.toc { - border:1px dotted #888; - background:#f0f0f0; - margin:1em 0 1em 1em; - float:right; - font-size:95%; -} -div.toc .tocheader { - font-weight:bold; - margin:0.5em 1em; -} -div.toc ol { - margin:1em 0.5em 1em 1em; - padding:0; -} -div.toc ol li { - margin:0; - padding:0; - margin-left:1em; -} -div.toc ol ol { - margin:0.5em 0.5em 0.5em 1em; - padding:0; -} -div.recentchanges table { - clear:both; -} -div#editor-help { - font-size:90%; - border:1px dotted #888; - padding:0ex 1ex 1ex 1ex; - background:#f7f6f2; -} -div#preview { - margin-top:1em; -} -label.block { - display:block; - text-align:right; - font-weight:bold; -} -label.simple { - display:block; - text-align:left; - font-weight:normal; -} -label.block input.edit { - width:50%; -} -/*fieldset { - width:300px; - text-align:center; - padding:0.5em; - margin:auto; -} -*/ -div.editor { - margin:0 0 0 0; -} -table { - margin:0.5em 0; - border-collapse:collapse; -} -td { - padding:0.25em; - border:1pt solid #ADB9CC; -} -td p { - margin:0; - padding:0; -} -.u { - text-decoration:underline; -} -.footnotes ul { - padding:0 2em; - margin:0 0 1em; -} -.footnotes li { - list-style:none; -} -.userpref table, .userpref td { - border:none; -} -#message { - clear:both; - padding:5px 10px; - background-color:#eee; - border-bottom:2px solid #ccc; -} -#message p { - margin:5px 0; - padding:0; - font-weight:bold; -} -#message div.buttons { - font-weight:normal; -} -.diff { - width:99%; -} -.diff-title { - background-color:#C0C0C0; -} -.searchresult dd span { - font-weight:bold; -} -.boxtext { - font-family:tahoma, arial, sans-serif; - font-size:11px; - color:#000; - float:none; - padding:3px 0 0 10px; -} -.statusbutton { - width:32px; - height:32px; - float:left; - margin-left:-32px; - margin-right:5px; - opacity:0; - cursor:pointer -} -.dlsize { - float:left; - padding-right: 8px; -} -.dlspeed { - float:left; - padding-right: 8px; -} -.package { - margin-bottom: 10px; -} -.packagename { - font-weight: bold; -} - -.child { - margin-left: 20px; -} -.child_status { - margin-right: 10px; -} -.child_secrow { - font-size: 10px; -} - -.header, .header th { - text-align: left; - font-weight: normal; - background-color:#ececec; - -moz-border-radius:5px; - border-radius:5px; -} -.progress_bar { - background: #0C0; - height: 5px; - -} - -.queue { - border: none -} - -.queue tr td { - border: none -} - -.header, .header th{ - text-align: left; - font-weight: normal; -} - - -.clearer -{ - clear: both; - height: 1px; -} - -.left -{ - float: left; -} - -.right -{ - float: right; -} - - -.setfield -{ - display: table-cell; -} - -ul.tabs li a -{ - padding: 5px 16px 4px 15px; - border: none; - font-weight: bold; - - border-radius: 5px 5px 0 0; - -moz-border-radius: 5px 5px 0 0; - -} - - -#tabs span -{ - display: none; -} - -#tabs span.selected -{ - display: inline; -} - -#tabsback -{ - background-color: #525252; - margin: 2px 0 0; - padding: 6px 4px 1px 4px; - - border-top-right-radius: 30px; - border-top-left-radius: 3px; - -moz-border-radius-topright: 30px; - -moz-border-radius-topleft: 3px; -} -ul.tabs -{ - list-style-type: none; - margin:0; - padding: 0 40px 0 0; -} - -ul.tabs li -{ - display: inline; - margin-left: 8px; -} - - -ul.tabs li a -{ - color: #42454a; - background-color: #eaeaea; - border: 1px none #c9c3ba; - margin: 0; - text-decoration: none; - - outline: 0; - - padding: 5px 16px 4px 15px; - font-weight: bold; - - border-radius: 5px 5px 0 0; - -moz-border-radius: 5px 5px 0 0; - -} - -ul.tabs li a.selected, ul.tabs li a:hover -{ - color: #000; - background-color: white; - - border-bottom-right-radius: 0; - border-bottom-left-radius: 0; - -moz-border-radius-bottomright: 0; - -moz-border-radius-bottomleft: 0; -} - -ul.tabs li a:hover -{ - background-color: #f1f4ee; -} - -ul.tabs li a.selected -{ - font-weight: bold; - background-color: #525252; - padding-bottom: 5px; - color: white; -} - - -#tabs-body { - position: relative; - overflow: hidden; -} - - -span.tabContent -{ - border: 2px solid #525252; - margin: 0; - padding: 0; - padding-bottom: 10px; -} - -#tabs-body > span { - display: none; -} - -#tabs-body > span.active { - display: block; -} - -.hide -{ - display: none; -} - -.settable -{ - margin: 20px; - border: none; -} -.settable td -{ - border: none; - margin: 0; - padding: 5px; -} - -.settable th{ - padding-bottom: 8px; -} - -.settable.wide td , .settable.wide th { - padding-left: 15px; - padding-right: 15px; -} - - -/*settings navbar*/ -ul.nav { - margin: -30px 0 0; - padding: 0; - list-style: none; - position: absolute; -} - - -ul.nav li { - position: relative; - float: left; - padding: 5px; -} - -ul.nav > li a { - background: white; - -moz-border-radius: 4px 4px 4px 4px; - border: 1px solid #C9C3BA; - border-bottom: medium none; - color: black; -} - -ul.nav ul { - position: absolute; - top: 26px; - left: 10px; - margin: 0; - padding: 0; - list-style: none; - border: 1px solid #AAA; - background: #f1f1f1; - -webkit-box-shadow: 1px 1px 5px #AAA; - -moz-box-shadow: 1px 1px 5px #AAA; - box-shadow: 1px 1px 5px #AAA; - cursor: pointer; -} - -ul.nav .open { - display: block; -} - -ul.nav .close { - display: none; -} - -ul.nav ul li { - float: none; - padding: 0; -} - -ul.nav ul li a { - width: 130px; - background: #f1f1f1; - padding: 3px; - display: block; - font-weight: normal; -} - -ul.nav ul li a:hover { - background: #CDCDCD; -} - -ul.nav ul ul { - left: 137px; - top: 0; -} - -.purr-wrapper{ - margin:10px; -} - -/*Purr alert styles*/ - -.purr-alert{ - margin-bottom:10px; - padding:10px; - background:#000; - font-size:13px; - font-weight:bold; - color:#FFF; - -moz-border-radius:5px; - -webkit-border-radius:5px; - /*-moz-box-shadow: 0 0 10px rgba(255,255,0,.25);*/ - width:300px; -} -.purr-alert.error{ - color:#F55; - padding-left:30px; - background:url(../img/error.png) no-repeat #000 7px 10px; - width:280px; -} -.purr-alert.success{ - color:#5F5; - padding-left:30px; - background:url(../img/success.png) no-repeat #000 7px 10px; - width:280px; -} -.purr-alert.notice{ - color:#99F; - padding-left:30px; - background:url(../img/notice.png) no-repeat #000 7px 10px; - width:280px; -} - -table.system { - border: none; - margin-left: 10px; -} - -table.system td { - border: none -} - -table.system tr > td:first-child { - font-weight: bold; - padding-right: 10px; -} diff --git a/pyload/webui/themes/Default/css/log.css b/pyload/webui/themes/Default/css/log.css deleted file mode 100644 index 33e67397d..000000000 --- a/pyload/webui/themes/Default/css/log.css +++ /dev/null @@ -1,71 +0,0 @@ - -html, body, #content -{ - height: 100%; -} -#body-wrapper -{ - height: 70%; -} -.logdiv -{ - height: 90%; - width: 100%; - overflow: auto; - border: 2px solid #CCC; - outline: 1px solid #666; - background-color: #FFE; - margin-right: auto; - margin-left: auto; -} -.logform -{ - display: table; - margin: 0 auto 0 auto; - padding-top: 5px; -} -.logtable -{ - - margin: 0px; -} -.logtable td -{ - border: none; - white-space: nowrap; - - font-family: monospace; - font-size: 16px; - margin: 0px; - padding: 0px 10px 0px 10px; - line-height: 110%; -} -td.logline -{ - background-color: #EEE; - text-align:right; - padding: 0px 5px 0px 5px; -} -td.loglevel -{ - text-align:right; -} -.logperpage -{ - float: right; - padding-bottom: 8px; -} -.logpaginator -{ - float: left; - padding-top: 5px; -} -.logpaginator a -{ - padding: 0px 8px 0px 8px; -} -.logwarn -{ - text-align: center; - color: red; -} diff --git a/pyload/webui/themes/Default/css/pathchooser.css b/pyload/webui/themes/Default/css/pathchooser.css deleted file mode 100644 index 204812aa1..000000000 --- a/pyload/webui/themes/Default/css/pathchooser.css +++ /dev/null @@ -1,68 +0,0 @@ -table { - width: 90%; - border: 1px dotted #888888; - font-family: sans-serif; - font-size: 10pt; -} - -th { - background-color: #525252; - color: #E0E0E0; -} - -table, tr, td { - background-color: #F0F0F0; -} - -a, a:visited { - text-decoration: none; - font-weight: bold; -} - -#paths { - width: 90%; - text-align: left; -} - -.file_directory { - color: #c0c0c0; -} -.path_directory { - color: #3c3c3c; -} -.file_file { - color: #3c3c3c; -} -.path_file { - color: #c0c0c0; -} - -.parentdir { - color: #000000; - font-size: 10pt; -} -.name { - text-align: left; -} -.size { - text-align: right; -} -.type { - text-align: left; -} -.mtime { - text-align: center; -} - -.path_abs_rel { - color: #3c3c3c; - text-decoration: none; - font-weight: bold; - font-family: sans-serif; - font-size: 10pt; -} - -.path_abs_rel a { - color: #3c3c3c; - font-style: italic; -} diff --git a/pyload/webui/themes/Default/css/window.css b/pyload/webui/themes/Default/css/window.css deleted file mode 100644 index b469b4259..000000000 --- a/pyload/webui/themes/Default/css/window.css +++ /dev/null @@ -1,73 +0,0 @@ -/* ----------- stylized ----------- */ -.window_box h1{ - font-size:14px; - font-weight:bold; - margin-bottom:8px; -} -.window_box p{ - font-size:11px; - color:#666666; - margin-bottom:20px; - border-bottom:solid 1px #b7ddf2; - padding-bottom:10px; -} -.window_box label{ - display:block; - font-weight:bold; - text-align:right; - width:240px; - float:left; -} -.window_box .small{ - color:#666666; - display:block; - font-size:11px; - font-weight:normal; - text-align:right; - width:240px; -} -.window_box select, .window_box input{ - float:left; - font-size:12px; - padding:4px 2px; - border:solid 1px #aacfe4; - width:300px; - margin:2px 0 20px 10px; -} -.window_box .cont{ - float:left; - font-size:12px; - padding: 0px 10px 15px 0px; - width:300px; - margin:0px 0px 0px 10px; -} -.window_box .cont input{ - float: none; - margin: 0px 15px 0px 1px; -} -.window_box textarea{ - float:left; - font-size:12px; - padding:4px 2px; - border:solid 1px #aacfe4; - width:300px; - margin:2px 0 20px 10px; -} -.window_box button, .styled_button{ - clear:both; - margin-left:150px; - width:125px; - height:31px; - background:#666666 url(../img/button.png) no-repeat; - text-align:center; - line-height:31px; - color:#FFFFFF; - font-size:11px; - font-weight:bold; - border: 0px; -} - -.styled_button { - margin-left: 15px; - cursor: pointer; -} diff --git a/pyload/webui/themes/Default/img/MooDialog/dialog-close.png b/pyload/webui/themes/Default/img/MooDialog/dialog-close.png deleted file mode 100644 index 81ebb88b2..000000000 Binary files a/pyload/webui/themes/Default/img/MooDialog/dialog-close.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/MooDialog/dialog-error.png b/pyload/webui/themes/Default/img/MooDialog/dialog-error.png deleted file mode 100644 index d70328403..000000000 Binary files a/pyload/webui/themes/Default/img/MooDialog/dialog-error.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/MooDialog/dialog-question.png b/pyload/webui/themes/Default/img/MooDialog/dialog-question.png deleted file mode 100644 index b0af3db5b..000000000 Binary files a/pyload/webui/themes/Default/img/MooDialog/dialog-question.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/MooDialog/dialog-warning.png b/pyload/webui/themes/Default/img/MooDialog/dialog-warning.png deleted file mode 100644 index aad64d4be..000000000 Binary files a/pyload/webui/themes/Default/img/MooDialog/dialog-warning.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/add_folder.png b/pyload/webui/themes/Default/img/add_folder.png deleted file mode 100644 index 8acbc411b..000000000 Binary files a/pyload/webui/themes/Default/img/add_folder.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/ajax-loader.gif b/pyload/webui/themes/Default/img/ajax-loader.gif deleted file mode 100644 index 2fd8e0737..000000000 Binary files a/pyload/webui/themes/Default/img/ajax-loader.gif and /dev/null differ diff --git a/pyload/webui/themes/Default/img/arrow_refresh.png b/pyload/webui/themes/Default/img/arrow_refresh.png deleted file mode 100644 index 0de26566d..000000000 Binary files a/pyload/webui/themes/Default/img/arrow_refresh.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/arrow_right.png b/pyload/webui/themes/Default/img/arrow_right.png deleted file mode 100644 index b1a181923..000000000 Binary files a/pyload/webui/themes/Default/img/arrow_right.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/big_button.gif b/pyload/webui/themes/Default/img/big_button.gif deleted file mode 100644 index 7680490ea..000000000 Binary files a/pyload/webui/themes/Default/img/big_button.gif and /dev/null differ diff --git a/pyload/webui/themes/Default/img/big_button_over.gif b/pyload/webui/themes/Default/img/big_button_over.gif deleted file mode 100644 index 2e3ee10d2..000000000 Binary files a/pyload/webui/themes/Default/img/big_button_over.gif and /dev/null differ diff --git a/pyload/webui/themes/Default/img/body.png b/pyload/webui/themes/Default/img/body.png deleted file mode 100644 index 7ff1043e0..000000000 Binary files a/pyload/webui/themes/Default/img/body.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/button.png b/pyload/webui/themes/Default/img/button.png deleted file mode 100644 index 890160614..000000000 Binary files a/pyload/webui/themes/Default/img/button.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/closebtn.gif b/pyload/webui/themes/Default/img/closebtn.gif deleted file mode 100644 index 3e27e6030..000000000 Binary files a/pyload/webui/themes/Default/img/closebtn.gif and /dev/null differ diff --git a/pyload/webui/themes/Default/img/cog.png b/pyload/webui/themes/Default/img/cog.png deleted file mode 100644 index 67de2c6cc..000000000 Binary files a/pyload/webui/themes/Default/img/cog.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/control_add.png b/pyload/webui/themes/Default/img/control_add.png deleted file mode 100644 index d39886893..000000000 Binary files a/pyload/webui/themes/Default/img/control_add.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/control_add_blue.png b/pyload/webui/themes/Default/img/control_add_blue.png deleted file mode 100644 index d11b7f41d..000000000 Binary files a/pyload/webui/themes/Default/img/control_add_blue.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/control_cancel.png b/pyload/webui/themes/Default/img/control_cancel.png deleted file mode 100644 index 7b9bc3fba..000000000 Binary files a/pyload/webui/themes/Default/img/control_cancel.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/control_cancel_blue.png b/pyload/webui/themes/Default/img/control_cancel_blue.png deleted file mode 100644 index 0c5c96ce3..000000000 Binary files a/pyload/webui/themes/Default/img/control_cancel_blue.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/control_pause.png b/pyload/webui/themes/Default/img/control_pause.png deleted file mode 100644 index 2d9ce9c4e..000000000 Binary files a/pyload/webui/themes/Default/img/control_pause.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/control_pause_blue.png b/pyload/webui/themes/Default/img/control_pause_blue.png deleted file mode 100644 index ec61099b0..000000000 Binary files a/pyload/webui/themes/Default/img/control_pause_blue.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/control_play.png b/pyload/webui/themes/Default/img/control_play.png deleted file mode 100644 index 0846555d0..000000000 Binary files a/pyload/webui/themes/Default/img/control_play.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/control_play_blue.png b/pyload/webui/themes/Default/img/control_play_blue.png deleted file mode 100644 index f8c8ec683..000000000 Binary files a/pyload/webui/themes/Default/img/control_play_blue.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/control_stop.png b/pyload/webui/themes/Default/img/control_stop.png deleted file mode 100644 index 893bb60e5..000000000 Binary files a/pyload/webui/themes/Default/img/control_stop.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/control_stop_blue.png b/pyload/webui/themes/Default/img/control_stop_blue.png deleted file mode 100644 index e6f75d232..000000000 Binary files a/pyload/webui/themes/Default/img/control_stop_blue.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/delete.png b/pyload/webui/themes/Default/img/delete.png deleted file mode 100644 index 08f249365..000000000 Binary files a/pyload/webui/themes/Default/img/delete.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/drag_corner.gif b/pyload/webui/themes/Default/img/drag_corner.gif deleted file mode 100644 index befb1adf1..000000000 Binary files a/pyload/webui/themes/Default/img/drag_corner.gif and /dev/null differ diff --git a/pyload/webui/themes/Default/img/error.png b/pyload/webui/themes/Default/img/error.png deleted file mode 100644 index c37bd062e..000000000 Binary files a/pyload/webui/themes/Default/img/error.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/folder.png b/pyload/webui/themes/Default/img/folder.png deleted file mode 100644 index 784e8fa48..000000000 Binary files a/pyload/webui/themes/Default/img/folder.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/full.png b/pyload/webui/themes/Default/img/full.png deleted file mode 100644 index fea52af76..000000000 Binary files a/pyload/webui/themes/Default/img/full.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/head-login.png b/pyload/webui/themes/Default/img/head-login.png deleted file mode 100644 index b59b7cbbf..000000000 Binary files a/pyload/webui/themes/Default/img/head-login.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/head-menu-collector.png b/pyload/webui/themes/Default/img/head-menu-collector.png deleted file mode 100644 index 861be40bc..000000000 Binary files a/pyload/webui/themes/Default/img/head-menu-collector.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/head-menu-config.png b/pyload/webui/themes/Default/img/head-menu-config.png deleted file mode 100644 index bbf43d4f3..000000000 Binary files a/pyload/webui/themes/Default/img/head-menu-config.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/head-menu-development.png b/pyload/webui/themes/Default/img/head-menu-development.png deleted file mode 100644 index fad150fe1..000000000 Binary files a/pyload/webui/themes/Default/img/head-menu-development.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/head-menu-download.png b/pyload/webui/themes/Default/img/head-menu-download.png deleted file mode 100644 index 98c5da9db..000000000 Binary files a/pyload/webui/themes/Default/img/head-menu-download.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/head-menu-home.png b/pyload/webui/themes/Default/img/head-menu-home.png deleted file mode 100644 index 9d62109aa..000000000 Binary files a/pyload/webui/themes/Default/img/head-menu-home.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/head-menu-index.png b/pyload/webui/themes/Default/img/head-menu-index.png deleted file mode 100644 index 44d631064..000000000 Binary files a/pyload/webui/themes/Default/img/head-menu-index.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/head-menu-news.png b/pyload/webui/themes/Default/img/head-menu-news.png deleted file mode 100644 index 43950ebc9..000000000 Binary files a/pyload/webui/themes/Default/img/head-menu-news.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/head-menu-queue.png b/pyload/webui/themes/Default/img/head-menu-queue.png deleted file mode 100644 index be98793ce..000000000 Binary files a/pyload/webui/themes/Default/img/head-menu-queue.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/head-menu-recent.png b/pyload/webui/themes/Default/img/head-menu-recent.png deleted file mode 100644 index fc9b0497f..000000000 Binary files a/pyload/webui/themes/Default/img/head-menu-recent.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/head-menu-wiki.png b/pyload/webui/themes/Default/img/head-menu-wiki.png deleted file mode 100644 index 07cf0102d..000000000 Binary files a/pyload/webui/themes/Default/img/head-menu-wiki.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/head-search-noshadow.png b/pyload/webui/themes/Default/img/head-search-noshadow.png deleted file mode 100644 index aafdae015..000000000 Binary files a/pyload/webui/themes/Default/img/head-search-noshadow.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/head_bg1.png b/pyload/webui/themes/Default/img/head_bg1.png deleted file mode 100644 index f2848c3cc..000000000 Binary files a/pyload/webui/themes/Default/img/head_bg1.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/images.png b/pyload/webui/themes/Default/img/images.png deleted file mode 100644 index 184860d1e..000000000 Binary files a/pyload/webui/themes/Default/img/images.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/notice.png b/pyload/webui/themes/Default/img/notice.png deleted file mode 100644 index 12cd1aef9..000000000 Binary files a/pyload/webui/themes/Default/img/notice.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/package_go.png b/pyload/webui/themes/Default/img/package_go.png deleted file mode 100644 index aace63ad6..000000000 Binary files a/pyload/webui/themes/Default/img/package_go.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/page-tools-backlinks.png b/pyload/webui/themes/Default/img/page-tools-backlinks.png deleted file mode 100644 index 3eb6a9ce3..000000000 Binary files a/pyload/webui/themes/Default/img/page-tools-backlinks.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/page-tools-edit.png b/pyload/webui/themes/Default/img/page-tools-edit.png deleted file mode 100644 index 188e1c12b..000000000 Binary files a/pyload/webui/themes/Default/img/page-tools-edit.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/page-tools-revisions.png b/pyload/webui/themes/Default/img/page-tools-revisions.png deleted file mode 100644 index 5c3b8587f..000000000 Binary files a/pyload/webui/themes/Default/img/page-tools-revisions.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/parseUri.png b/pyload/webui/themes/Default/img/parseUri.png deleted file mode 100644 index 937bded9d..000000000 Binary files a/pyload/webui/themes/Default/img/parseUri.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/pencil.png b/pyload/webui/themes/Default/img/pencil.png deleted file mode 100644 index 0bfecd50e..000000000 Binary files a/pyload/webui/themes/Default/img/pencil.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/pyload-logo.png b/pyload/webui/themes/Default/img/pyload-logo.png deleted file mode 100644 index 2443cd8b1..000000000 Binary files a/pyload/webui/themes/Default/img/pyload-logo.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/reconnect.png b/pyload/webui/themes/Default/img/reconnect.png deleted file mode 100644 index 49b269145..000000000 Binary files a/pyload/webui/themes/Default/img/reconnect.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/status_None.png b/pyload/webui/themes/Default/img/status_None.png deleted file mode 100644 index 293b13f77..000000000 Binary files a/pyload/webui/themes/Default/img/status_None.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/status_downloading.png b/pyload/webui/themes/Default/img/status_downloading.png deleted file mode 100644 index fb4ebc850..000000000 Binary files a/pyload/webui/themes/Default/img/status_downloading.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/status_failed.png b/pyload/webui/themes/Default/img/status_failed.png deleted file mode 100644 index c37bd062e..000000000 Binary files a/pyload/webui/themes/Default/img/status_failed.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/status_finished.png b/pyload/webui/themes/Default/img/status_finished.png deleted file mode 100644 index 89c8129a4..000000000 Binary files a/pyload/webui/themes/Default/img/status_finished.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/status_offline.png b/pyload/webui/themes/Default/img/status_offline.png deleted file mode 100644 index 0cfd58596..000000000 Binary files a/pyload/webui/themes/Default/img/status_offline.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/status_proc.png b/pyload/webui/themes/Default/img/status_proc.png deleted file mode 100644 index 67de2c6cc..000000000 Binary files a/pyload/webui/themes/Default/img/status_proc.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/status_queue.png b/pyload/webui/themes/Default/img/status_queue.png deleted file mode 100644 index 293b13f77..000000000 Binary files a/pyload/webui/themes/Default/img/status_queue.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/status_waiting.png b/pyload/webui/themes/Default/img/status_waiting.png deleted file mode 100644 index 2842cc338..000000000 Binary files a/pyload/webui/themes/Default/img/status_waiting.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/success.png b/pyload/webui/themes/Default/img/success.png deleted file mode 100644 index 89c8129a4..000000000 Binary files a/pyload/webui/themes/Default/img/success.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/tab-background.png b/pyload/webui/themes/Default/img/tab-background.png deleted file mode 100644 index 29a5d1991..000000000 Binary files a/pyload/webui/themes/Default/img/tab-background.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/tabs-border-bottom.png b/pyload/webui/themes/Default/img/tabs-border-bottom.png deleted file mode 100644 index 02440f428..000000000 Binary files a/pyload/webui/themes/Default/img/tabs-border-bottom.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/user-actions-logout.png b/pyload/webui/themes/Default/img/user-actions-logout.png deleted file mode 100644 index 0010931e2..000000000 Binary files a/pyload/webui/themes/Default/img/user-actions-logout.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/user-actions-profile.png b/pyload/webui/themes/Default/img/user-actions-profile.png deleted file mode 100644 index 46573fff6..000000000 Binary files a/pyload/webui/themes/Default/img/user-actions-profile.png and /dev/null differ diff --git a/pyload/webui/themes/Default/img/user-info.png b/pyload/webui/themes/Default/img/user-info.png deleted file mode 100644 index 6e643100f..000000000 Binary files a/pyload/webui/themes/Default/img/user-info.png and /dev/null differ diff --git a/pyload/webui/themes/Default/js/render/admin.coffee b/pyload/webui/themes/Default/js/render/admin.coffee deleted file mode 100644 index 5afbcbb66..000000000 --- a/pyload/webui/themes/Default/js/render/admin.coffee +++ /dev/null @@ -1,58 +0,0 @@ -root = this - -window.addEvent "domready", -> - - root.passwordDialog = new MooDialog {destroyOnHide: false} - root.passwordDialog.setContent $ 'password_box' - - $("login_password_reset").addEvent "click", (e) -> root.passwordDialog.close() - $("login_password_button").addEvent "click", (e) -> - - newpw = $("login_new_password").get("value") - newpw2 = $("login_new_password2").get("value") - - if newpw is newpw2 - form = $("password_form") - form.set "send", { - onSuccess: (data) -> - root.notify.alert "Success", { - 'className': 'success' - } - onFailure: (data) -> - root.notify.alert "Error", { - 'className': 'error' - } - } - - form.send() - - root.passwordDialog.close() - else - alert '{{_("Passwords did not match.")}}' - - e.stop() - - for item in $$(".change_password") - id = item.get("id") - user = id.split("|")[1] - $("user_login").set("value", user) - item.addEvent "click", (e) -> root.passwordDialog.open() - - $('quit-pyload').addEvent "click", (e) -> - new MooDialog.Confirm "{{_('You are really sure you want to quit pyLoad?')}}", -> - new Request.JSON({ - url: '/api/kill' - method: 'get' - }).send() - , -> - e.stop() - - $('restart-pyload').addEvent "click", (e) -> - new MooDialog.Confirm "{{_('Are you sure you want to restart pyLoad?')}}", -> - new Request.JSON({ - url: '/api/restart' - method: 'get' - onSuccess: (data) -> alert "{{_('pyLoad restarted')}}" - }).send() - , -> - e.stop() diff --git a/pyload/webui/themes/Default/js/render/admin.min.js b/pyload/webui/themes/Default/js/render/admin.min.js deleted file mode 100644 index 94a5e494d..000000000 --- a/pyload/webui/themes/Default/js/render/admin.min.js +++ /dev/null @@ -1,3 +0,0 @@ -{% autoescape true %} -var root;root=this;window.addEvent("domready",function(){var f,c,b,e,a,d;root.passwordDialog=new MooDialog({destroyOnHide:false});root.passwordDialog.setContent($("password_box"));$("login_password_reset").addEvent("click",function(g){return root.passwordDialog.close()});$("login_password_button").addEvent("click",function(j){var h,i,g;i=$("login_new_password").get("value");g=$("login_new_password2").get("value");if(i===g){h=$("password_form");h.set("send",{onSuccess:function(k){return root.notify.alert("Success",{className:"success"})},onFailure:function(k){return root.notify.alert("Error",{className:"error"})}});h.send();root.passwordDialog.close()}else{alert('{{_("Passwords did not match.")}}')}return j.stop()});d=$$(".change_password");for(e=0,a=d.length;e - filesizename = new Array("B", "KiB", "MiB", "GiB", "TiB", "PiB") - loga = Math.log(size) / Math.log(1024) - i = Math.floor(loga) - a = Math.pow(1024, i) - if size is 0 then "0 B" else (Math.round(size * 100 / a) / 100 + " " + filesizename[i]) - - -parseUri = () -> - oldString = $("add_links").value - regxp = new RegExp('(ht|f)tp(s?):\/\/[a-zA-Z0-9\-\.\/\?=_&%#]+[<| |\"|\'|\r|\n|\t]{1}', 'g') - resu = oldString.match regxp - return if resu == null - res = "" - - for part in resu - if part.indexOf(" ") != -1 - res = res + part.replace(" ", " \n") - else if part.indexOf("\t") != -1 - res = res + part.replace("\t", " \n") - else if part.indexOf("\r") != -1 - res = res + part.replace("\r", " \n") - else if part.indexOf("\"") != -1 - res = res + part.replace("\"", " \n") - else if part.indexOf("<") != -1 - res = res + part.replace("<", " \n") - else if part.indexOf("'") != -1 - res = res + part.replace("'", " \n") - else - res = res + part.replace("\n", " \n") - - $("add_links").value = res - - -Array::remove = (from, to) -> - rest = this.slice((to || from) + 1 || this.length) - this.length = from < 0 ? this.length + from : from - return [] if this.length == 0 - return this.push.apply(this, rest) - - -document.addEvent "domready", -> - - # global notification - root.notify = new Purr { - 'mode': 'top' - 'position': 'center' - } - - root.captchaBox = new MooDialog {destroyOnHide: false} - root.captchaBox.setContent $ 'cap_box' - - root.addBox = new MooDialog {destroyOnHide: false} - root.addBox.setContent $ 'add_box' - - $('add_form').onsubmit = -> - $('add_form').target = 'upload_target' - if $('add_name').value is "" and $('add_file').value is "" - alert '{{_("Please Enter a packagename.")}}' - return false - else - root.addBox.close() - return true - - $('add_reset').addEvent 'click', -> root.addBox.close() - - $('action_add').addEvent 'click', -> $("add_form").reset(); root.addBox.open() - $('action_play').addEvent 'click', -> new Request({method: 'get', url: '/api/unpauseServer'}).send() - $('action_cancel').addEvent 'click', -> new Request({method: 'get', url: '/api/stopAllDownloads'}).send() - $('action_stop').addEvent 'click', -> new Request({method: 'get', url: '/api/pauseServer'}).send() - - - # captcha events - - $('cap_info').addEvent 'click', -> - load_captcha "get", "" - root.captchaBox.open() - $('cap_reset').addEvent 'click', -> root.captchaBox.close() - $('cap_form').addEvent 'submit', (e) -> - submit_captcha() - e.stop() - - $('cap_positional').addEvent 'click', on_captcha_click - - new Request.JSON({ - url: "/json/status" - onSuccess: LoadJsonToContent - secure: false - async: true - initialDelay: 0 - delay: 4000 - limit: 3000 - }).startTimer() - - -LoadJsonToContent = (data) -> - $("speed").set 'text', humanFileSize(data.speed)+"/s" - $("aktiv").set 'text', data.active - $("aktiv_from").set 'text', data.queue - $("aktiv_total").set 'text', data.total - - if data.captcha - if $("cap_info").getStyle("display") != "inline" - $("cap_info").setStyle 'display', 'inline' - root.notify.alert '{{_("New Captcha Request")}}', { - 'className': 'notify' - } - else - $("cap_info").setStyle 'display', 'none' - - - if data.download - $("time").set 'text', ' {{_("on")}}' - $("time").setStyle 'background-color', "#8ffc25" - else - $("time").set 'text', ' {{_("off")}}' - $("time").setStyle 'background-color', "#fc6e26" - - if data.reconnect - $("reconnect").set 'text', ' {{_("on")}}' - $("reconnect").setStyle 'background-color', "#8ffc25" - else - $("reconnect").set 'text', ' {{_("off")}}' - $("reconnect").setStyle 'background-color', "#fc6e26" - - return null - - -set_captcha = (data) -> - $('cap_id').set 'value', data.id - if (data.result_type is 'textual') - $('cap_textual_img').set 'src', data.src - $('cap_title').set 'text', '{{_("Please read the text on the captcha.")}}' - $('cap_submit').setStyle 'display', 'inline' - $('cap_textual').setStyle 'display', 'block' - $('cap_positional').setStyle 'display', 'none' - - else if (data.result_type == 'positional') - $('cap_positional_img').set('src', data.src) - $('cap_title').set('text', '{{_("Please click on the right captcha position.")}}') - $('cap_submit').setStyle('display', 'none') - $('cap_textual').setStyle('display', 'none') - - -load_captcha = (method, post) -> - new Request.JSON({ - url: "/json/set_captcha" - onSuccess: (data) -> set_captcha(data) if data.captcha else clear_captcha() - secure: false - async: true - method: method - }).send(post) - - -clear_captcha = -> - $('cap_textual').setStyle 'display', 'none' - $('cap_textual_img').set 'src', '' - $('cap_positional').setStyle 'display', 'none' - $('cap_positional_img').set 'src', '' - $('cap_title').set 'text', '{{_("No Captchas to read.")}}' - - -submit_captcha = -> - load_captcha("post", "cap_id=" + $('cap_id').get('value') + "&cap_result=" + $('cap_result').get('value') ) - $('cap_result').set('value', '') - - -on_captcha_click = (e) -> - position = e.target.getPosition() - x = e.page.x - position.x - y = e.page.y - position.y - $('cap_result').value = x + "," + y - submit_captcha() diff --git a/pyload/webui/themes/Default/js/render/base.min.js b/pyload/webui/themes/Default/js/render/base.min.js deleted file mode 100644 index 1ba1d73f9..000000000 --- a/pyload/webui/themes/Default/js/render/base.min.js +++ /dev/null @@ -1,3 +0,0 @@ -{% autoescape true %} -var LoadJsonToContent,clear_captcha,humanFileSize,load_captcha,on_captcha_click,parseUri,root,set_captcha,submit_captcha;root=this;humanFileSize=function(f){var c,d,e,b;d=new Array("B","KiB","MiB","GiB","TiB","PiB");b=Math.log(f)/Math.log(1024);e=Math.floor(b);c=Math.pow(1024,e);if(f===0){return"0 B"}else{return Math.round(f*100/c)/100+" "+d[e]}};parseUri=function(){var b,c,g,e,d,f,a;b=$("add_links").value;g=new RegExp("(ht|f)tp(s?)://[a-zA-Z0-9-./?=_&%#]+[<| |\"|'|\r|\n|\t]{1}","g");d=b.match(g);if(d===null){return}e="";for(f=0,a=d.length;f 0) { - window.location.reload() - } else { - this.packages.each(function(pack) { - pack.close(); - }); - indicateSuccess(); - } - }.bind(this), - onFailure: indicateFail - }).send(); - }, - - restartFailed: function() { - indicateLoad(); - new Request.JSON({ - method: 'get', - url: '/api/restartFailed', - onSuccess: function(data) { - this.packages.each(function(pack) { - pack.close(); - }); - indicateSuccess(); - }.bind(this), - onFailure: indicateFail - }).send(); - }, - - startSort: function(ele, copy) { - }, - - saveSort: function(ele, copy) { - var order = []; - this.sorts.serialize(function(li, pos) { - if (li == ele && ele.retrieve("order") != pos) { - order.push(ele.retrieve("pid") + "|" + pos) - } - li.store("order", pos) - }); - if (order.length > 0) { - indicateLoad(); - new Request.JSON({ - method: 'get', - url: '/json/package_order/' + order[0], - onSuccess: indicateFinish, - onFailure: indicateFail - }).send(); - } - } - -}); - -var Package = new Class({ - initialize: function(ui, id, ele, data) { - this.ui = ui; - this.id = id; - this.linksLoaded = false; - - if (!ele) { - this.createElement(data); - } else { - this.ele = ele; - this.order = ele.getElements("div.order")[0].get("html"); - this.ele.store("order", this.order); - this.ele.store("pid", this.id); - this.parseElement(); - } - - var pname = this.ele.getElements(".packagename")[0]; - this.buttons = new Fx.Tween(this.ele.getElements(".buttons")[0], {link: "cancel"}); - this.buttons.set("opacity", 0); - - pname.addEvent("mouseenter", function(e) { - this.buttons.start("opacity", 1) - }.bind(this)); - - pname.addEvent("mouseleave", function(e) { - this.buttons.start("opacity", 0) - }.bind(this)); - - - }, - - createElement: function() { - alert("create") - }, - - parseElement: function() { - var imgs = this.ele.getElements('img'); - - this.name = this.ele.getElements('.name')[0]; - this.folder = this.ele.getElements('.folder')[0]; - this.password = this.ele.getElements('.password')[0]; - - imgs[1].addEvent('click', this.deletePackage.bind(this)); - imgs[2].addEvent('click', this.restartPackage.bind(this)); - imgs[3].addEvent('click', this.editPackage.bind(this)); - imgs[4].addEvent('click', this.movePackage.bind(this)); - - this.ele.getElement('.packagename').addEvent('click', this.toggle.bind(this)); - - }, - - loadLinks: function() { - indicateLoad(); - new Request.JSON({ - method: 'get', - url: '/json/package/' + this.id, - onSuccess: this.createLinks.bind(this), - onFailure: indicateFail - }).send(); - }, - - createLinks: function(data) { - var ul = $("sort_children_{id}".substitute({'id': this.id})); - ul.set("html", ""); - data.links.each(function(link) { - link.id = link.fid; - var li = new Element("li", { - 'style': { - 'margin-left': 0 - } - }); - - var html = "\n".substitute({'icon': link.icon}); - html += "{name}
      ".substitute({'url': link.url, 'name': link.name}); - html += "{statusmsg}{error} ".substitute({'statusmsg': link.statusmsg, 'error':link.error}); - html += "{format_size}".substitute({'format_size': link.format_size}); - html += "{plugin}  ".substitute({'plugin': link.plugin}); - html += "  "; - html += "
      "; - - var div = new Element("div", { - 'id': "file_" + link.id, - 'class': "child", - 'html': html - }); - - li.store("order", link.order); - li.store("lid", link.id); - - li.adopt(div); - ul.adopt(li); - }); - this.sorts = new Sortables(ul, { - constrain: false, - clone: true, - revert: true, - opacity: 0.4, - handle: ".sorthandle", - onComplete: this.saveSort.bind(this) - }); - this.registerLinkEvents(); - this.linksLoaded = true; - indicateFinish(); - this.toggle(); - }, - - registerLinkEvents: function() { - this.ele.getElements('.child').each(function(child) { - var lid = child.get('id').match(/[0-9]+/); - var imgs = child.getElements('.child_secrow img'); - imgs[0].addEvent('click', function(e) { - new Request({ - method: 'get', - url: '/api/deleteFiles/[' + this + "]", - onSuccess: function() { - $('file_' + this).nix() - }.bind(this), - onFailure: indicateFail - }).send(); - }.bind(lid)); - - imgs[1].addEvent('click', function(e) { - new Request({ - method: 'get', - url: '/api/restartFile/' + this, - onSuccess: function() { - var ele = $('file_' + this); - var imgs = ele.getElements("img"); - imgs[0].set("src", "../img/status_queue.png"); - var spans = ele.getElements(".child_status"); - spans[1].set("html", "queued"); - indicateSuccess(); - }.bind(this), - onFailure: indicateFail - }).send(); - }.bind(lid)); - }); - }, - - toggle: function() { - var child = this.ele.getElement('.children'); - if (child.getStyle('display') == "block") { - child.dissolve(); - } else { - if (!this.linksLoaded) { - this.loadLinks(); - } else { - child.reveal(); - } - } - }, - - - deletePackage: function(event) { - indicateLoad(); - new Request({ - method: 'get', - url: '/api/deletePackages/[' + this.id + "]", - onSuccess: function() { - this.ele.nix(); - indicateFinish(); - }.bind(this), - onFailure: indicateFail - }).send(); - //hide_pack(); - event.stop(); - }, - - restartPackage: function(event) { - indicateLoad(); - new Request({ - method: 'get', - url: '/api/restartPackage/' + this.id, - onSuccess: function() { - this.close(); - indicateSuccess(); - }.bind(this), - onFailure: indicateFail - }).send(); - event.stop(); - }, - - close: function() { - var child = this.ele.getElement('.children'); - if (child.getStyle('display') == "block") { - child.dissolve(); - } - var ul = $("sort_children_{id}".substitute({'id': this.id})); - ul.erase("html"); - this.linksLoaded = false; - }, - - movePackage: function(event) { - indicateLoad(); - new Request({ - method: 'get', - url: '/json/move_package/' + ((this.ui.type + 1) % 2) + "/" + this.id, - onSuccess: function() { - this.ele.nix(); - indicateFinish(); - }.bind(this), - onFailure: indicateFail - }).send(); - event.stop(); - }, - - editPackage: function(event) { - $("pack_form").removeEvents("submit"); - $("pack_form").addEvent("submit", this.savePackage.bind(this)); - - $("pack_id").set("value", this.id); - $("pack_name").set("value", this.name.get("text")); - $("pack_folder").set("value", this.folder.get("text")); - $("pack_pws").set("value", this.password.get("text")); - - root.packageBox.open(); - event.stop(); - }, - - savePackage: function(event) { - $("pack_form").send(); - this.name.set("text", $("pack_name").get("value")); - this.folder.set("text", $("pack_folder").get("value")); - this.password.set("text", $("pack_pws").get("value")); - root.packageBox.close(); - event.stop(); - }, - - saveSort: function(ele, copy) { - var order = []; - this.sorts.serialize(function(li, pos) { - if (li == ele && ele.retrieve("order") != pos) { - order.push(ele.retrieve("lid") + "|" + pos) - } - li.store("order", pos) - }); - if (order.length > 0) { - indicateLoad(); - new Request.JSON({ - method: 'get', - url: '/json/link_order/' + order[0], - onSuccess: indicateFinish, - onFailure: indicateFail - }).send(); - } - } - -}); diff --git a/pyload/webui/themes/Default/js/render/settings.coffee b/pyload/webui/themes/Default/js/render/settings.coffee deleted file mode 100644 index d522741b9..000000000 --- a/pyload/webui/themes/Default/js/render/settings.coffee +++ /dev/null @@ -1,107 +0,0 @@ -root = this - -window.addEvent 'domready', -> - root.accountDialog = new MooDialog {destroyOnHide: false} - root.accountDialog.setContent $ 'account_box' - - new TinyTab $$('#toptabs li a'), $$('#tabs-body > span') - - $$('ul.nav').each (nav) -> - new MooDropMenu nav, { - onOpen: (el) -> el.fade 'in' - onClose: (el) -> el.fade 'out' - onInitialize: (el) -> el.fade('hide').set 'tween', {duration:500} - } - - new SettingsUI() - - -class SettingsUI - constructor: -> - @menu = $$ "#general-menu li" - @menu.append $$ "#plugin-menu li" - - @name = $ "tabsback" - @general = $ "general_form_content" - @plugin = $ "plugin_form_content" - - el.addEvent 'click', @menuClick.bind(this) for el in @menu - - $("general|submit").addEvent "click", @configSubmit.bind(this) - $("plugin|submit").addEvent "click", @configSubmit.bind(this) - - $("account_add").addEvent "click", (e) -> - root.accountDialog.open() - e.stop() - - $("account_reset").addEvent "click", (e) -> - root.accountDialog.close() - - $("account_add_button").addEvent "click", @addAccount.bind(this) - $("account_submit").addEvent "click", @submitAccounts.bind(this) - - - menuClick: (e) -> - [category, section] = e.target.get("id").split("|") - name = e.target.get "text" - - - target = if category is "general" then @general else @plugin - target.dissolve() - - new Request({ - "method" : "get" - "url" : "/json/load_config/#{category}/#{section}" - 'onSuccess': (data) => - target.set "html", data - target.reveal() - this.name.set "text", name - }).send() - - - configSubmit: (e) -> - category = e.target.get("id").split("|")[0] - form = $("#{category}_form") - - form.set "send", { - 'method': "post" - 'url': "/json/save_config/#{category}" - "onSuccess" : -> - root.notify.alert '{{ _("Settings saved.")}}', { - 'className': 'success' - } - 'onFailure': -> - root.notify.alert '{{ _("Error occured.")}}', { - 'className': 'error' - } - } - form.send() - e.stop() - - addAccount: (e) -> - form = $ "add_account_form" - form.set "send", { - 'method': "post" - "onSuccess" : -> window.location.reload() - 'onFailure': -> - root.notify.alert '{{_("Error occured.")}}', { - 'className': 'error' - } - } - - form.send() - e.stop() - - submitAccounts: (e) -> - form = $ "account_form" - form.set "send", { - 'method': "post", - "onSuccess" : -> window.location.reload() - 'onFailure': -> - root.notify.alert('{{ _("Error occured.") }}', { - 'className': 'error' - }) - } - - form.send() - e.stop() diff --git a/pyload/webui/themes/Default/js/render/settings.min.js b/pyload/webui/themes/Default/js/render/settings.min.js deleted file mode 100644 index 41d1cb25a..000000000 --- a/pyload/webui/themes/Default/js/render/settings.min.js +++ /dev/null @@ -1,3 +0,0 @@ -{% autoescape true %} -var SettingsUI,root;var __bind=function(a,b){return function(){return a.apply(b,arguments)}};root=this;window.addEvent("domready",function(){root.accountDialog=new MooDialog({destroyOnHide:false});root.accountDialog.setContent($("account_box"));new TinyTab($$("#toptabs li a"),$$("#tabs-body > span"));$$("ul.nav").each(function(a){return new MooDropMenu(a,{onOpen:function(b){return b.fade("in")},onClose:function(b){return b.fade("out")},onInitialize:function(b){return b.fade("hide").set("tween",{duration:500})}})});return new SettingsUI()});SettingsUI=(function(){function a(){var c,e,b,d;this.menu=$$("#general-menu li");this.menu.append($$("#plugin-menu li"));this.name=$("tabsback");this.general=$("general_form_content");this.plugin=$("plugin_form_content");d=this.menu;for(e=0,b=d.length;e*/// IE 6 scroll - if ((options.scroll && Browser.ie6) || options.forceScroll){ - wrapper.setStyle('position', 'absolute'); - var position = wrapper.getPosition(options.inject); - window.addEvent('scroll', function(){ - var scroll = document.getScroll(); - wrapper.setPosition({ - x: position.x + scroll.x, - y: position.y + scroll.y - }); - }); - } - /**/ - - if (options.useEscKey){ - // Add event for the esc key - document.addEvent('keydown', function(e){ - if (e.key == 'esc') this.close(); - }.bind(this)); - } - - this.addEvent('hide', function(){ - if (options.destroyOnHide) this.destroy(); - }.bind(this)); - - this.fireEvent('initialize', wrapper); - }, - - setContent: function(){ - var content = Array.from(arguments); - if (content.length == 1) content = content[0]; - - this.content.empty(); - - var type = typeOf(content); - if (['string', 'number'].contains(type)) this.content.set('text', content); - else this.content.adopt(content); - - this.fireEvent('contentChange', this.content); - - return this; - }, - - open: function(){ - this.fireEvent('beforeOpen', this.wrapper).fireEvent('open'); - this.opened = true; - return this; - }, - - close: function(){ - this.fireEvent('beforeClose', this.wrapper).fireEvent('close'); - this.opened = false; - return this; - }, - - destroy: function(){ - this.wrapper.destroy(); - }, - - toElement: function(){ - return this.wrapper; - } - -}); - - -Element.implement({ - - MooDialog: function(options){ - this.store('MooDialog', - new MooDialog(options).setContent(this).open() - ); - return this; - } - -}); diff --git a/pyload/webui/themes/Default/js/static/MooDialog.min.js b/pyload/webui/themes/Default/js/static/MooDialog.min.js deleted file mode 100644 index 90b3ae100..000000000 --- a/pyload/webui/themes/Default/js/static/MooDialog.min.js +++ /dev/null @@ -1 +0,0 @@ -var MooDialog=new Class({Implements:[Options,Events],options:{"class":"MooDialog",title:null,scroll:!0,forceScroll:!1,useEscKey:!0,destroyOnHide:!0,autoOpen:!0,closeButton:!0,onInitialize:function(){this.wrapper.setStyle("display","none")},onBeforeOpen:function(){this.wrapper.setStyle("display","block"),this.fireEvent("show")},onBeforeClose:function(){this.wrapper.setStyle("display","none"),this.fireEvent("hide")}},initialize:function(t){this.setOptions(t),this.options.inject=this.options.inject||document.body,t=this.options;var e=this.wrapper=new Element("div."+t["class"].replace(" ",".")).inject(t.inject);if(this.content=new Element("div.content").inject(e),t.title&&(this.title=new Element("div.title").set("text",t.title).inject(e),e.addClass("MooDialogTitle")),t.closeButton&&(this.closeButton=new Element("a.close",{events:{click:this.close.bind(this)}}).inject(e)),t.scroll&&Browser.ie6||t.forceScroll){e.setStyle("position","absolute");var n=e.getPosition(t.inject);window.addEvent("scroll",function(){var t=document.getScroll();e.setPosition({x:n.x+t.x,y:n.y+t.y})})}t.useEscKey&&document.addEvent("keydown",function(t){"esc"==t.key&&this.close()}.bind(this)),this.addEvent("hide",function(){t.destroyOnHide&&this.destroy()}.bind(this)),this.fireEvent("initialize",e)},setContent:function(){var t=Array.from(arguments);1==t.length&&(t=t[0]),this.content.empty();var e=typeOf(t);return["string","number"].contains(e)?this.content.set("text",t):this.content.adopt(t),this.fireEvent("contentChange",this.content),this},open:function(){return this.fireEvent("beforeOpen",this.wrapper).fireEvent("open"),this.opened=!0,this},close:function(){return this.fireEvent("beforeClose",this.wrapper).fireEvent("close"),this.opened=!1,this},destroy:function(){this.wrapper.destroy()},toElement:function(){return this.wrapper}});Element.implement({MooDialog:function(t){return this.store("MooDialog",new MooDialog(t).setContent(this).open()),this}}); \ No newline at end of file diff --git a/pyload/webui/themes/Default/js/static/MooDropMenu.js b/pyload/webui/themes/Default/js/static/MooDropMenu.js deleted file mode 100644 index ac0fa1874..000000000 --- a/pyload/webui/themes/Default/js/static/MooDropMenu.js +++ /dev/null @@ -1,86 +0,0 @@ -/* ---- -description: This provides a simple Drop Down menu with infinit levels - -license: MIT-style - -authors: -- Arian Stolwijk - -requires: - - Core/Class.Extras - - Core/Element.Event - - Core/Selectors - -provides: [MooDropMenu, Element.MooDropMenu] - -... -*/ - -var MooDropMenu = new Class({ - - Implements: [Options, Events], - - options: { - onOpen: function(el){ - el.removeClass('close').addClass('open'); - }, - onClose: function(el){ - el.removeClass('open').addClass('close'); - }, - onInitialize: function(el){ - el.removeClass('open').addClass('close'); - }, - mouseoutDelay: 200, - mouseoverDelay: 0, - listSelector: 'ul', - itemSelector: 'li', - openEvent: 'mouseenter', - closeEvent: 'mouseleave' - }, - - initialize: function(menu, options, level){ - this.setOptions(options); - options = this.options; - - var menu = this.menu = document.id(menu); - - menu.getElements(options.itemSelector + ' > ' + options.listSelector).each(function(el){ - - this.fireEvent('initialize', el); - - var parent = el.getParent(options.itemSelector), - timer; - - parent.addEvent(options.openEvent, function(){ - parent.store('DropDownOpen', true); - - clearTimeout(timer); - if (options.mouseoverDelay) timer = this.fireEvent.delay(options.mouseoverDelay, this, ['open', el]); - else this.fireEvent('open', el); - - }.bind(this)).addEvent(options.closeEvent, function(){ - parent.store('DropDownOpen', false); - - clearTimeout(timer); - timer = (function(){ - if (!parent.retrieve('DropDownOpen')) this.fireEvent('close', el); - }).delay(options.mouseoutDelay, this); - - }.bind(this)); - - }, this); - }, - - toElement: function(){ - return this.menu - } - -}); - -/* So you can do like this $('nav').MooDropMenu(); or even $('nav').MooDropMenu().setStyle('border',1); */ -Element.implement({ - MooDropMenu: function(options){ - return this.store('MooDropMenu', new MooDropMenu(this, options)); - } -}); diff --git a/pyload/webui/themes/Default/js/static/MooDropMenu.min.js b/pyload/webui/themes/Default/js/static/MooDropMenu.min.js deleted file mode 100644 index 552ae247a..000000000 --- a/pyload/webui/themes/Default/js/static/MooDropMenu.min.js +++ /dev/null @@ -1 +0,0 @@ -var MooDropMenu=new Class({Implements:[Options,Events],options:{onOpen:function(e){e.removeClass("close").addClass("open")},onClose:function(e){e.removeClass("open").addClass("close")},onInitialize:function(e){e.removeClass("open").addClass("close")},mouseoutDelay:200,mouseoverDelay:0,listSelector:"ul",itemSelector:"li",openEvent:"mouseenter",closeEvent:"mouseleave"},initialize:function(e,o){this.setOptions(o),o=this.options;var e=this.menu=document.id(e);e.getElements(o.itemSelector+" > "+o.listSelector).each(function(e){this.fireEvent("initialize",e);var n,t=e.getParent(o.itemSelector);t.addEvent(o.openEvent,function(){t.store("DropDownOpen",!0),clearTimeout(n),o.mouseoverDelay?n=this.fireEvent.delay(o.mouseoverDelay,this,["open",e]):this.fireEvent("open",e)}.bind(this)).addEvent(o.closeEvent,function(){t.store("DropDownOpen",!1),clearTimeout(n),n=function(){t.retrieve("DropDownOpen")||this.fireEvent("close",e)}.delay(o.mouseoutDelay,this)}.bind(this))},this)},toElement:function(){return this.menu}});Element.implement({MooDropMenu:function(e){return this.store("MooDropMenu",new MooDropMenu(this,e))}}); \ No newline at end of file diff --git a/pyload/webui/themes/Default/js/static/mootools-core.js b/pyload/webui/themes/Default/js/static/mootools-core.js deleted file mode 100644 index db83850fd..000000000 --- a/pyload/webui/themes/Default/js/static/mootools-core.js +++ /dev/null @@ -1,5977 +0,0 @@ -/* ---- -MooTools: the javascript framework - -web build: - - http://mootools.net/core/8423c12ffd6a6bfcde9ea22554aec795 - -packager build: - - packager build Core/Core Core/Array Core/String Core/Number Core/Function Core/Object Core/Event Core/Browser Core/Class Core/Class.Extras Core/Slick.Parser Core/Slick.Finder Core/Element Core/Element.Style Core/Element.Event Core/Element.Delegation Core/Element.Dimensions Core/Fx Core/Fx.CSS Core/Fx.Tween Core/Fx.Morph Core/Fx.Transitions Core/Request Core/Request.HTML Core/Request.JSON Core/Cookie Core/JSON Core/DOMReady - -... -*/ - -/* ---- - -name: Core - -description: The heart of MooTools. - -license: MIT-style license. - -copyright: Copyright (c) 2006-2014 [Valerio Proietti](http://mad4milk.net/). - -authors: The MooTools production team (http://mootools.net/developers/) - -inspiration: - - Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php) - - Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php) - -provides: [Core, MooTools, Type, typeOf, instanceOf, Native] - -... -*/ - -(function(){ - -this.MooTools = { - version: '1.5.0', - build: '0f7b690afee9349b15909f33016a25d2e4d9f4e3' -}; - -// typeOf, instanceOf - -var typeOf = this.typeOf = function(item){ - if (item == null) return 'null'; - if (item.$family != null) return item.$family(); - - if (item.nodeName){ - if (item.nodeType == 1) return 'element'; - if (item.nodeType == 3) return (/\S/).test(item.nodeValue) ? 'textnode' : 'whitespace'; - } else if (typeof item.length == 'number'){ - if ('callee' in item) return 'arguments'; - if ('item' in item) return 'collection'; - } - - return typeof item; -}; - -var instanceOf = this.instanceOf = function(item, object){ - if (item == null) return false; - var constructor = item.$constructor || item.constructor; - while (constructor){ - if (constructor === object) return true; - constructor = constructor.parent; - } - /**/ - if (!item.hasOwnProperty) return false; - /**/ - return item instanceof object; -}; - -// Function overloading - -var Function = this.Function; - -var enumerables = true; -for (var i in {toString: 1}) enumerables = null; -if (enumerables) enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'constructor']; - -Function.prototype.overloadSetter = function(usePlural){ - var self = this; - return function(a, b){ - if (a == null) return this; - if (usePlural || typeof a != 'string'){ - for (var k in a) self.call(this, k, a[k]); - if (enumerables) for (var i = enumerables.length; i--;){ - k = enumerables[i]; - if (a.hasOwnProperty(k)) self.call(this, k, a[k]); - } - } else { - self.call(this, a, b); - } - return this; - }; -}; - -Function.prototype.overloadGetter = function(usePlural){ - var self = this; - return function(a){ - var args, result; - if (typeof a != 'string') args = a; - else if (arguments.length > 1) args = arguments; - else if (usePlural) args = [a]; - if (args){ - result = {}; - for (var i = 0; i < args.length; i++) result[args[i]] = self.call(this, args[i]); - } else { - result = self.call(this, a); - } - return result; - }; -}; - -Function.prototype.extend = function(key, value){ - this[key] = value; -}.overloadSetter(); - -Function.prototype.implement = function(key, value){ - this.prototype[key] = value; -}.overloadSetter(); - -// From - -var slice = Array.prototype.slice; - -Function.from = function(item){ - return (typeOf(item) == 'function') ? item : function(){ - return item; - }; -}; - -Array.from = function(item){ - if (item == null) return []; - return (Type.isEnumerable(item) && typeof item != 'string') ? (typeOf(item) == 'array') ? item : slice.call(item) : [item]; -}; - -Number.from = function(item){ - var number = parseFloat(item); - return isFinite(number) ? number : null; -}; - -String.from = function(item){ - return item + ''; -}; - -// hide, protect - -Function.implement({ - - hide: function(){ - this.$hidden = true; - return this; - }, - - protect: function(){ - this.$protected = true; - return this; - } - -}); - -// Type - -var Type = this.Type = function(name, object){ - if (name){ - var lower = name.toLowerCase(); - var typeCheck = function(item){ - return (typeOf(item) == lower); - }; - - Type['is' + name] = typeCheck; - if (object != null){ - object.prototype.$family = (function(){ - return lower; - }).hide(); - - } - } - - if (object == null) return null; - - object.extend(this); - object.$constructor = Type; - object.prototype.$constructor = object; - - return object; -}; - -var toString = Object.prototype.toString; - -Type.isEnumerable = function(item){ - return (item != null && typeof item.length == 'number' && toString.call(item) != '[object Function]' ); -}; - -var hooks = {}; - -var hooksOf = function(object){ - var type = typeOf(object.prototype); - return hooks[type] || (hooks[type] = []); -}; - -var implement = function(name, method){ - if (method && method.$hidden) return; - - var hooks = hooksOf(this); - - for (var i = 0; i < hooks.length; i++){ - var hook = hooks[i]; - if (typeOf(hook) == 'type') implement.call(hook, name, method); - else hook.call(this, name, method); - } - - var previous = this.prototype[name]; - if (previous == null || !previous.$protected) this.prototype[name] = method; - - if (this[name] == null && typeOf(method) == 'function') extend.call(this, name, function(item){ - return method.apply(item, slice.call(arguments, 1)); - }); -}; - -var extend = function(name, method){ - if (method && method.$hidden) return; - var previous = this[name]; - if (previous == null || !previous.$protected) this[name] = method; -}; - -Type.implement({ - - implement: implement.overloadSetter(), - - extend: extend.overloadSetter(), - - alias: function(name, existing){ - implement.call(this, name, this.prototype[existing]); - }.overloadSetter(), - - mirror: function(hook){ - hooksOf(this).push(hook); - return this; - } - -}); - -new Type('Type', Type); - -// Default Types - -var force = function(name, object, methods){ - var isType = (object != Object), - prototype = object.prototype; - - if (isType) object = new Type(name, object); - - for (var i = 0, l = methods.length; i < l; i++){ - var key = methods[i], - generic = object[key], - proto = prototype[key]; - - if (generic) generic.protect(); - if (isType && proto) object.implement(key, proto.protect()); - } - - if (isType){ - var methodsEnumerable = prototype.propertyIsEnumerable(methods[0]); - object.forEachMethod = function(fn){ - if (!methodsEnumerable) for (var i = 0, l = methods.length; i < l; i++){ - fn.call(prototype, prototype[methods[i]], methods[i]); - } - for (var key in prototype) fn.call(prototype, prototype[key], key); - }; - } - - return force; -}; - -force('String', String, [ - 'charAt', 'charCodeAt', 'concat', 'contains', 'indexOf', 'lastIndexOf', 'match', 'quote', 'replace', 'search', - 'slice', 'split', 'substr', 'substring', 'trim', 'toLowerCase', 'toUpperCase' -])('Array', Array, [ - 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice', - 'indexOf', 'lastIndexOf', 'filter', 'forEach', 'every', 'map', 'some', 'reduce', 'reduceRight' -])('Number', Number, [ - 'toExponential', 'toFixed', 'toLocaleString', 'toPrecision' -])('Function', Function, [ - 'apply', 'call', 'bind' -])('RegExp', RegExp, [ - 'exec', 'test' -])('Object', Object, [ - 'create', 'defineProperty', 'defineProperties', 'keys', - 'getPrototypeOf', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', - 'preventExtensions', 'isExtensible', 'seal', 'isSealed', 'freeze', 'isFrozen' -])('Date', Date, ['now']); - -Object.extend = extend.overloadSetter(); - -Date.extend('now', function(){ - return +(new Date); -}); - -new Type('Boolean', Boolean); - -// fixes NaN returning as Number - -Number.prototype.$family = function(){ - return isFinite(this) ? 'number' : 'null'; -}.hide(); - -// Number.random - -Number.extend('random', function(min, max){ - return Math.floor(Math.random() * (max - min + 1) + min); -}); - -// forEach, each - -var hasOwnProperty = Object.prototype.hasOwnProperty; -Object.extend('forEach', function(object, fn, bind){ - for (var key in object){ - if (hasOwnProperty.call(object, key)) fn.call(bind, object[key], key, object); - } -}); - -Object.each = Object.forEach; - -Array.implement({ - - /**/ - forEach: function(fn, bind){ - for (var i = 0, l = this.length; i < l; i++){ - if (i in this) fn.call(bind, this[i], i, this); - } - }, - /**/ - - each: function(fn, bind){ - Array.forEach(this, fn, bind); - return this; - } - -}); - -// Array & Object cloning, Object merging and appending - -var cloneOf = function(item){ - switch (typeOf(item)){ - case 'array': return item.clone(); - case 'object': return Object.clone(item); - default: return item; - } -}; - -Array.implement('clone', function(){ - var i = this.length, clone = new Array(i); - while (i--) clone[i] = cloneOf(this[i]); - return clone; -}); - -var mergeOne = function(source, key, current){ - switch (typeOf(current)){ - case 'object': - if (typeOf(source[key]) == 'object') Object.merge(source[key], current); - else source[key] = Object.clone(current); - break; - case 'array': source[key] = current.clone(); break; - default: source[key] = current; - } - return source; -}; - -Object.extend({ - - merge: function(source, k, v){ - if (typeOf(k) == 'string') return mergeOne(source, k, v); - for (var i = 1, l = arguments.length; i < l; i++){ - var object = arguments[i]; - for (var key in object) mergeOne(source, key, object[key]); - } - return source; - }, - - clone: function(object){ - var clone = {}; - for (var key in object) clone[key] = cloneOf(object[key]); - return clone; - }, - - append: function(original){ - for (var i = 1, l = arguments.length; i < l; i++){ - var extended = arguments[i] || {}; - for (var key in extended) original[key] = extended[key]; - } - return original; - } - -}); - -// Object-less types - -['Object', 'WhiteSpace', 'TextNode', 'Collection', 'Arguments'].each(function(name){ - new Type(name); -}); - -// Unique ID - -var UID = Date.now(); - -String.extend('uniqueID', function(){ - return (UID++).toString(36); -}); - - - -})(); - - -/* ---- - -name: Array - -description: Contains Array Prototypes like each, contains, and erase. - -license: MIT-style license. - -requires: [Type] - -provides: Array - -... -*/ - -Array.implement({ - - /**/ - every: function(fn, bind){ - for (var i = 0, l = this.length >>> 0; i < l; i++){ - if ((i in this) && !fn.call(bind, this[i], i, this)) return false; - } - return true; - }, - - filter: function(fn, bind){ - var results = []; - for (var value, i = 0, l = this.length >>> 0; i < l; i++) if (i in this){ - value = this[i]; - if (fn.call(bind, value, i, this)) results.push(value); - } - return results; - }, - - indexOf: function(item, from){ - var length = this.length >>> 0; - for (var i = (from < 0) ? Math.max(0, length + from) : from || 0; i < length; i++){ - if (this[i] === item) return i; - } - return -1; - }, - - map: function(fn, bind){ - var length = this.length >>> 0, results = Array(length); - for (var i = 0; i < length; i++){ - if (i in this) results[i] = fn.call(bind, this[i], i, this); - } - return results; - }, - - some: function(fn, bind){ - for (var i = 0, l = this.length >>> 0; i < l; i++){ - if ((i in this) && fn.call(bind, this[i], i, this)) return true; - } - return false; - }, - /**/ - - clean: function(){ - return this.filter(function(item){ - return item != null; - }); - }, - - invoke: function(methodName){ - var args = Array.slice(arguments, 1); - return this.map(function(item){ - return item[methodName].apply(item, args); - }); - }, - - associate: function(keys){ - var obj = {}, length = Math.min(this.length, keys.length); - for (var i = 0; i < length; i++) obj[keys[i]] = this[i]; - return obj; - }, - - link: function(object){ - var result = {}; - for (var i = 0, l = this.length; i < l; i++){ - for (var key in object){ - if (object[key](this[i])){ - result[key] = this[i]; - delete object[key]; - break; - } - } - } - return result; - }, - - contains: function(item, from){ - return this.indexOf(item, from) != -1; - }, - - append: function(array){ - this.push.apply(this, array); - return this; - }, - - getLast: function(){ - return (this.length) ? this[this.length - 1] : null; - }, - - getRandom: function(){ - return (this.length) ? this[Number.random(0, this.length - 1)] : null; - }, - - include: function(item){ - if (!this.contains(item)) this.push(item); - return this; - }, - - combine: function(array){ - for (var i = 0, l = array.length; i < l; i++) this.include(array[i]); - return this; - }, - - erase: function(item){ - for (var i = this.length; i--;){ - if (this[i] === item) this.splice(i, 1); - } - return this; - }, - - empty: function(){ - this.length = 0; - return this; - }, - - flatten: function(){ - var array = []; - for (var i = 0, l = this.length; i < l; i++){ - var type = typeOf(this[i]); - if (type == 'null') continue; - array = array.concat((type == 'array' || type == 'collection' || type == 'arguments' || instanceOf(this[i], Array)) ? Array.flatten(this[i]) : this[i]); - } - return array; - }, - - pick: function(){ - for (var i = 0, l = this.length; i < l; i++){ - if (this[i] != null) return this[i]; - } - return null; - }, - - hexToRgb: function(array){ - if (this.length != 3) return null; - var rgb = this.map(function(value){ - if (value.length == 1) value += value; - return parseInt(value, 16); - }); - return (array) ? rgb : 'rgb(' + rgb + ')'; - }, - - rgbToHex: function(array){ - if (this.length < 3) return null; - if (this.length == 4 && this[3] == 0 && !array) return 'transparent'; - var hex = []; - for (var i = 0; i < 3; i++){ - var bit = (this[i] - 0).toString(16); - hex.push((bit.length == 1) ? '0' + bit : bit); - } - return (array) ? hex : '#' + hex.join(''); - } - -}); - - - - -/* ---- - -name: String - -description: Contains String Prototypes like camelCase, capitalize, test, and toInt. - -license: MIT-style license. - -requires: [Type, Array] - -provides: String - -... -*/ - -String.implement({ - - // - contains: function(string, index){ - return (index ? String(this).slice(index) : String(this)).indexOf(string) > -1; - }, - // - - test: function(regex, params){ - return ((typeOf(regex) == 'regexp') ? regex : new RegExp('' + regex, params)).test(this); - }, - - trim: function(){ - return String(this).replace(/^\s+|\s+$/g, ''); - }, - - clean: function(){ - return String(this).replace(/\s+/g, ' ').trim(); - }, - - camelCase: function(){ - return String(this).replace(/-\D/g, function(match){ - return match.charAt(1).toUpperCase(); - }); - }, - - hyphenate: function(){ - return String(this).replace(/[A-Z]/g, function(match){ - return ('-' + match.charAt(0).toLowerCase()); - }); - }, - - capitalize: function(){ - return String(this).replace(/\b[a-z]/g, function(match){ - return match.toUpperCase(); - }); - }, - - escapeRegExp: function(){ - return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1'); - }, - - toInt: function(base){ - return parseInt(this, base || 10); - }, - - toFloat: function(){ - return parseFloat(this); - }, - - hexToRgb: function(array){ - var hex = String(this).match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/); - return (hex) ? hex.slice(1).hexToRgb(array) : null; - }, - - rgbToHex: function(array){ - var rgb = String(this).match(/\d{1,3}/g); - return (rgb) ? rgb.rgbToHex(array) : null; - }, - - substitute: function(object, regexp){ - return String(this).replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){ - if (match.charAt(0) == '\\') return match.slice(1); - return (object[name] != null) ? object[name] : ''; - }); - } - -}); - - - - -/* ---- - -name: Number - -description: Contains Number Prototypes like limit, round, times, and ceil. - -license: MIT-style license. - -requires: Type - -provides: Number - -... -*/ - -Number.implement({ - - limit: function(min, max){ - return Math.min(max, Math.max(min, this)); - }, - - round: function(precision){ - precision = Math.pow(10, precision || 0).toFixed(precision < 0 ? -precision : 0); - return Math.round(this * precision) / precision; - }, - - times: function(fn, bind){ - for (var i = 0; i < this; i++) fn.call(bind, i, this); - }, - - toFloat: function(){ - return parseFloat(this); - }, - - toInt: function(base){ - return parseInt(this, base || 10); - } - -}); - -Number.alias('each', 'times'); - -(function(math){ - var methods = {}; - math.each(function(name){ - if (!Number[name]) methods[name] = function(){ - return Math[name].apply(null, [this].concat(Array.from(arguments))); - }; - }); - Number.implement(methods); -})(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']); - - -/* ---- - -name: Function - -description: Contains Function Prototypes like create, bind, pass, and delay. - -license: MIT-style license. - -requires: Type - -provides: Function - -... -*/ - -Function.extend({ - - attempt: function(){ - for (var i = 0, l = arguments.length; i < l; i++){ - try { - return arguments[i](); - } catch (e){} - } - return null; - } - -}); - -Function.implement({ - - attempt: function(args, bind){ - try { - return this.apply(bind, Array.from(args)); - } catch (e){} - - return null; - }, - - /**/ - bind: function(that){ - var self = this, - args = arguments.length > 1 ? Array.slice(arguments, 1) : null, - F = function(){}; - - var bound = function(){ - var context = that, length = arguments.length; - if (this instanceof bound){ - F.prototype = self.prototype; - context = new F; - } - var result = (!args && !length) - ? self.call(context) - : self.apply(context, args && length ? args.concat(Array.slice(arguments)) : args || arguments); - return context == that ? result : context; - }; - return bound; - }, - /**/ - - pass: function(args, bind){ - var self = this; - if (args != null) args = Array.from(args); - return function(){ - return self.apply(bind, args || arguments); - }; - }, - - delay: function(delay, bind, args){ - return setTimeout(this.pass((args == null ? [] : args), bind), delay); - }, - - periodical: function(periodical, bind, args){ - return setInterval(this.pass((args == null ? [] : args), bind), periodical); - } - -}); - - - - -/* ---- - -name: Object - -description: Object generic methods - -license: MIT-style license. - -requires: Type - -provides: [Object, Hash] - -... -*/ - -(function(){ - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -Object.extend({ - - subset: function(object, keys){ - var results = {}; - for (var i = 0, l = keys.length; i < l; i++){ - var k = keys[i]; - if (k in object) results[k] = object[k]; - } - return results; - }, - - map: function(object, fn, bind){ - var results = {}; - for (var key in object){ - if (hasOwnProperty.call(object, key)) results[key] = fn.call(bind, object[key], key, object); - } - return results; - }, - - filter: function(object, fn, bind){ - var results = {}; - for (var key in object){ - var value = object[key]; - if (hasOwnProperty.call(object, key) && fn.call(bind, value, key, object)) results[key] = value; - } - return results; - }, - - every: function(object, fn, bind){ - for (var key in object){ - if (hasOwnProperty.call(object, key) && !fn.call(bind, object[key], key)) return false; - } - return true; - }, - - some: function(object, fn, bind){ - for (var key in object){ - if (hasOwnProperty.call(object, key) && fn.call(bind, object[key], key)) return true; - } - return false; - }, - - keys: function(object){ - var keys = []; - for (var key in object){ - if (hasOwnProperty.call(object, key)) keys.push(key); - } - return keys; - }, - - values: function(object){ - var values = []; - for (var key in object){ - if (hasOwnProperty.call(object, key)) values.push(object[key]); - } - return values; - }, - - getLength: function(object){ - return Object.keys(object).length; - }, - - keyOf: function(object, value){ - for (var key in object){ - if (hasOwnProperty.call(object, key) && object[key] === value) return key; - } - return null; - }, - - contains: function(object, value){ - return Object.keyOf(object, value) != null; - }, - - toQueryString: function(object, base){ - var queryString = []; - - Object.each(object, function(value, key){ - if (base) key = base + '[' + key + ']'; - var result; - switch (typeOf(value)){ - case 'object': result = Object.toQueryString(value, key); break; - case 'array': - var qs = {}; - value.each(function(val, i){ - qs[i] = val; - }); - result = Object.toQueryString(qs, key); - break; - default: result = key + '=' + encodeURIComponent(value); - } - if (value != null) queryString.push(result); - }); - - return queryString.join('&'); - } - -}); - -})(); - - - - -/* ---- - -name: Browser - -description: The Browser Object. Contains Browser initialization, Window and Document, and the Browser Hash. - -license: MIT-style license. - -requires: [Array, Function, Number, String] - -provides: [Browser, Window, Document] - -... -*/ - -(function(){ - -var document = this.document; -var window = document.window = this; - -var parse = function(ua, platform){ - ua = ua.toLowerCase(); - platform = (platform ? platform.toLowerCase() : ''); - - var UA = ua.match(/(opera|ie|firefox|chrome|trident|crios|version)[\s\/:]([\w\d\.]+)?.*?(safari|(?:rv[\s\/:]|version[\s\/:])([\w\d\.]+)|$)/) || [null, 'unknown', 0]; - - if (UA[1] == 'trident'){ - UA[1] = 'ie'; - if (UA[4]) UA[2] = UA[4]; - } else if (UA[1] == 'crios') { - UA[1] = 'chrome'; - } - - var platform = ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android)/) || platform.match(/mac|win|linux/) || ['other'])[0]; - if (platform == 'win') platform = 'windows'; - - return { - extend: Function.prototype.extend, - name: (UA[1] == 'version') ? UA[3] : UA[1], - version: parseFloat((UA[1] == 'opera' && UA[4]) ? UA[4] : UA[2]), - platform: platform - }; -}; - -var Browser = this.Browser = parse(navigator.userAgent, navigator.platform); - -if (Browser.ie){ - Browser.version = document.documentMode; -} - -Browser.extend({ - Features: { - xpath: !!(document.evaluate), - air: !!(window.runtime), - query: !!(document.querySelector), - json: !!(window.JSON) - }, - parseUA: parse -}); - - - -// Request - -Browser.Request = (function(){ - - var XMLHTTP = function(){ - return new XMLHttpRequest(); - }; - - var MSXML2 = function(){ - return new ActiveXObject('MSXML2.XMLHTTP'); - }; - - var MSXML = function(){ - return new ActiveXObject('Microsoft.XMLHTTP'); - }; - - return Function.attempt(function(){ - XMLHTTP(); - return XMLHTTP; - }, function(){ - MSXML2(); - return MSXML2; - }, function(){ - MSXML(); - return MSXML; - }); - -})(); - -Browser.Features.xhr = !!(Browser.Request); - - - -// String scripts - -Browser.exec = function(text){ - if (!text) return text; - if (window.execScript){ - window.execScript(text); - } else { - var script = document.createElement('script'); - script.setAttribute('type', 'text/javascript'); - script.text = text; - document.head.appendChild(script); - document.head.removeChild(script); - } - return text; -}; - -String.implement('stripScripts', function(exec){ - var scripts = ''; - var text = this.replace(/]*>([\s\S]*?)<\/script>/gi, function(all, code){ - scripts += code + '\n'; - return ''; - }); - if (exec === true) Browser.exec(scripts); - else if (typeOf(exec) == 'function') exec(scripts, text); - return text; -}); - -// Window, Document - -Browser.extend({ - Document: this.Document, - Window: this.Window, - Element: this.Element, - Event: this.Event -}); - -this.Window = this.$constructor = new Type('Window', function(){}); - -this.$family = Function.from('window').hide(); - -Window.mirror(function(name, method){ - window[name] = method; -}); - -this.Document = document.$constructor = new Type('Document', function(){}); - -document.$family = Function.from('document').hide(); - -Document.mirror(function(name, method){ - document[name] = method; -}); - -document.html = document.documentElement; -if (!document.head) document.head = document.getElementsByTagName('head')[0]; - -if (document.execCommand) try { - document.execCommand("BackgroundImageCache", false, true); -} catch (e){} - -/**/ -if (this.attachEvent && !this.addEventListener){ - var unloadEvent = function(){ - this.detachEvent('onunload', unloadEvent); - document.head = document.html = document.window = null; - }; - this.attachEvent('onunload', unloadEvent); -} - -// IE fails on collections and ) -var arrayFrom = Array.from; -try { - arrayFrom(document.html.childNodes); -} catch(e){ - Array.from = function(item){ - if (typeof item != 'string' && Type.isEnumerable(item) && typeOf(item) != 'array'){ - var i = item.length, array = new Array(i); - while (i--) array[i] = item[i]; - return array; - } - return arrayFrom(item); - }; - - var prototype = Array.prototype, - slice = prototype.slice; - ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice'].each(function(name){ - var method = prototype[name]; - Array[name] = function(item){ - return method.apply(Array.from(item), slice.call(arguments, 1)); - }; - }); -} -/**/ - - - -})(); - - -/* ---- - -name: Event - -description: Contains the Event Type, to make the event object cross-browser. - -license: MIT-style license. - -requires: [Window, Document, Array, Function, String, Object] - -provides: Event - -... -*/ - -(function() { - -var _keys = {}; - -var DOMEvent = this.DOMEvent = new Type('DOMEvent', function(event, win){ - if (!win) win = window; - event = event || win.event; - if (event.$extended) return event; - this.event = event; - this.$extended = true; - this.shift = event.shiftKey; - this.control = event.ctrlKey; - this.alt = event.altKey; - this.meta = event.metaKey; - var type = this.type = event.type; - var target = event.target || event.srcElement; - while (target && target.nodeType == 3) target = target.parentNode; - this.target = document.id(target); - - if (type.indexOf('key') == 0){ - var code = this.code = (event.which || event.keyCode); - this.key = _keys[code]; - if (type == 'keydown' || type == 'keyup'){ - if (code > 111 && code < 124) this.key = 'f' + (code - 111); - else if (code > 95 && code < 106) this.key = code - 96; - } - if (this.key == null) this.key = String.fromCharCode(code).toLowerCase(); - } else if (type == 'click' || type == 'dblclick' || type == 'contextmenu' || type == 'DOMMouseScroll' || type.indexOf('mouse') == 0){ - var doc = win.document; - doc = (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body; - this.page = { - x: (event.pageX != null) ? event.pageX : event.clientX + doc.scrollLeft, - y: (event.pageY != null) ? event.pageY : event.clientY + doc.scrollTop - }; - this.client = { - x: (event.pageX != null) ? event.pageX - win.pageXOffset : event.clientX, - y: (event.pageY != null) ? event.pageY - win.pageYOffset : event.clientY - }; - if (type == 'DOMMouseScroll' || type == 'mousewheel') - this.wheel = (event.wheelDelta) ? event.wheelDelta / 120 : -(event.detail || 0) / 3; - - this.rightClick = (event.which == 3 || event.button == 2); - if (type == 'mouseover' || type == 'mouseout'){ - var related = event.relatedTarget || event[(type == 'mouseover' ? 'from' : 'to') + 'Element']; - while (related && related.nodeType == 3) related = related.parentNode; - this.relatedTarget = document.id(related); - } - } else if (type.indexOf('touch') == 0 || type.indexOf('gesture') == 0){ - this.rotation = event.rotation; - this.scale = event.scale; - this.targetTouches = event.targetTouches; - this.changedTouches = event.changedTouches; - var touches = this.touches = event.touches; - if (touches && touches[0]){ - var touch = touches[0]; - this.page = {x: touch.pageX, y: touch.pageY}; - this.client = {x: touch.clientX, y: touch.clientY}; - } - } - - if (!this.client) this.client = {}; - if (!this.page) this.page = {}; -}); - -DOMEvent.implement({ - - stop: function(){ - return this.preventDefault().stopPropagation(); - }, - - stopPropagation: function(){ - if (this.event.stopPropagation) this.event.stopPropagation(); - else this.event.cancelBubble = true; - return this; - }, - - preventDefault: function(){ - if (this.event.preventDefault) this.event.preventDefault(); - else this.event.returnValue = false; - return this; - } - -}); - -DOMEvent.defineKey = function(code, key){ - _keys[code] = key; - return this; -}; - -DOMEvent.defineKeys = DOMEvent.defineKey.overloadSetter(true); - -DOMEvent.defineKeys({ - '38': 'up', '40': 'down', '37': 'left', '39': 'right', - '27': 'esc', '32': 'space', '8': 'backspace', '9': 'tab', - '46': 'delete', '13': 'enter' -}); - -})(); - - - - - - -/* ---- - -name: Class - -description: Contains the Class Function for easily creating, extending, and implementing reusable Classes. - -license: MIT-style license. - -requires: [Array, String, Function, Number] - -provides: Class - -... -*/ - -(function(){ - -var Class = this.Class = new Type('Class', function(params){ - if (instanceOf(params, Function)) params = {initialize: params}; - - var newClass = function(){ - reset(this); - if (newClass.$prototyping) return this; - this.$caller = null; - var value = (this.initialize) ? this.initialize.apply(this, arguments) : this; - this.$caller = this.caller = null; - return value; - }.extend(this).implement(params); - - newClass.$constructor = Class; - newClass.prototype.$constructor = newClass; - newClass.prototype.parent = parent; - - return newClass; -}); - -var parent = function(){ - if (!this.$caller) throw new Error('The method "parent" cannot be called.'); - var name = this.$caller.$name, - parent = this.$caller.$owner.parent, - previous = (parent) ? parent.prototype[name] : null; - if (!previous) throw new Error('The method "' + name + '" has no parent.'); - return previous.apply(this, arguments); -}; - -var reset = function(object){ - for (var key in object){ - var value = object[key]; - switch (typeOf(value)){ - case 'object': - var F = function(){}; - F.prototype = value; - object[key] = reset(new F); - break; - case 'array': object[key] = value.clone(); break; - } - } - return object; -}; - -var wrap = function(self, key, method){ - if (method.$origin) method = method.$origin; - var wrapper = function(){ - if (method.$protected && this.$caller == null) throw new Error('The method "' + key + '" cannot be called.'); - var caller = this.caller, current = this.$caller; - this.caller = current; this.$caller = wrapper; - var result = method.apply(this, arguments); - this.$caller = current; this.caller = caller; - return result; - }.extend({$owner: self, $origin: method, $name: key}); - return wrapper; -}; - -var implement = function(key, value, retain){ - if (Class.Mutators.hasOwnProperty(key)){ - value = Class.Mutators[key].call(this, value); - if (value == null) return this; - } - - if (typeOf(value) == 'function'){ - if (value.$hidden) return this; - this.prototype[key] = (retain) ? value : wrap(this, key, value); - } else { - Object.merge(this.prototype, key, value); - } - - return this; -}; - -var getInstance = function(klass){ - klass.$prototyping = true; - var proto = new klass; - delete klass.$prototyping; - return proto; -}; - -Class.implement('implement', implement.overloadSetter()); - -Class.Mutators = { - - Extends: function(parent){ - this.parent = parent; - this.prototype = getInstance(parent); - }, - - Implements: function(items){ - Array.from(items).each(function(item){ - var instance = new item; - for (var key in instance) implement.call(this, key, instance[key], true); - }, this); - } -}; - -})(); - - -/* ---- - -name: Class.Extras - -description: Contains Utility Classes that can be implemented into your own Classes to ease the execution of many common tasks. - -license: MIT-style license. - -requires: Class - -provides: [Class.Extras, Chain, Events, Options] - -... -*/ - -(function(){ - -this.Chain = new Class({ - - $chain: [], - - chain: function(){ - this.$chain.append(Array.flatten(arguments)); - return this; - }, - - callChain: function(){ - return (this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false; - }, - - clearChain: function(){ - this.$chain.empty(); - return this; - } - -}); - -var removeOn = function(string){ - return string.replace(/^on([A-Z])/, function(full, first){ - return first.toLowerCase(); - }); -}; - -this.Events = new Class({ - - $events: {}, - - addEvent: function(type, fn, internal){ - type = removeOn(type); - - - - this.$events[type] = (this.$events[type] || []).include(fn); - if (internal) fn.internal = true; - return this; - }, - - addEvents: function(events){ - for (var type in events) this.addEvent(type, events[type]); - return this; - }, - - fireEvent: function(type, args, delay){ - type = removeOn(type); - var events = this.$events[type]; - if (!events) return this; - args = Array.from(args); - events.each(function(fn){ - if (delay) fn.delay(delay, this, args); - else fn.apply(this, args); - }, this); - return this; - }, - - removeEvent: function(type, fn){ - type = removeOn(type); - var events = this.$events[type]; - if (events && !fn.internal){ - var index = events.indexOf(fn); - if (index != -1) delete events[index]; - } - return this; - }, - - removeEvents: function(events){ - var type; - if (typeOf(events) == 'object'){ - for (type in events) this.removeEvent(type, events[type]); - return this; - } - if (events) events = removeOn(events); - for (type in this.$events){ - if (events && events != type) continue; - var fns = this.$events[type]; - for (var i = fns.length; i--;) if (i in fns){ - this.removeEvent(type, fns[i]); - } - } - return this; - } - -}); - -this.Options = new Class({ - - setOptions: function(){ - var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments)); - if (this.addEvent) for (var option in options){ - if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue; - this.addEvent(option, options[option]); - delete options[option]; - } - return this; - } - -}); - -})(); - - -/* ---- -name: Slick.Parser -description: Standalone CSS3 Selector parser -provides: Slick.Parser -... -*/ - -;(function(){ - -var parsed, - separatorIndex, - combinatorIndex, - reversed, - cache = {}, - reverseCache = {}, - reUnescape = /\\/g; - -var parse = function(expression, isReversed){ - if (expression == null) return null; - if (expression.Slick === true) return expression; - expression = ('' + expression).replace(/^\s+|\s+$/g, ''); - reversed = !!isReversed; - var currentCache = (reversed) ? reverseCache : cache; - if (currentCache[expression]) return currentCache[expression]; - parsed = { - Slick: true, - expressions: [], - raw: expression, - reverse: function(){ - return parse(this.raw, true); - } - }; - separatorIndex = -1; - while (expression != (expression = expression.replace(regexp, parser))); - parsed.length = parsed.expressions.length; - return currentCache[parsed.raw] = (reversed) ? reverse(parsed) : parsed; -}; - -var reverseCombinator = function(combinator){ - if (combinator === '!') return ' '; - else if (combinator === ' ') return '!'; - else if ((/^!/).test(combinator)) return combinator.replace(/^!/, ''); - else return '!' + combinator; -}; - -var reverse = function(expression){ - var expressions = expression.expressions; - for (var i = 0; i < expressions.length; i++){ - var exp = expressions[i]; - var last = {parts: [], tag: '*', combinator: reverseCombinator(exp[0].combinator)}; - - for (var j = 0; j < exp.length; j++){ - var cexp = exp[j]; - if (!cexp.reverseCombinator) cexp.reverseCombinator = ' '; - cexp.combinator = cexp.reverseCombinator; - delete cexp.reverseCombinator; - } - - exp.reverse().push(last); - } - return expression; -}; - -var escapeRegExp = function(string){// Credit: XRegExp 0.6.1 (c) 2007-2008 Steven Levithan MIT License - return string.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, function(match){ - return '\\' + match; - }); -}; - -var regexp = new RegExp( -/* -#!/usr/bin/env ruby -puts "\t\t" + DATA.read.gsub(/\(\?x\)|\s+#.*$|\s+|\\$|\\n/,'') -__END__ - "(?x)^(?:\ - \\s* ( , ) \\s* # Separator \n\ - | \\s* ( + ) \\s* # Combinator \n\ - | ( \\s+ ) # CombinatorChildren \n\ - | ( + | \\* ) # Tag \n\ - | \\# ( + ) # ID \n\ - | \\. ( + ) # ClassName \n\ - | # Attribute \n\ - \\[ \ - \\s* (+) (?: \ - \\s* ([*^$!~|]?=) (?: \ - \\s* (?:\ - ([\"']?)(.*?)\\9 \ - )\ - ) \ - )? \\s* \ - \\](?!\\]) \n\ - | :+ ( + )(?:\ - \\( (?:\ - (?:([\"'])([^\\12]*)\\12)|((?:\\([^)]+\\)|[^()]*)+)\ - ) \\)\ - )?\ - )" -*/ - "^(?:\\s*(,)\\s*|\\s*(+)\\s*|(\\s+)|(+|\\*)|\\#(+)|\\.(+)|\\[\\s*(+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)" - .replace(//, '[' + escapeRegExp(">+~`!@$%^&={}\\;/g, '(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])') - .replace(//g, '(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])') -); - -function parser( - rawMatch, - - separator, - combinator, - combinatorChildren, - - tagName, - id, - className, - - attributeKey, - attributeOperator, - attributeQuote, - attributeValue, - - pseudoMarker, - pseudoClass, - pseudoQuote, - pseudoClassQuotedValue, - pseudoClassValue -){ - if (separator || separatorIndex === -1){ - parsed.expressions[++separatorIndex] = []; - combinatorIndex = -1; - if (separator) return ''; - } - - if (combinator || combinatorChildren || combinatorIndex === -1){ - combinator = combinator || ' '; - var currentSeparator = parsed.expressions[separatorIndex]; - if (reversed && currentSeparator[combinatorIndex]) - currentSeparator[combinatorIndex].reverseCombinator = reverseCombinator(combinator); - currentSeparator[++combinatorIndex] = {combinator: combinator, tag: '*'}; - } - - var currentParsed = parsed.expressions[separatorIndex][combinatorIndex]; - - if (tagName){ - currentParsed.tag = tagName.replace(reUnescape, ''); - - } else if (id){ - currentParsed.id = id.replace(reUnescape, ''); - - } else if (className){ - className = className.replace(reUnescape, ''); - - if (!currentParsed.classList) currentParsed.classList = []; - if (!currentParsed.classes) currentParsed.classes = []; - currentParsed.classList.push(className); - currentParsed.classes.push({ - value: className, - regexp: new RegExp('(^|\\s)' + escapeRegExp(className) + '(\\s|$)') - }); - - } else if (pseudoClass){ - pseudoClassValue = pseudoClassValue || pseudoClassQuotedValue; - pseudoClassValue = pseudoClassValue ? pseudoClassValue.replace(reUnescape, '') : null; - - if (!currentParsed.pseudos) currentParsed.pseudos = []; - currentParsed.pseudos.push({ - key: pseudoClass.replace(reUnescape, ''), - value: pseudoClassValue, - type: pseudoMarker.length == 1 ? 'class' : 'element' - }); - - } else if (attributeKey){ - attributeKey = attributeKey.replace(reUnescape, ''); - attributeValue = (attributeValue || '').replace(reUnescape, ''); - - var test, regexp; - - switch (attributeOperator){ - case '^=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) ); break; - case '$=' : regexp = new RegExp( escapeRegExp(attributeValue) +'$' ); break; - case '~=' : regexp = new RegExp( '(^|\\s)'+ escapeRegExp(attributeValue) +'(\\s|$)' ); break; - case '|=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) +'(-|$)' ); break; - case '=' : test = function(value){ - return attributeValue == value; - }; break; - case '*=' : test = function(value){ - return value && value.indexOf(attributeValue) > -1; - }; break; - case '!=' : test = function(value){ - return attributeValue != value; - }; break; - default : test = function(value){ - return !!value; - }; - } - - if (attributeValue == '' && (/^[*$^]=$/).test(attributeOperator)) test = function(){ - return false; - }; - - if (!test) test = function(value){ - return value && regexp.test(value); - }; - - if (!currentParsed.attributes) currentParsed.attributes = []; - currentParsed.attributes.push({ - key: attributeKey, - operator: attributeOperator, - value: attributeValue, - test: test - }); - - } - - return ''; -}; - -// Slick NS - -var Slick = (this.Slick || {}); - -Slick.parse = function(expression){ - return parse(expression); -}; - -Slick.escapeRegExp = escapeRegExp; - -if (!this.Slick) this.Slick = Slick; - -}).apply(/**/(typeof exports != 'undefined') ? exports : /**/this); - - -/* ---- -name: Slick.Finder -description: The new, superfast css selector engine. -provides: Slick.Finder -requires: Slick.Parser -... -*/ - -;(function(){ - -var local = {}, - featuresCache = {}, - toString = Object.prototype.toString; - -// Feature / Bug detection - -local.isNativeCode = function(fn){ - return (/\{\s*\[native code\]\s*\}/).test('' + fn); -}; - -local.isXML = function(document){ - return (!!document.xmlVersion) || (!!document.xml) || (toString.call(document) == '[object XMLDocument]') || - (document.nodeType == 9 && document.documentElement.nodeName != 'HTML'); -}; - -local.setDocument = function(document){ - - // convert elements / window arguments to document. if document cannot be extrapolated, the function returns. - var nodeType = document.nodeType; - if (nodeType == 9); // document - else if (nodeType) document = document.ownerDocument; // node - else if (document.navigator) document = document.document; // window - else return; - - // check if it's the old document - - if (this.document === document) return; - this.document = document; - - // check if we have done feature detection on this document before - - var root = document.documentElement, - rootUid = this.getUIDXML(root), - features = featuresCache[rootUid], - feature; - - if (features){ - for (feature in features){ - this[feature] = features[feature]; - } - return; - } - - features = featuresCache[rootUid] = {}; - - features.root = root; - features.isXMLDocument = this.isXML(document); - - features.brokenStarGEBTN - = features.starSelectsClosedQSA - = features.idGetsName - = features.brokenMixedCaseQSA - = features.brokenGEBCN - = features.brokenCheckedQSA - = features.brokenEmptyAttributeQSA - = features.isHTMLDocument - = features.nativeMatchesSelector - = false; - - var starSelectsClosed, starSelectsComments, - brokenSecondClassNameGEBCN, cachedGetElementsByClassName, - brokenFormAttributeGetter; - - var selected, id = 'slick_uniqueid'; - var testNode = document.createElement('div'); - - var testRoot = document.body || document.getElementsByTagName('body')[0] || root; - testRoot.appendChild(testNode); - - // on non-HTML documents innerHTML and getElementsById doesnt work properly - try { - testNode.innerHTML = ''; - features.isHTMLDocument = !!document.getElementById(id); - } catch(e){}; - - if (features.isHTMLDocument){ - - testNode.style.display = 'none'; - - // IE returns comment nodes for getElementsByTagName('*') for some documents - testNode.appendChild(document.createComment('')); - starSelectsComments = (testNode.getElementsByTagName('*').length > 1); - - // IE returns closed nodes (EG:"") for getElementsByTagName('*') for some documents - try { - testNode.innerHTML = 'foo'; - selected = testNode.getElementsByTagName('*'); - starSelectsClosed = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/'); - } catch(e){}; - - features.brokenStarGEBTN = starSelectsComments || starSelectsClosed; - - // IE returns elements with the name instead of just id for getElementsById for some documents - try { - testNode.innerHTML = ''; - features.idGetsName = document.getElementById(id) === testNode.firstChild; - } catch(e){}; - - if (testNode.getElementsByClassName){ - - // Safari 3.2 getElementsByClassName caches results - try { - testNode.innerHTML = ''; - testNode.getElementsByClassName('b').length; - testNode.firstChild.className = 'b'; - cachedGetElementsByClassName = (testNode.getElementsByClassName('b').length != 2); - } catch(e){}; - - // Opera 9.6 getElementsByClassName doesnt detects the class if its not the first one - try { - testNode.innerHTML = ''; - brokenSecondClassNameGEBCN = (testNode.getElementsByClassName('a').length != 2); - } catch(e){}; - - features.brokenGEBCN = cachedGetElementsByClassName || brokenSecondClassNameGEBCN; - } - - if (testNode.querySelectorAll){ - // IE 8 returns closed nodes (EG:"") for querySelectorAll('*') for some documents - try { - testNode.innerHTML = 'foo'; - selected = testNode.querySelectorAll('*'); - features.starSelectsClosedQSA = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/'); - } catch(e){}; - - // Safari 3.2 querySelectorAll doesnt work with mixedcase on quirksmode - try { - testNode.innerHTML = ''; - features.brokenMixedCaseQSA = !testNode.querySelectorAll('.MiX').length; - } catch(e){}; - - // Webkit and Opera dont return selected options on querySelectorAll - try { - testNode.innerHTML = ''; - features.brokenCheckedQSA = (testNode.querySelectorAll(':checked').length == 0); - } catch(e){}; - - // IE returns incorrect results for attr[*^$]="" selectors on querySelectorAll - try { - testNode.innerHTML = ''; - features.brokenEmptyAttributeQSA = (testNode.querySelectorAll('[class*=""]').length != 0); - } catch(e){}; - - } - - // IE6-7, if a form has an input of id x, form.getAttribute(x) returns a reference to the input - try { - testNode.innerHTML = '
      '; - brokenFormAttributeGetter = (testNode.firstChild.getAttribute('action') != 's'); - } catch(e){}; - - // native matchesSelector function - - features.nativeMatchesSelector = root.matches || /*root.msMatchesSelector ||*/ root.mozMatchesSelector || root.webkitMatchesSelector; - if (features.nativeMatchesSelector) try { - // if matchesSelector trows errors on incorrect sintaxes we can use it - features.nativeMatchesSelector.call(root, ':slick'); - features.nativeMatchesSelector = null; - } catch(e){}; - - } - - try { - root.slick_expando = 1; - delete root.slick_expando; - features.getUID = this.getUIDHTML; - } catch(e) { - features.getUID = this.getUIDXML; - } - - testRoot.removeChild(testNode); - testNode = selected = testRoot = null; - - // getAttribute - - features.getAttribute = (features.isHTMLDocument && brokenFormAttributeGetter) ? function(node, name){ - var method = this.attributeGetters[name]; - if (method) return method.call(node); - var attributeNode = node.getAttributeNode(name); - return (attributeNode) ? attributeNode.nodeValue : null; - } : function(node, name){ - var method = this.attributeGetters[name]; - return (method) ? method.call(node) : node.getAttribute(name); - }; - - // hasAttribute - - features.hasAttribute = (root && this.isNativeCode(root.hasAttribute)) ? function(node, attribute) { - return node.hasAttribute(attribute); - } : function(node, attribute) { - node = node.getAttributeNode(attribute); - return !!(node && (node.specified || node.nodeValue)); - }; - - // contains - // FIXME: Add specs: local.contains should be different for xml and html documents? - var nativeRootContains = root && this.isNativeCode(root.contains), - nativeDocumentContains = document && this.isNativeCode(document.contains); - - features.contains = (nativeRootContains && nativeDocumentContains) ? function(context, node){ - return context.contains(node); - } : (nativeRootContains && !nativeDocumentContains) ? function(context, node){ - // IE8 does not have .contains on document. - return context === node || ((context === document) ? document.documentElement : context).contains(node); - } : (root && root.compareDocumentPosition) ? function(context, node){ - return context === node || !!(context.compareDocumentPosition(node) & 16); - } : function(context, node){ - if (node) do { - if (node === context) return true; - } while ((node = node.parentNode)); - return false; - }; - - // document order sorting - // credits to Sizzle (http://sizzlejs.com/) - - features.documentSorter = (root.compareDocumentPosition) ? function(a, b){ - if (!a.compareDocumentPosition || !b.compareDocumentPosition) return 0; - return a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; - } : ('sourceIndex' in root) ? function(a, b){ - if (!a.sourceIndex || !b.sourceIndex) return 0; - return a.sourceIndex - b.sourceIndex; - } : (document.createRange) ? function(a, b){ - if (!a.ownerDocument || !b.ownerDocument) return 0; - var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); - aRange.setStart(a, 0); - aRange.setEnd(a, 0); - bRange.setStart(b, 0); - bRange.setEnd(b, 0); - return aRange.compareBoundaryPoints(Range.START_TO_END, bRange); - } : null ; - - root = null; - - for (feature in features){ - this[feature] = features[feature]; - } -}; - -// Main Method - -var reSimpleSelector = /^([#.]?)((?:[\w-]+|\*))$/, - reEmptyAttribute = /\[.+[*$^]=(?:""|'')?\]/, - qsaFailExpCache = {}; - -local.search = function(context, expression, append, first){ - - var found = this.found = (first) ? null : (append || []); - - if (!context) return found; - else if (context.navigator) context = context.document; // Convert the node from a window to a document - else if (!context.nodeType) return found; - - // setup - - var parsed, i, - uniques = this.uniques = {}, - hasOthers = !!(append && append.length), - contextIsDocument = (context.nodeType == 9); - - if (this.document !== (contextIsDocument ? context : context.ownerDocument)) this.setDocument(context); - - // avoid duplicating items already in the append array - if (hasOthers) for (i = found.length; i--;) uniques[this.getUID(found[i])] = true; - - // expression checks - - if (typeof expression == 'string'){ // expression is a string - - /**/ - var simpleSelector = expression.match(reSimpleSelector); - simpleSelectors: if (simpleSelector) { - - var symbol = simpleSelector[1], - name = simpleSelector[2], - node, nodes; - - if (!symbol){ - - if (name == '*' && this.brokenStarGEBTN) break simpleSelectors; - nodes = context.getElementsByTagName(name); - if (first) return nodes[0] || null; - for (i = 0; node = nodes[i++];){ - if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); - } - - } else if (symbol == '#'){ - - if (!this.isHTMLDocument || !contextIsDocument) break simpleSelectors; - node = context.getElementById(name); - if (!node) return found; - if (this.idGetsName && node.getAttributeNode('id').nodeValue != name) break simpleSelectors; - if (first) return node || null; - if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); - - } else if (symbol == '.'){ - - if (!this.isHTMLDocument || ((!context.getElementsByClassName || this.brokenGEBCN) && context.querySelectorAll)) break simpleSelectors; - if (context.getElementsByClassName && !this.brokenGEBCN){ - nodes = context.getElementsByClassName(name); - if (first) return nodes[0] || null; - for (i = 0; node = nodes[i++];){ - if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); - } - } else { - var matchClass = new RegExp('(^|\\s)'+ Slick.escapeRegExp(name) +'(\\s|$)'); - nodes = context.getElementsByTagName('*'); - for (i = 0; node = nodes[i++];){ - className = node.className; - if (!(className && matchClass.test(className))) continue; - if (first) return node; - if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); - } - } - - } - - if (hasOthers) this.sort(found); - return (first) ? null : found; - - } - /**/ - - /**/ - querySelector: if (context.querySelectorAll) { - - if (!this.isHTMLDocument - || qsaFailExpCache[expression] - //TODO: only skip when expression is actually mixed case - || this.brokenMixedCaseQSA - || (this.brokenCheckedQSA && expression.indexOf(':checked') > -1) - || (this.brokenEmptyAttributeQSA && reEmptyAttribute.test(expression)) - || (!contextIsDocument //Abort when !contextIsDocument and... - // there are multiple expressions in the selector - // since we currently only fix non-document rooted QSA for single expression selectors - && expression.indexOf(',') > -1 - ) - || Slick.disableQSA - ) break querySelector; - - var _expression = expression, _context = context; - if (!contextIsDocument){ - // non-document rooted QSA - // credits to Andrew Dupont - var currentId = _context.getAttribute('id'), slickid = 'slickid__'; - _context.setAttribute('id', slickid); - _expression = '#' + slickid + ' ' + _expression; - context = _context.parentNode; - } - - try { - if (first) return context.querySelector(_expression) || null; - else nodes = context.querySelectorAll(_expression); - } catch(e) { - qsaFailExpCache[expression] = 1; - break querySelector; - } finally { - if (!contextIsDocument){ - if (currentId) _context.setAttribute('id', currentId); - else _context.removeAttribute('id'); - context = _context; - } - } - - if (this.starSelectsClosedQSA) for (i = 0; node = nodes[i++];){ - if (node.nodeName > '@' && !(hasOthers && uniques[this.getUID(node)])) found.push(node); - } else for (i = 0; node = nodes[i++];){ - if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); - } - - if (hasOthers) this.sort(found); - return found; - - } - /**/ - - parsed = this.Slick.parse(expression); - if (!parsed.length) return found; - } else if (expression == null){ // there is no expression - return found; - } else if (expression.Slick){ // expression is a parsed Slick object - parsed = expression; - } else if (this.contains(context.documentElement || context, expression)){ // expression is a node - (found) ? found.push(expression) : found = expression; - return found; - } else { // other junk - return found; - } - - /**//**/ - - // cache elements for the nth selectors - - this.posNTH = {}; - this.posNTHLast = {}; - this.posNTHType = {}; - this.posNTHTypeLast = {}; - - /**//**/ - - // if append is null and there is only a single selector with one expression use pushArray, else use pushUID - this.push = (!hasOthers && (first || (parsed.length == 1 && parsed.expressions[0].length == 1))) ? this.pushArray : this.pushUID; - - if (found == null) found = []; - - // default engine - - var j, m, n; - var combinator, tag, id, classList, classes, attributes, pseudos; - var currentItems, currentExpression, currentBit, lastBit, expressions = parsed.expressions; - - search: for (i = 0; (currentExpression = expressions[i]); i++) for (j = 0; (currentBit = currentExpression[j]); j++){ - - combinator = 'combinator:' + currentBit.combinator; - if (!this[combinator]) continue search; - - tag = (this.isXMLDocument) ? currentBit.tag : currentBit.tag.toUpperCase(); - id = currentBit.id; - classList = currentBit.classList; - classes = currentBit.classes; - attributes = currentBit.attributes; - pseudos = currentBit.pseudos; - lastBit = (j === (currentExpression.length - 1)); - - this.bitUniques = {}; - - if (lastBit){ - this.uniques = uniques; - this.found = found; - } else { - this.uniques = {}; - this.found = []; - } - - if (j === 0){ - this[combinator](context, tag, id, classes, attributes, pseudos, classList); - if (first && lastBit && found.length) break search; - } else { - if (first && lastBit) for (m = 0, n = currentItems.length; m < n; m++){ - this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList); - if (found.length) break search; - } else for (m = 0, n = currentItems.length; m < n; m++) this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList); - } - - currentItems = this.found; - } - - // should sort if there are nodes in append and if you pass multiple expressions. - if (hasOthers || (parsed.expressions.length > 1)) this.sort(found); - - return (first) ? (found[0] || null) : found; -}; - -// Utils - -local.uidx = 1; -local.uidk = 'slick-uniqueid'; - -local.getUIDXML = function(node){ - var uid = node.getAttribute(this.uidk); - if (!uid){ - uid = this.uidx++; - node.setAttribute(this.uidk, uid); - } - return uid; -}; - -local.getUIDHTML = function(node){ - return node.uniqueNumber || (node.uniqueNumber = this.uidx++); -}; - -// sort based on the setDocument documentSorter method. - -local.sort = function(results){ - if (!this.documentSorter) return results; - results.sort(this.documentSorter); - return results; -}; - -/**//**/ - -local.cacheNTH = {}; - -local.matchNTH = /^([+-]?\d*)?([a-z]+)?([+-]\d+)?$/; - -local.parseNTHArgument = function(argument){ - var parsed = argument.match(this.matchNTH); - if (!parsed) return false; - var special = parsed[2] || false; - var a = parsed[1] || 1; - if (a == '-') a = -1; - var b = +parsed[3] || 0; - parsed = - (special == 'n') ? {a: a, b: b} : - (special == 'odd') ? {a: 2, b: 1} : - (special == 'even') ? {a: 2, b: 0} : {a: 0, b: a}; - - return (this.cacheNTH[argument] = parsed); -}; - -local.createNTHPseudo = function(child, sibling, positions, ofType){ - return function(node, argument){ - var uid = this.getUID(node); - if (!this[positions][uid]){ - var parent = node.parentNode; - if (!parent) return false; - var el = parent[child], count = 1; - if (ofType){ - var nodeName = node.nodeName; - do { - if (el.nodeName != nodeName) continue; - this[positions][this.getUID(el)] = count++; - } while ((el = el[sibling])); - } else { - do { - if (el.nodeType != 1) continue; - this[positions][this.getUID(el)] = count++; - } while ((el = el[sibling])); - } - } - argument = argument || 'n'; - var parsed = this.cacheNTH[argument] || this.parseNTHArgument(argument); - if (!parsed) return false; - var a = parsed.a, b = parsed.b, pos = this[positions][uid]; - if (a == 0) return b == pos; - if (a > 0){ - if (pos < b) return false; - } else { - if (b < pos) return false; - } - return ((pos - b) % a) == 0; - }; -}; - -/**//**/ - -local.pushArray = function(node, tag, id, classes, attributes, pseudos){ - if (this.matchSelector(node, tag, id, classes, attributes, pseudos)) this.found.push(node); -}; - -local.pushUID = function(node, tag, id, classes, attributes, pseudos){ - var uid = this.getUID(node); - if (!this.uniques[uid] && this.matchSelector(node, tag, id, classes, attributes, pseudos)){ - this.uniques[uid] = true; - this.found.push(node); - } -}; - -local.matchNode = function(node, selector){ - if (this.isHTMLDocument && this.nativeMatchesSelector){ - try { - return this.nativeMatchesSelector.call(node, selector.replace(/\[([^=]+)=\s*([^'"\]]+?)\s*\]/g, '[$1="$2"]')); - } catch(matchError) {} - } - - var parsed = this.Slick.parse(selector); - if (!parsed) return true; - - // simple (single) selectors - var expressions = parsed.expressions, simpleExpCounter = 0, i; - for (i = 0; (currentExpression = expressions[i]); i++){ - if (currentExpression.length == 1){ - var exp = currentExpression[0]; - if (this.matchSelector(node, (this.isXMLDocument) ? exp.tag : exp.tag.toUpperCase(), exp.id, exp.classes, exp.attributes, exp.pseudos)) return true; - simpleExpCounter++; - } - } - - if (simpleExpCounter == parsed.length) return false; - - var nodes = this.search(this.document, parsed), item; - for (i = 0; item = nodes[i++];){ - if (item === node) return true; - } - return false; -}; - -local.matchPseudo = function(node, name, argument){ - var pseudoName = 'pseudo:' + name; - if (this[pseudoName]) return this[pseudoName](node, argument); - var attribute = this.getAttribute(node, name); - return (argument) ? argument == attribute : !!attribute; -}; - -local.matchSelector = function(node, tag, id, classes, attributes, pseudos){ - if (tag){ - var nodeName = (this.isXMLDocument) ? node.nodeName : node.nodeName.toUpperCase(); - if (tag == '*'){ - if (nodeName < '@') return false; // Fix for comment nodes and closed nodes - } else { - if (nodeName != tag) return false; - } - } - - if (id && node.getAttribute('id') != id) return false; - - var i, part, cls; - if (classes) for (i = classes.length; i--;){ - cls = this.getAttribute(node, 'class'); - if (!(cls && classes[i].regexp.test(cls))) return false; - } - if (attributes) for (i = attributes.length; i--;){ - part = attributes[i]; - if (part.operator ? !part.test(this.getAttribute(node, part.key)) : !this.hasAttribute(node, part.key)) return false; - } - if (pseudos) for (i = pseudos.length; i--;){ - part = pseudos[i]; - if (!this.matchPseudo(node, part.key, part.value)) return false; - } - return true; -}; - -var combinators = { - - ' ': function(node, tag, id, classes, attributes, pseudos, classList){ // all child nodes, any level - - var i, item, children; - - if (this.isHTMLDocument){ - getById: if (id){ - item = this.document.getElementById(id); - if ((!item && node.all) || (this.idGetsName && item && item.getAttributeNode('id').nodeValue != id)){ - // all[id] returns all the elements with that name or id inside node - // if theres just one it will return the element, else it will be a collection - children = node.all[id]; - if (!children) return; - if (!children[0]) children = [children]; - for (i = 0; item = children[i++];){ - var idNode = item.getAttributeNode('id'); - if (idNode && idNode.nodeValue == id){ - this.push(item, tag, null, classes, attributes, pseudos); - break; - } - } - return; - } - if (!item){ - // if the context is in the dom we return, else we will try GEBTN, breaking the getById label - if (this.contains(this.root, node)) return; - else break getById; - } else if (this.document !== node && !this.contains(node, item)) return; - this.push(item, tag, null, classes, attributes, pseudos); - return; - } - getByClass: if (classes && node.getElementsByClassName && !this.brokenGEBCN){ - children = node.getElementsByClassName(classList.join(' ')); - if (!(children && children.length)) break getByClass; - for (i = 0; item = children[i++];) this.push(item, tag, id, null, attributes, pseudos); - return; - } - } - getByTag: { - children = node.getElementsByTagName(tag); - if (!(children && children.length)) break getByTag; - if (!this.brokenStarGEBTN) tag = null; - for (i = 0; item = children[i++];) this.push(item, tag, id, classes, attributes, pseudos); - } - }, - - '>': function(node, tag, id, classes, attributes, pseudos){ // direct children - if ((node = node.firstChild)) do { - if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos); - } while ((node = node.nextSibling)); - }, - - '+': function(node, tag, id, classes, attributes, pseudos){ // next sibling - while ((node = node.nextSibling)) if (node.nodeType == 1){ - this.push(node, tag, id, classes, attributes, pseudos); - break; - } - }, - - '^': function(node, tag, id, classes, attributes, pseudos){ // first child - node = node.firstChild; - if (node){ - if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos); - else this['combinator:+'](node, tag, id, classes, attributes, pseudos); - } - }, - - '~': function(node, tag, id, classes, attributes, pseudos){ // next siblings - while ((node = node.nextSibling)){ - if (node.nodeType != 1) continue; - var uid = this.getUID(node); - if (this.bitUniques[uid]) break; - this.bitUniques[uid] = true; - this.push(node, tag, id, classes, attributes, pseudos); - } - }, - - '++': function(node, tag, id, classes, attributes, pseudos){ // next sibling and previous sibling - this['combinator:+'](node, tag, id, classes, attributes, pseudos); - this['combinator:!+'](node, tag, id, classes, attributes, pseudos); - }, - - '~~': function(node, tag, id, classes, attributes, pseudos){ // next siblings and previous siblings - this['combinator:~'](node, tag, id, classes, attributes, pseudos); - this['combinator:!~'](node, tag, id, classes, attributes, pseudos); - }, - - '!': function(node, tag, id, classes, attributes, pseudos){ // all parent nodes up to document - while ((node = node.parentNode)) if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos); - }, - - '!>': function(node, tag, id, classes, attributes, pseudos){ // direct parent (one level) - node = node.parentNode; - if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos); - }, - - '!+': function(node, tag, id, classes, attributes, pseudos){ // previous sibling - while ((node = node.previousSibling)) if (node.nodeType == 1){ - this.push(node, tag, id, classes, attributes, pseudos); - break; - } - }, - - '!^': function(node, tag, id, classes, attributes, pseudos){ // last child - node = node.lastChild; - if (node){ - if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos); - else this['combinator:!+'](node, tag, id, classes, attributes, pseudos); - } - }, - - '!~': function(node, tag, id, classes, attributes, pseudos){ // previous siblings - while ((node = node.previousSibling)){ - if (node.nodeType != 1) continue; - var uid = this.getUID(node); - if (this.bitUniques[uid]) break; - this.bitUniques[uid] = true; - this.push(node, tag, id, classes, attributes, pseudos); - } - } - -}; - -for (var c in combinators) local['combinator:' + c] = combinators[c]; - -var pseudos = { - - /**/ - - 'empty': function(node){ - var child = node.firstChild; - return !(child && child.nodeType == 1) && !(node.innerText || node.textContent || '').length; - }, - - 'not': function(node, expression){ - return !this.matchNode(node, expression); - }, - - 'contains': function(node, text){ - return (node.innerText || node.textContent || '').indexOf(text) > -1; - }, - - 'first-child': function(node){ - while ((node = node.previousSibling)) if (node.nodeType == 1) return false; - return true; - }, - - 'last-child': function(node){ - while ((node = node.nextSibling)) if (node.nodeType == 1) return false; - return true; - }, - - 'only-child': function(node){ - var prev = node; - while ((prev = prev.previousSibling)) if (prev.nodeType == 1) return false; - var next = node; - while ((next = next.nextSibling)) if (next.nodeType == 1) return false; - return true; - }, - - /**/ - - 'nth-child': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTH'), - - 'nth-last-child': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHLast'), - - 'nth-of-type': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTHType', true), - - 'nth-last-of-type': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHTypeLast', true), - - 'index': function(node, index){ - return this['pseudo:nth-child'](node, '' + (index + 1)); - }, - - 'even': function(node){ - return this['pseudo:nth-child'](node, '2n'); - }, - - 'odd': function(node){ - return this['pseudo:nth-child'](node, '2n+1'); - }, - - /**/ - - /**/ - - 'first-of-type': function(node){ - var nodeName = node.nodeName; - while ((node = node.previousSibling)) if (node.nodeName == nodeName) return false; - return true; - }, - - 'last-of-type': function(node){ - var nodeName = node.nodeName; - while ((node = node.nextSibling)) if (node.nodeName == nodeName) return false; - return true; - }, - - 'only-of-type': function(node){ - var prev = node, nodeName = node.nodeName; - while ((prev = prev.previousSibling)) if (prev.nodeName == nodeName) return false; - var next = node; - while ((next = next.nextSibling)) if (next.nodeName == nodeName) return false; - return true; - }, - - /**/ - - // custom pseudos - - 'enabled': function(node){ - return !node.disabled; - }, - - 'disabled': function(node){ - return node.disabled; - }, - - 'checked': function(node){ - return node.checked || node.selected; - }, - - 'focus': function(node){ - return this.isHTMLDocument && this.document.activeElement === node && (node.href || node.type || this.hasAttribute(node, 'tabindex')); - }, - - 'root': function(node){ - return (node === this.root); - }, - - 'selected': function(node){ - return node.selected; - } - - /**/ -}; - -for (var p in pseudos) local['pseudo:' + p] = pseudos[p]; - -// attributes methods - -var attributeGetters = local.attributeGetters = { - - 'for': function(){ - return ('htmlFor' in this) ? this.htmlFor : this.getAttribute('for'); - }, - - 'href': function(){ - return ('href' in this) ? this.getAttribute('href', 2) : this.getAttribute('href'); - }, - - 'style': function(){ - return (this.style) ? this.style.cssText : this.getAttribute('style'); - }, - - 'tabindex': function(){ - var attributeNode = this.getAttributeNode('tabindex'); - return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null; - }, - - 'type': function(){ - return this.getAttribute('type'); - }, - - 'maxlength': function(){ - var attributeNode = this.getAttributeNode('maxLength'); - return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null; - } - -}; - -attributeGetters.MAXLENGTH = attributeGetters.maxLength = attributeGetters.maxlength; - -// Slick - -var Slick = local.Slick = (this.Slick || {}); - -Slick.version = '1.1.7'; - -// Slick finder - -Slick.search = function(context, expression, append){ - return local.search(context, expression, append); -}; - -Slick.find = function(context, expression){ - return local.search(context, expression, null, true); -}; - -// Slick containment checker - -Slick.contains = function(container, node){ - local.setDocument(container); - return local.contains(container, node); -}; - -// Slick attribute getter - -Slick.getAttribute = function(node, name){ - local.setDocument(node); - return local.getAttribute(node, name); -}; - -Slick.hasAttribute = function(node, name){ - local.setDocument(node); - return local.hasAttribute(node, name); -}; - -// Slick matcher - -Slick.match = function(node, selector){ - if (!(node && selector)) return false; - if (!selector || selector === node) return true; - local.setDocument(node); - return local.matchNode(node, selector); -}; - -// Slick attribute accessor - -Slick.defineAttributeGetter = function(name, fn){ - local.attributeGetters[name] = fn; - return this; -}; - -Slick.lookupAttributeGetter = function(name){ - return local.attributeGetters[name]; -}; - -// Slick pseudo accessor - -Slick.definePseudo = function(name, fn){ - local['pseudo:' + name] = function(node, argument){ - return fn.call(node, argument); - }; - return this; -}; - -Slick.lookupPseudo = function(name){ - var pseudo = local['pseudo:' + name]; - if (pseudo) return function(argument){ - return pseudo.call(this, argument); - }; - return null; -}; - -// Slick overrides accessor - -Slick.override = function(regexp, fn){ - local.override(regexp, fn); - return this; -}; - -Slick.isXML = local.isXML; - -Slick.uidOf = function(node){ - return local.getUIDHTML(node); -}; - -if (!this.Slick) this.Slick = Slick; - -}).apply(/**/(typeof exports != 'undefined') ? exports : /**/this); - - -/* ---- - -name: Element - -description: One of the most important items in MooTools. Contains the dollar function, the dollars function, and an handful of cross-browser, time-saver methods to let you easily work with HTML Elements. - -license: MIT-style license. - -requires: [Window, Document, Array, String, Function, Object, Number, Slick.Parser, Slick.Finder] - -provides: [Element, Elements, $, $$, IFrame, Selectors] - -... -*/ - -var Element = this.Element = function(tag, props){ - var konstructor = Element.Constructors[tag]; - if (konstructor) return konstructor(props); - if (typeof tag != 'string') return document.id(tag).set(props); - - if (!props) props = {}; - - if (!(/^[\w-]+$/).test(tag)){ - var parsed = Slick.parse(tag).expressions[0][0]; - tag = (parsed.tag == '*') ? 'div' : parsed.tag; - if (parsed.id && props.id == null) props.id = parsed.id; - - var attributes = parsed.attributes; - if (attributes) for (var attr, i = 0, l = attributes.length; i < l; i++){ - attr = attributes[i]; - if (props[attr.key] != null) continue; - - if (attr.value != null && attr.operator == '=') props[attr.key] = attr.value; - else if (!attr.value && !attr.operator) props[attr.key] = true; - } - - if (parsed.classList && props['class'] == null) props['class'] = parsed.classList.join(' '); - } - - return document.newElement(tag, props); -}; - - -if (Browser.Element){ - Element.prototype = Browser.Element.prototype; - // IE8 and IE9 require the wrapping. - Element.prototype._fireEvent = (function(fireEvent){ - return function(type, event){ - return fireEvent.call(this, type, event); - }; - })(Element.prototype.fireEvent); -} - -new Type('Element', Element).mirror(function(name){ - if (Array.prototype[name]) return; - - var obj = {}; - obj[name] = function(){ - var results = [], args = arguments, elements = true; - for (var i = 0, l = this.length; i < l; i++){ - var element = this[i], result = results[i] = element[name].apply(element, args); - elements = (elements && typeOf(result) == 'element'); - } - return (elements) ? new Elements(results) : results; - }; - - Elements.implement(obj); -}); - -if (!Browser.Element){ - Element.parent = Object; - - Element.Prototype = { - '$constructor': Element, - '$family': Function.from('element').hide() - }; - - Element.mirror(function(name, method){ - Element.Prototype[name] = method; - }); -} - -Element.Constructors = {}; - - - -var IFrame = new Type('IFrame', function(){ - var params = Array.link(arguments, { - properties: Type.isObject, - iframe: function(obj){ - return (obj != null); - } - }); - - var props = params.properties || {}, iframe; - if (params.iframe) iframe = document.id(params.iframe); - var onload = props.onload || function(){}; - delete props.onload; - props.id = props.name = [props.id, props.name, iframe ? (iframe.id || iframe.name) : 'IFrame_' + String.uniqueID()].pick(); - iframe = new Element(iframe || 'iframe', props); - - var onLoad = function(){ - onload.call(iframe.contentWindow); - }; - - if (window.frames[props.id]) onLoad(); - else iframe.addListener('load', onLoad); - return iframe; -}); - -var Elements = this.Elements = function(nodes){ - if (nodes && nodes.length){ - var uniques = {}, node; - for (var i = 0; node = nodes[i++];){ - var uid = Slick.uidOf(node); - if (!uniques[uid]){ - uniques[uid] = true; - this.push(node); - } - } - } -}; - -Elements.prototype = {length: 0}; -Elements.parent = Array; - -new Type('Elements', Elements).implement({ - - filter: function(filter, bind){ - if (!filter) return this; - return new Elements(Array.filter(this, (typeOf(filter) == 'string') ? function(item){ - return item.match(filter); - } : filter, bind)); - }.protect(), - - push: function(){ - var length = this.length; - for (var i = 0, l = arguments.length; i < l; i++){ - var item = document.id(arguments[i]); - if (item) this[length++] = item; - } - return (this.length = length); - }.protect(), - - unshift: function(){ - var items = []; - for (var i = 0, l = arguments.length; i < l; i++){ - var item = document.id(arguments[i]); - if (item) items.push(item); - } - return Array.prototype.unshift.apply(this, items); - }.protect(), - - concat: function(){ - var newElements = new Elements(this); - for (var i = 0, l = arguments.length; i < l; i++){ - var item = arguments[i]; - if (Type.isEnumerable(item)) newElements.append(item); - else newElements.push(item); - } - return newElements; - }.protect(), - - append: function(collection){ - for (var i = 0, l = collection.length; i < l; i++) this.push(collection[i]); - return this; - }.protect(), - - empty: function(){ - while (this.length) delete this[--this.length]; - return this; - }.protect() - -}); - - - -(function(){ - -// FF, IE -var splice = Array.prototype.splice, object = {'0': 0, '1': 1, length: 2}; - -splice.call(object, 1, 1); -if (object[1] == 1) Elements.implement('splice', function(){ - var length = this.length; - var result = splice.apply(this, arguments); - while (length >= this.length) delete this[length--]; - return result; -}.protect()); - -Array.forEachMethod(function(method, name){ - Elements.implement(name, method); -}); - -Array.mirror(Elements); - -/**/ -var createElementAcceptsHTML; -try { - createElementAcceptsHTML = (document.createElement('').name == 'x'); -} catch (e){} - -var escapeQuotes = function(html){ - return ('' + html).replace(/&/g, '&').replace(/"/g, '"'); -}; -/**/ - -Document.implement({ - - newElement: function(tag, props){ - if (props && props.checked != null) props.defaultChecked = props.checked; - /**/// Fix for readonly name and type properties in IE < 8 - if (createElementAcceptsHTML && props){ - tag = '<' + tag; - if (props.name) tag += ' name="' + escapeQuotes(props.name) + '"'; - if (props.type) tag += ' type="' + escapeQuotes(props.type) + '"'; - tag += '>'; - delete props.name; - delete props.type; - } - /**/ - return this.id(this.createElement(tag)).set(props); - } - -}); - -})(); - -(function(){ - -Slick.uidOf(window); -Slick.uidOf(document); - -Document.implement({ - - newTextNode: function(text){ - return this.createTextNode(text); - }, - - getDocument: function(){ - return this; - }, - - getWindow: function(){ - return this.window; - }, - - id: (function(){ - - var types = { - - string: function(id, nocash, doc){ - id = Slick.find(doc, '#' + id.replace(/(\W)/g, '\\$1')); - return (id) ? types.element(id, nocash) : null; - }, - - element: function(el, nocash){ - Slick.uidOf(el); - if (!nocash && !el.$family && !(/^(?:object|embed)$/i).test(el.tagName)){ - var fireEvent = el.fireEvent; - // wrapping needed in IE7, or else crash - el._fireEvent = function(type, event){ - return fireEvent(type, event); - }; - Object.append(el, Element.Prototype); - } - return el; - }, - - object: function(obj, nocash, doc){ - if (obj.toElement) return types.element(obj.toElement(doc), nocash); - return null; - } - - }; - - types.textnode = types.whitespace = types.window = types.document = function(zero){ - return zero; - }; - - return function(el, nocash, doc){ - if (el && el.$family && el.uniqueNumber) return el; - var type = typeOf(el); - return (types[type]) ? types[type](el, nocash, doc || document) : null; - }; - - })() - -}); - -if (window.$ == null) Window.implement('$', function(el, nc){ - return document.id(el, nc, this.document); -}); - -Window.implement({ - - getDocument: function(){ - return this.document; - }, - - getWindow: function(){ - return this; - } - -}); - -[Document, Element].invoke('implement', { - - getElements: function(expression){ - return Slick.search(this, expression, new Elements); - }, - - getElement: function(expression){ - return document.id(Slick.find(this, expression)); - } - -}); - -var contains = {contains: function(element){ - return Slick.contains(this, element); -}}; - -if (!document.contains) Document.implement(contains); -if (!document.createElement('div').contains) Element.implement(contains); - - - -// tree walking - -var injectCombinator = function(expression, combinator){ - if (!expression) return combinator; - - expression = Object.clone(Slick.parse(expression)); - - var expressions = expression.expressions; - for (var i = expressions.length; i--;) - expressions[i][0].combinator = combinator; - - return expression; -}; - -Object.forEach({ - getNext: '~', - getPrevious: '!~', - getParent: '!' -}, function(combinator, method){ - Element.implement(method, function(expression){ - return this.getElement(injectCombinator(expression, combinator)); - }); -}); - -Object.forEach({ - getAllNext: '~', - getAllPrevious: '!~', - getSiblings: '~~', - getChildren: '>', - getParents: '!' -}, function(combinator, method){ - Element.implement(method, function(expression){ - return this.getElements(injectCombinator(expression, combinator)); - }); -}); - -Element.implement({ - - getFirst: function(expression){ - return document.id(Slick.search(this, injectCombinator(expression, '>'))[0]); - }, - - getLast: function(expression){ - return document.id(Slick.search(this, injectCombinator(expression, '>')).getLast()); - }, - - getWindow: function(){ - return this.ownerDocument.window; - }, - - getDocument: function(){ - return this.ownerDocument; - }, - - getElementById: function(id){ - return document.id(Slick.find(this, '#' + ('' + id).replace(/(\W)/g, '\\$1'))); - }, - - match: function(expression){ - return !expression || Slick.match(this, expression); - } - -}); - - - -if (window.$$ == null) Window.implement('$$', function(selector){ - if (arguments.length == 1){ - if (typeof selector == 'string') return Slick.search(this.document, selector, new Elements); - else if (Type.isEnumerable(selector)) return new Elements(selector); - } - return new Elements(arguments); -}); - -// Inserters - -var inserters = { - - before: function(context, element){ - var parent = element.parentNode; - if (parent) parent.insertBefore(context, element); - }, - - after: function(context, element){ - var parent = element.parentNode; - if (parent) parent.insertBefore(context, element.nextSibling); - }, - - bottom: function(context, element){ - element.appendChild(context); - }, - - top: function(context, element){ - element.insertBefore(context, element.firstChild); - } - -}; - -inserters.inside = inserters.bottom; - - - -// getProperty / setProperty - -var propertyGetters = {}, propertySetters = {}; - -// properties - -var properties = {}; -Array.forEach([ - 'type', 'value', 'defaultValue', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan', - 'frameBorder', 'rowSpan', 'tabIndex', 'useMap' -], function(property){ - properties[property.toLowerCase()] = property; -}); - -properties.html = 'innerHTML'; -properties.text = (document.createElement('div').textContent == null) ? 'innerText': 'textContent'; - -Object.forEach(properties, function(real, key){ - propertySetters[key] = function(node, value){ - node[real] = value; - }; - propertyGetters[key] = function(node){ - return node[real]; - }; -}); - -// Booleans - -var bools = [ - 'compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked', - 'disabled', 'readOnly', 'multiple', 'selected', 'noresize', - 'defer', 'defaultChecked', 'autofocus', 'controls', 'autoplay', - 'loop' -]; - -var booleans = {}; -Array.forEach(bools, function(bool){ - var lower = bool.toLowerCase(); - booleans[lower] = bool; - propertySetters[lower] = function(node, value){ - node[bool] = !!value; - }; - propertyGetters[lower] = function(node){ - return !!node[bool]; - }; -}); - -// Special cases - -Object.append(propertySetters, { - - 'class': function(node, value){ - ('className' in node) ? node.className = (value || '') : node.setAttribute('class', value); - }, - - 'for': function(node, value){ - ('htmlFor' in node) ? node.htmlFor = value : node.setAttribute('for', value); - }, - - 'style': function(node, value){ - (node.style) ? node.style.cssText = value : node.setAttribute('style', value); - }, - - 'value': function(node, value){ - node.value = (value != null) ? value : ''; - } - -}); - -propertyGetters['class'] = function(node){ - return ('className' in node) ? node.className || null : node.getAttribute('class'); -}; - -/* */ -var el = document.createElement('button'); -// IE sets type as readonly and throws -try { el.type = 'button'; } catch(e){} -if (el.type != 'button') propertySetters.type = function(node, value){ - node.setAttribute('type', value); -}; -el = null; -/* */ - -/**/ -var input = document.createElement('input'); -input.value = 't'; -input.type = 'submit'; -if (input.value != 't') propertySetters.type = function(node, type){ - var value = node.value; - node.type = type; - node.value = value; -}; -input = null; -/**/ - -/* getProperty, setProperty */ - -/* */ -var pollutesGetAttribute = (function(div){ - div.random = 'attribute'; - return (div.getAttribute('random') == 'attribute'); -})(document.createElement('div')); - -var hasCloneBug = (function(test){ - test.innerHTML = ''; - return test.cloneNode(true).firstChild.childNodes.length != 1; -})(document.createElement('div')); -/* */ - -var hasClassList = !!document.createElement('div').classList; - -var classes = function(className){ - var classNames = (className || '').clean().split(" "), uniques = {}; - return classNames.filter(function(className){ - if (className !== "" && !uniques[className]) return uniques[className] = className; - }); -}; - -var addToClassList = function(name){ - this.classList.add(name); -}; - -var removeFromClassList = function(name){ - this.classList.remove(name); -}; - -Element.implement({ - - setProperty: function(name, value){ - var setter = propertySetters[name.toLowerCase()]; - if (setter){ - setter(this, value); - } else { - /* */ - var attributeWhiteList; - if (pollutesGetAttribute) attributeWhiteList = this.retrieve('$attributeWhiteList', {}); - /* */ - - if (value == null){ - this.removeAttribute(name); - /* */ - if (pollutesGetAttribute) delete attributeWhiteList[name]; - /* */ - } else { - this.setAttribute(name, '' + value); - /* */ - if (pollutesGetAttribute) attributeWhiteList[name] = true; - /* */ - } - } - return this; - }, - - setProperties: function(attributes){ - for (var attribute in attributes) this.setProperty(attribute, attributes[attribute]); - return this; - }, - - getProperty: function(name){ - var getter = propertyGetters[name.toLowerCase()]; - if (getter) return getter(this); - /* */ - if (pollutesGetAttribute){ - var attr = this.getAttributeNode(name), attributeWhiteList = this.retrieve('$attributeWhiteList', {}); - if (!attr) return null; - if (attr.expando && !attributeWhiteList[name]){ - var outer = this.outerHTML; - // segment by the opening tag and find mention of attribute name - if (outer.substr(0, outer.search(/\/?['"]?>(?![^<]*<['"])/)).indexOf(name) < 0) return null; - attributeWhiteList[name] = true; - } - } - /* */ - var result = Slick.getAttribute(this, name); - return (!result && !Slick.hasAttribute(this, name)) ? null : result; - }, - - getProperties: function(){ - var args = Array.from(arguments); - return args.map(this.getProperty, this).associate(args); - }, - - removeProperty: function(name){ - return this.setProperty(name, null); - }, - - removeProperties: function(){ - Array.each(arguments, this.removeProperty, this); - return this; - }, - - set: function(prop, value){ - var property = Element.Properties[prop]; - (property && property.set) ? property.set.call(this, value) : this.setProperty(prop, value); - }.overloadSetter(), - - get: function(prop){ - var property = Element.Properties[prop]; - return (property && property.get) ? property.get.apply(this) : this.getProperty(prop); - }.overloadGetter(), - - erase: function(prop){ - var property = Element.Properties[prop]; - (property && property.erase) ? property.erase.apply(this) : this.removeProperty(prop); - return this; - }, - - hasClass: hasClassList ? function(className){ - return this.classList.contains(className); - } : function(className){ - return this.className.clean().contains(className, ' '); - }, - - addClass: hasClassList ? function(className){ - classes(className).forEach(addToClassList, this); - return this; - } : function(className){ - this.className = classes(className + ' ' + this.className).join(' '); - return this; - }, - - removeClass: hasClassList ? function(className){ - classes(className).forEach(removeFromClassList, this); - return this; - } : function(className){ - var classNames = classes(this.className); - classes(className).forEach(classNames.erase, classNames); - this.className = classNames.join(' '); - return this; - }, - - toggleClass: function(className, force){ - if (force == null) force = !this.hasClass(className); - return (force) ? this.addClass(className) : this.removeClass(className); - }, - - adopt: function(){ - var parent = this, fragment, elements = Array.flatten(arguments), length = elements.length; - if (length > 1) parent = fragment = document.createDocumentFragment(); - - for (var i = 0; i < length; i++){ - var element = document.id(elements[i], true); - if (element) parent.appendChild(element); - } - - if (fragment) this.appendChild(fragment); - - return this; - }, - - appendText: function(text, where){ - return this.grab(this.getDocument().newTextNode(text), where); - }, - - grab: function(el, where){ - inserters[where || 'bottom'](document.id(el, true), this); - return this; - }, - - inject: function(el, where){ - inserters[where || 'bottom'](this, document.id(el, true)); - return this; - }, - - replaces: function(el){ - el = document.id(el, true); - el.parentNode.replaceChild(this, el); - return this; - }, - - wraps: function(el, where){ - el = document.id(el, true); - return this.replaces(el).grab(el, where); - }, - - getSelected: function(){ - this.selectedIndex; // Safari 3.2.1 - return new Elements(Array.from(this.options).filter(function(option){ - return option.selected; - })); - }, - - toQueryString: function(){ - var queryString = []; - this.getElements('input, select, textarea').each(function(el){ - var type = el.type; - if (!el.name || el.disabled || type == 'submit' || type == 'reset' || type == 'file' || type == 'image') return; - - var value = (el.get('tag') == 'select') ? el.getSelected().map(function(opt){ - // IE - return document.id(opt).get('value'); - }) : ((type == 'radio' || type == 'checkbox') && !el.checked) ? null : el.get('value'); - - Array.from(value).each(function(val){ - if (typeof val != 'undefined') queryString.push(encodeURIComponent(el.name) + '=' + encodeURIComponent(val)); - }); - }); - return queryString.join('&'); - } - -}); - - -// appendHTML - -var appendInserters = { - before: 'beforeBegin', - after: 'afterEnd', - bottom: 'beforeEnd', - top: 'afterBegin', - inside: 'beforeEnd' -}; - -Element.implement('appendHTML', ('insertAdjacentHTML' in document.createElement('div')) ? function(html, where){ - this.insertAdjacentHTML(appendInserters[where || 'bottom'], html); - return this; -} : function(html, where){ - var temp = new Element('div', {html: html}), - children = temp.childNodes, - fragment = temp.firstChild; - - if (!fragment) return this; - if (children.length > 1){ - fragment = document.createDocumentFragment(); - for (var i = 0, l = children.length; i < l; i++){ - fragment.appendChild(children[i]); - } - } - - inserters[where || 'bottom'](fragment, this); - return this; -}); - -var collected = {}, storage = {}; - -var get = function(uid){ - return (storage[uid] || (storage[uid] = {})); -}; - -var clean = function(item){ - var uid = item.uniqueNumber; - if (item.removeEvents) item.removeEvents(); - if (item.clearAttributes) item.clearAttributes(); - if (uid != null){ - delete collected[uid]; - delete storage[uid]; - } - return item; -}; - -var formProps = {input: 'checked', option: 'selected', textarea: 'value'}; - -Element.implement({ - - destroy: function(){ - var children = clean(this).getElementsByTagName('*'); - Array.each(children, clean); - Element.dispose(this); - return null; - }, - - empty: function(){ - Array.from(this.childNodes).each(Element.dispose); - return this; - }, - - dispose: function(){ - return (this.parentNode) ? this.parentNode.removeChild(this) : this; - }, - - clone: function(contents, keepid){ - contents = contents !== false; - var clone = this.cloneNode(contents), ce = [clone], te = [this], i; - - if (contents){ - ce.append(Array.from(clone.getElementsByTagName('*'))); - te.append(Array.from(this.getElementsByTagName('*'))); - } - - for (i = ce.length; i--;){ - var node = ce[i], element = te[i]; - if (!keepid) node.removeAttribute('id'); - /**/ - if (node.clearAttributes){ - node.clearAttributes(); - node.mergeAttributes(element); - node.removeAttribute('uniqueNumber'); - if (node.options){ - var no = node.options, eo = element.options; - for (var j = no.length; j--;) no[j].selected = eo[j].selected; - } - } - /**/ - var prop = formProps[element.tagName.toLowerCase()]; - if (prop && element[prop]) node[prop] = element[prop]; - } - - /**/ - if (hasCloneBug){ - var co = clone.getElementsByTagName('object'), to = this.getElementsByTagName('object'); - for (i = co.length; i--;) co[i].outerHTML = to[i].outerHTML; - } - /**/ - return document.id(clone); - } - -}); - -[Element, Window, Document].invoke('implement', { - - addListener: function(type, fn){ - if (window.attachEvent && !window.addEventListener){ - collected[Slick.uidOf(this)] = this; - } - if (this.addEventListener) this.addEventListener(type, fn, !!arguments[2]); - else this.attachEvent('on' + type, fn); - return this; - }, - - removeListener: function(type, fn){ - if (this.removeEventListener) this.removeEventListener(type, fn, !!arguments[2]); - else this.detachEvent('on' + type, fn); - return this; - }, - - retrieve: function(property, dflt){ - var storage = get(Slick.uidOf(this)), prop = storage[property]; - if (dflt != null && prop == null) prop = storage[property] = dflt; - return prop != null ? prop : null; - }, - - store: function(property, value){ - var storage = get(Slick.uidOf(this)); - storage[property] = value; - return this; - }, - - eliminate: function(property){ - var storage = get(Slick.uidOf(this)); - delete storage[property]; - return this; - } - -}); - -/**/ -if (window.attachEvent && !window.addEventListener){ - var gc = function(){ - Object.each(collected, clean); - if (window.CollectGarbage) CollectGarbage(); - window.removeListener('unload', gc); - } - window.addListener('unload', gc); -} -/**/ - -Element.Properties = {}; - - - -Element.Properties.style = { - - set: function(style){ - this.style.cssText = style; - }, - - get: function(){ - return this.style.cssText; - }, - - erase: function(){ - this.style.cssText = ''; - } - -}; - -Element.Properties.tag = { - - get: function(){ - return this.tagName.toLowerCase(); - } - -}; - -Element.Properties.html = { - - set: function(html){ - if (html == null) html = ''; - else if (typeOf(html) == 'array') html = html.join(''); - this.innerHTML = html; - }, - - erase: function(){ - this.innerHTML = ''; - } - -}; - -var supportsHTML5Elements = true, supportsTableInnerHTML = true, supportsTRInnerHTML = true; - -/**/ -// technique by jdbarlett - http://jdbartlett.com/innershiv/ -var div = document.createElement('div'); -div.innerHTML = ''; -supportsHTML5Elements = (div.childNodes.length == 1); -if (!supportsHTML5Elements){ - var tags = 'abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' '), - fragment = document.createDocumentFragment(), l = tags.length; - while (l--) fragment.createElement(tags[l]); -} -div = null; -/**/ - -/**/ -supportsTableInnerHTML = Function.attempt(function(){ - var table = document.createElement('table'); - table.innerHTML = ''; - return true; -}); - -/**/ -var tr = document.createElement('tr'), html = ''; -tr.innerHTML = html; -supportsTRInnerHTML = (tr.innerHTML == html); -tr = null; -/**/ - -if (!supportsTableInnerHTML || !supportsTRInnerHTML || !supportsHTML5Elements){ - - Element.Properties.html.set = (function(set){ - - var translations = { - table: [1, '', '
      '], - select: [1, ''], - tbody: [2, '', '
      '], - tr: [3, '', '
      '] - }; - - translations.thead = translations.tfoot = translations.tbody; - - return function(html){ - var wrap = translations[this.get('tag')]; - if (!wrap && !supportsHTML5Elements) wrap = [0, '', '']; - if (!wrap) return set.call(this, html); - - var level = wrap[0], wrapper = document.createElement('div'), target = wrapper; - if (!supportsHTML5Elements) fragment.appendChild(wrapper); - wrapper.innerHTML = [wrap[1], html, wrap[2]].flatten().join(''); - while (level--) target = target.firstChild; - this.empty().adopt(target.childNodes); - if (!supportsHTML5Elements) fragment.removeChild(wrapper); - wrapper = null; - }; - - })(Element.Properties.html.set); -} -/*
      */ - -/**/ -var testForm = document.createElement('form'); -testForm.innerHTML = ''; - -if (testForm.firstChild.value != 's') Element.Properties.value = { - - set: function(value){ - var tag = this.get('tag'); - if (tag != 'select') return this.setProperty('value', value); - var options = this.getElements('option'); - value = String(value); - for (var i = 0; i < options.length; i++){ - var option = options[i], - attr = option.getAttributeNode('value'), - optionValue = (attr && attr.specified) ? option.value : option.get('text'); - if (optionValue === value) return option.selected = true; - } - }, - - get: function(){ - var option = this, tag = option.get('tag'); - - if (tag != 'select' && tag != 'option') return this.getProperty('value'); - - if (tag == 'select' && !(option = option.getSelected()[0])) return ''; - - var attr = option.getAttributeNode('value'); - return (attr && attr.specified) ? option.value : option.get('text'); - } - -}; -testForm = null; -/**/ - -/**/ -if (document.createElement('div').getAttributeNode('id')) Element.Properties.id = { - set: function(id){ - this.id = this.getAttributeNode('id').value = id; - }, - get: function(){ - return this.id || null; - }, - erase: function(){ - this.id = this.getAttributeNode('id').value = ''; - } -}; -/**/ - -})(); - - -/* ---- - -name: Element.Style - -description: Contains methods for interacting with the styles of Elements in a fashionable way. - -license: MIT-style license. - -requires: Element - -provides: Element.Style - -... -*/ - -(function(){ - -var html = document.html, el; - -// -// Check for oldIE, which does not remove styles when they're set to null -el = document.createElement('div'); -el.style.color = 'red'; -el.style.color = null; -var doesNotRemoveStyles = el.style.color == 'red'; - -// check for oldIE, which returns border* shorthand styles in the wrong order (color-width-style instead of width-style-color) -var border = '1px solid #123abc'; -el.style.border = border; -var returnsBordersInWrongOrder = el.style.border != border; -el = null; -// - -var hasGetComputedStyle = !!window.getComputedStyle; - -Element.Properties.styles = {set: function(styles){ - this.setStyles(styles); -}}; - -var hasOpacity = (html.style.opacity != null), - hasFilter = (html.style.filter != null), - reAlpha = /alpha\(opacity=([\d.]+)\)/i; - -var setVisibility = function(element, opacity){ - element.store('$opacity', opacity); - element.style.visibility = opacity > 0 || opacity == null ? 'visible' : 'hidden'; -}; - -// -var setFilter = function(element, regexp, value){ - var style = element.style, - filter = style.filter || element.getComputedStyle('filter') || ''; - style.filter = (regexp.test(filter) ? filter.replace(regexp, value) : filter + ' ' + value).trim(); - if (!style.filter) style.removeAttribute('filter'); -}; -// - -var setOpacity = (hasOpacity ? function(element, opacity){ - element.style.opacity = opacity; -} : (hasFilter ? function(element, opacity){ - if (!element.currentStyle || !element.currentStyle.hasLayout) element.style.zoom = 1; - if (opacity == null || opacity == 1){ - setFilter(element, reAlpha, ''); - if (opacity == 1 && getOpacity(element) != 1) setFilter(element, reAlpha, 'alpha(opacity=100)'); - } else { - setFilter(element, reAlpha, 'alpha(opacity=' + (opacity * 100).limit(0, 100).round() + ')'); - } -} : setVisibility)); - -var getOpacity = (hasOpacity ? function(element){ - var opacity = element.style.opacity || element.getComputedStyle('opacity'); - return (opacity == '') ? 1 : opacity.toFloat(); -} : (hasFilter ? function(element){ - var filter = (element.style.filter || element.getComputedStyle('filter')), - opacity; - if (filter) opacity = filter.match(reAlpha); - return (opacity == null || filter == null) ? 1 : (opacity[1] / 100); -} : function(element){ - var opacity = element.retrieve('$opacity'); - if (opacity == null) opacity = (element.style.visibility == 'hidden' ? 0 : 1); - return opacity; -})); - -var floatName = (html.style.cssFloat == null) ? 'styleFloat' : 'cssFloat', - namedPositions = {left: '0%', top: '0%', center: '50%', right: '100%', bottom: '100%'}, - hasBackgroundPositionXY = (html.style.backgroundPositionX != null); - -// -var removeStyle = function(style, property){ - if (property == 'backgroundPosition'){ - style.removeAttribute(property + 'X'); - property += 'Y'; - } - style.removeAttribute(property); -}; -// - -Element.implement({ - - getComputedStyle: function(property){ - if (!hasGetComputedStyle && this.currentStyle) return this.currentStyle[property.camelCase()]; - var defaultView = Element.getDocument(this).defaultView, - computed = defaultView ? defaultView.getComputedStyle(this, null) : null; - return (computed) ? computed.getPropertyValue((property == floatName) ? 'float' : property.hyphenate()) : ''; - }, - - setStyle: function(property, value){ - if (property == 'opacity'){ - if (value != null) value = parseFloat(value); - setOpacity(this, value); - return this; - } - property = (property == 'float' ? floatName : property).camelCase(); - if (typeOf(value) != 'string'){ - var map = (Element.Styles[property] || '@').split(' '); - value = Array.from(value).map(function(val, i){ - if (!map[i]) return ''; - return (typeOf(val) == 'number') ? map[i].replace('@', Math.round(val)) : val; - }).join(' '); - } else if (value == String(Number(value))){ - value = Math.round(value); - } - this.style[property] = value; - // - if ((value == '' || value == null) && doesNotRemoveStyles && this.style.removeAttribute){ - removeStyle(this.style, property); - } - // - return this; - }, - - getStyle: function(property){ - if (property == 'opacity') return getOpacity(this); - property = (property == 'float' ? floatName : property).camelCase(); - var result = this.style[property]; - if (!result || property == 'zIndex'){ - if (Element.ShortStyles.hasOwnProperty(property)){ - result = []; - for (var s in Element.ShortStyles[property]) result.push(this.getStyle(s)); - return result.join(' '); - } - result = this.getComputedStyle(property); - } - if (hasBackgroundPositionXY && /^backgroundPosition[XY]?$/.test(property)){ - return result.replace(/(top|right|bottom|left)/g, function(position){ - return namedPositions[position]; - }) || '0px'; - } - if (!result && property == 'backgroundPosition') return '0px 0px'; - if (result){ - result = String(result); - var color = result.match(/rgba?\([\d\s,]+\)/); - if (color) result = result.replace(color[0], color[0].rgbToHex()); - } - if (!hasGetComputedStyle && !this.style[property]){ - if ((/^(height|width)$/).test(property) && !(/px$/.test(result))){ - var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0; - values.each(function(value){ - size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt(); - }, this); - return this['offset' + property.capitalize()] - size + 'px'; - } - if ((/^border(.+)Width|margin|padding/).test(property) && isNaN(parseFloat(result))){ - return '0px'; - } - } - // - if (returnsBordersInWrongOrder && /^border(Top|Right|Bottom|Left)?$/.test(property) && /^#/.test(result)){ - return result.replace(/^(.+)\s(.+)\s(.+)$/, '$2 $3 $1'); - } - // - return result; - }, - - setStyles: function(styles){ - for (var style in styles) this.setStyle(style, styles[style]); - return this; - }, - - getStyles: function(){ - var result = {}; - Array.flatten(arguments).each(function(key){ - result[key] = this.getStyle(key); - }, this); - return result; - } - -}); - -Element.Styles = { - left: '@px', top: '@px', bottom: '@px', right: '@px', - width: '@px', height: '@px', maxWidth: '@px', maxHeight: '@px', minWidth: '@px', minHeight: '@px', - backgroundColor: 'rgb(@, @, @)', backgroundSize: '@px', backgroundPosition: '@px @px', color: 'rgb(@, @, @)', - fontSize: '@px', letterSpacing: '@px', lineHeight: '@px', clip: 'rect(@px @px @px @px)', - margin: '@px @px @px @px', padding: '@px @px @px @px', border: '@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)', - borderWidth: '@px @px @px @px', borderStyle: '@ @ @ @', borderColor: 'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)', - zIndex: '@', 'zoom': '@', fontWeight: '@', textIndent: '@px', opacity: '@' -}; - - - - - -Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, borderStyle: {}, borderColor: {}}; - -['Top', 'Right', 'Bottom', 'Left'].each(function(direction){ - var Short = Element.ShortStyles; - var All = Element.Styles; - ['margin', 'padding'].each(function(style){ - var sd = style + direction; - Short[style][sd] = All[sd] = '@px'; - }); - var bd = 'border' + direction; - Short.border[bd] = All[bd] = '@px @ rgb(@, @, @)'; - var bdw = bd + 'Width', bds = bd + 'Style', bdc = bd + 'Color'; - Short[bd] = {}; - Short.borderWidth[bdw] = Short[bd][bdw] = All[bdw] = '@px'; - Short.borderStyle[bds] = Short[bd][bds] = All[bds] = '@'; - Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)'; -}); - -if (hasBackgroundPositionXY) Element.ShortStyles.backgroundPosition = {backgroundPositionX: '@', backgroundPositionY: '@'}; -})(); - - -/* ---- - -name: Element.Event - -description: Contains Element methods for dealing with events. This file also includes mouseenter and mouseleave custom Element Events, if necessary. - -license: MIT-style license. - -requires: [Element, Event] - -provides: Element.Event - -... -*/ - -(function(){ - -Element.Properties.events = {set: function(events){ - this.addEvents(events); -}}; - -[Element, Window, Document].invoke('implement', { - - addEvent: function(type, fn){ - var events = this.retrieve('events', {}); - if (!events[type]) events[type] = {keys: [], values: []}; - if (events[type].keys.contains(fn)) return this; - events[type].keys.push(fn); - var realType = type, - custom = Element.Events[type], - condition = fn, - self = this; - if (custom){ - if (custom.onAdd) custom.onAdd.call(this, fn, type); - if (custom.condition){ - condition = function(event){ - if (custom.condition.call(this, event, type)) return fn.call(this, event); - return true; - }; - } - if (custom.base) realType = Function.from(custom.base).call(this, type); - } - var defn = function(){ - return fn.call(self); - }; - var nativeEvent = Element.NativeEvents[realType]; - if (nativeEvent){ - if (nativeEvent == 2){ - defn = function(event){ - event = new DOMEvent(event, self.getWindow()); - if (condition.call(self, event) === false) event.stop(); - }; - } - this.addListener(realType, defn, arguments[2]); - } - events[type].values.push(defn); - return this; - }, - - removeEvent: function(type, fn){ - var events = this.retrieve('events'); - if (!events || !events[type]) return this; - var list = events[type]; - var index = list.keys.indexOf(fn); - if (index == -1) return this; - var value = list.values[index]; - delete list.keys[index]; - delete list.values[index]; - var custom = Element.Events[type]; - if (custom){ - if (custom.onRemove) custom.onRemove.call(this, fn, type); - if (custom.base) type = Function.from(custom.base).call(this, type); - } - return (Element.NativeEvents[type]) ? this.removeListener(type, value, arguments[2]) : this; - }, - - addEvents: function(events){ - for (var event in events) this.addEvent(event, events[event]); - return this; - }, - - removeEvents: function(events){ - var type; - if (typeOf(events) == 'object'){ - for (type in events) this.removeEvent(type, events[type]); - return this; - } - var attached = this.retrieve('events'); - if (!attached) return this; - if (!events){ - for (type in attached) this.removeEvents(type); - this.eliminate('events'); - } else if (attached[events]){ - attached[events].keys.each(function(fn){ - this.removeEvent(events, fn); - }, this); - delete attached[events]; - } - return this; - }, - - fireEvent: function(type, args, delay){ - var events = this.retrieve('events'); - if (!events || !events[type]) return this; - args = Array.from(args); - - events[type].keys.each(function(fn){ - if (delay) fn.delay(delay, this, args); - else fn.apply(this, args); - }, this); - return this; - }, - - cloneEvents: function(from, type){ - from = document.id(from); - var events = from.retrieve('events'); - if (!events) return this; - if (!type){ - for (var eventType in events) this.cloneEvents(from, eventType); - } else if (events[type]){ - events[type].keys.each(function(fn){ - this.addEvent(type, fn); - }, this); - } - return this; - } - -}); - -Element.NativeEvents = { - click: 2, dblclick: 2, mouseup: 2, mousedown: 2, contextmenu: 2, //mouse buttons - mousewheel: 2, DOMMouseScroll: 2, //mouse wheel - mouseover: 2, mouseout: 2, mousemove: 2, selectstart: 2, selectend: 2, //mouse movement - keydown: 2, keypress: 2, keyup: 2, //keyboard - orientationchange: 2, // mobile - touchstart: 2, touchmove: 2, touchend: 2, touchcancel: 2, // touch - gesturestart: 2, gesturechange: 2, gestureend: 2, // gesture - focus: 2, blur: 2, change: 2, reset: 2, select: 2, submit: 2, paste: 2, input: 2, //form elements - load: 2, unload: 1, beforeunload: 2, resize: 1, move: 1, DOMContentLoaded: 1, readystatechange: 1, //window - hashchange: 1, popstate: 2, // history - error: 1, abort: 1, scroll: 1 //misc -}; - -Element.Events = { - mousewheel: { - base: 'onwheel' in document ? 'wheel' : 'onmousewheel' in document ? 'mousewheel' : 'DOMMouseScroll' - } -}; - -var check = function(event){ - var related = event.relatedTarget; - if (related == null) return true; - if (!related) return false; - return (related != this && related.prefix != 'xul' && typeOf(this) != 'document' && !this.contains(related)); -}; - -if ('onmouseenter' in document.documentElement){ - Element.NativeEvents.mouseenter = Element.NativeEvents.mouseleave = 2; - Element.MouseenterCheck = check; -} else { - Element.Events.mouseenter = { - base: 'mouseover', - condition: check - }; - - Element.Events.mouseleave = { - base: 'mouseout', - condition: check - }; -} - -/**/ -if (!window.addEventListener){ - Element.NativeEvents.propertychange = 2; - Element.Events.change = { - base: function(){ - var type = this.type; - return (this.get('tag') == 'input' && (type == 'radio' || type == 'checkbox')) ? 'propertychange' : 'change'; - }, - condition: function(event){ - return event.type != 'propertychange' || event.event.propertyName == 'checked'; - } - }; -} -/**/ - - - -})(); - - -/* ---- - -name: Element.Delegation - -description: Extends the Element native object to include the delegate method for more efficient event management. - -license: MIT-style license. - -requires: [Element.Event] - -provides: [Element.Delegation] - -... -*/ - -(function(){ - -var eventListenerSupport = !!window.addEventListener; - -Element.NativeEvents.focusin = Element.NativeEvents.focusout = 2; - -var bubbleUp = function(self, match, fn, event, target){ - while (target && target != self){ - if (match(target, event)) return fn.call(target, event, target); - target = document.id(target.parentNode); - } -}; - -var map = { - mouseenter: { - base: 'mouseover', - condition: Element.MouseenterCheck - }, - mouseleave: { - base: 'mouseout', - condition: Element.MouseenterCheck - }, - focus: { - base: 'focus' + (eventListenerSupport ? '' : 'in'), - capture: true - }, - blur: { - base: eventListenerSupport ? 'blur' : 'focusout', - capture: true - } -}; - -/**/ -var _key = '$delegation:'; -var formObserver = function(type){ - - return { - - base: 'focusin', - - remove: function(self, uid){ - var list = self.retrieve(_key + type + 'listeners', {})[uid]; - if (list && list.forms) for (var i = list.forms.length; i--;){ - list.forms[i].removeEvent(type, list.fns[i]); - } - }, - - listen: function(self, match, fn, event, target, uid){ - var form = (target.get('tag') == 'form') ? target : event.target.getParent('form'); - if (!form) return; - - var listeners = self.retrieve(_key + type + 'listeners', {}), - listener = listeners[uid] || {forms: [], fns: []}, - forms = listener.forms, fns = listener.fns; - - if (forms.indexOf(form) != -1) return; - forms.push(form); - - var _fn = function(event){ - bubbleUp(self, match, fn, event, target); - }; - form.addEvent(type, _fn); - fns.push(_fn); - - listeners[uid] = listener; - self.store(_key + type + 'listeners', listeners); - } - }; -}; - -var inputObserver = function(type){ - return { - base: 'focusin', - listen: function(self, match, fn, event, target){ - var events = {blur: function(){ - this.removeEvents(events); - }}; - events[type] = function(event){ - bubbleUp(self, match, fn, event, target); - }; - event.target.addEvents(events); - } - }; -}; - -if (!eventListenerSupport) Object.append(map, { - submit: formObserver('submit'), - reset: formObserver('reset'), - change: inputObserver('change'), - select: inputObserver('select') -}); -/**/ - -var proto = Element.prototype, - addEvent = proto.addEvent, - removeEvent = proto.removeEvent; - -var relay = function(old, method){ - return function(type, fn, useCapture){ - if (type.indexOf(':relay') == -1) return old.call(this, type, fn, useCapture); - var parsed = Slick.parse(type).expressions[0][0]; - if (parsed.pseudos[0].key != 'relay') return old.call(this, type, fn, useCapture); - var newType = parsed.tag; - parsed.pseudos.slice(1).each(function(pseudo){ - newType += ':' + pseudo.key + (pseudo.value ? '(' + pseudo.value + ')' : ''); - }); - old.call(this, type, fn); - return method.call(this, newType, parsed.pseudos[0].value, fn); - }; -}; - -var delegation = { - - addEvent: function(type, match, fn){ - var storage = this.retrieve('$delegates', {}), stored = storage[type]; - if (stored) for (var _uid in stored){ - if (stored[_uid].fn == fn && stored[_uid].match == match) return this; - } - - var _type = type, _match = match, _fn = fn, _map = map[type] || {}; - type = _map.base || _type; - - match = function(target){ - return Slick.match(target, _match); - }; - - var elementEvent = Element.Events[_type]; - if (_map.condition || elementEvent && elementEvent.condition){ - var __match = match, condition = _map.condition || elementEvent.condition; - match = function(target, event){ - return __match(target, event) && condition.call(target, event, type); - }; - } - - var self = this, uid = String.uniqueID(); - var delegator = _map.listen ? function(event, target){ - if (!target && event && event.target) target = event.target; - if (target) _map.listen(self, match, fn, event, target, uid); - } : function(event, target){ - if (!target && event && event.target) target = event.target; - if (target) bubbleUp(self, match, fn, event, target); - }; - - if (!stored) stored = {}; - stored[uid] = { - match: _match, - fn: _fn, - delegator: delegator - }; - storage[_type] = stored; - return addEvent.call(this, type, delegator, _map.capture); - }, - - removeEvent: function(type, match, fn, _uid){ - var storage = this.retrieve('$delegates', {}), stored = storage[type]; - if (!stored) return this; - - if (_uid){ - var _type = type, delegator = stored[_uid].delegator, _map = map[type] || {}; - type = _map.base || _type; - if (_map.remove) _map.remove(this, _uid); - delete stored[_uid]; - storage[_type] = stored; - return removeEvent.call(this, type, delegator, _map.capture); - } - - var __uid, s; - if (fn) for (__uid in stored){ - s = stored[__uid]; - if (s.match == match && s.fn == fn) return delegation.removeEvent.call(this, type, match, fn, __uid); - } else for (__uid in stored){ - s = stored[__uid]; - if (s.match == match) delegation.removeEvent.call(this, type, match, s.fn, __uid); - } - return this; - } - -}; - -[Element, Window, Document].invoke('implement', { - addEvent: relay(addEvent, delegation.addEvent), - removeEvent: relay(removeEvent, delegation.removeEvent) -}); - -})(); - - -/* ---- - -name: Element.Dimensions - -description: Contains methods to work with size, scroll, or positioning of Elements and the window object. - -license: MIT-style license. - -credits: - - Element positioning based on the [qooxdoo](http://qooxdoo.org/) code and smart browser fixes, [LGPL License](http://www.gnu.org/licenses/lgpl.html). - - Viewport dimensions based on [YUI](http://developer.yahoo.com/yui/) code, [BSD License](http://developer.yahoo.com/yui/license.html). - -requires: [Element, Element.Style] - -provides: [Element.Dimensions] - -... -*/ - -(function(){ - -var element = document.createElement('div'), - child = document.createElement('div'); -element.style.height = '0'; -element.appendChild(child); -var brokenOffsetParent = (child.offsetParent === element); -element = child = null; - -var isOffset = function(el){ - return styleString(el, 'position') != 'static' || isBody(el); -}; - -var isOffsetStatic = function(el){ - return isOffset(el) || (/^(?:table|td|th)$/i).test(el.tagName); -}; - -Element.implement({ - - scrollTo: function(x, y){ - if (isBody(this)){ - this.getWindow().scrollTo(x, y); - } else { - this.scrollLeft = x; - this.scrollTop = y; - } - return this; - }, - - getSize: function(){ - if (isBody(this)) return this.getWindow().getSize(); - return {x: this.offsetWidth, y: this.offsetHeight}; - }, - - getScrollSize: function(){ - if (isBody(this)) return this.getWindow().getScrollSize(); - return {x: this.scrollWidth, y: this.scrollHeight}; - }, - - getScroll: function(){ - if (isBody(this)) return this.getWindow().getScroll(); - return {x: this.scrollLeft, y: this.scrollTop}; - }, - - getScrolls: function(){ - var element = this.parentNode, position = {x: 0, y: 0}; - while (element && !isBody(element)){ - position.x += element.scrollLeft; - position.y += element.scrollTop; - element = element.parentNode; - } - return position; - }, - - getOffsetParent: brokenOffsetParent ? function(){ - var element = this; - if (isBody(element) || styleString(element, 'position') == 'fixed') return null; - - var isOffsetCheck = (styleString(element, 'position') == 'static') ? isOffsetStatic : isOffset; - while ((element = element.parentNode)){ - if (isOffsetCheck(element)) return element; - } - return null; - } : function(){ - var element = this; - if (isBody(element) || styleString(element, 'position') == 'fixed') return null; - - try { - return element.offsetParent; - } catch(e) {} - return null; - }, - - getOffsets: function(){ - var hasGetBoundingClientRect = this.getBoundingClientRect; - - if (hasGetBoundingClientRect){ - var bound = this.getBoundingClientRect(), - html = document.id(this.getDocument().documentElement), - htmlScroll = html.getScroll(), - elemScrolls = this.getScrolls(), - isFixed = (styleString(this, 'position') == 'fixed'); - - return { - x: bound.left.toInt() + elemScrolls.x + ((isFixed) ? 0 : htmlScroll.x) - html.clientLeft, - y: bound.top.toInt() + elemScrolls.y + ((isFixed) ? 0 : htmlScroll.y) - html.clientTop - }; - } - - var element = this, position = {x: 0, y: 0}; - if (isBody(this)) return position; - - while (element && !isBody(element)){ - position.x += element.offsetLeft; - position.y += element.offsetTop; - - element = element.offsetParent; - } - - return position; - }, - - getPosition: function(relative){ - var offset = this.getOffsets(), - scroll = this.getScrolls(); - var position = { - x: offset.x - scroll.x, - y: offset.y - scroll.y - }; - - if (relative && (relative = document.id(relative))){ - var relativePosition = relative.getPosition(); - return {x: position.x - relativePosition.x - leftBorder(relative), y: position.y - relativePosition.y - topBorder(relative)}; - } - return position; - }, - - getCoordinates: function(element){ - if (isBody(this)) return this.getWindow().getCoordinates(); - var position = this.getPosition(element), - size = this.getSize(); - var obj = { - left: position.x, - top: position.y, - width: size.x, - height: size.y - }; - obj.right = obj.left + obj.width; - obj.bottom = obj.top + obj.height; - return obj; - }, - - computePosition: function(obj){ - return { - left: obj.x - styleNumber(this, 'margin-left'), - top: obj.y - styleNumber(this, 'margin-top') - }; - }, - - setPosition: function(obj){ - return this.setStyles(this.computePosition(obj)); - } - -}); - - -[Document, Window].invoke('implement', { - - getSize: function(){ - var doc = getCompatElement(this); - return {x: doc.clientWidth, y: doc.clientHeight}; - }, - - getScroll: function(){ - var win = this.getWindow(), doc = getCompatElement(this); - return {x: win.pageXOffset || doc.scrollLeft, y: win.pageYOffset || doc.scrollTop}; - }, - - getScrollSize: function(){ - var doc = getCompatElement(this), - min = this.getSize(), - body = this.getDocument().body; - - return {x: Math.max(doc.scrollWidth, body.scrollWidth, min.x), y: Math.max(doc.scrollHeight, body.scrollHeight, min.y)}; - }, - - getPosition: function(){ - return {x: 0, y: 0}; - }, - - getCoordinates: function(){ - var size = this.getSize(); - return {top: 0, left: 0, bottom: size.y, right: size.x, height: size.y, width: size.x}; - } - -}); - -// private methods - -var styleString = Element.getComputedStyle; - -function styleNumber(element, style){ - return styleString(element, style).toInt() || 0; -} - -function borderBox(element){ - return styleString(element, '-moz-box-sizing') == 'border-box'; -} - -function topBorder(element){ - return styleNumber(element, 'border-top-width'); -} - -function leftBorder(element){ - return styleNumber(element, 'border-left-width'); -} - -function isBody(element){ - return (/^(?:body|html)$/i).test(element.tagName); -} - -function getCompatElement(element){ - var doc = element.getDocument(); - return (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body; -} - -})(); - -//aliases -Element.alias({position: 'setPosition'}); //compatability - -[Window, Document, Element].invoke('implement', { - - getHeight: function(){ - return this.getSize().y; - }, - - getWidth: function(){ - return this.getSize().x; - }, - - getScrollTop: function(){ - return this.getScroll().y; - }, - - getScrollLeft: function(){ - return this.getScroll().x; - }, - - getScrollHeight: function(){ - return this.getScrollSize().y; - }, - - getScrollWidth: function(){ - return this.getScrollSize().x; - }, - - getTop: function(){ - return this.getPosition().y; - }, - - getLeft: function(){ - return this.getPosition().x; - } - -}); - - -/* ---- - -name: Fx - -description: Contains the basic animation logic to be extended by all other Fx Classes. - -license: MIT-style license. - -requires: [Chain, Events, Options] - -provides: Fx - -... -*/ - -(function(){ - -var Fx = this.Fx = new Class({ - - Implements: [Chain, Events, Options], - - options: { - /* - onStart: nil, - onCancel: nil, - onComplete: nil, - */ - fps: 60, - unit: false, - duration: 500, - frames: null, - frameSkip: true, - link: 'ignore' - }, - - initialize: function(options){ - this.subject = this.subject || this; - this.setOptions(options); - }, - - getTransition: function(){ - return function(p){ - return -(Math.cos(Math.PI * p) - 1) / 2; - }; - }, - - step: function(now){ - if (this.options.frameSkip){ - var diff = (this.time != null) ? (now - this.time) : 0, frames = diff / this.frameInterval; - this.time = now; - this.frame += frames; - } else { - this.frame++; - } - - if (this.frame < this.frames){ - var delta = this.transition(this.frame / this.frames); - this.set(this.compute(this.from, this.to, delta)); - } else { - this.frame = this.frames; - this.set(this.compute(this.from, this.to, 1)); - this.stop(); - } - }, - - set: function(now){ - return now; - }, - - compute: function(from, to, delta){ - return Fx.compute(from, to, delta); - }, - - check: function(){ - if (!this.isRunning()) return true; - switch (this.options.link){ - case 'cancel': this.cancel(); return true; - case 'chain': this.chain(this.caller.pass(arguments, this)); return false; - } - return false; - }, - - start: function(from, to){ - if (!this.check(from, to)) return this; - this.from = from; - this.to = to; - this.frame = (this.options.frameSkip) ? 0 : -1; - this.time = null; - this.transition = this.getTransition(); - var frames = this.options.frames, fps = this.options.fps, duration = this.options.duration; - this.duration = Fx.Durations[duration] || duration.toInt(); - this.frameInterval = 1000 / fps; - this.frames = frames || Math.round(this.duration / this.frameInterval); - this.fireEvent('start', this.subject); - pushInstance.call(this, fps); - return this; - }, - - stop: function(){ - if (this.isRunning()){ - this.time = null; - pullInstance.call(this, this.options.fps); - if (this.frames == this.frame){ - this.fireEvent('complete', this.subject); - if (!this.callChain()) this.fireEvent('chainComplete', this.subject); - } else { - this.fireEvent('stop', this.subject); - } - } - return this; - }, - - cancel: function(){ - if (this.isRunning()){ - this.time = null; - pullInstance.call(this, this.options.fps); - this.frame = this.frames; - this.fireEvent('cancel', this.subject).clearChain(); - } - return this; - }, - - pause: function(){ - if (this.isRunning()){ - this.time = null; - pullInstance.call(this, this.options.fps); - } - return this; - }, - - resume: function(){ - if (this.isPaused()) pushInstance.call(this, this.options.fps); - return this; - }, - - isRunning: function(){ - var list = instances[this.options.fps]; - return list && list.contains(this); - }, - - isPaused: function(){ - return (this.frame < this.frames) && !this.isRunning(); - } - -}); - -Fx.compute = function(from, to, delta){ - return (to - from) * delta + from; -}; - -Fx.Durations = {'short': 250, 'normal': 500, 'long': 1000}; - -// global timers - -var instances = {}, timers = {}; - -var loop = function(){ - var now = Date.now(); - for (var i = this.length; i--;){ - var instance = this[i]; - if (instance) instance.step(now); - } -}; - -var pushInstance = function(fps){ - var list = instances[fps] || (instances[fps] = []); - list.push(this); - if (!timers[fps]) timers[fps] = loop.periodical(Math.round(1000 / fps), list); -}; - -var pullInstance = function(fps){ - var list = instances[fps]; - if (list){ - list.erase(this); - if (!list.length && timers[fps]){ - delete instances[fps]; - timers[fps] = clearInterval(timers[fps]); - } - } -}; - -})(); - - -/* ---- - -name: Fx.CSS - -description: Contains the CSS animation logic. Used by Fx.Tween, Fx.Morph, Fx.Elements. - -license: MIT-style license. - -requires: [Fx, Element.Style] - -provides: Fx.CSS - -... -*/ - -Fx.CSS = new Class({ - - Extends: Fx, - - //prepares the base from/to object - - prepare: function(element, property, values){ - values = Array.from(values); - var from = values[0], to = values[1]; - if (to == null){ - to = from; - from = element.getStyle(property); - var unit = this.options.unit; - // adapted from: https://github.com/ryanmorr/fx/blob/master/fx.js#L299 - if (unit && from && typeof from == 'string' && from.slice(-unit.length) != unit && parseFloat(from) != 0){ - element.setStyle(property, to + unit); - var value = element.getComputedStyle(property); - // IE and Opera support pixelLeft or pixelWidth - if (!(/px$/.test(value))){ - value = element.style[('pixel-' + property).camelCase()]; - if (value == null){ - // adapted from Dean Edwards' http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - var left = element.style.left; - element.style.left = to + unit; - value = element.style.pixelLeft; - element.style.left = left; - } - } - from = (to || 1) / (parseFloat(value) || 1) * (parseFloat(from) || 0); - element.setStyle(property, from + unit); - } - } - return {from: this.parse(from), to: this.parse(to)}; - }, - - //parses a value into an array - - parse: function(value){ - value = Function.from(value)(); - value = (typeof value == 'string') ? value.split(' ') : Array.from(value); - return value.map(function(val){ - val = String(val); - var found = false; - Object.each(Fx.CSS.Parsers, function(parser, key){ - if (found) return; - var parsed = parser.parse(val); - if (parsed || parsed === 0) found = {value: parsed, parser: parser}; - }); - found = found || {value: val, parser: Fx.CSS.Parsers.String}; - return found; - }); - }, - - //computes by a from and to prepared objects, using their parsers. - - compute: function(from, to, delta){ - var computed = []; - (Math.min(from.length, to.length)).times(function(i){ - computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser}); - }); - computed.$family = Function.from('fx:css:value'); - return computed; - }, - - //serves the value as settable - - serve: function(value, unit){ - if (typeOf(value) != 'fx:css:value') value = this.parse(value); - var returned = []; - value.each(function(bit){ - returned = returned.concat(bit.parser.serve(bit.value, unit)); - }); - return returned; - }, - - //renders the change to an element - - render: function(element, property, value, unit){ - element.setStyle(property, this.serve(value, unit)); - }, - - //searches inside the page css to find the values for a selector - - search: function(selector){ - if (Fx.CSS.Cache[selector]) return Fx.CSS.Cache[selector]; - var to = {}, selectorTest = new RegExp('^' + selector.escapeRegExp() + '$'); - - var searchStyles = function(rules){ - Array.each(rules, function(rule, i){ - if (rule.media){ - searchStyles(rule.rules || rule.cssRules); - return; - } - if (!rule.style) return; - var selectorText = (rule.selectorText) ? rule.selectorText.replace(/^\w+/, function(m){ - return m.toLowerCase(); - }) : null; - if (!selectorText || !selectorTest.test(selectorText)) return; - Object.each(Element.Styles, function(value, style){ - if (!rule.style[style] || Element.ShortStyles[style]) return; - value = String(rule.style[style]); - to[style] = ((/^rgb/).test(value)) ? value.rgbToHex() : value; - }); - }); - }; - - Array.each(document.styleSheets, function(sheet, j){ - var href = sheet.href; - if (href && href.indexOf('://') > -1 && href.indexOf(document.domain) == -1) return; - var rules = sheet.rules || sheet.cssRules; - searchStyles(rules); - }); - return Fx.CSS.Cache[selector] = to; - } - -}); - -Fx.CSS.Cache = {}; - -Fx.CSS.Parsers = { - - Color: { - parse: function(value){ - if (value.match(/^#[0-9a-f]{3,6}$/i)) return value.hexToRgb(true); - return ((value = value.match(/(\d+),\s*(\d+),\s*(\d+)/))) ? [value[1], value[2], value[3]] : false; - }, - compute: function(from, to, delta){ - return from.map(function(value, i){ - return Math.round(Fx.compute(from[i], to[i], delta)); - }); - }, - serve: function(value){ - return value.map(Number); - } - }, - - Number: { - parse: parseFloat, - compute: Fx.compute, - serve: function(value, unit){ - return (unit) ? value + unit : value; - } - }, - - String: { - parse: Function.from(false), - compute: function(zero, one){ - return one; - }, - serve: function(zero){ - return zero; - } - } - -}; - - - - -/* ---- - -name: Fx.Tween - -description: Formerly Fx.Style, effect to transition any CSS property for an element. - -license: MIT-style license. - -requires: Fx.CSS - -provides: [Fx.Tween, Element.fade, Element.highlight] - -... -*/ - -Fx.Tween = new Class({ - - Extends: Fx.CSS, - - initialize: function(element, options){ - this.element = this.subject = document.id(element); - this.parent(options); - }, - - set: function(property, now){ - if (arguments.length == 1){ - now = property; - property = this.property || this.options.property; - } - this.render(this.element, property, now, this.options.unit); - return this; - }, - - start: function(property, from, to){ - if (!this.check(property, from, to)) return this; - var args = Array.flatten(arguments); - this.property = this.options.property || args.shift(); - var parsed = this.prepare(this.element, this.property, args); - return this.parent(parsed.from, parsed.to); - } - -}); - -Element.Properties.tween = { - - set: function(options){ - this.get('tween').cancel().setOptions(options); - return this; - }, - - get: function(){ - var tween = this.retrieve('tween'); - if (!tween){ - tween = new Fx.Tween(this, {link: 'cancel'}); - this.store('tween', tween); - } - return tween; - } - -}; - -Element.implement({ - - tween: function(property, from, to){ - this.get('tween').start(property, from, to); - return this; - }, - - fade: function(how){ - var fade = this.get('tween'), method, args = ['opacity'].append(arguments), toggle; - if (args[1] == null) args[1] = 'toggle'; - switch (args[1]){ - case 'in': method = 'start'; args[1] = 1; break; - case 'out': method = 'start'; args[1] = 0; break; - case 'show': method = 'set'; args[1] = 1; break; - case 'hide': method = 'set'; args[1] = 0; break; - case 'toggle': - var flag = this.retrieve('fade:flag', this.getStyle('opacity') == 1); - method = 'start'; - args[1] = flag ? 0 : 1; - this.store('fade:flag', !flag); - toggle = true; - break; - default: method = 'start'; - } - if (!toggle) this.eliminate('fade:flag'); - fade[method].apply(fade, args); - var to = args[args.length - 1]; - if (method == 'set' || to != 0) this.setStyle('visibility', to == 0 ? 'hidden' : 'visible'); - else fade.chain(function(){ - this.element.setStyle('visibility', 'hidden'); - this.callChain(); - }); - return this; - }, - - highlight: function(start, end){ - if (!end){ - end = this.retrieve('highlight:original', this.getStyle('background-color')); - end = (end == 'transparent') ? '#fff' : end; - } - var tween = this.get('tween'); - tween.start('background-color', start || '#ffff88', end).chain(function(){ - this.setStyle('background-color', this.retrieve('highlight:original')); - tween.callChain(); - }.bind(this)); - return this; - } - -}); - - -/* ---- - -name: Fx.Morph - -description: Formerly Fx.Styles, effect to transition any number of CSS properties for an element using an object of rules, or CSS based selector rules. - -license: MIT-style license. - -requires: Fx.CSS - -provides: Fx.Morph - -... -*/ - -Fx.Morph = new Class({ - - Extends: Fx.CSS, - - initialize: function(element, options){ - this.element = this.subject = document.id(element); - this.parent(options); - }, - - set: function(now){ - if (typeof now == 'string') now = this.search(now); - for (var p in now) this.render(this.element, p, now[p], this.options.unit); - return this; - }, - - compute: function(from, to, delta){ - var now = {}; - for (var p in from) now[p] = this.parent(from[p], to[p], delta); - return now; - }, - - start: function(properties){ - if (!this.check(properties)) return this; - if (typeof properties == 'string') properties = this.search(properties); - var from = {}, to = {}; - for (var p in properties){ - var parsed = this.prepare(this.element, p, properties[p]); - from[p] = parsed.from; - to[p] = parsed.to; - } - return this.parent(from, to); - } - -}); - -Element.Properties.morph = { - - set: function(options){ - this.get('morph').cancel().setOptions(options); - return this; - }, - - get: function(){ - var morph = this.retrieve('morph'); - if (!morph){ - morph = new Fx.Morph(this, {link: 'cancel'}); - this.store('morph', morph); - } - return morph; - } - -}; - -Element.implement({ - - morph: function(props){ - this.get('morph').start(props); - return this; - } - -}); - - -/* ---- - -name: Fx.Transitions - -description: Contains a set of advanced transitions to be used with any of the Fx Classes. - -license: MIT-style license. - -credits: - - Easing Equations by Robert Penner, , modified and optimized to be used with MooTools. - -requires: Fx - -provides: Fx.Transitions - -... -*/ - -Fx.implement({ - - getTransition: function(){ - var trans = this.options.transition || Fx.Transitions.Sine.easeInOut; - if (typeof trans == 'string'){ - var data = trans.split(':'); - trans = Fx.Transitions; - trans = trans[data[0]] || trans[data[0].capitalize()]; - if (data[1]) trans = trans['ease' + data[1].capitalize() + (data[2] ? data[2].capitalize() : '')]; - } - return trans; - } - -}); - -Fx.Transition = function(transition, params){ - params = Array.from(params); - var easeIn = function(pos){ - return transition(pos, params); - }; - return Object.append(easeIn, { - easeIn: easeIn, - easeOut: function(pos){ - return 1 - transition(1 - pos, params); - }, - easeInOut: function(pos){ - return (pos <= 0.5 ? transition(2 * pos, params) : (2 - transition(2 * (1 - pos), params))) / 2; - } - }); -}; - -Fx.Transitions = { - - linear: function(zero){ - return zero; - } - -}; - - - -Fx.Transitions.extend = function(transitions){ - for (var transition in transitions) Fx.Transitions[transition] = new Fx.Transition(transitions[transition]); -}; - -Fx.Transitions.extend({ - - Pow: function(p, x){ - return Math.pow(p, x && x[0] || 6); - }, - - Expo: function(p){ - return Math.pow(2, 8 * (p - 1)); - }, - - Circ: function(p){ - return 1 - Math.sin(Math.acos(p)); - }, - - Sine: function(p){ - return 1 - Math.cos(p * Math.PI / 2); - }, - - Back: function(p, x){ - x = x && x[0] || 1.618; - return Math.pow(p, 2) * ((x + 1) * p - x); - }, - - Bounce: function(p){ - var value; - for (var a = 0, b = 1; 1; a += b, b /= 2){ - if (p >= (7 - 4 * a) / 11){ - value = b * b - Math.pow((11 - 6 * a - 11 * p) / 4, 2); - break; - } - } - return value; - }, - - Elastic: function(p, x){ - return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x && x[0] || 1) / 3); - } - -}); - -['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){ - Fx.Transitions[transition] = new Fx.Transition(function(p){ - return Math.pow(p, i + 2); - }); -}); - - -/* ---- - -name: Request - -description: Powerful all purpose Request Class. Uses XMLHTTPRequest. - -license: MIT-style license. - -requires: [Object, Element, Chain, Events, Options, Browser] - -provides: Request - -... -*/ - -(function(){ - -var empty = function(){}, - progressSupport = ('onprogress' in new Browser.Request); - -var Request = this.Request = new Class({ - - Implements: [Chain, Events, Options], - - options: {/* - onRequest: function(){}, - onLoadstart: function(event, xhr){}, - onProgress: function(event, xhr){}, - onComplete: function(){}, - onCancel: function(){}, - onSuccess: function(responseText, responseXML){}, - onFailure: function(xhr){}, - onException: function(headerName, value){}, - onTimeout: function(){}, - user: '', - password: '',*/ - url: '', - data: '', - headers: { - 'X-Requested-With': 'XMLHttpRequest', - 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' - }, - async: true, - format: false, - method: 'post', - link: 'ignore', - isSuccess: null, - emulation: true, - urlEncoded: true, - encoding: 'utf-8', - evalScripts: false, - evalResponse: false, - timeout: 0, - noCache: false - }, - - initialize: function(options){ - this.xhr = new Browser.Request(); - this.setOptions(options); - this.headers = this.options.headers; - }, - - onStateChange: function(){ - var xhr = this.xhr; - if (xhr.readyState != 4 || !this.running) return; - this.running = false; - this.status = 0; - Function.attempt(function(){ - var status = xhr.status; - this.status = (status == 1223) ? 204 : status; - }.bind(this)); - xhr.onreadystatechange = empty; - if (progressSupport) xhr.onprogress = xhr.onloadstart = empty; - clearTimeout(this.timer); - - this.response = {text: this.xhr.responseText || '', xml: this.xhr.responseXML}; - if (this.options.isSuccess.call(this, this.status)) - this.success(this.response.text, this.response.xml); - else - this.failure(); - }, - - isSuccess: function(){ - var status = this.status; - return (status >= 200 && status < 300); - }, - - isRunning: function(){ - return !!this.running; - }, - - processScripts: function(text){ - if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader('Content-type'))) return Browser.exec(text); - return text.stripScripts(this.options.evalScripts); - }, - - success: function(text, xml){ - this.onSuccess(this.processScripts(text), xml); - }, - - onSuccess: function(){ - this.fireEvent('complete', arguments).fireEvent('success', arguments).callChain(); - }, - - failure: function(){ - this.onFailure(); - }, - - onFailure: function(){ - this.fireEvent('complete').fireEvent('failure', this.xhr); - }, - - loadstart: function(event){ - this.fireEvent('loadstart', [event, this.xhr]); - }, - - progress: function(event){ - this.fireEvent('progress', [event, this.xhr]); - }, - - timeout: function(){ - this.fireEvent('timeout', this.xhr); - }, - - setHeader: function(name, value){ - this.headers[name] = value; - return this; - }, - - getHeader: function(name){ - return Function.attempt(function(){ - return this.xhr.getResponseHeader(name); - }.bind(this)); - }, - - check: function(){ - if (!this.running) return true; - switch (this.options.link){ - case 'cancel': this.cancel(); return true; - case 'chain': this.chain(this.caller.pass(arguments, this)); return false; - } - return false; - }, - - send: function(options){ - if (!this.check(options)) return this; - - this.options.isSuccess = this.options.isSuccess || this.isSuccess; - this.running = true; - - var type = typeOf(options); - if (type == 'string' || type == 'element') options = {data: options}; - - var old = this.options; - options = Object.append({data: old.data, url: old.url, method: old.method}, options); - var data = options.data, url = String(options.url), method = options.method.toLowerCase(); - - switch (typeOf(data)){ - case 'element': data = document.id(data).toQueryString(); break; - case 'object': case 'hash': data = Object.toQueryString(data); - } - - if (this.options.format){ - var format = 'format=' + this.options.format; - data = (data) ? format + '&' + data : format; - } - - if (this.options.emulation && !['get', 'post'].contains(method)){ - var _method = '_method=' + method; - data = (data) ? _method + '&' + data : _method; - method = 'post'; - } - - if (this.options.urlEncoded && ['post', 'put'].contains(method)){ - var encoding = (this.options.encoding) ? '; charset=' + this.options.encoding : ''; - this.headers['Content-type'] = 'application/x-www-form-urlencoded' + encoding; - } - - if (!url) url = document.location.pathname; - - var trimPosition = url.lastIndexOf('/'); - if (trimPosition > -1 && (trimPosition = url.indexOf('#')) > -1) url = url.substr(0, trimPosition); - - if (this.options.noCache) - url += (url.indexOf('?') > -1 ? '&' : '?') + String.uniqueID(); - - if (data && (method == 'get' || method == 'delete')){ - url += (url.indexOf('?') > -1 ? '&' : '?') + data; - data = null; - } - - var xhr = this.xhr; - if (progressSupport){ - xhr.onloadstart = this.loadstart.bind(this); - xhr.onprogress = this.progress.bind(this); - } - - xhr.open(method.toUpperCase(), url, this.options.async, this.options.user, this.options.password); - if (this.options.user && 'withCredentials' in xhr) xhr.withCredentials = true; - - xhr.onreadystatechange = this.onStateChange.bind(this); - - Object.each(this.headers, function(value, key){ - try { - xhr.setRequestHeader(key, value); - } catch (e){ - this.fireEvent('exception', [key, value]); - } - }, this); - - this.fireEvent('request'); - xhr.send(data); - if (!this.options.async) this.onStateChange(); - else if (this.options.timeout) this.timer = this.timeout.delay(this.options.timeout, this); - return this; - }, - - cancel: function(){ - if (!this.running) return this; - this.running = false; - var xhr = this.xhr; - xhr.abort(); - clearTimeout(this.timer); - xhr.onreadystatechange = empty; - if (progressSupport) xhr.onprogress = xhr.onloadstart = empty; - this.xhr = new Browser.Request(); - this.fireEvent('cancel'); - return this; - } - -}); - -var methods = {}; -['get', 'post', 'put', 'delete', 'GET', 'POST', 'PUT', 'DELETE'].each(function(method){ - methods[method] = function(data){ - var object = { - method: method - }; - if (data != null) object.data = data; - return this.send(object); - }; -}); - -Request.implement(methods); - -Element.Properties.send = { - - set: function(options){ - var send = this.get('send').cancel(); - send.setOptions(options); - return this; - }, - - get: function(){ - var send = this.retrieve('send'); - if (!send){ - send = new Request({ - data: this, link: 'cancel', method: this.get('method') || 'post', url: this.get('action') - }); - this.store('send', send); - } - return send; - } - -}; - -Element.implement({ - - send: function(url){ - var sender = this.get('send'); - sender.send({data: this, url: url || sender.options.url}); - return this; - } - -}); - -})(); - - -/* ---- - -name: Request.HTML - -description: Extends the basic Request Class with additional methods for interacting with HTML responses. - -license: MIT-style license. - -requires: [Element, Request] - -provides: Request.HTML - -... -*/ - -Request.HTML = new Class({ - - Extends: Request, - - options: { - update: false, - append: false, - evalScripts: true, - filter: false, - headers: { - Accept: 'text/html, application/xml, text/xml, */*' - } - }, - - success: function(text){ - var options = this.options, response = this.response; - - response.html = text.stripScripts(function(script){ - response.javascript = script; - }); - - var match = response.html.match(/]*>([\s\S]*?)<\/body>/i); - if (match) response.html = match[1]; - var temp = new Element('div').set('html', response.html); - - response.tree = temp.childNodes; - response.elements = temp.getElements(options.filter || '*'); - - if (options.filter) response.tree = response.elements; - if (options.update){ - var update = document.id(options.update).empty(); - if (options.filter) update.adopt(response.elements); - else update.set('html', response.html); - } else if (options.append){ - var append = document.id(options.append); - if (options.filter) response.elements.reverse().inject(append); - else append.adopt(temp.getChildren()); - } - if (options.evalScripts) Browser.exec(response.javascript); - - this.onSuccess(response.tree, response.elements, response.html, response.javascript); - } - -}); - -Element.Properties.load = { - - set: function(options){ - var load = this.get('load').cancel(); - load.setOptions(options); - return this; - }, - - get: function(){ - var load = this.retrieve('load'); - if (!load){ - load = new Request.HTML({data: this, link: 'cancel', update: this, method: 'get'}); - this.store('load', load); - } - return load; - } - -}; - -Element.implement({ - - load: function(){ - this.get('load').send(Array.link(arguments, {data: Type.isObject, url: Type.isString})); - return this; - } - -}); - - -/* ---- - -name: JSON - -description: JSON encoder and decoder. - -license: MIT-style license. - -SeeAlso: - -requires: [Array, String, Number, Function] - -provides: JSON - -... -*/ - -if (typeof JSON == 'undefined') this.JSON = {}; - - - -(function(){ - -var special = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'}; - -var escape = function(chr){ - return special[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16)).slice(-4); -}; - -JSON.validate = function(string){ - string = string.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@'). - replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'). - replace(/(?:^|:|,)(?:\s*\[)+/g, ''); - - return (/^[\],:{}\s]*$/).test(string); -}; - -JSON.encode = JSON.stringify ? function(obj){ - return JSON.stringify(obj); -} : function(obj){ - if (obj && obj.toJSON) obj = obj.toJSON(); - - switch (typeOf(obj)){ - case 'string': - return '"' + obj.replace(/[\x00-\x1f\\"]/g, escape) + '"'; - case 'array': - return '[' + obj.map(JSON.encode).clean() + ']'; - case 'object': case 'hash': - var string = []; - Object.each(obj, function(value, key){ - var json = JSON.encode(value); - if (json) string.push(JSON.encode(key) + ':' + json); - }); - return '{' + string + '}'; - case 'number': case 'boolean': return '' + obj; - case 'null': return 'null'; - } - - return null; -}; - -JSON.secure = true; - - -JSON.decode = function(string, secure){ - if (!string || typeOf(string) != 'string') return null; - - if (secure == null) secure = JSON.secure; - if (secure){ - if (JSON.parse) return JSON.parse(string); - if (!JSON.validate(string)) throw new Error('JSON could not decode the input; security is enabled and the value is not secure.'); - } - - return eval('(' + string + ')'); -}; - -})(); - - -/* ---- - -name: Request.JSON - -description: Extends the basic Request Class with additional methods for sending and receiving JSON data. - -license: MIT-style license. - -requires: [Request, JSON] - -provides: Request.JSON - -... -*/ - -Request.JSON = new Class({ - - Extends: Request, - - options: { - /*onError: function(text, error){},*/ - secure: true - }, - - initialize: function(options){ - this.parent(options); - Object.append(this.headers, { - 'Accept': 'application/json', - 'X-Request': 'JSON' - }); - }, - - success: function(text){ - var json; - try { - json = this.response.json = JSON.decode(text, this.options.secure); - } catch (error){ - this.fireEvent('error', [text, error]); - return; - } - if (json == null) this.onFailure(); - else this.onSuccess(json, text); - } - -}); - - -/* ---- - -name: Cookie - -description: Class for creating, reading, and deleting browser Cookies. - -license: MIT-style license. - -credits: - - Based on the functions by Peter-Paul Koch (http://quirksmode.org). - -requires: [Options, Browser] - -provides: Cookie - -... -*/ - -var Cookie = new Class({ - - Implements: Options, - - options: { - path: '/', - domain: false, - duration: false, - secure: false, - document: document, - encode: true - }, - - initialize: function(key, options){ - this.key = key; - this.setOptions(options); - }, - - write: function(value){ - if (this.options.encode) value = encodeURIComponent(value); - if (this.options.domain) value += '; domain=' + this.options.domain; - if (this.options.path) value += '; path=' + this.options.path; - if (this.options.duration){ - var date = new Date(); - date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000); - value += '; expires=' + date.toGMTString(); - } - if (this.options.secure) value += '; secure'; - this.options.document.cookie = this.key + '=' + value; - return this; - }, - - read: function(){ - var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key.escapeRegExp() + '=([^;]*)'); - return (value) ? decodeURIComponent(value[1]) : null; - }, - - dispose: function(){ - new Cookie(this.key, Object.merge({}, this.options, {duration: -1})).write(''); - return this; - } - -}); - -Cookie.write = function(key, value, options){ - return new Cookie(key, options).write(value); -}; - -Cookie.read = function(key){ - return new Cookie(key).read(); -}; - -Cookie.dispose = function(key, options){ - return new Cookie(key, options).dispose(); -}; - - -/* ---- - -name: DOMReady - -description: Contains the custom event domready. - -license: MIT-style license. - -requires: [Browser, Element, Element.Event] - -provides: [DOMReady, DomReady] - -... -*/ - -(function(window, document){ - -var ready, - loaded, - checks = [], - shouldPoll, - timer, - testElement = document.createElement('div'); - -var domready = function(){ - clearTimeout(timer); - if (ready) return; - Browser.loaded = ready = true; - document.removeListener('DOMContentLoaded', domready).removeListener('readystatechange', check); - - document.fireEvent('domready'); - window.fireEvent('domready'); -}; - -var check = function(){ - for (var i = checks.length; i--;) if (checks[i]()){ - domready(); - return true; - } - return false; -}; - -var poll = function(){ - clearTimeout(timer); - if (!check()) timer = setTimeout(poll, 10); -}; - -document.addListener('DOMContentLoaded', domready); - -/**/ -// doScroll technique by Diego Perini http://javascript.nwbox.com/IEContentLoaded/ -// testElement.doScroll() throws when the DOM is not ready, only in the top window -var doScrollWorks = function(){ - try { - testElement.doScroll(); - return true; - } catch (e){} - return false; -}; -// If doScroll works already, it can't be used to determine domready -// e.g. in an iframe -if (testElement.doScroll && !doScrollWorks()){ - checks.push(doScrollWorks); - shouldPoll = true; -} -/**/ - -if (document.readyState) checks.push(function(){ - var state = document.readyState; - return (state == 'loaded' || state == 'complete'); -}); - -if ('onreadystatechange' in document) document.addListener('readystatechange', check); -else shouldPoll = true; - -if (shouldPoll) poll(); - -Element.Events.domready = { - onAdd: function(fn){ - if (ready) fn.call(this); - } -}; - -// Make sure that domready fires before load -Element.Events.load = { - base: 'load', - onAdd: function(fn){ - if (loaded && this == window) fn.call(this); - }, - condition: function(){ - if (this == window){ - domready(); - delete Element.Events.load; - } - return true; - } -}; - -// This is based on the custom load event -window.addEvent('load', function(){ - loaded = true; -}); - -})(window, document); - diff --git a/pyload/webui/themes/Default/js/static/mootools-core.min.js b/pyload/webui/themes/Default/js/static/mootools-core.min.js deleted file mode 100644 index 354f94196..000000000 --- a/pyload/webui/themes/Default/js/static/mootools-core.min.js +++ /dev/null @@ -1,491 +0,0 @@ -/* ---- -MooTools: the javascript framework - -web build: - - http://mootools.net/core/8423c12ffd6a6bfcde9ea22554aec795 - -packager build: - - packager build Core/Core Core/Array Core/String Core/Number Core/Function Core/Object Core/Event Core/Browser Core/Class Core/Class.Extras Core/Slick.Parser Core/Slick.Finder Core/Element Core/Element.Style Core/Element.Event Core/Element.Delegation Core/Element.Dimensions Core/Fx Core/Fx.CSS Core/Fx.Tween Core/Fx.Morph Core/Fx.Transitions Core/Request Core/Request.HTML Core/Request.JSON Core/Cookie Core/JSON Core/DOMReady - -copyrights: - - [MooTools](http://mootools.net) - -licenses: - - [MIT License](http://mootools.net/license.txt) -... -*/ - -(function(){this.MooTools={version:"1.5.0",build:"0f7b690afee9349b15909f33016a25d2e4d9f4e3"};var o=this.typeOf=function(i){if(i==null){return"null";}if(i.$family!=null){return i.$family(); -}if(i.nodeName){if(i.nodeType==1){return"element";}if(i.nodeType==3){return(/\S/).test(i.nodeValue)?"textnode":"whitespace";}}else{if(typeof i.length=="number"){if("callee" in i){return"arguments"; -}if("item" in i){return"collection";}}}return typeof i;};var j=this.instanceOf=function(t,i){if(t==null){return false;}var s=t.$constructor||t.constructor; -while(s){if(s===i){return true;}s=s.parent;}if(!t.hasOwnProperty){return false;}return t instanceof i;};var f=this.Function;var p=true;for(var k in {toString:1}){p=null; -}if(p){p=["hasOwnProperty","valueOf","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","constructor"];}f.prototype.overloadSetter=function(s){var i=this; -return function(u,t){if(u==null){return this;}if(s||typeof u!="string"){for(var v in u){i.call(this,v,u[v]);}if(p){for(var w=p.length;w--;){v=p[w];if(u.hasOwnProperty(v)){i.call(this,v,u[v]); -}}}}else{i.call(this,u,t);}return this;};};f.prototype.overloadGetter=function(s){var i=this;return function(u){var v,t;if(typeof u!="string"){v=u;}else{if(arguments.length>1){v=arguments; -}else{if(s){v=[u];}}}if(v){t={};for(var w=0;w>>0; -b>>0;b>>0;for(var a=(d<0)?Math.max(0,b+d):d||0;a>>0,b=Array(d);for(var a=0;a>>0; -b-1;},test:function(a,b){return((typeOf(a)=="regexp")?a:new RegExp(""+a,b)).test(this); -},trim:function(){return String(this).replace(/^\s+|\s+$/g,"");},clean:function(){return String(this).replace(/\s+/g," ").trim();},camelCase:function(){return String(this).replace(/-\D/g,function(a){return a.charAt(1).toUpperCase(); -});},hyphenate:function(){return String(this).replace(/[A-Z]/g,function(a){return("-"+a.charAt(0).toLowerCase());});},capitalize:function(){return String(this).replace(/\b[a-z]/g,function(a){return a.toUpperCase(); -});},escapeRegExp:function(){return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1");},toInt:function(a){return parseInt(this,a||10);},toFloat:function(){return parseFloat(this); -},hexToRgb:function(b){var a=String(this).match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(a)?a.slice(1).hexToRgb(b):null;},rgbToHex:function(b){var a=String(this).match(/\d{1,3}/g); -return(a)?a.rgbToHex(b):null;},substitute:function(a,b){return String(this).replace(b||(/\\?\{([^{}]+)\}/g),function(d,c){if(d.charAt(0)=="\\"){return d.slice(1); -}return(a[c]!=null)?a[c]:"";});}});Number.implement({limit:function(b,a){return Math.min(a,Math.max(b,this));},round:function(a){a=Math.pow(10,a||0).toFixed(a<0?-a:0); -return Math.round(this*a)/a;},times:function(b,c){for(var a=0;a1?Array.slice(arguments,1):null,d=function(){};var c=function(){var g=e,h=arguments.length;if(this instanceof c){d.prototype=a.prototype; -g=new d;}var f=(!b&&!h)?a.call(g):a.apply(g,b&&h?b.concat(Array.slice(arguments)):b||arguments);return g==e?f:g;};return c;},pass:function(b,c){var a=this; -if(b!=null){b=Array.from(b);}return function(){return a.apply(c,b||arguments);};},delay:function(b,c,a){return setTimeout(this.pass((a==null?[]:a),c),b); -},periodical:function(c,b,a){return setInterval(this.pass((a==null?[]:a),b),c);}});(function(){var a=Object.prototype.hasOwnProperty;Object.extend({subset:function(d,g){var f={}; -for(var e=0,b=g.length;e]*>([\s\S]*?)<\/script>/gi,function(m,n){e+=n+"\n";return""; -});if(k===true){j.exec(e);}else{if(typeOf(k)=="function"){k(e,l);}}return l;});j.extend({Document:this.Document,Window:this.Window,Element:this.Element,Event:this.Event}); -this.Window=this.$constructor=new Type("Window",function(){});this.$family=Function.from("window").hide();Window.mirror(function(e,k){d[e]=k;});this.Document=f.$constructor=new Type("Document",function(){}); -f.$family=Function.from("document").hide();Document.mirror(function(e,k){f[e]=k;});f.html=f.documentElement;if(!f.head){f.head=f.getElementsByTagName("head")[0]; -}if(f.execCommand){try{f.execCommand("BackgroundImageCache",false,true);}catch(c){}}if(this.attachEvent&&!this.addEventListener){var b=function(){this.detachEvent("onunload",b); -f.head=f.html=f.window=null;};this.attachEvent("onunload",b);}var g=Array.from;try{g(f.html.childNodes);}catch(c){Array.from=function(k){if(typeof k!="string"&&Type.isEnumerable(k)&&typeOf(k)!="array"){var e=k.length,l=new Array(e); -while(e--){l[e]=k[e];}return l;}return g(k);};var h=Array.prototype,i=h.slice;["pop","push","reverse","shift","sort","splice","unshift","concat","join","slice"].each(function(e){var k=h[e]; -Array[e]=function(l){return k.apply(Array.from(l),i.call(arguments,1));};});}})();(function(){var b={};var a=this.DOMEvent=new Type("DOMEvent",function(c,g){if(!g){g=window; -}c=c||g.event;if(c.$extended){return c;}this.event=c;this.$extended=true;this.shift=c.shiftKey;this.control=c.ctrlKey;this.alt=c.altKey;this.meta=c.metaKey; -var i=this.type=c.type;var h=c.target||c.srcElement;while(h&&h.nodeType==3){h=h.parentNode;}this.target=document.id(h);if(i.indexOf("key")==0){var d=this.code=(c.which||c.keyCode); -this.key=b[d];if(i=="keydown"||i=="keyup"){if(d>111&&d<124){this.key="f"+(d-111);}else{if(d>95&&d<106){this.key=d-96;}}}if(this.key==null){this.key=String.fromCharCode(d).toLowerCase(); -}}else{if(i=="click"||i=="dblclick"||i=="contextmenu"||i=="DOMMouseScroll"||i.indexOf("mouse")==0){var j=g.document;j=(!j.compatMode||j.compatMode=="CSS1Compat")?j.html:j.body; -this.page={x:(c.pageX!=null)?c.pageX:c.clientX+j.scrollLeft,y:(c.pageY!=null)?c.pageY:c.clientY+j.scrollTop};this.client={x:(c.pageX!=null)?c.pageX-g.pageXOffset:c.clientX,y:(c.pageY!=null)?c.pageY-g.pageYOffset:c.clientY}; -if(i=="DOMMouseScroll"||i=="mousewheel"){this.wheel=(c.wheelDelta)?c.wheelDelta/120:-(c.detail||0)/3;}this.rightClick=(c.which==3||c.button==2);if(i=="mouseover"||i=="mouseout"){var k=c.relatedTarget||c[(i=="mouseover"?"from":"to")+"Element"]; -while(k&&k.nodeType==3){k=k.parentNode;}this.relatedTarget=document.id(k);}}else{if(i.indexOf("touch")==0||i.indexOf("gesture")==0){this.rotation=c.rotation; -this.scale=c.scale;this.targetTouches=c.targetTouches;this.changedTouches=c.changedTouches;var f=this.touches=c.touches;if(f&&f[0]){var e=f[0];this.page={x:e.pageX,y:e.pageY}; -this.client={x:e.clientX,y:e.clientY};}}}}if(!this.client){this.client={};}if(!this.page){this.page={};}});a.implement({stop:function(){return this.preventDefault().stopPropagation(); -},stopPropagation:function(){if(this.event.stopPropagation){this.event.stopPropagation();}else{this.event.cancelBubble=true;}return this;},preventDefault:function(){if(this.event.preventDefault){this.event.preventDefault(); -}else{this.event.returnValue=false;}return this;}});a.defineKey=function(d,c){b[d]=c;return this;};a.defineKeys=a.defineKey.overloadSetter(true);a.defineKeys({"38":"up","40":"down","37":"left","39":"right","27":"esc","32":"space","8":"backspace","9":"tab","46":"delete","13":"enter"}); -})();(function(){var a=this.Class=new Type("Class",function(h){if(instanceOf(h,Function)){h={initialize:h};}var g=function(){e(this);if(g.$prototyping){return this; -}this.$caller=null;var i=(this.initialize)?this.initialize.apply(this,arguments):this;this.$caller=this.caller=null;return i;}.extend(this).implement(h); -g.$constructor=a;g.prototype.$constructor=g;g.prototype.parent=c;return g;});var c=function(){if(!this.$caller){throw new Error('The method "parent" cannot be called.'); -}var g=this.$caller.$name,h=this.$caller.$owner.parent,i=(h)?h.prototype[g]:null;if(!i){throw new Error('The method "'+g+'" has no parent.');}return i.apply(this,arguments); -};var e=function(g){for(var h in g){var j=g[h];switch(typeOf(j)){case"object":var i=function(){};i.prototype=j;g[h]=e(new i);break;case"array":g[h]=j.clone(); -break;}}return g;};var b=function(g,h,j){if(j.$origin){j=j.$origin;}var i=function(){if(j.$protected&&this.$caller==null){throw new Error('The method "'+h+'" cannot be called.'); -}var l=this.caller,m=this.$caller;this.caller=m;this.$caller=i;var k=j.apply(this,arguments);this.$caller=m;this.caller=l;return k;}.extend({$owner:g,$origin:j,$name:h}); -return i;};var f=function(h,i,g){if(a.Mutators.hasOwnProperty(h)){i=a.Mutators[h].call(this,i);if(i==null){return this;}}if(typeOf(i)=="function"){if(i.$hidden){return this; -}this.prototype[h]=(g)?i:b(this,h,i);}else{Object.merge(this.prototype,h,i);}return this;};var d=function(g){g.$prototyping=true;var h=new g;delete g.$prototyping; -return h;};a.implement("implement",f.overloadSetter());a.Mutators={Extends:function(g){this.parent=g;this.prototype=d(g);},Implements:function(g){Array.from(g).each(function(j){var h=new j; -for(var i in h){f.call(this,i,h[i],true);}},this);}};})();(function(){this.Chain=new Class({$chain:[],chain:function(){this.$chain.append(Array.flatten(arguments)); -return this;},callChain:function(){return(this.$chain.length)?this.$chain.shift().apply(this,arguments):false;},clearChain:function(){this.$chain.empty(); -return this;}});var a=function(b){return b.replace(/^on([A-Z])/,function(c,d){return d.toLowerCase();});};this.Events=new Class({$events:{},addEvent:function(d,c,b){d=a(d); -this.$events[d]=(this.$events[d]||[]).include(c);if(b){c.internal=true;}return this;},addEvents:function(b){for(var c in b){this.addEvent(c,b[c]);}return this; -},fireEvent:function(e,c,b){e=a(e);var d=this.$events[e];if(!d){return this;}c=Array.from(c);d.each(function(f){if(b){f.delay(b,this,c);}else{f.apply(this,c); -}},this);return this;},removeEvent:function(e,d){e=a(e);var c=this.$events[e];if(c&&!d.internal){var b=c.indexOf(d);if(b!=-1){delete c[b];}}return this; -},removeEvents:function(d){var e;if(typeOf(d)=="object"){for(e in d){this.removeEvent(e,d[e]);}return this;}if(d){d=a(d);}for(e in this.$events){if(d&&d!=e){continue; -}var c=this.$events[e];for(var b=c.length;b--;){if(b in c){this.removeEvent(e,c[b]);}}}return this;}});this.Options=new Class({setOptions:function(){var b=this.options=Object.merge.apply(null,[{},this.options].append(arguments)); -if(this.addEvent){for(var c in b){if(typeOf(b[c])!="function"||!(/^on[A-Z]/).test(c)){continue;}this.addEvent(c,b[c]);delete b[c];}}return this;}});})(); -(function(){var k,n,l,g,a={},c={},m=/\\/g;var e=function(q,p){if(q==null){return null;}if(q.Slick===true){return q;}q=(""+q).replace(/^\s+|\s+$/g,"");g=!!p; -var o=(g)?c:a;if(o[q]){return o[q];}k={Slick:true,expressions:[],raw:q,reverse:function(){return e(this.raw,true);}};n=-1;while(q!=(q=q.replace(j,b))){}k.length=k.expressions.length; -return o[k.raw]=(g)?h(k):k;};var i=function(o){if(o==="!"){return" ";}else{if(o===" "){return"!";}else{if((/^!/).test(o)){return o.replace(/^!/,"");}else{return"!"+o; -}}}};var h=function(u){var r=u.expressions;for(var p=0;p+)\\s*|(\\s+)|(+|\\*)|\\#(+)|\\.(+)|\\[\\s*(+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)".replace(//,"["+f(">+~`!@$%^&={}\\;/g,"(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])").replace(//g,"(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])")); -function b(x,s,D,z,r,C,q,B,A,y,u,F,G,v,p,w){if(s||n===-1){k.expressions[++n]=[];l=-1;if(s){return"";}}if(D||z||l===-1){D=D||" ";var t=k.expressions[n]; -if(g&&t[l]){t[l].reverseCombinator=i(D);}t[++l]={combinator:D,tag:"*"};}var o=k.expressions[n][l];if(r){o.tag=r.replace(m,"");}else{if(C){o.id=C.replace(m,""); -}else{if(q){q=q.replace(m,"");if(!o.classList){o.classList=[];}if(!o.classes){o.classes=[];}o.classList.push(q);o.classes.push({value:q,regexp:new RegExp("(^|\\s)"+f(q)+"(\\s|$)")}); -}else{if(G){w=w||p;w=w?w.replace(m,""):null;if(!o.pseudos){o.pseudos=[];}o.pseudos.push({key:G.replace(m,""),value:w,type:F.length==1?"class":"element"}); -}else{if(B){B=B.replace(m,"");u=(u||"").replace(m,"");var E,H;switch(A){case"^=":H=new RegExp("^"+f(u));break;case"$=":H=new RegExp(f(u)+"$");break;case"~=":H=new RegExp("(^|\\s)"+f(u)+"(\\s|$)"); -break;case"|=":H=new RegExp("^"+f(u)+"(-|$)");break;case"=":E=function(I){return u==I;};break;case"*=":E=function(I){return I&&I.indexOf(u)>-1;};break; -case"!=":E=function(I){return u!=I;};break;default:E=function(I){return !!I;};}if(u==""&&(/^[*$^]=$/).test(A)){E=function(){return false;};}if(!E){E=function(I){return I&&H.test(I); -};}if(!o.attributes){o.attributes=[];}o.attributes.push({key:B,operator:A,value:u,test:E});}}}}}return"";}var d=(this.Slick||{});d.parse=function(o){return e(o); -};d.escapeRegExp=f;if(!this.Slick){this.Slick=d;}}).apply((typeof exports!="undefined")?exports:this);(function(){var k={},m={},d=Object.prototype.toString; -k.isNativeCode=function(c){return(/\{\s*\[native code\]\s*\}/).test(""+c);};k.isXML=function(c){return(!!c.xmlVersion)||(!!c.xml)||(d.call(c)=="[object XMLDocument]")||(c.nodeType==9&&c.documentElement.nodeName!="HTML"); -};k.setDocument=function(w){var p=w.nodeType;if(p==9){}else{if(p){w=w.ownerDocument;}else{if(w.navigator){w=w.document;}else{return;}}}if(this.document===w){return; -}this.document=w;var A=w.documentElement,o=this.getUIDXML(A),s=m[o],r;if(s){for(r in s){this[r]=s[r];}return;}s=m[o]={};s.root=A;s.isXMLDocument=this.isXML(w); -s.brokenStarGEBTN=s.starSelectsClosedQSA=s.idGetsName=s.brokenMixedCaseQSA=s.brokenGEBCN=s.brokenCheckedQSA=s.brokenEmptyAttributeQSA=s.isHTMLDocument=s.nativeMatchesSelector=false; -var q,u,y,z,t;var x,v="slick_uniqueid";var c=w.createElement("div");var n=w.body||w.getElementsByTagName("body")[0]||A;n.appendChild(c);try{c.innerHTML=''; -s.isHTMLDocument=!!w.getElementById(v);}catch(C){}if(s.isHTMLDocument){c.style.display="none";c.appendChild(w.createComment(""));u=(c.getElementsByTagName("*").length>1); -try{c.innerHTML="foo";x=c.getElementsByTagName("*");q=(x&&!!x.length&&x[0].nodeName.charAt(0)=="/");}catch(C){}s.brokenStarGEBTN=u||q;try{c.innerHTML=''; -s.idGetsName=w.getElementById(v)===c.firstChild;}catch(C){}if(c.getElementsByClassName){try{c.innerHTML='';c.getElementsByClassName("b").length; -c.firstChild.className="b";z=(c.getElementsByClassName("b").length!=2);}catch(C){}try{c.innerHTML='';y=(c.getElementsByClassName("a").length!=2); -}catch(C){}s.brokenGEBCN=z||y;}if(c.querySelectorAll){try{c.innerHTML="foo";x=c.querySelectorAll("*");s.starSelectsClosedQSA=(x&&!!x.length&&x[0].nodeName.charAt(0)=="/"); -}catch(C){}try{c.innerHTML='';s.brokenMixedCaseQSA=!c.querySelectorAll(".MiX").length;}catch(C){}try{c.innerHTML=''; -s.brokenCheckedQSA=(c.querySelectorAll(":checked").length==0);}catch(C){}try{c.innerHTML='';s.brokenEmptyAttributeQSA=(c.querySelectorAll('[class*=""]').length!=0); -}catch(C){}}try{c.innerHTML='
      ';t=(c.firstChild.getAttribute("action")!="s");}catch(C){}s.nativeMatchesSelector=A.matches||A.mozMatchesSelector||A.webkitMatchesSelector; -if(s.nativeMatchesSelector){try{s.nativeMatchesSelector.call(A,":slick");s.nativeMatchesSelector=null;}catch(C){}}}try{A.slick_expando=1;delete A.slick_expando; -s.getUID=this.getUIDHTML;}catch(C){s.getUID=this.getUIDXML;}n.removeChild(c);c=x=n=null;s.getAttribute=(s.isHTMLDocument&&t)?function(G,E){var H=this.attributeGetters[E]; -if(H){return H.call(G);}var F=G.getAttributeNode(E);return(F)?F.nodeValue:null;}:function(F,E){var G=this.attributeGetters[E];return(G)?G.call(F):F.getAttribute(E); -};s.hasAttribute=(A&&this.isNativeCode(A.hasAttribute))?function(F,E){return F.hasAttribute(E);}:function(F,E){F=F.getAttributeNode(E);return !!(F&&(F.specified||F.nodeValue)); -};var D=A&&this.isNativeCode(A.contains),B=w&&this.isNativeCode(w.contains);s.contains=(D&&B)?function(E,F){return E.contains(F);}:(D&&!B)?function(E,F){return E===F||((E===w)?w.documentElement:E).contains(F); -}:(A&&A.compareDocumentPosition)?function(E,F){return E===F||!!(E.compareDocumentPosition(F)&16);}:function(E,F){if(F){do{if(F===E){return true;}}while((F=F.parentNode)); -}return false;};s.documentSorter=(A.compareDocumentPosition)?function(F,E){if(!F.compareDocumentPosition||!E.compareDocumentPosition){return 0;}return F.compareDocumentPosition(E)&4?-1:F===E?0:1; -}:("sourceIndex" in A)?function(F,E){if(!F.sourceIndex||!E.sourceIndex){return 0;}return F.sourceIndex-E.sourceIndex;}:(w.createRange)?function(H,F){if(!H.ownerDocument||!F.ownerDocument){return 0; -}var G=H.ownerDocument.createRange(),E=F.ownerDocument.createRange();G.setStart(H,0);G.setEnd(H,0);E.setStart(F,0);E.setEnd(F,0);return G.compareBoundaryPoints(Range.START_TO_END,E); -}:null;A=null;for(r in s){this[r]=s[r];}};var f=/^([#.]?)((?:[\w-]+|\*))$/,h=/\[.+[*$^]=(?:""|'')?\]/,g={};k.search=function(U,z,H,s){var p=this.found=(s)?null:(H||[]); -if(!U){return p;}else{if(U.navigator){U=U.document;}else{if(!U.nodeType){return p;}}}var F,O,V=this.uniques={},I=!!(H&&H.length),y=(U.nodeType==9);if(this.document!==(y?U:U.ownerDocument)){this.setDocument(U); -}if(I){for(O=p.length;O--;){V[this.getUID(p[O])]=true;}}if(typeof z=="string"){var r=z.match(f);simpleSelectors:if(r){var u=r[1],v=r[2],A,E;if(!u){if(v=="*"&&this.brokenStarGEBTN){break simpleSelectors; -}E=U.getElementsByTagName(v);if(s){return E[0]||null;}for(O=0;A=E[O++];){if(!(I&&V[this.getUID(A)])){p.push(A);}}}else{if(u=="#"){if(!this.isHTMLDocument||!y){break simpleSelectors; -}A=U.getElementById(v);if(!A){return p;}if(this.idGetsName&&A.getAttributeNode("id").nodeValue!=v){break simpleSelectors;}if(s){return A||null;}if(!(I&&V[this.getUID(A)])){p.push(A); -}}else{if(u=="."){if(!this.isHTMLDocument||((!U.getElementsByClassName||this.brokenGEBCN)&&U.querySelectorAll)){break simpleSelectors;}if(U.getElementsByClassName&&!this.brokenGEBCN){E=U.getElementsByClassName(v); -if(s){return E[0]||null;}for(O=0;A=E[O++];){if(!(I&&V[this.getUID(A)])){p.push(A);}}}else{var T=new RegExp("(^|\\s)"+e.escapeRegExp(v)+"(\\s|$)");E=U.getElementsByTagName("*"); -for(O=0;A=E[O++];){className=A.className;if(!(className&&T.test(className))){continue;}if(s){return A;}if(!(I&&V[this.getUID(A)])){p.push(A);}}}}}}if(I){this.sort(p); -}return(s)?null:p;}querySelector:if(U.querySelectorAll){if(!this.isHTMLDocument||g[z]||this.brokenMixedCaseQSA||(this.brokenCheckedQSA&&z.indexOf(":checked")>-1)||(this.brokenEmptyAttributeQSA&&h.test(z))||(!y&&z.indexOf(",")>-1)||e.disableQSA){break querySelector; -}var S=z,x=U;if(!y){var C=x.getAttribute("id"),t="slickid__";x.setAttribute("id",t);S="#"+t+" "+S;U=x.parentNode;}try{if(s){return U.querySelector(S)||null; -}else{E=U.querySelectorAll(S);}}catch(Q){g[z]=1;break querySelector;}finally{if(!y){if(C){x.setAttribute("id",C);}else{x.removeAttribute("id");}U=x;}}if(this.starSelectsClosedQSA){for(O=0; -A=E[O++];){if(A.nodeName>"@"&&!(I&&V[this.getUID(A)])){p.push(A);}}}else{for(O=0;A=E[O++];){if(!(I&&V[this.getUID(A)])){p.push(A);}}}if(I){this.sort(p); -}return p;}F=this.Slick.parse(z);if(!F.length){return p;}}else{if(z==null){return p;}else{if(z.Slick){F=z;}else{if(this.contains(U.documentElement||U,z)){(p)?p.push(z):p=z; -return p;}else{return p;}}}}this.posNTH={};this.posNTHLast={};this.posNTHType={};this.posNTHTypeLast={};this.push=(!I&&(s||(F.length==1&&F.expressions[0].length==1)))?this.pushArray:this.pushUID; -if(p==null){p=[];}var M,L,K;var B,J,D,c,q,G,W;var N,P,o,w,R=F.expressions;search:for(O=0;(P=R[O]);O++){for(M=0;(o=P[M]);M++){B="combinator:"+o.combinator; -if(!this[B]){continue search;}J=(this.isXMLDocument)?o.tag:o.tag.toUpperCase();D=o.id;c=o.classList;q=o.classes;G=o.attributes;W=o.pseudos;w=(M===(P.length-1)); -this.bitUniques={};if(w){this.uniques=V;this.found=p;}else{this.uniques={};this.found=[];}if(M===0){this[B](U,J,D,q,G,W,c);if(s&&w&&p.length){break search; -}}else{if(s&&w){for(L=0,K=N.length;L1)){this.sort(p);}return(s)?(p[0]||null):p;};k.uidx=1;k.uidk="slick-uniqueid";k.getUIDXML=function(n){var c=n.getAttribute(this.uidk); -if(!c){c=this.uidx++;n.setAttribute(this.uidk,c);}return c;};k.getUIDHTML=function(c){return c.uniqueNumber||(c.uniqueNumber=this.uidx++);};k.sort=function(c){if(!this.documentSorter){return c; -}c.sort(this.documentSorter);return c;};k.cacheNTH={};k.matchNTH=/^([+-]?\d*)?([a-z]+)?([+-]\d+)?$/;k.parseNTHArgument=function(q){var o=q.match(this.matchNTH); -if(!o){return false;}var p=o[2]||false;var n=o[1]||1;if(n=="-"){n=-1;}var c=+o[3]||0;o=(p=="n")?{a:n,b:c}:(p=="odd")?{a:2,b:1}:(p=="even")?{a:2,b:0}:{a:0,b:n}; -return(this.cacheNTH[q]=o);};k.createNTHPseudo=function(p,n,c,o){return function(s,q){var u=this.getUID(s);if(!this[c][u]){var A=s.parentNode;if(!A){return false; -}var r=A[p],t=1;if(o){var z=s.nodeName;do{if(r.nodeName!=z){continue;}this[c][this.getUID(r)]=t++;}while((r=r[n]));}else{do{if(r.nodeType!=1){continue; -}this[c][this.getUID(r)]=t++;}while((r=r[n]));}}q=q||"n";var v=this.cacheNTH[q]||this.parseNTHArgument(q);if(!v){return false;}var y=v.a,x=v.b,w=this[c][u]; -if(y==0){return x==w;}if(y>0){if(w":function(p,c,r,o,n,q){if((p=p.firstChild)){do{if(p.nodeType==1){this.push(p,c,r,o,n,q); -}}while((p=p.nextSibling));}},"+":function(p,c,r,o,n,q){while((p=p.nextSibling)){if(p.nodeType==1){this.push(p,c,r,o,n,q);break;}}},"^":function(p,c,r,o,n,q){p=p.firstChild; -if(p){if(p.nodeType==1){this.push(p,c,r,o,n,q);}else{this["combinator:+"](p,c,r,o,n,q);}}},"~":function(q,c,s,p,n,r){while((q=q.nextSibling)){if(q.nodeType!=1){continue; -}var o=this.getUID(q);if(this.bitUniques[o]){break;}this.bitUniques[o]=true;this.push(q,c,s,p,n,r);}},"++":function(p,c,r,o,n,q){this["combinator:+"](p,c,r,o,n,q); -this["combinator:!+"](p,c,r,o,n,q);},"~~":function(p,c,r,o,n,q){this["combinator:~"](p,c,r,o,n,q);this["combinator:!~"](p,c,r,o,n,q);},"!":function(p,c,r,o,n,q){while((p=p.parentNode)){if(p!==this.document){this.push(p,c,r,o,n,q); -}}},"!>":function(p,c,r,o,n,q){p=p.parentNode;if(p!==this.document){this.push(p,c,r,o,n,q);}},"!+":function(p,c,r,o,n,q){while((p=p.previousSibling)){if(p.nodeType==1){this.push(p,c,r,o,n,q); -break;}}},"!^":function(p,c,r,o,n,q){p=p.lastChild;if(p){if(p.nodeType==1){this.push(p,c,r,o,n,q);}else{this["combinator:!+"](p,c,r,o,n,q);}}},"!~":function(q,c,s,p,n,r){while((q=q.previousSibling)){if(q.nodeType!=1){continue; -}var o=this.getUID(q);if(this.bitUniques[o]){break;}this.bitUniques[o]=true;this.push(q,c,s,p,n,r);}}};for(var i in j){k["combinator:"+i]=j[i];}var l={empty:function(c){var n=c.firstChild; -return !(n&&n.nodeType==1)&&!(c.innerText||c.textContent||"").length;},not:function(c,n){return !this.matchNode(c,n);},contains:function(c,n){return(c.innerText||c.textContent||"").indexOf(n)>-1; -},"first-child":function(c){while((c=c.previousSibling)){if(c.nodeType==1){return false;}}return true;},"last-child":function(c){while((c=c.nextSibling)){if(c.nodeType==1){return false; -}}return true;},"only-child":function(o){var n=o;while((n=n.previousSibling)){if(n.nodeType==1){return false;}}var c=o;while((c=c.nextSibling)){if(c.nodeType==1){return false; -}}return true;},"nth-child":k.createNTHPseudo("firstChild","nextSibling","posNTH"),"nth-last-child":k.createNTHPseudo("lastChild","previousSibling","posNTHLast"),"nth-of-type":k.createNTHPseudo("firstChild","nextSibling","posNTHType",true),"nth-last-of-type":k.createNTHPseudo("lastChild","previousSibling","posNTHTypeLast",true),index:function(n,c){return this["pseudo:nth-child"](n,""+(c+1)); -},even:function(c){return this["pseudo:nth-child"](c,"2n");},odd:function(c){return this["pseudo:nth-child"](c,"2n+1");},"first-of-type":function(c){var n=c.nodeName; -while((c=c.previousSibling)){if(c.nodeName==n){return false;}}return true;},"last-of-type":function(c){var n=c.nodeName;while((c=c.nextSibling)){if(c.nodeName==n){return false; -}}return true;},"only-of-type":function(o){var n=o,p=o.nodeName;while((n=n.previousSibling)){if(n.nodeName==p){return false;}}var c=o;while((c=c.nextSibling)){if(c.nodeName==p){return false; -}}return true;},enabled:function(c){return !c.disabled;},disabled:function(c){return c.disabled;},checked:function(c){return c.checked||c.selected;},focus:function(c){return this.isHTMLDocument&&this.document.activeElement===c&&(c.href||c.type||this.hasAttribute(c,"tabindex")); -},root:function(c){return(c===this.root);},selected:function(c){return c.selected;}};for(var b in l){k["pseudo:"+b]=l[b];}var a=k.attributeGetters={"for":function(){return("htmlFor" in this)?this.htmlFor:this.getAttribute("for"); -},href:function(){return("href" in this)?this.getAttribute("href",2):this.getAttribute("href");},style:function(){return(this.style)?this.style.cssText:this.getAttribute("style"); -},tabindex:function(){var c=this.getAttributeNode("tabindex");return(c&&c.specified)?c.nodeValue:null;},type:function(){return this.getAttribute("type"); -},maxlength:function(){var c=this.getAttributeNode("maxLength");return(c&&c.specified)?c.nodeValue:null;}};a.MAXLENGTH=a.maxLength=a.maxlength;var e=k.Slick=(this.Slick||{}); -e.version="1.1.7";e.search=function(n,o,c){return k.search(n,o,c);};e.find=function(c,n){return k.search(c,n,null,true);};e.contains=function(c,n){k.setDocument(c); -return k.contains(c,n);};e.getAttribute=function(n,c){k.setDocument(n);return k.getAttribute(n,c);};e.hasAttribute=function(n,c){k.setDocument(n);return k.hasAttribute(n,c); -};e.match=function(n,c){if(!(n&&c)){return false;}if(!c||c===n){return true;}k.setDocument(n);return k.matchNode(n,c);};e.defineAttributeGetter=function(c,n){k.attributeGetters[c]=n; -return this;};e.lookupAttributeGetter=function(c){return k.attributeGetters[c];};e.definePseudo=function(c,n){k["pseudo:"+c]=function(p,o){return n.call(p,o); -};return this;};e.lookupPseudo=function(c){var n=k["pseudo:"+c];if(n){return function(o){return n.call(this,o);};}return null;};e.override=function(n,c){k.override(n,c); -return this;};e.isXML=k.isXML;e.uidOf=function(c){return k.getUIDHTML(c);};if(!this.Slick){this.Slick=e;}}).apply((typeof exports!="undefined")?exports:this); -var Element=this.Element=function(b,g){var h=Element.Constructors[b];if(h){return h(g);}if(typeof b!="string"){return document.id(b).set(g);}if(!g){g={}; -}if(!(/^[\w-]+$/).test(b)){var e=Slick.parse(b).expressions[0][0];b=(e.tag=="*")?"div":e.tag;if(e.id&&g.id==null){g.id=e.id;}var d=e.attributes;if(d){for(var a,f=0,c=d.length; -f=this.length){delete this[g--]; -}return e;}.protect());}Array.forEachMethod(function(g,e){Elements.implement(e,g);});Array.mirror(Elements);var d;try{d=(document.createElement("").name=="x"); -}catch(b){}var c=function(e){return(""+e).replace(/&/g,"&").replace(/"/g,""");};Document.implement({newElement:function(e,g){if(g&&g.checked!=null){g.defaultChecked=g.checked; -}if(d&&g){e="<"+e;if(g.name){e+=' name="'+c(g.name)+'"';}if(g.type){e+=' type="'+c(g.type)+'"';}e+=">";delete g.name;delete g.type;}return this.id(this.createElement(e)).set(g); -}});})();(function(){Slick.uidOf(window);Slick.uidOf(document);Document.implement({newTextNode:function(e){return this.createTextNode(e);},getDocument:function(){return this; -},getWindow:function(){return this.window;},id:(function(){var e={string:function(L,K,l){L=Slick.find(l,"#"+L.replace(/(\W)/g,"\\$1"));return(L)?e.element(L,K):null; -},element:function(K,L){Slick.uidOf(K);if(!L&&!K.$family&&!(/^(?:object|embed)$/i).test(K.tagName)){var l=K.fireEvent;K._fireEvent=function(M,N){return l(M,N); -};Object.append(K,Element.Prototype);}return K;},object:function(K,L,l){if(K.toElement){return e.element(K.toElement(l),L);}return null;}};e.textnode=e.whitespace=e.window=e.document=function(l){return l; -};return function(K,M,L){if(K&&K.$family&&K.uniqueNumber){return K;}var l=typeOf(K);return(e[l])?e[l](K,M,L||document):null;};})()});if(window.$==null){Window.implement("$",function(e,l){return document.id(e,l,this.document); -});}Window.implement({getDocument:function(){return this.document;},getWindow:function(){return this;}});[Document,Element].invoke("implement",{getElements:function(e){return Slick.search(this,e,new Elements); -},getElement:function(e){return document.id(Slick.find(this,e));}});var p={contains:function(e){return Slick.contains(this,e);}};if(!document.contains){Document.implement(p); -}if(!document.createElement("div").contains){Element.implement(p);}var v=function(L,K){if(!L){return K;}L=Object.clone(Slick.parse(L));var l=L.expressions; -for(var e=l.length;e--;){l[e][0].combinator=K;}return L;};Object.forEach({getNext:"~",getPrevious:"!~",getParent:"!"},function(e,l){Element.implement(l,function(K){return this.getElement(v(K,e)); -});});Object.forEach({getAllNext:"~",getAllPrevious:"!~",getSiblings:"~~",getChildren:">",getParents:"!"},function(e,l){Element.implement(l,function(K){return this.getElements(v(K,e)); -});});Element.implement({getFirst:function(e){return document.id(Slick.search(this,v(e,">"))[0]);},getLast:function(e){return document.id(Slick.search(this,v(e,">")).getLast()); -},getWindow:function(){return this.ownerDocument.window;},getDocument:function(){return this.ownerDocument;},getElementById:function(e){return document.id(Slick.find(this,"#"+(""+e).replace(/(\W)/g,"\\$1"))); -},match:function(e){return !e||Slick.match(this,e);}});if(window.$$==null){Window.implement("$$",function(e){if(arguments.length==1){if(typeof e=="string"){return Slick.search(this.document,e,new Elements); -}else{if(Type.isEnumerable(e)){return new Elements(e);}}}return new Elements(arguments);});}var A={before:function(l,e){var K=e.parentNode;if(K){K.insertBefore(l,e); -}},after:function(l,e){var K=e.parentNode;if(K){K.insertBefore(l,e.nextSibling);}},bottom:function(l,e){e.appendChild(l);},top:function(l,e){e.insertBefore(l,e.firstChild); -}};A.inside=A.bottom;var n={},d={};var o={};Array.forEach(["type","value","defaultValue","accessKey","cellPadding","cellSpacing","colSpan","frameBorder","rowSpan","tabIndex","useMap"],function(e){o[e.toLowerCase()]=e; -});o.html="innerHTML";o.text=(document.createElement("div").textContent==null)?"innerText":"textContent";Object.forEach(o,function(l,e){d[e]=function(K,L){K[l]=L; -};n[e]=function(K){return K[l];};});var B=["compact","nowrap","ismap","declare","noshade","checked","disabled","readOnly","multiple","selected","noresize","defer","defaultChecked","autofocus","controls","autoplay","loop"]; -var k={};Array.forEach(B,function(e){var l=e.toLowerCase();k[l]=e;d[l]=function(K,L){K[e]=!!L;};n[l]=function(K){return !!K[e];};});Object.append(d,{"class":function(e,l){("className" in e)?e.className=(l||""):e.setAttribute("class",l); -},"for":function(e,l){("htmlFor" in e)?e.htmlFor=l:e.setAttribute("for",l);},style:function(e,l){(e.style)?e.style.cssText=l:e.setAttribute("style",l); -},value:function(e,l){e.value=(l!=null)?l:"";}});n["class"]=function(e){return("className" in e)?e.className||null:e.getAttribute("class");};var f=document.createElement("button"); -try{f.type="button";}catch(E){}if(f.type!="button"){d.type=function(e,l){e.setAttribute("type",l);};}f=null;var s=document.createElement("input");s.value="t"; -s.type="submit";if(s.value!="t"){d.type=function(l,e){var K=l.value;l.type=e;l.value=K;};}s=null;var u=(function(e){e.random="attribute";return(e.getAttribute("random")=="attribute"); -})(document.createElement("div"));var i=(function(e){e.innerHTML='';return e.cloneNode(true).firstChild.childNodes.length!=1; -})(document.createElement("div"));var j=!!document.createElement("div").classList;var F=function(e){var l=(e||"").clean().split(" "),K={};return l.filter(function(L){if(L!==""&&!K[L]){return K[L]=L; -}});};var t=function(e){this.classList.add(e);};var g=function(e){this.classList.remove(e);};Element.implement({setProperty:function(l,K){var L=d[l.toLowerCase()]; -if(L){L(this,K);}else{var e;if(u){e=this.retrieve("$attributeWhiteList",{});}if(K==null){this.removeAttribute(l);if(u){delete e[l];}}else{this.setAttribute(l,""+K); -if(u){e[l]=true;}}}return this;},setProperties:function(e){for(var l in e){this.setProperty(l,e[l]);}return this;},getProperty:function(M){var K=n[M.toLowerCase()]; -if(K){return K(this);}if(u){var l=this.getAttributeNode(M),L=this.retrieve("$attributeWhiteList",{});if(!l){return null;}if(l.expando&&!L[M]){var N=this.outerHTML; -if(N.substr(0,N.search(/\/?['"]?>(?![^<]*<['"])/)).indexOf(M)<0){return null;}L[M]=true;}}var e=Slick.getAttribute(this,M);return(!e&&!Slick.hasAttribute(this,M))?null:e; -},getProperties:function(){var e=Array.from(arguments);return e.map(this.getProperty,this).associate(e);},removeProperty:function(e){return this.setProperty(e,null); -},removeProperties:function(){Array.each(arguments,this.removeProperty,this);return this;},set:function(K,l){var e=Element.Properties[K];(e&&e.set)?e.set.call(this,l):this.setProperty(K,l); -}.overloadSetter(),get:function(l){var e=Element.Properties[l];return(e&&e.get)?e.get.apply(this):this.getProperty(l);}.overloadGetter(),erase:function(l){var e=Element.Properties[l]; -(e&&e.erase)?e.erase.apply(this):this.removeProperty(l);return this;},hasClass:j?function(e){return this.classList.contains(e);}:function(e){return this.className.clean().contains(e," "); -},addClass:j?function(e){F(e).forEach(t,this);return this;}:function(e){this.className=F(e+" "+this.className).join(" ");return this;},removeClass:j?function(e){F(e).forEach(g,this); -return this;}:function(e){var l=F(this.className);F(e).forEach(l.erase,l);this.className=l.join(" ");return this;},toggleClass:function(e,l){if(l==null){l=!this.hasClass(e); -}return(l)?this.addClass(e):this.removeClass(e);},adopt:function(){var L=this,e,N=Array.flatten(arguments),M=N.length;if(M>1){L=e=document.createDocumentFragment(); -}for(var K=0;K1){L=document.createDocumentFragment(); -for(var N=0,e=O.length;N";a=(x.childNodes.length==1);if(!a){var w="abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video".split(" "),b=document.createDocumentFragment(),y=w.length; -while(y--){b.createElement(w[y]);}}x=null;h=Function.attempt(function(){var e=document.createElement("table");e.innerHTML="";return true; -});var c=document.createElement("tr"),r="";c.innerHTML=r;C=(c.innerHTML==r);c=null;if(!h||!C||!a){Element.Properties.html.set=(function(l){var e={table:[1,"","
      "],select:[1,""],tbody:[2,"","
      "],tr:[3,"","
      "]}; -e.thead=e.tfoot=e.tbody;return function(K){var L=e[this.get("tag")];if(!L&&!a){L=[0,"",""];}if(!L){return l.call(this,K);}var O=L[0],N=document.createElement("div"),M=N; -if(!a){b.appendChild(N);}N.innerHTML=[L[1],K,L[2]].flatten().join("");while(O--){M=M.firstChild;}this.empty().adopt(M.childNodes);if(!a){b.removeChild(N); -}N=null;};})(Element.Properties.html.set);}var q=document.createElement("form");q.innerHTML="";if(q.firstChild.value!="s"){Element.Properties.value={set:function(N){var l=this.get("tag"); -if(l!="select"){return this.setProperty("value",N);}var K=this.getElements("option");N=String(N);for(var L=0;L0||r==null?"visible":"hidden";};var p=function(r,v,u){var t=r.style,s=t.filter||r.getComputedStyle("filter")||"";t.filter=(v.test(s)?s.replace(v,u):s+" "+u).trim(); -if(!t.filter){t.removeAttribute("filter");}};var h=(j?function(s,r){s.style.opacity=r;}:(g?function(s,r){if(!s.currentStyle||!s.currentStyle.hasLayout){s.style.zoom=1; -}if(r==null||r==1){p(s,q,"");if(r==1&&i(s)!=1){p(s,q,"alpha(opacity=100)");}}else{p(s,q,"alpha(opacity="+(r*100).limit(0,100).round()+")");}}:b));var i=(j?function(s){var r=s.style.opacity||s.getComputedStyle("opacity"); -return(r=="")?1:r.toFloat();}:(g?function(s){var t=(s.style.filter||s.getComputedStyle("filter")),r;if(t){r=t.match(q);}return(r==null||t==null)?1:(r[1]/100); -}:function(s){var r=s.retrieve("$opacity");if(r==null){r=(s.style.visibility=="hidden"?0:1);}return r;}));var d=(l.style.cssFloat==null)?"styleFloat":"cssFloat",a={left:"0%",top:"0%",center:"50%",right:"100%",bottom:"100%"},c=(l.style.backgroundPositionX!=null); -var m=function(r,s){if(s=="backgroundPosition"){r.removeAttribute(s+"X");s+="Y";}r.removeAttribute(s);};Element.implement({getComputedStyle:function(t){if(!n&&this.currentStyle){return this.currentStyle[t.camelCase()]; -}var s=Element.getDocument(this).defaultView,r=s?s.getComputedStyle(this,null):null;return(r)?r.getPropertyValue((t==d)?"float":t.hyphenate()):"";},setStyle:function(s,r){if(s=="opacity"){if(r!=null){r=parseFloat(r); -}h(this,r);return this;}s=(s=="float"?d:s).camelCase();if(typeOf(r)!="string"){var t=(Element.Styles[s]||"@").split(" ");r=Array.from(r).map(function(v,u){if(!t[u]){return""; -}return(typeOf(v)=="number")?t[u].replace("@",Math.round(v)):v;}).join(" ");}else{if(r==String(Number(r))){r=Math.round(r);}}this.style[s]=r;if((r==""||r==null)&&e&&this.style.removeAttribute){m(this.style,s); -}return this;},getStyle:function(x){if(x=="opacity"){return i(this);}x=(x=="float"?d:x).camelCase();var r=this.style[x];if(!r||x=="zIndex"){if(Element.ShortStyles.hasOwnProperty(x)){r=[]; -for(var w in Element.ShortStyles[x]){r.push(this.getStyle(w));}return r.join(" ");}r=this.getComputedStyle(x);}if(c&&/^backgroundPosition[XY]?$/.test(x)){return r.replace(/(top|right|bottom|left)/g,function(s){return a[s]; -})||"0px";}if(!r&&x=="backgroundPosition"){return"0px 0px";}if(r){r=String(r);var u=r.match(/rgba?\([\d\s,]+\)/);if(u){r=r.replace(u[0],u[0].rgbToHex()); -}}if(!n&&!this.style[x]){if((/^(height|width)$/).test(x)&&!(/px$/.test(r))){var t=(x=="width")?["left","right"]:["top","bottom"],v=0;t.each(function(s){v+=this.getStyle("border-"+s+"-width").toInt()+this.getStyle("padding-"+s).toInt(); -},this);return this["offset"+x.capitalize()]-v+"px";}if((/^border(.+)Width|margin|padding/).test(x)&&isNaN(parseFloat(r))){return"0px";}}if(o&&/^border(Top|Right|Bottom|Left)?$/.test(x)&&/^#/.test(r)){return r.replace(/^(.+)\s(.+)\s(.+)$/,"$2 $3 $1"); -}return r;},setStyles:function(s){for(var r in s){this.setStyle(r,s[r]);}return this;},getStyles:function(){var r={};Array.flatten(arguments).each(function(s){r[s]=this.getStyle(s); -},this);return r;}});Element.Styles={left:"@px",top:"@px",bottom:"@px",right:"@px",width:"@px",height:"@px",maxWidth:"@px",maxHeight:"@px",minWidth:"@px",minHeight:"@px",backgroundColor:"rgb(@, @, @)",backgroundSize:"@px",backgroundPosition:"@px @px",color:"rgb(@, @, @)",fontSize:"@px",letterSpacing:"@px",lineHeight:"@px",clip:"rect(@px @px @px @px)",margin:"@px @px @px @px",padding:"@px @px @px @px",border:"@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)",borderWidth:"@px @px @px @px",borderStyle:"@ @ @ @",borderColor:"rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)",zIndex:"@",zoom:"@",fontWeight:"@",textIndent:"@px",opacity:"@"}; -Element.ShortStyles={margin:{},padding:{},border:{},borderWidth:{},borderStyle:{},borderColor:{}};["Top","Right","Bottom","Left"].each(function(x){var w=Element.ShortStyles; -var s=Element.Styles;["margin","padding"].each(function(y){var z=y+x;w[y][z]=s[z]="@px";});var v="border"+x;w.border[v]=s[v]="@px @ rgb(@, @, @)";var u=v+"Width",r=v+"Style",t=v+"Color"; -w[v]={};w.borderWidth[u]=w[v][u]=s[u]="@px";w.borderStyle[r]=w[v][r]=s[r]="@";w.borderColor[t]=w[v][t]=s[t]="rgb(@, @, @)";});if(c){Element.ShortStyles.backgroundPosition={backgroundPositionX:"@",backgroundPositionY:"@"}; -}})();(function(){Element.Properties.events={set:function(b){this.addEvents(b);}};[Element,Window,Document].invoke("implement",{addEvent:function(f,h){var i=this.retrieve("events",{}); -if(!i[f]){i[f]={keys:[],values:[]};}if(i[f].keys.contains(h)){return this;}i[f].keys.push(h);var g=f,b=Element.Events[f],d=h,j=this;if(b){if(b.onAdd){b.onAdd.call(this,h,f); -}if(b.condition){d=function(k){if(b.condition.call(this,k,f)){return h.call(this,k);}return true;};}if(b.base){g=Function.from(b.base).call(this,f);}}var e=function(){return h.call(j); -};var c=Element.NativeEvents[g];if(c){if(c==2){e=function(k){k=new DOMEvent(k,j.getWindow());if(d.call(j,k)===false){k.stop();}};}this.addListener(g,e,arguments[2]); -}i[f].values.push(e);return this;},removeEvent:function(e,d){var c=this.retrieve("events");if(!c||!c[e]){return this;}var h=c[e];var b=h.keys.indexOf(d); -if(b==-1){return this;}var g=h.values[b];delete h.keys[b];delete h.values[b];var f=Element.Events[e];if(f){if(f.onRemove){f.onRemove.call(this,d,e);}if(f.base){e=Function.from(f.base).call(this,e); -}}return(Element.NativeEvents[e])?this.removeListener(e,g,arguments[2]):this;},addEvents:function(b){for(var c in b){this.addEvent(c,b[c]);}return this; -},removeEvents:function(b){var d;if(typeOf(b)=="object"){for(d in b){this.removeEvent(d,b[d]);}return this;}var c=this.retrieve("events");if(!c){return this; -}if(!b){for(d in c){this.removeEvents(d);}this.eliminate("events");}else{if(c[b]){c[b].keys.each(function(e){this.removeEvent(b,e);},this);delete c[b]; -}}return this;},fireEvent:function(e,c,b){var d=this.retrieve("events");if(!d||!d[e]){return this;}c=Array.from(c);d[e].keys.each(function(f){if(b){f.delay(b,this,c); -}else{f.apply(this,c);}},this);return this;},cloneEvents:function(e,d){e=document.id(e);var c=e.retrieve("events");if(!c){return this;}if(!d){for(var b in c){this.cloneEvents(e,b); -}}else{if(c[d]){c[d].keys.each(function(f){this.addEvent(d,f);},this);}}return this;}});Element.NativeEvents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,DOMMouseScroll:2,mouseover:2,mouseout:2,mousemove:2,selectstart:2,selectend:2,keydown:2,keypress:2,keyup:2,orientationchange:2,touchstart:2,touchmove:2,touchend:2,touchcancel:2,gesturestart:2,gesturechange:2,gestureend:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,paste:2,input:2,load:2,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,hashchange:1,popstate:2,error:1,abort:1,scroll:1}; -Element.Events={mousewheel:{base:"onwheel" in document?"wheel":"onmousewheel" in document?"mousewheel":"DOMMouseScroll"}};var a=function(b){var c=b.relatedTarget; -if(c==null){return true;}if(!c){return false;}return(c!=this&&c.prefix!="xul"&&typeOf(this)!="document"&&!this.contains(c));};if("onmouseenter" in document.documentElement){Element.NativeEvents.mouseenter=Element.NativeEvents.mouseleave=2; -Element.MouseenterCheck=a;}else{Element.Events.mouseenter={base:"mouseover",condition:a};Element.Events.mouseleave={base:"mouseout",condition:a};}if(!window.addEventListener){Element.NativeEvents.propertychange=2; -Element.Events.change={base:function(){var b=this.type;return(this.get("tag")=="input"&&(b=="radio"||b=="checkbox"))?"propertychange":"change";},condition:function(b){return b.type!="propertychange"||b.event.propertyName=="checked"; -}};}})();(function(){var c=!!window.addEventListener;Element.NativeEvents.focusin=Element.NativeEvents.focusout=2;var k=function(l,m,n,o,p){while(p&&p!=l){if(m(p,o)){return n.call(p,o,p); -}p=document.id(p.parentNode);}};var a={mouseenter:{base:"mouseover",condition:Element.MouseenterCheck},mouseleave:{base:"mouseout",condition:Element.MouseenterCheck},focus:{base:"focus"+(c?"":"in"),capture:true},blur:{base:c?"blur":"focusout",capture:true}}; -var b="$delegation:";var i=function(l){return{base:"focusin",remove:function(m,o){var p=m.retrieve(b+l+"listeners",{})[o];if(p&&p.forms){for(var n=p.forms.length; -n--;){p.forms[n].removeEvent(l,p.fns[n]);}}},listen:function(x,r,v,n,t,s){var o=(t.get("tag")=="form")?t:n.target.getParent("form");if(!o){return;}var u=x.retrieve(b+l+"listeners",{}),p=u[s]||{forms:[],fns:[]},m=p.forms,w=p.fns; -if(m.indexOf(o)!=-1){return;}m.push(o);var q=function(y){k(x,r,v,y,t);};o.addEvent(l,q);w.push(q);u[s]=p;x.store(b+l+"listeners",u);}};};var d=function(l){return{base:"focusin",listen:function(m,n,p,q,r){var o={blur:function(){this.removeEvents(o); -}};o[l]=function(s){k(m,n,p,s,r);};q.target.addEvents(o);}};};if(!c){Object.append(a,{submit:i("submit"),reset:i("reset"),change:d("change"),select:d("select")}); -}var h=Element.prototype,f=h.addEvent,j=h.removeEvent;var e=function(l,m){return function(r,q,n){if(r.indexOf(":relay")==-1){return l.call(this,r,q,n); -}var o=Slick.parse(r).expressions[0][0];if(o.pseudos[0].key!="relay"){return l.call(this,r,q,n);}var p=o.tag;o.pseudos.slice(1).each(function(s){p+=":"+s.key+(s.value?"("+s.value+")":""); -});l.call(this,r,q);return m.call(this,p,o.pseudos[0].value,q);};};var g={addEvent:function(v,q,x){var t=this.retrieve("$delegates",{}),r=t[v];if(r){for(var y in r){if(r[y].fn==x&&r[y].match==q){return this; -}}}var p=v,u=q,o=x,n=a[v]||{};v=n.base||p;q=function(B){return Slick.match(B,u);};var w=Element.Events[p];if(n.condition||w&&w.condition){var l=q,m=n.condition||w.condition; -q=function(C,B){return l(C,B)&&m.call(C,B,v);};}var z=this,s=String.uniqueID();var A=n.listen?function(B,C){if(!C&&B&&B.target){C=B.target;}if(C){n.listen(z,q,x,B,C,s); -}}:function(B,C){if(!C&&B&&B.target){C=B.target;}if(C){k(z,q,x,B,C);}};if(!r){r={};}r[s]={match:u,fn:o,delegator:A};t[p]=r;return f.call(this,v,A,n.capture); -},removeEvent:function(r,n,t,u){var q=this.retrieve("$delegates",{}),p=q[r];if(!p){return this;}if(u){var m=r,w=p[u].delegator,l=a[r]||{};r=l.base||m;if(l.remove){l.remove(this,u); -}delete p[u];q[m]=p;return j.call(this,r,w,l.capture);}var o,v;if(t){for(o in p){v=p[o];if(v.match==n&&v.fn==t){return g.removeEvent.call(this,r,n,t,o); -}}}else{for(o in p){v=p[o];if(v.match==n){g.removeEvent.call(this,r,n,v.fn,o);}}}return this;}};[Element,Window,Document].invoke("implement",{addEvent:e(f,g.addEvent),removeEvent:e(j,g.removeEvent)}); -})();(function(){var h=document.createElement("div"),e=document.createElement("div");h.style.height="0";h.appendChild(e);var d=(e.offsetParent===h);h=e=null; -var l=function(m){return k(m,"position")!="static"||a(m);};var i=function(m){return l(m)||(/^(?:table|td|th)$/i).test(m.tagName);};Element.implement({scrollTo:function(m,n){if(a(this)){this.getWindow().scrollTo(m,n); -}else{this.scrollLeft=m;this.scrollTop=n;}return this;},getSize:function(){if(a(this)){return this.getWindow().getSize();}return{x:this.offsetWidth,y:this.offsetHeight}; -},getScrollSize:function(){if(a(this)){return this.getWindow().getScrollSize();}return{x:this.scrollWidth,y:this.scrollHeight};},getScroll:function(){if(a(this)){return this.getWindow().getScroll(); -}return{x:this.scrollLeft,y:this.scrollTop};},getScrolls:function(){var n=this.parentNode,m={x:0,y:0};while(n&&!a(n)){m.x+=n.scrollLeft;m.y+=n.scrollTop; -n=n.parentNode;}return m;},getOffsetParent:d?function(){var m=this;if(a(m)||k(m,"position")=="fixed"){return null;}var n=(k(m,"position")=="static")?i:l; -while((m=m.parentNode)){if(n(m)){return m;}}return null;}:function(){var m=this;if(a(m)||k(m,"position")=="fixed"){return null;}try{return m.offsetParent; -}catch(n){}return null;},getOffsets:function(){var n=this.getBoundingClientRect;if(n){var r=this.getBoundingClientRect(),p=document.id(this.getDocument().documentElement),q=p.getScroll(),t=this.getScrolls(),s=(k(this,"position")=="fixed"); -return{x:r.left.toInt()+t.x+((s)?0:q.x)-p.clientLeft,y:r.top.toInt()+t.y+((s)?0:q.y)-p.clientTop};}var o=this,m={x:0,y:0};if(a(this)){return m;}while(o&&!a(o)){m.x+=o.offsetLeft; -m.y+=o.offsetTop;o=o.offsetParent;}return m;},getPosition:function(p){var q=this.getOffsets(),n=this.getScrolls();var m={x:q.x-n.x,y:q.y-n.y};if(p&&(p=document.id(p))){var o=p.getPosition(); -return{x:m.x-o.x-b(p),y:m.y-o.y-g(p)};}return m;},getCoordinates:function(o){if(a(this)){return this.getWindow().getCoordinates();}var m=this.getPosition(o),n=this.getSize(); -var p={left:m.x,top:m.y,width:n.x,height:n.y};p.right=p.left+p.width;p.bottom=p.top+p.height;return p;},computePosition:function(m){return{left:m.x-j(this,"margin-left"),top:m.y-j(this,"margin-top")}; -},setPosition:function(m){return this.setStyles(this.computePosition(m));}});[Document,Window].invoke("implement",{getSize:function(){var m=f(this);return{x:m.clientWidth,y:m.clientHeight}; -},getScroll:function(){var n=this.getWindow(),m=f(this);return{x:n.pageXOffset||m.scrollLeft,y:n.pageYOffset||m.scrollTop};},getScrollSize:function(){var o=f(this),n=this.getSize(),m=this.getDocument().body; -return{x:Math.max(o.scrollWidth,m.scrollWidth,n.x),y:Math.max(o.scrollHeight,m.scrollHeight,n.y)};},getPosition:function(){return{x:0,y:0};},getCoordinates:function(){var m=this.getSize(); -return{top:0,left:0,bottom:m.y,right:m.x,height:m.y,width:m.x};}});var k=Element.getComputedStyle;function j(m,n){return k(m,n).toInt()||0;}function c(m){return k(m,"-moz-box-sizing")=="border-box"; -}function g(m){return j(m,"border-top-width");}function b(m){return j(m,"border-left-width");}function a(m){return(/^(?:body|html)$/i).test(m.tagName); -}function f(m){var n=m.getDocument();return(!n.compatMode||n.compatMode=="CSS1Compat")?n.html:n.body;}})();Element.alias({position:"setPosition"});[Window,Document,Element].invoke("implement",{getHeight:function(){return this.getSize().y; -},getWidth:function(){return this.getSize().x;},getScrollTop:function(){return this.getScroll().y;},getScrollLeft:function(){return this.getScroll().x; -},getScrollHeight:function(){return this.getScrollSize().y;},getScrollWidth:function(){return this.getScrollSize().x;},getTop:function(){return this.getPosition().y; -},getLeft:function(){return this.getPosition().x;}});(function(){var f=this.Fx=new Class({Implements:[Chain,Events,Options],options:{fps:60,unit:false,duration:500,frames:null,frameSkip:true,link:"ignore"},initialize:function(g){this.subject=this.subject||this; -this.setOptions(g);},getTransition:function(){return function(g){return -(Math.cos(Math.PI*g)-1)/2;};},step:function(g){if(this.options.frameSkip){var h=(this.time!=null)?(g-this.time):0,i=h/this.frameInterval; -this.time=g;this.frame+=i;}else{this.frame++;}if(this.frame-1&&e.indexOf(document.domain)==-1){return;}var h=g.rules||g.cssRules; -b(h);});return Fx.CSS.Cache[a]=d;}});Fx.CSS.Cache={};Fx.CSS.Parsers={Color:{parse:function(a){if(a.match(/^#[0-9a-f]{3,6}$/i)){return a.hexToRgb(true); -}return((a=a.match(/(\d+),\s*(\d+),\s*(\d+)/)))?[a[1],a[2],a[3]]:false;},compute:function(c,b,a){return c.map(function(e,d){return Math.round(Fx.compute(c[d],b[d],a)); -});},serve:function(a){return a.map(Number);}},Number:{parse:parseFloat,compute:Fx.compute,serve:function(b,a){return(a)?b+a:b;}},String:{parse:Function.from(false),compute:function(b,a){return a; -},serve:function(a){return a;}}};Fx.Tween=new Class({Extends:Fx.CSS,initialize:function(b,a){this.element=this.subject=document.id(b);this.parent(a);},set:function(b,a){if(arguments.length==1){a=b; -b=this.property||this.options.property;}this.render(this.element,b,a,this.options.unit);return this;},start:function(c,e,d){if(!this.check(c,e,d)){return this; -}var b=Array.flatten(arguments);this.property=this.options.property||b.shift();var a=this.prepare(this.element,this.property,b);return this.parent(a.from,a.to); -}});Element.Properties.tween={set:function(a){this.get("tween").cancel().setOptions(a);return this;},get:function(){var a=this.retrieve("tween");if(!a){a=new Fx.Tween(this,{link:"cancel"}); -this.store("tween",a);}return a;}};Element.implement({tween:function(a,c,b){this.get("tween").start(a,c,b);return this;},fade:function(d){var e=this.get("tween"),g,c=["opacity"].append(arguments),a; -if(c[1]==null){c[1]="toggle";}switch(c[1]){case"in":g="start";c[1]=1;break;case"out":g="start";c[1]=0;break;case"show":g="set";c[1]=1;break;case"hide":g="set"; -c[1]=0;break;case"toggle":var b=this.retrieve("fade:flag",this.getStyle("opacity")==1);g="start";c[1]=b?0:1;this.store("fade:flag",!b);a=true;break;default:g="start"; -}if(!a){this.eliminate("fade:flag");}e[g].apply(e,c);var f=c[c.length-1];if(g=="set"||f!=0){this.setStyle("visibility",f==0?"hidden":"visible");}else{e.chain(function(){this.element.setStyle("visibility","hidden"); -this.callChain();});}return this;},highlight:function(c,a){if(!a){a=this.retrieve("highlight:original",this.getStyle("background-color"));a=(a=="transparent")?"#fff":a; -}var b=this.get("tween");b.start("background-color",c||"#ffff88",a).chain(function(){this.setStyle("background-color",this.retrieve("highlight:original")); -b.callChain();}.bind(this));return this;}});Fx.Morph=new Class({Extends:Fx.CSS,initialize:function(b,a){this.element=this.subject=document.id(b);this.parent(a); -},set:function(a){if(typeof a=="string"){a=this.search(a);}for(var b in a){this.render(this.element,b,a[b],this.options.unit);}return this;},compute:function(e,d,c){var a={}; -for(var b in e){a[b]=this.parent(e[b],d[b],c);}return a;},start:function(b){if(!this.check(b)){return this;}if(typeof b=="string"){b=this.search(b);}var e={},d={}; -for(var c in b){var a=this.prepare(this.element,c,b[c]);e[c]=a.from;d[c]=a.to;}return this.parent(e,d);}});Element.Properties.morph={set:function(a){this.get("morph").cancel().setOptions(a); -return this;},get:function(){var a=this.retrieve("morph");if(!a){a=new Fx.Morph(this,{link:"cancel"});this.store("morph",a);}return a;}};Element.implement({morph:function(a){this.get("morph").start(a); -return this;}});Fx.implement({getTransition:function(){var a=this.options.transition||Fx.Transitions.Sine.easeInOut;if(typeof a=="string"){var b=a.split(":"); -a=Fx.Transitions;a=a[b[0]]||a[b[0].capitalize()];if(b[1]){a=a["ease"+b[1].capitalize()+(b[2]?b[2].capitalize():"")];}}return a;}});Fx.Transition=function(c,b){b=Array.from(b); -var a=function(d){return c(d,b);};return Object.append(a,{easeIn:a,easeOut:function(d){return 1-c(1-d,b);},easeInOut:function(d){return(d<=0.5?c(2*d,b):(2-c(2*(1-d),b)))/2; -}});};Fx.Transitions={linear:function(a){return a;}};Fx.Transitions.extend=function(a){for(var b in a){Fx.Transitions[b]=new Fx.Transition(a[b]);}};Fx.Transitions.extend({Pow:function(b,a){return Math.pow(b,a&&a[0]||6); -},Expo:function(a){return Math.pow(2,8*(a-1));},Circ:function(a){return 1-Math.sin(Math.acos(a));},Sine:function(a){return 1-Math.cos(a*Math.PI/2);},Back:function(b,a){a=a&&a[0]||1.618; -return Math.pow(b,2)*((a+1)*b-a);},Bounce:function(f){var e;for(var d=0,c=1;1;d+=c,c/=2){if(f>=(7-4*d)/11){e=c*c-Math.pow((11-6*d-11*f)/4,2);break;}}return e; -},Elastic:function(b,a){return Math.pow(2,10*--b)*Math.cos(20*b*Math.PI*(a&&a[0]||1)/3);}});["Quad","Cubic","Quart","Quint"].each(function(b,a){Fx.Transitions[b]=new Fx.Transition(function(c){return Math.pow(c,a+2); -});});(function(){var d=function(){},a=("onprogress" in new Browser.Request);var c=this.Request=new Class({Implements:[Chain,Events,Options],options:{url:"",data:"",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript, text/html, application/xml, text/xml, */*"},async:true,format:false,method:"post",link:"ignore",isSuccess:null,emulation:true,urlEncoded:true,encoding:"utf-8",evalScripts:false,evalResponse:false,timeout:0,noCache:false},initialize:function(e){this.xhr=new Browser.Request(); -this.setOptions(e);this.headers=this.options.headers;},onStateChange:function(){var e=this.xhr;if(e.readyState!=4||!this.running){return;}this.running=false; -this.status=0;Function.attempt(function(){var f=e.status;this.status=(f==1223)?204:f;}.bind(this));e.onreadystatechange=d;if(a){e.onprogress=e.onloadstart=d; -}clearTimeout(this.timer);this.response={text:this.xhr.responseText||"",xml:this.xhr.responseXML};if(this.options.isSuccess.call(this,this.status)){this.success(this.response.text,this.response.xml); -}else{this.failure();}},isSuccess:function(){var e=this.status;return(e>=200&&e<300);},isRunning:function(){return !!this.running;},processScripts:function(e){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader("Content-type"))){return Browser.exec(e); -}return e.stripScripts(this.options.evalScripts);},success:function(f,e){this.onSuccess(this.processScripts(f),e);},onSuccess:function(){this.fireEvent("complete",arguments).fireEvent("success",arguments).callChain(); -},failure:function(){this.onFailure();},onFailure:function(){this.fireEvent("complete").fireEvent("failure",this.xhr);},loadstart:function(e){this.fireEvent("loadstart",[e,this.xhr]); -},progress:function(e){this.fireEvent("progress",[e,this.xhr]);},timeout:function(){this.fireEvent("timeout",this.xhr);},setHeader:function(e,f){this.headers[e]=f; -return this;},getHeader:function(e){return Function.attempt(function(){return this.xhr.getResponseHeader(e);}.bind(this));},check:function(){if(!this.running){return true; -}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(this.caller.pass(arguments,this));return false;}return false;},send:function(o){if(!this.check(o)){return this; -}this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.running=true;var l=typeOf(o);if(l=="string"||l=="element"){o={data:o};}var h=this.options; -o=Object.append({data:h.data,url:h.url,method:h.method},o);var j=o.data,f=String(o.url),e=o.method.toLowerCase();switch(typeOf(j)){case"element":j=document.id(j).toQueryString(); -break;case"object":case"hash":j=Object.toQueryString(j);}if(this.options.format){var m="format="+this.options.format;j=(j)?m+"&"+j:m;}if(this.options.emulation&&!["get","post"].contains(e)){var k="_method="+e; -j=(j)?k+"&"+j:k;e="post";}if(this.options.urlEncoded&&["post","put"].contains(e)){var g=(this.options.encoding)?"; charset="+this.options.encoding:"";this.headers["Content-type"]="application/x-www-form-urlencoded"+g; -}if(!f){f=document.location.pathname;}var i=f.lastIndexOf("/");if(i>-1&&(i=f.indexOf("#"))>-1){f=f.substr(0,i);}if(this.options.noCache){f+=(f.indexOf("?")>-1?"&":"?")+String.uniqueID(); -}if(j&&(e=="get"||e=="delete")){f+=(f.indexOf("?")>-1?"&":"?")+j;j=null;}var n=this.xhr;if(a){n.onloadstart=this.loadstart.bind(this);n.onprogress=this.progress.bind(this); -}n.open(e.toUpperCase(),f,this.options.async,this.options.user,this.options.password);if(this.options.user&&"withCredentials" in n){n.withCredentials=true; -}n.onreadystatechange=this.onStateChange.bind(this);Object.each(this.headers,function(q,p){try{n.setRequestHeader(p,q);}catch(r){this.fireEvent("exception",[p,q]); -}},this);this.fireEvent("request");n.send(j);if(!this.options.async){this.onStateChange();}else{if(this.options.timeout){this.timer=this.timeout.delay(this.options.timeout,this); -}}return this;},cancel:function(){if(!this.running){return this;}this.running=false;var e=this.xhr;e.abort();clearTimeout(this.timer);e.onreadystatechange=d; -if(a){e.onprogress=e.onloadstart=d;}this.xhr=new Browser.Request();this.fireEvent("cancel");return this;}});var b={};["get","post","put","delete","GET","POST","PUT","DELETE"].each(function(e){b[e]=function(g){var f={method:e}; -if(g!=null){f.data=g;}return this.send(f);};});c.implement(b);Element.Properties.send={set:function(e){var f=this.get("send").cancel();f.setOptions(e); -return this;},get:function(){var e=this.retrieve("send");if(!e){e=new c({data:this,link:"cancel",method:this.get("method")||"post",url:this.get("action")}); -this.store("send",e);}return e;}};Element.implement({send:function(e){var f=this.get("send");f.send({data:this,url:e||f.options.url});return this;}});})(); -Request.HTML=new Class({Extends:Request,options:{update:false,append:false,evalScripts:true,filter:false,headers:{Accept:"text/html, application/xml, text/xml, */*"}},success:function(f){var e=this.options,c=this.response; -c.html=f.stripScripts(function(h){c.javascript=h;});var d=c.html.match(/]*>([\s\S]*?)<\/body>/i);if(d){c.html=d[1];}var b=new Element("div").set("html",c.html); -c.tree=b.childNodes;c.elements=b.getElements(e.filter||"*");if(e.filter){c.tree=c.elements;}if(e.update){var g=document.id(e.update).empty();if(e.filter){g.adopt(c.elements); -}else{g.set("html",c.html);}}else{if(e.append){var a=document.id(e.append);if(e.filter){c.elements.reverse().inject(a);}else{a.adopt(b.getChildren());}}}if(e.evalScripts){Browser.exec(c.javascript); -}this.onSuccess(c.tree,c.elements,c.html,c.javascript);}});Element.Properties.load={set:function(a){var b=this.get("load").cancel();b.setOptions(a);return this; -},get:function(){var a=this.retrieve("load");if(!a){a=new Request.HTML({data:this,link:"cancel",update:this,method:"get"});this.store("load",a);}return a; -}};Element.implement({load:function(){this.get("load").send(Array.link(arguments,{data:Type.isObject,url:Type.isString}));return this;}});if(typeof JSON=="undefined"){this.JSON={}; -}(function(){var special={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};var escape=function(chr){return special[chr]||"\\u"+("0000"+chr.charCodeAt(0).toString(16)).slice(-4); -};JSON.validate=function(string){string=string.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""); -return(/^[\],:{}\s]*$/).test(string);};JSON.encode=JSON.stringify?function(obj){return JSON.stringify(obj);}:function(obj){if(obj&&obj.toJSON){obj=obj.toJSON(); -}switch(typeOf(obj)){case"string":return'"'+obj.replace(/[\x00-\x1f\\"]/g,escape)+'"';case"array":return"["+obj.map(JSON.encode).clean()+"]";case"object":case"hash":var string=[]; -Object.each(obj,function(value,key){var json=JSON.encode(value);if(json){string.push(JSON.encode(key)+":"+json);}});return"{"+string+"}";case"number":case"boolean":return""+obj; -case"null":return"null";}return null;};JSON.secure=true;JSON.decode=function(string,secure){if(!string||typeOf(string)!="string"){return null;}if(secure==null){secure=JSON.secure; -}if(secure){if(JSON.parse){return JSON.parse(string);}if(!JSON.validate(string)){throw new Error("JSON could not decode the input; security is enabled and the value is not secure."); -}}return eval("("+string+")");};})();Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(a){this.parent(a);Object.append(this.headers,{Accept:"application/json","X-Request":"JSON"}); -},success:function(c){var b;try{b=this.response.json=JSON.decode(c,this.options.secure);}catch(a){this.fireEvent("error",[c,a]);return;}if(b==null){this.onFailure(); -}else{this.onSuccess(b,c);}}});var Cookie=new Class({Implements:Options,options:{path:"/",domain:false,duration:false,secure:false,document:document,encode:true},initialize:function(b,a){this.key=b; -this.setOptions(a);},write:function(b){if(this.options.encode){b=encodeURIComponent(b);}if(this.options.domain){b+="; domain="+this.options.domain;}if(this.options.path){b+="; path="+this.options.path; -}if(this.options.duration){var a=new Date();a.setTime(a.getTime()+this.options.duration*24*60*60*1000);b+="; expires="+a.toGMTString();}if(this.options.secure){b+="; secure"; -}this.options.document.cookie=this.key+"="+b;return this;},read:function(){var a=this.options.document.cookie.match("(?:^|;)\\s*"+this.key.escapeRegExp()+"=([^;]*)"); -return(a)?decodeURIComponent(a[1]):null;},dispose:function(){new Cookie(this.key,Object.merge({},this.options,{duration:-1})).write("");return this;}}); -Cookie.write=function(b,c,a){return new Cookie(b,a).write(c);};Cookie.read=function(a){return new Cookie(a).read();};Cookie.dispose=function(b,a){return new Cookie(b,a).dispose(); -};(function(i,k){var l,f,e=[],c,b,d=k.createElement("div");var g=function(){clearTimeout(b);if(l){return;}Browser.loaded=l=true;k.removeListener("DOMContentLoaded",g).removeListener("readystatechange",a); -k.fireEvent("domready");i.fireEvent("domready");};var a=function(){for(var m=e.length;m--;){if(e[m]()){g();return true;}}return false;};var j=function(){clearTimeout(b); -if(!a()){b=setTimeout(j,10);}};k.addListener("DOMContentLoaded",g);var h=function(){try{d.doScroll();return true;}catch(m){}return false;};if(d.doScroll&&!h()){e.push(h); -c=true;}if(k.readyState){e.push(function(){var m=k.readyState;return(m=="loaded"||m=="complete");});}if("onreadystatechange" in k){k.addListener("readystatechange",a); -}else{c=true;}if(c){j();}Element.Events.domready={onAdd:function(m){if(l){m.call(this);}}};Element.Events.load={base:"load",onAdd:function(m){if(f&&this==i){m.call(this); -}},condition:function(){if(this==i){g();delete Element.Events.load;}return true;}};i.addEvent("load",function(){f=true;});})(window,document); \ No newline at end of file diff --git a/pyload/webui/themes/Default/js/static/mootools-more.js b/pyload/webui/themes/Default/js/static/mootools-more.js deleted file mode 100644 index c7f4a1a0e..000000000 --- a/pyload/webui/themes/Default/js/static/mootools-more.js +++ /dev/null @@ -1,2856 +0,0 @@ -/* ---- -MooTools: the javascript framework - -web build: - - http://mootools.net/more/c1cc18c2fff04bcc58921b4dff80a6f1 - -packager build: - - packager build More/Form.Request More/Fx.Reveal More/Sortables More/Request.Periodical More/Color - -... -*/ - -/* ---- - -script: More.js - -name: More - -description: MooTools More - -license: MIT-style license - -authors: - - Guillermo Rauch - - Thomas Aylott - - Scott Kyle - - Arian Stolwijk - - Tim Wienk - - Christoph Pojer - - Aaron Newton - - Jacob Thornton - -requires: - - Core/MooTools - -provides: [MooTools.More] - -... -*/ - -MooTools.More = { - version: '1.5.0', - build: '73db5e24e6e9c5c87b3a27aebef2248053f7db37' -}; - - -/* ---- - -script: Class.Binds.js - -name: Class.Binds - -description: Automagically binds specified methods in a class to the instance of the class. - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Class - - MooTools.More - -provides: [Class.Binds] - -... -*/ - -Class.Mutators.Binds = function(binds){ - if (!this.prototype.initialize) this.implement('initialize', function(){}); - return Array.from(binds).concat(this.prototype.Binds || []); -}; - -Class.Mutators.initialize = function(initialize){ - return function(){ - Array.from(this.Binds).each(function(name){ - var original = this[name]; - if (original) this[name] = original.bind(this); - }, this); - return initialize.apply(this, arguments); - }; -}; - - -/* ---- - -script: Class.Occlude.js - -name: Class.Occlude - -description: Prevents a class from being applied to a DOM element twice. - -license: MIT-style license. - -authors: - - Aaron Newton - -requires: - - Core/Class - - Core/Element - - MooTools.More - -provides: [Class.Occlude] - -... -*/ - -Class.Occlude = new Class({ - - occlude: function(property, element){ - element = document.id(element || this.element); - var instance = element.retrieve(property || this.property); - if (instance && !this.occluded) - return (this.occluded = instance); - - this.occluded = false; - element.store(property || this.property, this); - return this.occluded; - } - -}); - - -/* ---- - -script: Class.Refactor.js - -name: Class.Refactor - -description: Extends a class onto itself with new property, preserving any items attached to the class's namespace. - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Class - - MooTools.More - -# Some modules declare themselves dependent on Class.Refactor -provides: [Class.refactor, Class.Refactor] - -... -*/ - -Class.refactor = function(original, refactors){ - - Object.each(refactors, function(item, name){ - var origin = original.prototype[name]; - origin = (origin && origin.$origin) || origin || function(){}; - original.implement(name, (typeof item == 'function') ? function(){ - var old = this.previous; - this.previous = origin; - var value = item.apply(this, arguments); - this.previous = old; - return value; - } : item); - }); - - return original; - -}; - - -/* ---- - -script: Element.Measure.js - -name: Element.Measure - -description: Extends the Element native object to include methods useful in measuring dimensions. - -credits: "Element.measure / .expose methods by Daniel Steigerwald License: MIT-style license. Copyright: Copyright (c) 2008 Daniel Steigerwald, daniel.steigerwald.cz" - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Element.Style - - Core/Element.Dimensions - - MooTools.More - -provides: [Element.Measure] - -... -*/ - -(function(){ - -var getStylesList = function(styles, planes){ - var list = []; - Object.each(planes, function(directions){ - Object.each(directions, function(edge){ - styles.each(function(style){ - list.push(style + '-' + edge + (style == 'border' ? '-width' : '')); - }); - }); - }); - return list; -}; - -var calculateEdgeSize = function(edge, styles){ - var total = 0; - Object.each(styles, function(value, style){ - if (style.test(edge)) total = total + value.toInt(); - }); - return total; -}; - -var isVisible = function(el){ - return !!(!el || el.offsetHeight || el.offsetWidth); -}; - - -Element.implement({ - - measure: function(fn){ - if (isVisible(this)) return fn.call(this); - var parent = this.getParent(), - toMeasure = []; - while (!isVisible(parent) && parent != document.body){ - toMeasure.push(parent.expose()); - parent = parent.getParent(); - } - var restore = this.expose(), - result = fn.call(this); - restore(); - toMeasure.each(function(restore){ - restore(); - }); - return result; - }, - - expose: function(){ - if (this.getStyle('display') != 'none') return function(){}; - var before = this.style.cssText; - this.setStyles({ - display: 'block', - position: 'absolute', - visibility: 'hidden' - }); - return function(){ - this.style.cssText = before; - }.bind(this); - }, - - getDimensions: function(options){ - options = Object.merge({computeSize: false}, options); - var dim = {x: 0, y: 0}; - - var getSize = function(el, options){ - return (options.computeSize) ? el.getComputedSize(options) : el.getSize(); - }; - - var parent = this.getParent('body'); - - if (parent && this.getStyle('display') == 'none'){ - dim = this.measure(function(){ - return getSize(this, options); - }); - } else if (parent){ - try { //safari sometimes crashes here, so catch it - dim = getSize(this, options); - }catch(e){} - } - - return Object.append(dim, (dim.x || dim.x === 0) ? { - width: dim.x, - height: dim.y - } : { - x: dim.width, - y: dim.height - } - ); - }, - - getComputedSize: function(options){ - - - options = Object.merge({ - styles: ['padding','border'], - planes: { - height: ['top','bottom'], - width: ['left','right'] - }, - mode: 'both' - }, options); - - var styles = {}, - size = {width: 0, height: 0}, - dimensions; - - if (options.mode == 'vertical'){ - delete size.width; - delete options.planes.width; - } else if (options.mode == 'horizontal'){ - delete size.height; - delete options.planes.height; - } - - getStylesList(options.styles, options.planes).each(function(style){ - styles[style] = this.getStyle(style).toInt(); - }, this); - - Object.each(options.planes, function(edges, plane){ - - var capitalized = plane.capitalize(), - style = this.getStyle(plane); - - if (style == 'auto' && !dimensions) dimensions = this.getDimensions(); - - style = styles[plane] = (style == 'auto') ? dimensions[plane] : style.toInt(); - size['total' + capitalized] = style; - - edges.each(function(edge){ - var edgesize = calculateEdgeSize(edge, styles); - size['computed' + edge.capitalize()] = edgesize; - size['total' + capitalized] += edgesize; - }); - - }, this); - - return Object.append(size, styles); - } - -}); - -})(); - - -/* ---- - -script: Element.Position.js - -name: Element.Position - -description: Extends the Element native object to include methods useful positioning elements relative to others. - -license: MIT-style license - -authors: - - Aaron Newton - - Jacob Thornton - -requires: - - Core/Options - - Core/Element.Dimensions - - Element.Measure - -provides: [Element.Position] - -... -*/ - -(function(original){ - -var local = Element.Position = { - - options: {/* - edge: false, - returnPos: false, - minimum: {x: 0, y: 0}, - maximum: {x: 0, y: 0}, - relFixedPosition: false, - ignoreMargins: false, - ignoreScroll: false, - allowNegative: false,*/ - relativeTo: document.body, - position: { - x: 'center', //left, center, right - y: 'center' //top, center, bottom - }, - offset: {x: 0, y: 0} - }, - - getOptions: function(element, options){ - options = Object.merge({}, local.options, options); - local.setPositionOption(options); - local.setEdgeOption(options); - local.setOffsetOption(element, options); - local.setDimensionsOption(element, options); - return options; - }, - - setPositionOption: function(options){ - options.position = local.getCoordinateFromValue(options.position); - }, - - setEdgeOption: function(options){ - var edgeOption = local.getCoordinateFromValue(options.edge); - options.edge = edgeOption ? edgeOption : - (options.position.x == 'center' && options.position.y == 'center') ? {x: 'center', y: 'center'} : - {x: 'left', y: 'top'}; - }, - - setOffsetOption: function(element, options){ - var parentOffset = {x: 0, y: 0}; - var parentScroll = {x: 0, y: 0}; - var offsetParent = element.measure(function(){ - return document.id(this.getOffsetParent()); - }); - - if (!offsetParent || offsetParent == element.getDocument().body) return; - - parentScroll = offsetParent.getScroll(); - parentOffset = offsetParent.measure(function(){ - var position = this.getPosition(); - if (this.getStyle('position') == 'fixed'){ - var scroll = window.getScroll(); - position.x += scroll.x; - position.y += scroll.y; - } - return position; - }); - - options.offset = { - parentPositioned: offsetParent != document.id(options.relativeTo), - x: options.offset.x - parentOffset.x + parentScroll.x, - y: options.offset.y - parentOffset.y + parentScroll.y - }; - }, - - setDimensionsOption: function(element, options){ - options.dimensions = element.getDimensions({ - computeSize: true, - styles: ['padding', 'border', 'margin'] - }); - }, - - getPosition: function(element, options){ - var position = {}; - options = local.getOptions(element, options); - var relativeTo = document.id(options.relativeTo) || document.body; - - local.setPositionCoordinates(options, position, relativeTo); - if (options.edge) local.toEdge(position, options); - - var offset = options.offset; - position.left = ((position.x >= 0 || offset.parentPositioned || options.allowNegative) ? position.x : 0).toInt(); - position.top = ((position.y >= 0 || offset.parentPositioned || options.allowNegative) ? position.y : 0).toInt(); - - local.toMinMax(position, options); - - if (options.relFixedPosition || relativeTo.getStyle('position') == 'fixed') local.toRelFixedPosition(relativeTo, position); - if (options.ignoreScroll) local.toIgnoreScroll(relativeTo, position); - if (options.ignoreMargins) local.toIgnoreMargins(position, options); - - position.left = Math.ceil(position.left); - position.top = Math.ceil(position.top); - delete position.x; - delete position.y; - - return position; - }, - - setPositionCoordinates: function(options, position, relativeTo){ - var offsetY = options.offset.y, - offsetX = options.offset.x, - calc = (relativeTo == document.body) ? window.getScroll() : relativeTo.getPosition(), - top = calc.y, - left = calc.x, - winSize = window.getSize(); - - switch(options.position.x){ - case 'left': position.x = left + offsetX; break; - case 'right': position.x = left + offsetX + relativeTo.offsetWidth; break; - default: position.x = left + ((relativeTo == document.body ? winSize.x : relativeTo.offsetWidth) / 2) + offsetX; break; - } - - switch(options.position.y){ - case 'top': position.y = top + offsetY; break; - case 'bottom': position.y = top + offsetY + relativeTo.offsetHeight; break; - default: position.y = top + ((relativeTo == document.body ? winSize.y : relativeTo.offsetHeight) / 2) + offsetY; break; - } - }, - - toMinMax: function(position, options){ - var xy = {left: 'x', top: 'y'}, value; - ['minimum', 'maximum'].each(function(minmax){ - ['left', 'top'].each(function(lr){ - value = options[minmax] ? options[minmax][xy[lr]] : null; - if (value != null && ((minmax == 'minimum') ? position[lr] < value : position[lr] > value)) position[lr] = value; - }); - }); - }, - - toRelFixedPosition: function(relativeTo, position){ - var winScroll = window.getScroll(); - position.top += winScroll.y; - position.left += winScroll.x; - }, - - toIgnoreScroll: function(relativeTo, position){ - var relScroll = relativeTo.getScroll(); - position.top -= relScroll.y; - position.left -= relScroll.x; - }, - - toIgnoreMargins: function(position, options){ - position.left += options.edge.x == 'right' - ? options.dimensions['margin-right'] - : (options.edge.x != 'center' - ? -options.dimensions['margin-left'] - : -options.dimensions['margin-left'] + ((options.dimensions['margin-right'] + options.dimensions['margin-left']) / 2)); - - position.top += options.edge.y == 'bottom' - ? options.dimensions['margin-bottom'] - : (options.edge.y != 'center' - ? -options.dimensions['margin-top'] - : -options.dimensions['margin-top'] + ((options.dimensions['margin-bottom'] + options.dimensions['margin-top']) / 2)); - }, - - toEdge: function(position, options){ - var edgeOffset = {}, - dimensions = options.dimensions, - edge = options.edge; - - switch(edge.x){ - case 'left': edgeOffset.x = 0; break; - case 'right': edgeOffset.x = -dimensions.x - dimensions.computedRight - dimensions.computedLeft; break; - // center - default: edgeOffset.x = -(Math.round(dimensions.totalWidth / 2)); break; - } - - switch(edge.y){ - case 'top': edgeOffset.y = 0; break; - case 'bottom': edgeOffset.y = -dimensions.y - dimensions.computedTop - dimensions.computedBottom; break; - // center - default: edgeOffset.y = -(Math.round(dimensions.totalHeight / 2)); break; - } - - position.x += edgeOffset.x; - position.y += edgeOffset.y; - }, - - getCoordinateFromValue: function(option){ - if (typeOf(option) != 'string') return option; - option = option.toLowerCase(); - - return { - x: option.test('left') ? 'left' - : (option.test('right') ? 'right' : 'center'), - y: option.test(/upper|top/) ? 'top' - : (option.test('bottom') ? 'bottom' : 'center') - }; - } - -}; - -Element.implement({ - - position: function(options){ - if (options && (options.x != null || options.y != null)){ - return (original ? original.apply(this, arguments) : this); - } - var position = this.setStyle('position', 'absolute').calculatePosition(options); - return (options && options.returnPos) ? position : this.setStyles(position); - }, - - calculatePosition: function(options){ - return local.getPosition(this, options); - } - -}); - -})(Element.prototype.position); - - -/* ---- - -script: IframeShim.js - -name: IframeShim - -description: Defines IframeShim, a class for obscuring select lists and flash objects in IE. - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Element.Event - - Core/Element.Style - - Core/Options - - Core/Events - - Element.Position - - Class.Occlude - -provides: [IframeShim] - -... -*/ - -(function(){ - -var browsers = false; - - -this.IframeShim = new Class({ - - Implements: [Options, Events, Class.Occlude], - - options: { - className: 'iframeShim', - src: 'javascript:false;document.write("");', - display: false, - zIndex: null, - margin: 0, - offset: {x: 0, y: 0}, - browsers: browsers - }, - - property: 'IframeShim', - - initialize: function(element, options){ - this.element = document.id(element); - if (this.occlude()) return this.occluded; - this.setOptions(options); - this.makeShim(); - return this; - }, - - makeShim: function(){ - if (this.options.browsers){ - var zIndex = this.element.getStyle('zIndex').toInt(); - - if (!zIndex){ - zIndex = 1; - var pos = this.element.getStyle('position'); - if (pos == 'static' || !pos) this.element.setStyle('position', 'relative'); - this.element.setStyle('zIndex', zIndex); - } - zIndex = ((this.options.zIndex != null || this.options.zIndex === 0) && zIndex > this.options.zIndex) ? this.options.zIndex : zIndex - 1; - if (zIndex < 0) zIndex = 1; - this.shim = new Element('iframe', { - src: this.options.src, - scrolling: 'no', - frameborder: 0, - styles: { - zIndex: zIndex, - position: 'absolute', - border: 'none', - filter: 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)' - }, - 'class': this.options.className - }).store('IframeShim', this); - var inject = (function(){ - this.shim.inject(this.element, 'after'); - this[this.options.display ? 'show' : 'hide'](); - this.fireEvent('inject'); - }).bind(this); - if (!IframeShim.ready) window.addEvent('load', inject); - else inject(); - } else { - this.position = this.hide = this.show = this.dispose = Function.from(this); - } - }, - - position: function(){ - if (!IframeShim.ready || !this.shim) return this; - var size = this.element.measure(function(){ - return this.getSize(); - }); - if (this.options.margin != undefined){ - size.x = size.x - (this.options.margin * 2); - size.y = size.y - (this.options.margin * 2); - this.options.offset.x += this.options.margin; - this.options.offset.y += this.options.margin; - } - this.shim.set({width: size.x, height: size.y}).position({ - relativeTo: this.element, - offset: this.options.offset - }); - return this; - }, - - hide: function(){ - if (this.shim) this.shim.setStyle('display', 'none'); - return this; - }, - - show: function(){ - if (this.shim) this.shim.setStyle('display', 'block'); - return this.position(); - }, - - dispose: function(){ - if (this.shim) this.shim.dispose(); - return this; - }, - - destroy: function(){ - if (this.shim) this.shim.destroy(); - return this; - } - -}); - -})(); - -window.addEvent('load', function(){ - IframeShim.ready = true; -}); - - -/* ---- - -script: Mask.js - -name: Mask - -description: Creates a mask element to cover another. - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Options - - Core/Events - - Core/Element.Event - - Class.Binds - - Element.Position - - IframeShim - -provides: [Mask] - -... -*/ - -var Mask = new Class({ - - Implements: [Options, Events], - - Binds: ['position'], - - options: {/* - onShow: function(){}, - onHide: function(){}, - onDestroy: function(){}, - onClick: function(event){}, - inject: { - where: 'after', - target: null, - }, - hideOnClick: false, - id: null, - destroyOnHide: false,*/ - style: {}, - 'class': 'mask', - maskMargins: false, - useIframeShim: true, - iframeShimOptions: {} - }, - - initialize: function(target, options){ - this.target = document.id(target) || document.id(document.body); - this.target.store('mask', this); - this.setOptions(options); - this.render(); - this.inject(); - }, - - render: function(){ - this.element = new Element('div', { - 'class': this.options['class'], - id: this.options.id || 'mask-' + String.uniqueID(), - styles: Object.merge({}, this.options.style, { - display: 'none' - }), - events: { - click: function(event){ - this.fireEvent('click', event); - if (this.options.hideOnClick) this.hide(); - }.bind(this) - } - }); - - this.hidden = true; - }, - - toElement: function(){ - return this.element; - }, - - inject: function(target, where){ - where = where || (this.options.inject ? this.options.inject.where : '') || (this.target == document.body ? 'inside' : 'after'); - target = target || (this.options.inject && this.options.inject.target) || this.target; - - this.element.inject(target, where); - - if (this.options.useIframeShim){ - this.shim = new IframeShim(this.element, this.options.iframeShimOptions); - - this.addEvents({ - show: this.shim.show.bind(this.shim), - hide: this.shim.hide.bind(this.shim), - destroy: this.shim.destroy.bind(this.shim) - }); - } - }, - - position: function(){ - this.resize(this.options.width, this.options.height); - - this.element.position({ - relativeTo: this.target, - position: 'topLeft', - ignoreMargins: !this.options.maskMargins, - ignoreScroll: this.target == document.body - }); - - return this; - }, - - resize: function(x, y){ - var opt = { - styles: ['padding', 'border'] - }; - if (this.options.maskMargins) opt.styles.push('margin'); - - var dim = this.target.getComputedSize(opt); - if (this.target == document.body){ - this.element.setStyles({width: 0, height: 0}); - var win = window.getScrollSize(); - if (dim.totalHeight < win.y) dim.totalHeight = win.y; - if (dim.totalWidth < win.x) dim.totalWidth = win.x; - } - this.element.setStyles({ - width: Array.pick([x, dim.totalWidth, dim.x]), - height: Array.pick([y, dim.totalHeight, dim.y]) - }); - - return this; - }, - - show: function(){ - if (!this.hidden) return this; - - window.addEvent('resize', this.position); - this.position(); - this.showMask.apply(this, arguments); - - return this; - }, - - showMask: function(){ - this.element.setStyle('display', 'block'); - this.hidden = false; - this.fireEvent('show'); - }, - - hide: function(){ - if (this.hidden) return this; - - window.removeEvent('resize', this.position); - this.hideMask.apply(this, arguments); - if (this.options.destroyOnHide) return this.destroy(); - - return this; - }, - - hideMask: function(){ - this.element.setStyle('display', 'none'); - this.hidden = true; - this.fireEvent('hide'); - }, - - toggle: function(){ - this[this.hidden ? 'show' : 'hide'](); - }, - - destroy: function(){ - this.hide(); - this.element.destroy(); - this.fireEvent('destroy'); - this.target.eliminate('mask'); - } - -}); - -Element.Properties.mask = { - - set: function(options){ - var mask = this.retrieve('mask'); - if (mask) mask.destroy(); - return this.eliminate('mask').store('mask:options', options); - }, - - get: function(){ - var mask = this.retrieve('mask'); - if (!mask){ - mask = new Mask(this, this.retrieve('mask:options')); - this.store('mask', mask); - } - return mask; - } - -}; - -Element.implement({ - - mask: function(options){ - if (options) this.set('mask', options); - this.get('mask').show(); - return this; - }, - - unmask: function(){ - this.get('mask').hide(); - return this; - } - -}); - - -/* ---- - -script: Spinner.js - -name: Spinner - -description: Adds a semi-transparent overlay over a dom element with a spinnin ajax icon. - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Fx.Tween - - Core/Request - - Class.refactor - - Mask - -provides: [Spinner] - -... -*/ - -var Spinner = new Class({ - - Extends: Mask, - - Implements: Chain, - - options: {/* - message: false,*/ - 'class': 'spinner', - containerPosition: {}, - content: { - 'class': 'spinner-content' - }, - messageContainer: { - 'class': 'spinner-msg' - }, - img: { - 'class': 'spinner-img' - }, - fxOptions: { - link: 'chain' - } - }, - - initialize: function(target, options){ - this.target = document.id(target) || document.id(document.body); - this.target.store('spinner', this); - this.setOptions(options); - this.render(); - this.inject(); - - // Add this to events for when noFx is true; parent methods handle hide/show. - var deactivate = function(){ this.active = false; }.bind(this); - this.addEvents({ - hide: deactivate, - show: deactivate - }); - }, - - render: function(){ - this.parent(); - - this.element.set('id', this.options.id || 'spinner-' + String.uniqueID()); - - this.content = document.id(this.options.content) || new Element('div', this.options.content); - this.content.inject(this.element); - - if (this.options.message){ - this.msg = document.id(this.options.message) || new Element('p', this.options.messageContainer).appendText(this.options.message); - this.msg.inject(this.content); - } - - if (this.options.img){ - this.img = document.id(this.options.img) || new Element('div', this.options.img); - this.img.inject(this.content); - } - - this.element.set('tween', this.options.fxOptions); - }, - - show: function(noFx){ - if (this.active) return this.chain(this.show.bind(this)); - if (!this.hidden){ - this.callChain.delay(20, this); - return this; - } - - this.target.set('aria-busy', 'true'); - this.active = true; - - return this.parent(noFx); - }, - - showMask: function(noFx){ - var pos = function(){ - this.content.position(Object.merge({ - relativeTo: this.element - }, this.options.containerPosition)); - }.bind(this); - - if (noFx){ - this.parent(); - pos(); - } else { - if (!this.options.style.opacity) this.options.style.opacity = this.element.getStyle('opacity').toFloat(); - this.element.setStyles({ - display: 'block', - opacity: 0 - }).tween('opacity', this.options.style.opacity); - pos(); - this.hidden = false; - this.fireEvent('show'); - this.callChain(); - } - }, - - hide: function(noFx){ - if (this.active) return this.chain(this.hide.bind(this)); - if (this.hidden){ - this.callChain.delay(20, this); - return this; - } - - this.target.set('aria-busy', 'false'); - this.active = true; - - return this.parent(noFx); - }, - - hideMask: function(noFx){ - if (noFx) return this.parent(); - this.element.tween('opacity', 0).get('tween').chain(function(){ - this.element.setStyle('display', 'none'); - this.hidden = true; - this.fireEvent('hide'); - this.callChain(); - }.bind(this)); - }, - - destroy: function(){ - this.content.destroy(); - this.parent(); - this.target.eliminate('spinner'); - } - -}); - -Request = Class.refactor(Request, { - - options: { - useSpinner: false, - spinnerOptions: {}, - spinnerTarget: false - }, - - initialize: function(options){ - this._send = this.send; - this.send = function(options){ - var spinner = this.getSpinner(); - if (spinner) spinner.chain(this._send.pass(options, this)).show(); - else this._send(options); - return this; - }; - this.previous(options); - }, - - getSpinner: function(){ - if (!this.spinner){ - var update = document.id(this.options.spinnerTarget) || document.id(this.options.update); - if (this.options.useSpinner && update){ - update.set('spinner', this.options.spinnerOptions); - var spinner = this.spinner = update.get('spinner'); - ['complete', 'exception', 'cancel'].each(function(event){ - this.addEvent(event, spinner.hide.bind(spinner)); - }, this); - } - } - return this.spinner; - } - -}); - -Element.Properties.spinner = { - - set: function(options){ - var spinner = this.retrieve('spinner'); - if (spinner) spinner.destroy(); - return this.eliminate('spinner').store('spinner:options', options); - }, - - get: function(){ - var spinner = this.retrieve('spinner'); - if (!spinner){ - spinner = new Spinner(this, this.retrieve('spinner:options')); - this.store('spinner', spinner); - } - return spinner; - } - -}; - -Element.implement({ - - spin: function(options){ - if (options) this.set('spinner', options); - this.get('spinner').show(); - return this; - }, - - unspin: function(){ - this.get('spinner').hide(); - return this; - } - -}); - - -/* ---- - -script: String.QueryString.js - -name: String.QueryString - -description: Methods for dealing with URI query strings. - -license: MIT-style license - -authors: - - Sebastian Markbåge - - Aaron Newton - - Lennart Pilon - - Valerio Proietti - -requires: - - Core/Array - - Core/String - - MooTools.More - -provides: [String.QueryString] - -... -*/ - -String.implement({ - - parseQueryString: function(decodeKeys, decodeValues){ - if (decodeKeys == null) decodeKeys = true; - if (decodeValues == null) decodeValues = true; - - var vars = this.split(/[&;]/), - object = {}; - if (!vars.length) return object; - - vars.each(function(val){ - var index = val.indexOf('=') + 1, - value = index ? val.substr(index) : '', - keys = index ? val.substr(0, index - 1).match(/([^\]\[]+|(\B)(?=\]))/g) : [val], - obj = object; - if (!keys) return; - if (decodeValues) value = decodeURIComponent(value); - keys.each(function(key, i){ - if (decodeKeys) key = decodeURIComponent(key); - var current = obj[key]; - - if (i < keys.length - 1) obj = obj[key] = current || {}; - else if (typeOf(current) == 'array') current.push(value); - else obj[key] = current != null ? [current, value] : value; - }); - }); - - return object; - }, - - cleanQueryString: function(method){ - return this.split('&').filter(function(val){ - var index = val.indexOf('='), - key = index < 0 ? '' : val.substr(0, index), - value = val.substr(index + 1); - - return method ? method.call(null, key, value) : (value || value === 0); - }).join('&'); - } - -}); - - -/* ---- - -name: Events.Pseudos - -description: Adds the functionality to add pseudo events - -license: MIT-style license - -authors: - - Arian Stolwijk - -requires: [Core/Class.Extras, Core/Slick.Parser, MooTools.More] - -provides: [Events.Pseudos] - -... -*/ - -(function(){ - -Events.Pseudos = function(pseudos, addEvent, removeEvent){ - - var storeKey = '_monitorEvents:'; - - var storageOf = function(object){ - return { - store: object.store ? function(key, value){ - object.store(storeKey + key, value); - } : function(key, value){ - (object._monitorEvents || (object._monitorEvents = {}))[key] = value; - }, - retrieve: object.retrieve ? function(key, dflt){ - return object.retrieve(storeKey + key, dflt); - } : function(key, dflt){ - if (!object._monitorEvents) return dflt; - return object._monitorEvents[key] || dflt; - } - }; - }; - - var splitType = function(type){ - if (type.indexOf(':') == -1 || !pseudos) return null; - - var parsed = Slick.parse(type).expressions[0][0], - parsedPseudos = parsed.pseudos, - l = parsedPseudos.length, - splits = []; - - while (l--){ - var pseudo = parsedPseudos[l].key, - listener = pseudos[pseudo]; - if (listener != null) splits.push({ - event: parsed.tag, - value: parsedPseudos[l].value, - pseudo: pseudo, - original: type, - listener: listener - }); - } - return splits.length ? splits : null; - }; - - return { - - addEvent: function(type, fn, internal){ - var split = splitType(type); - if (!split) return addEvent.call(this, type, fn, internal); - - var storage = storageOf(this), - events = storage.retrieve(type, []), - eventType = split[0].event, - args = Array.slice(arguments, 2), - stack = fn, - self = this; - - split.each(function(item){ - var listener = item.listener, - stackFn = stack; - if (listener == false) eventType += ':' + item.pseudo + '(' + item.value + ')'; - else stack = function(){ - listener.call(self, item, stackFn, arguments, stack); - }; - }); - - events.include({type: eventType, event: fn, monitor: stack}); - storage.store(type, events); - - if (type != eventType) addEvent.apply(this, [type, fn].concat(args)); - return addEvent.apply(this, [eventType, stack].concat(args)); - }, - - removeEvent: function(type, fn){ - var split = splitType(type); - if (!split) return removeEvent.call(this, type, fn); - - var storage = storageOf(this), - events = storage.retrieve(type); - if (!events) return this; - - var args = Array.slice(arguments, 2); - - removeEvent.apply(this, [type, fn].concat(args)); - events.each(function(monitor, i){ - if (!fn || monitor.event == fn) removeEvent.apply(this, [monitor.type, monitor.monitor].concat(args)); - delete events[i]; - }, this); - - storage.store(type, events); - return this; - } - - }; - -}; - -var pseudos = { - - once: function(split, fn, args, monitor){ - fn.apply(this, args); - this.removeEvent(split.event, monitor) - .removeEvent(split.original, fn); - }, - - throttle: function(split, fn, args){ - if (!fn._throttled){ - fn.apply(this, args); - fn._throttled = setTimeout(function(){ - fn._throttled = false; - }, split.value || 250); - } - }, - - pause: function(split, fn, args){ - clearTimeout(fn._pause); - fn._pause = fn.delay(split.value || 250, this, args); - } - -}; - -Events.definePseudo = function(key, listener){ - pseudos[key] = listener; - return this; -}; - -Events.lookupPseudo = function(key){ - return pseudos[key]; -}; - -var proto = Events.prototype; -Events.implement(Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent)); - -['Request', 'Fx'].each(function(klass){ - if (this[klass]) this[klass].implement(Events.prototype); -}); - -})(); - - -/* ---- - -name: Element.Event.Pseudos - -description: Adds the functionality to add pseudo events for Elements - -license: MIT-style license - -authors: - - Arian Stolwijk - -requires: [Core/Element.Event, Core/Element.Delegation, Events.Pseudos] - -provides: [Element.Event.Pseudos, Element.Delegation.Pseudo] - -... -*/ - -(function(){ - -var pseudos = {relay: false}, - copyFromEvents = ['once', 'throttle', 'pause'], - count = copyFromEvents.length; - -while (count--) pseudos[copyFromEvents[count]] = Events.lookupPseudo(copyFromEvents[count]); - -DOMEvent.definePseudo = function(key, listener){ - pseudos[key] = listener; - return this; -}; - -var proto = Element.prototype; -[Element, Window, Document].invoke('implement', Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent)); - -})(); - - -/* ---- - -script: Form.Request.js - -name: Form.Request - -description: Handles the basic functionality of submitting a form and updating a dom element with the result. - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Request.HTML - - Class.Binds - - Class.Occlude - - Spinner - - String.QueryString - - Element.Delegation.Pseudo - -provides: [Form.Request] - -... -*/ - -if (!window.Form) window.Form = {}; - -(function(){ - - Form.Request = new Class({ - - Binds: ['onSubmit', 'onFormValidate'], - - Implements: [Options, Events, Class.Occlude], - - options: {/* - onFailure: function(){}, - onSuccess: function(){}, // aliased to onComplete, - onSend: function(){}*/ - requestOptions: { - evalScripts: true, - useSpinner: true, - emulation: false, - link: 'ignore' - }, - sendButtonClicked: true, - extraData: {}, - resetForm: true - }, - - property: 'form.request', - - initialize: function(form, target, options){ - this.element = document.id(form); - if (this.occlude()) return this.occluded; - this.setOptions(options) - .setTarget(target) - .attach(); - }, - - setTarget: function(target){ - this.target = document.id(target); - if (!this.request){ - this.makeRequest(); - } else { - this.request.setOptions({ - update: this.target - }); - } - return this; - }, - - toElement: function(){ - return this.element; - }, - - makeRequest: function(){ - var self = this; - this.request = new Request.HTML(Object.merge({ - update: this.target, - emulation: false, - spinnerTarget: this.element, - method: this.element.get('method') || 'post' - }, this.options.requestOptions)).addEvents({ - success: function(tree, elements, html, javascript){ - ['complete', 'success'].each(function(evt){ - self.fireEvent(evt, [self.target, tree, elements, html, javascript]); - }); - }, - failure: function(){ - self.fireEvent('complete', arguments).fireEvent('failure', arguments); - }, - exception: function(){ - self.fireEvent('failure', arguments); - } - }); - return this.attachReset(); - }, - - attachReset: function(){ - if (!this.options.resetForm) return this; - this.request.addEvent('success', function(){ - Function.attempt(function(){ - this.element.reset(); - }.bind(this)); - if (window.OverText) OverText.update(); - }.bind(this)); - return this; - }, - - attach: function(attach){ - var method = (attach != false) ? 'addEvent' : 'removeEvent'; - this.element[method]('click:relay(button, input[type=submit])', this.saveClickedButton.bind(this)); - - var fv = this.element.retrieve('validator'); - if (fv) fv[method]('onFormValidate', this.onFormValidate); - else this.element[method]('submit', this.onSubmit); - - return this; - }, - - detach: function(){ - return this.attach(false); - }, - - //public method - enable: function(){ - return this.attach(); - }, - - //public method - disable: function(){ - return this.detach(); - }, - - onFormValidate: function(valid, form, event){ - //if there's no event, then this wasn't a submit event - if (!event) return; - var fv = this.element.retrieve('validator'); - if (valid || (fv && !fv.options.stopOnFailure)){ - event.stop(); - this.send(); - } - }, - - onSubmit: function(event){ - var fv = this.element.retrieve('validator'); - if (fv){ - //form validator was created after Form.Request - this.element.removeEvent('submit', this.onSubmit); - fv.addEvent('onFormValidate', this.onFormValidate); - fv.validate(event); - return; - } - if (event) event.stop(); - this.send(); - }, - - saveClickedButton: function(event, target){ - var targetName = target.get('name'); - if (!targetName || !this.options.sendButtonClicked) return; - this.options.extraData[targetName] = target.get('value') || true; - this.clickedCleaner = function(){ - delete this.options.extraData[targetName]; - this.clickedCleaner = function(){}; - }.bind(this); - }, - - clickedCleaner: function(){}, - - send: function(){ - var str = this.element.toQueryString().trim(), - data = Object.toQueryString(this.options.extraData); - - if (str) str += "&" + data; - else str = data; - - this.fireEvent('send', [this.element, str.parseQueryString()]); - this.request.send({ - data: str, - url: this.options.requestOptions.url || this.element.get('action') - }); - this.clickedCleaner(); - return this; - } - - }); - - Element.implement('formUpdate', function(update, options){ - var fq = this.retrieve('form.request'); - if (!fq){ - fq = new Form.Request(this, update, options); - } else { - if (update) fq.setTarget(update); - if (options) fq.setOptions(options).makeRequest(); - } - fq.send(); - return this; - }); - -})(); - - -/* ---- - -script: Element.Shortcuts.js - -name: Element.Shortcuts - -description: Extends the Element native object to include some shortcut methods. - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Element.Style - - MooTools.More - -provides: [Element.Shortcuts] - -... -*/ - -Element.implement({ - - isDisplayed: function(){ - return this.getStyle('display') != 'none'; - }, - - isVisible: function(){ - var w = this.offsetWidth, - h = this.offsetHeight; - return (w == 0 && h == 0) ? false : (w > 0 && h > 0) ? true : this.style.display != 'none'; - }, - - toggle: function(){ - return this[this.isDisplayed() ? 'hide' : 'show'](); - }, - - hide: function(){ - var d; - try { - //IE fails here if the element is not in the dom - d = this.getStyle('display'); - } catch(e){} - if (d == 'none') return this; - return this.store('element:_originalDisplay', d || '').setStyle('display', 'none'); - }, - - show: function(display){ - if (!display && this.isDisplayed()) return this; - display = display || this.retrieve('element:_originalDisplay') || 'block'; - return this.setStyle('display', (display == 'none') ? 'block' : display); - }, - - swapClass: function(remove, add){ - return this.removeClass(remove).addClass(add); - } - -}); - -Document.implement({ - - clearSelection: function(){ - if (window.getSelection){ - var selection = window.getSelection(); - if (selection && selection.removeAllRanges) selection.removeAllRanges(); - } else if (document.selection && document.selection.empty){ - try { - //IE fails here if selected element is not in dom - document.selection.empty(); - } catch(e){} - } - } - -}); - - -/* ---- - -script: Fx.Reveal.js - -name: Fx.Reveal - -description: Defines Fx.Reveal, a class that shows and hides elements with a transition. - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Fx.Morph - - Element.Shortcuts - - Element.Measure - -provides: [Fx.Reveal] - -... -*/ - -(function(){ - - -var hideTheseOf = function(object){ - var hideThese = object.options.hideInputs; - if (window.OverText){ - var otClasses = [null]; - OverText.each(function(ot){ - otClasses.include('.' + ot.options.labelClass); - }); - if (otClasses) hideThese += otClasses.join(', '); - } - return (hideThese) ? object.element.getElements(hideThese) : null; -}; - - -Fx.Reveal = new Class({ - - Extends: Fx.Morph, - - options: {/* - onShow: function(thisElement){}, - onHide: function(thisElement){}, - onComplete: function(thisElement){}, - heightOverride: null, - widthOverride: null,*/ - link: 'cancel', - styles: ['padding', 'border', 'margin'], - transitionOpacity: 'opacity' in document.documentElement, - mode: 'vertical', - display: function(){ - return this.element.get('tag') != 'tr' ? 'block' : 'table-row'; - }, - opacity: 1, - hideInputs: !('opacity' in document.documentElement) ? 'select, input, textarea, object, embed' : null - }, - - dissolve: function(){ - if (!this.hiding && !this.showing){ - if (this.element.getStyle('display') != 'none'){ - this.hiding = true; - this.showing = false; - this.hidden = true; - this.cssText = this.element.style.cssText; - - var startStyles = this.element.getComputedSize({ - styles: this.options.styles, - mode: this.options.mode - }); - if (this.options.transitionOpacity) startStyles.opacity = this.options.opacity; - - var zero = {}; - Object.each(startStyles, function(style, name){ - zero[name] = [style, 0]; - }); - - this.element.setStyles({ - display: Function.from(this.options.display).call(this), - overflow: 'hidden' - }); - - var hideThese = hideTheseOf(this); - if (hideThese) hideThese.setStyle('visibility', 'hidden'); - - this.$chain.unshift(function(){ - if (this.hidden){ - this.hiding = false; - this.element.style.cssText = this.cssText; - this.element.setStyle('display', 'none'); - if (hideThese) hideThese.setStyle('visibility', 'visible'); - } - this.fireEvent('hide', this.element); - this.callChain(); - }.bind(this)); - - this.start(zero); - } else { - this.callChain.delay(10, this); - this.fireEvent('complete', this.element); - this.fireEvent('hide', this.element); - } - } else if (this.options.link == 'chain'){ - this.chain(this.dissolve.bind(this)); - } else if (this.options.link == 'cancel' && !this.hiding){ - this.cancel(); - this.dissolve(); - } - return this; - }, - - reveal: function(){ - if (!this.showing && !this.hiding){ - if (this.element.getStyle('display') == 'none'){ - this.hiding = false; - this.showing = true; - this.hidden = false; - this.cssText = this.element.style.cssText; - - var startStyles; - this.element.measure(function(){ - startStyles = this.element.getComputedSize({ - styles: this.options.styles, - mode: this.options.mode - }); - }.bind(this)); - if (this.options.heightOverride != null) startStyles.height = this.options.heightOverride.toInt(); - if (this.options.widthOverride != null) startStyles.width = this.options.widthOverride.toInt(); - if (this.options.transitionOpacity){ - this.element.setStyle('opacity', 0); - startStyles.opacity = this.options.opacity; - } - - var zero = { - height: 0, - display: Function.from(this.options.display).call(this) - }; - Object.each(startStyles, function(style, name){ - zero[name] = 0; - }); - zero.overflow = 'hidden'; - - this.element.setStyles(zero); - - var hideThese = hideTheseOf(this); - if (hideThese) hideThese.setStyle('visibility', 'hidden'); - - this.$chain.unshift(function(){ - this.element.style.cssText = this.cssText; - this.element.setStyle('display', Function.from(this.options.display).call(this)); - if (!this.hidden) this.showing = false; - if (hideThese) hideThese.setStyle('visibility', 'visible'); - this.callChain(); - this.fireEvent('show', this.element); - }.bind(this)); - - this.start(startStyles); - } else { - this.callChain(); - this.fireEvent('complete', this.element); - this.fireEvent('show', this.element); - } - } else if (this.options.link == 'chain'){ - this.chain(this.reveal.bind(this)); - } else if (this.options.link == 'cancel' && !this.showing){ - this.cancel(); - this.reveal(); - } - return this; - }, - - toggle: function(){ - if (this.element.getStyle('display') == 'none'){ - this.reveal(); - } else { - this.dissolve(); - } - return this; - }, - - cancel: function(){ - this.parent.apply(this, arguments); - if (this.cssText != null) this.element.style.cssText = this.cssText; - this.hiding = false; - this.showing = false; - return this; - } - -}); - -Element.Properties.reveal = { - - set: function(options){ - this.get('reveal').cancel().setOptions(options); - return this; - }, - - get: function(){ - var reveal = this.retrieve('reveal'); - if (!reveal){ - reveal = new Fx.Reveal(this); - this.store('reveal', reveal); - } - return reveal; - } - -}; - -Element.Properties.dissolve = Element.Properties.reveal; - -Element.implement({ - - reveal: function(options){ - this.get('reveal').setOptions(options).reveal(); - return this; - }, - - dissolve: function(options){ - this.get('reveal').setOptions(options).dissolve(); - return this; - }, - - nix: function(options){ - var params = Array.link(arguments, {destroy: Type.isBoolean, options: Type.isObject}); - this.get('reveal').setOptions(options).dissolve().chain(function(){ - this[params.destroy ? 'destroy' : 'dispose'](); - }.bind(this)); - return this; - }, - - wink: function(){ - var params = Array.link(arguments, {duration: Type.isNumber, options: Type.isObject}); - var reveal = this.get('reveal').setOptions(params.options); - reveal.reveal().chain(function(){ - (function(){ - reveal.dissolve(); - }).delay(params.duration || 2000); - }); - } - -}); - -})(); - - -/* ---- - -script: Drag.js - -name: Drag - -description: The base Drag Class. Can be used to drag and resize Elements using mouse events. - -license: MIT-style license - -authors: - - Valerio Proietti - - Tom Occhinno - - Jan Kassens - -requires: - - Core/Events - - Core/Options - - Core/Element.Event - - Core/Element.Style - - Core/Element.Dimensions - - MooTools.More - -provides: [Drag] -... - -*/ - -var Drag = new Class({ - - Implements: [Events, Options], - - options: {/* - onBeforeStart: function(thisElement){}, - onStart: function(thisElement, event){}, - onSnap: function(thisElement){}, - onDrag: function(thisElement, event){}, - onCancel: function(thisElement){}, - onComplete: function(thisElement, event){},*/ - snap: 6, - unit: 'px', - grid: false, - style: true, - limit: false, - handle: false, - invert: false, - preventDefault: false, - stopPropagation: false, - modifiers: {x: 'left', y: 'top'} - }, - - initialize: function(){ - var params = Array.link(arguments, { - 'options': Type.isObject, - 'element': function(obj){ - return obj != null; - } - }); - - this.element = document.id(params.element); - this.document = this.element.getDocument(); - this.setOptions(params.options || {}); - var htype = typeOf(this.options.handle); - this.handles = ((htype == 'array' || htype == 'collection') ? $$(this.options.handle) : document.id(this.options.handle)) || this.element; - this.mouse = {'now': {}, 'pos': {}}; - this.value = {'start': {}, 'now': {}}; - - this.selection = 'selectstart' in document ? 'selectstart' : 'mousedown'; - - - if ('ondragstart' in document && !('FileReader' in window) && !Drag.ondragstartFixed){ - document.ondragstart = Function.from(false); - Drag.ondragstartFixed = true; - } - - this.bound = { - start: this.start.bind(this), - check: this.check.bind(this), - drag: this.drag.bind(this), - stop: this.stop.bind(this), - cancel: this.cancel.bind(this), - eventStop: Function.from(false) - }; - this.attach(); - }, - - attach: function(){ - this.handles.addEvent('mousedown', this.bound.start); - return this; - }, - - detach: function(){ - this.handles.removeEvent('mousedown', this.bound.start); - return this; - }, - - start: function(event){ - var options = this.options; - - if (event.rightClick) return; - - if (options.preventDefault) event.preventDefault(); - if (options.stopPropagation) event.stopPropagation(); - this.mouse.start = event.page; - - this.fireEvent('beforeStart', this.element); - - var limit = options.limit; - this.limit = {x: [], y: []}; - - var z, coordinates; - for (z in options.modifiers){ - if (!options.modifiers[z]) continue; - - var style = this.element.getStyle(options.modifiers[z]); - - // Some browsers (IE and Opera) don't always return pixels. - if (style && !style.match(/px$/)){ - if (!coordinates) coordinates = this.element.getCoordinates(this.element.getOffsetParent()); - style = coordinates[options.modifiers[z]]; - } - - if (options.style) this.value.now[z] = (style || 0).toInt(); - else this.value.now[z] = this.element[options.modifiers[z]]; - - if (options.invert) this.value.now[z] *= -1; - - this.mouse.pos[z] = event.page[z] - this.value.now[z]; - - if (limit && limit[z]){ - var i = 2; - while (i--){ - var limitZI = limit[z][i]; - if (limitZI || limitZI === 0) this.limit[z][i] = (typeof limitZI == 'function') ? limitZI() : limitZI; - } - } - } - - if (typeOf(this.options.grid) == 'number') this.options.grid = { - x: this.options.grid, - y: this.options.grid - }; - - var events = { - mousemove: this.bound.check, - mouseup: this.bound.cancel - }; - events[this.selection] = this.bound.eventStop; - this.document.addEvents(events); - }, - - check: function(event){ - if (this.options.preventDefault) event.preventDefault(); - var distance = Math.round(Math.sqrt(Math.pow(event.page.x - this.mouse.start.x, 2) + Math.pow(event.page.y - this.mouse.start.y, 2))); - if (distance > this.options.snap){ - this.cancel(); - this.document.addEvents({ - mousemove: this.bound.drag, - mouseup: this.bound.stop - }); - this.fireEvent('start', [this.element, event]).fireEvent('snap', this.element); - } - }, - - drag: function(event){ - var options = this.options; - - if (options.preventDefault) event.preventDefault(); - this.mouse.now = event.page; - - for (var z in options.modifiers){ - if (!options.modifiers[z]) continue; - this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z]; - - if (options.invert) this.value.now[z] *= -1; - - if (options.limit && this.limit[z]){ - if ((this.limit[z][1] || this.limit[z][1] === 0) && (this.value.now[z] > this.limit[z][1])){ - this.value.now[z] = this.limit[z][1]; - } else if ((this.limit[z][0] || this.limit[z][0] === 0) && (this.value.now[z] < this.limit[z][0])){ - this.value.now[z] = this.limit[z][0]; - } - } - - if (options.grid[z]) this.value.now[z] -= ((this.value.now[z] - (this.limit[z][0]||0)) % options.grid[z]); - - if (options.style) this.element.setStyle(options.modifiers[z], this.value.now[z] + options.unit); - else this.element[options.modifiers[z]] = this.value.now[z]; - } - - this.fireEvent('drag', [this.element, event]); - }, - - cancel: function(event){ - this.document.removeEvents({ - mousemove: this.bound.check, - mouseup: this.bound.cancel - }); - if (event){ - this.document.removeEvent(this.selection, this.bound.eventStop); - this.fireEvent('cancel', this.element); - } - }, - - stop: function(event){ - var events = { - mousemove: this.bound.drag, - mouseup: this.bound.stop - }; - events[this.selection] = this.bound.eventStop; - this.document.removeEvents(events); - if (event) this.fireEvent('complete', [this.element, event]); - } - -}); - -Element.implement({ - - makeResizable: function(options){ - var drag = new Drag(this, Object.merge({ - modifiers: { - x: 'width', - y: 'height' - } - }, options)); - - this.store('resizer', drag); - return drag.addEvent('drag', function(){ - this.fireEvent('resize', drag); - }.bind(this)); - } - -}); - - -/* ---- - -script: Drag.Move.js - -name: Drag.Move - -description: A Drag extension that provides support for the constraining of draggables to containers and droppables. - -license: MIT-style license - -authors: - - Valerio Proietti - - Tom Occhinno - - Jan Kassens - - Aaron Newton - - Scott Kyle - -requires: - - Core/Element.Dimensions - - Drag - -provides: [Drag.Move] - -... -*/ - -Drag.Move = new Class({ - - Extends: Drag, - - options: {/* - onEnter: function(thisElement, overed){}, - onLeave: function(thisElement, overed){}, - onDrop: function(thisElement, overed, event){},*/ - droppables: [], - container: false, - precalculate: false, - includeMargins: true, - checkDroppables: true - }, - - initialize: function(element, options){ - this.parent(element, options); - element = this.element; - - this.droppables = $$(this.options.droppables); - this.setContainer(this.options.container); - - if (this.options.style){ - if (this.options.modifiers.x == 'left' && this.options.modifiers.y == 'top'){ - var parent = element.getOffsetParent(), - styles = element.getStyles('left', 'top'); - if (parent && (styles.left == 'auto' || styles.top == 'auto')){ - element.setPosition(element.getPosition(parent)); - } - } - - if (element.getStyle('position') == 'static') element.setStyle('position', 'absolute'); - } - - this.addEvent('start', this.checkDroppables, true); - this.overed = null; - }, - - setContainer: function(container) { - this.container = document.id(container); - if (this.container && typeOf(this.container) != 'element'){ - this.container = document.id(this.container.getDocument().body); - } - }, - - start: function(event){ - if (this.container) this.options.limit = this.calculateLimit(); - - if (this.options.precalculate){ - this.positions = this.droppables.map(function(el){ - return el.getCoordinates(); - }); - } - - this.parent(event); - }, - - calculateLimit: function(){ - var element = this.element, - container = this.container, - - offsetParent = document.id(element.getOffsetParent()) || document.body, - containerCoordinates = container.getCoordinates(offsetParent), - elementMargin = {}, - elementBorder = {}, - containerMargin = {}, - containerBorder = {}, - offsetParentPadding = {}; - - ['top', 'right', 'bottom', 'left'].each(function(pad){ - elementMargin[pad] = element.getStyle('margin-' + pad).toInt(); - elementBorder[pad] = element.getStyle('border-' + pad).toInt(); - containerMargin[pad] = container.getStyle('margin-' + pad).toInt(); - containerBorder[pad] = container.getStyle('border-' + pad).toInt(); - offsetParentPadding[pad] = offsetParent.getStyle('padding-' + pad).toInt(); - }, this); - - var width = element.offsetWidth + elementMargin.left + elementMargin.right, - height = element.offsetHeight + elementMargin.top + elementMargin.bottom, - left = 0, - top = 0, - right = containerCoordinates.right - containerBorder.right - width, - bottom = containerCoordinates.bottom - containerBorder.bottom - height; - - if (this.options.includeMargins){ - left += elementMargin.left; - top += elementMargin.top; - } else { - right += elementMargin.right; - bottom += elementMargin.bottom; - } - - if (element.getStyle('position') == 'relative'){ - var coords = element.getCoordinates(offsetParent); - coords.left -= element.getStyle('left').toInt(); - coords.top -= element.getStyle('top').toInt(); - - left -= coords.left; - top -= coords.top; - if (container.getStyle('position') != 'relative'){ - left += containerBorder.left; - top += containerBorder.top; - } - right += elementMargin.left - coords.left; - bottom += elementMargin.top - coords.top; - - if (container != offsetParent){ - left += containerMargin.left + offsetParentPadding.left; - if (!offsetParentPadding.left && left < 0) left = 0; - top += offsetParent == document.body ? 0 : containerMargin.top + offsetParentPadding.top; - if (!offsetParentPadding.top && top < 0) top = 0; - } - } else { - left -= elementMargin.left; - top -= elementMargin.top; - if (container != offsetParent){ - left += containerCoordinates.left + containerBorder.left; - top += containerCoordinates.top + containerBorder.top; - } - } - - return { - x: [left, right], - y: [top, bottom] - }; - }, - - getDroppableCoordinates: function(element){ - var position = element.getCoordinates(); - if (element.getStyle('position') == 'fixed'){ - var scroll = window.getScroll(); - position.left += scroll.x; - position.right += scroll.x; - position.top += scroll.y; - position.bottom += scroll.y; - } - return position; - }, - - checkDroppables: function(){ - var overed = this.droppables.filter(function(el, i){ - el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el); - var now = this.mouse.now; - return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top); - }, this).getLast(); - - if (this.overed != overed){ - if (this.overed) this.fireEvent('leave', [this.element, this.overed]); - if (overed) this.fireEvent('enter', [this.element, overed]); - this.overed = overed; - } - }, - - drag: function(event){ - this.parent(event); - if (this.options.checkDroppables && this.droppables.length) this.checkDroppables(); - }, - - stop: function(event){ - this.checkDroppables(); - this.fireEvent('drop', [this.element, this.overed, event]); - this.overed = null; - return this.parent(event); - } - -}); - -Element.implement({ - - makeDraggable: function(options){ - var drag = new Drag.Move(this, options); - this.store('dragger', drag); - return drag; - } - -}); - - -/* ---- - -script: Sortables.js - -name: Sortables - -description: Class for creating a drag and drop sorting interface for lists of items. - -license: MIT-style license - -authors: - - Tom Occhino - -requires: - - Core/Fx.Morph - - Drag.Move - -provides: [Sortables] - -... -*/ - -var Sortables = new Class({ - - Implements: [Events, Options], - - options: {/* - onSort: function(element, clone){}, - onStart: function(element, clone){}, - onComplete: function(element){},*/ - opacity: 1, - clone: false, - revert: false, - handle: false, - dragOptions: {}, - unDraggableTags: ['button', 'input', 'a', 'textarea', 'select', 'option'] - }, - - initialize: function(lists, options){ - this.setOptions(options); - - this.elements = []; - this.lists = []; - this.idle = true; - - this.addLists($$(document.id(lists) || lists)); - - if (!this.options.clone) this.options.revert = false; - if (this.options.revert) this.effect = new Fx.Morph(null, Object.merge({ - duration: 250, - link: 'cancel' - }, this.options.revert)); - }, - - attach: function(){ - this.addLists(this.lists); - return this; - }, - - detach: function(){ - this.lists = this.removeLists(this.lists); - return this; - }, - - addItems: function(){ - Array.flatten(arguments).each(function(element){ - this.elements.push(element); - var start = element.retrieve('sortables:start', function(event){ - this.start.call(this, event, element); - }.bind(this)); - (this.options.handle ? element.getElement(this.options.handle) || element : element).addEvent('mousedown', start); - }, this); - return this; - }, - - addLists: function(){ - Array.flatten(arguments).each(function(list){ - this.lists.include(list); - this.addItems(list.getChildren()); - }, this); - return this; - }, - - removeItems: function(){ - return $$(Array.flatten(arguments).map(function(element){ - this.elements.erase(element); - var start = element.retrieve('sortables:start'); - (this.options.handle ? element.getElement(this.options.handle) || element : element).removeEvent('mousedown', start); - - return element; - }, this)); - }, - - removeLists: function(){ - return $$(Array.flatten(arguments).map(function(list){ - this.lists.erase(list); - this.removeItems(list.getChildren()); - - return list; - }, this)); - }, - - getDroppableCoordinates: function (element){ - var offsetParent = element.getOffsetParent(); - var position = element.getPosition(offsetParent); - var scroll = { - w: window.getScroll(), - offsetParent: offsetParent.getScroll() - }; - position.x += scroll.offsetParent.x; - position.y += scroll.offsetParent.y; - - if (offsetParent.getStyle('position') == 'fixed'){ - position.x -= scroll.w.x; - position.y -= scroll.w.y; - } - - return position; - }, - - getClone: function(event, element){ - if (!this.options.clone) return new Element(element.tagName).inject(document.body); - if (typeOf(this.options.clone) == 'function') return this.options.clone.call(this, event, element, this.list); - var clone = element.clone(true).setStyles({ - margin: 0, - position: 'absolute', - visibility: 'hidden', - width: element.getStyle('width') - }).addEvent('mousedown', function(event){ - element.fireEvent('mousedown', event); - }); - //prevent the duplicated radio inputs from unchecking the real one - if (clone.get('html').test('radio')){ - clone.getElements('input[type=radio]').each(function(input, i){ - input.set('name', 'clone_' + i); - if (input.get('checked')) element.getElements('input[type=radio]')[i].set('checked', true); - }); - } - - return clone.inject(this.list).setPosition(this.getDroppableCoordinates(this.element)); - }, - - getDroppables: function(){ - var droppables = this.list.getChildren().erase(this.clone).erase(this.element); - if (!this.options.constrain) droppables.append(this.lists).erase(this.list); - return droppables; - }, - - insert: function(dragging, element){ - var where = 'inside'; - if (this.lists.contains(element)){ - this.list = element; - this.drag.droppables = this.getDroppables(); - } else { - where = this.element.getAllPrevious().contains(element) ? 'before' : 'after'; - } - this.element.inject(element, where); - this.fireEvent('sort', [this.element, this.clone]); - }, - - start: function(event, element){ - if ( - !this.idle || - event.rightClick || - (!this.options.handle && this.options.unDraggableTags.contains(event.target.get('tag'))) - ) return; - - this.idle = false; - this.element = element; - this.opacity = element.getStyle('opacity'); - this.list = element.getParent(); - this.clone = this.getClone(event, element); - - this.drag = new Drag.Move(this.clone, Object.merge({ - - droppables: this.getDroppables() - }, this.options.dragOptions)).addEvents({ - onSnap: function(){ - event.stop(); - this.clone.setStyle('visibility', 'visible'); - this.element.setStyle('opacity', this.options.opacity || 0); - this.fireEvent('start', [this.element, this.clone]); - }.bind(this), - onEnter: this.insert.bind(this), - onCancel: this.end.bind(this), - onComplete: this.end.bind(this) - }); - - this.clone.inject(this.element, 'before'); - this.drag.start(event); - }, - - end: function(){ - this.drag.detach(); - this.element.setStyle('opacity', this.opacity); - var self = this; - if (this.effect){ - var dim = this.element.getStyles('width', 'height'), - clone = this.clone, - pos = clone.computePosition(this.getDroppableCoordinates(clone)); - - var destroy = function(){ - this.removeEvent('cancel', destroy); - clone.destroy(); - self.reset(); - }; - - this.effect.element = clone; - this.effect.start({ - top: pos.top, - left: pos.left, - width: dim.width, - height: dim.height, - opacity: 0.25 - }).addEvent('cancel', destroy).chain(destroy); - } else { - this.clone.destroy(); - self.reset(); - } - - }, - - reset: function(){ - this.idle = true; - this.fireEvent('complete', this.element); - }, - - serialize: function(){ - var params = Array.link(arguments, { - modifier: Type.isFunction, - index: function(obj){ - return obj != null; - } - }); - var serial = this.lists.map(function(list){ - return list.getChildren().map(params.modifier || function(element){ - return element.get('id'); - }, this); - }, this); - - var index = params.index; - if (this.lists.length == 1) index = 0; - return (index || index === 0) && index >= 0 && index < this.lists.length ? serial[index] : serial; - } - -}); - - -/* ---- - -script: Request.Periodical.js - -name: Request.Periodical - -description: Requests the same URL to pull data from a server but increases the intervals if no data is returned to reduce the load - -license: MIT-style license - -authors: - - Christoph Pojer - -requires: - - Core/Request - - MooTools.More - -provides: [Request.Periodical] - -... -*/ - -Request.implement({ - - options: { - initialDelay: 5000, - delay: 5000, - limit: 60000 - }, - - startTimer: function(data){ - var fn = function(){ - if (!this.running) this.send({data: data}); - }; - this.lastDelay = this.options.initialDelay; - this.timer = fn.delay(this.lastDelay, this); - this.completeCheck = function(response){ - clearTimeout(this.timer); - this.lastDelay = (response) ? this.options.delay : (this.lastDelay + this.options.delay).min(this.options.limit); - this.timer = fn.delay(this.lastDelay, this); - }; - return this.addEvent('complete', this.completeCheck); - }, - - stopTimer: function(){ - clearTimeout(this.timer); - return this.removeEvent('complete', this.completeCheck); - } - -}); - - -/* ---- - -script: Color.js - -name: Color - -description: Class for creating and manipulating colors in JavaScript. Supports HSB -> RGB Conversions and vice versa. - -license: MIT-style license - -authors: - - Valerio Proietti - -requires: - - Core/Array - - Core/String - - Core/Number - - Core/Hash - - Core/Function - - MooTools.More - -provides: [Color] - -... -*/ - -(function(){ - -var Color = this.Color = new Type('Color', function(color, type){ - if (arguments.length >= 3){ - type = 'rgb'; color = Array.slice(arguments, 0, 3); - } else if (typeof color == 'string'){ - if (color.match(/rgb/)) color = color.rgbToHex().hexToRgb(true); - else if (color.match(/hsb/)) color = color.hsbToRgb(); - else color = color.hexToRgb(true); - } - type = type || 'rgb'; - switch (type){ - case 'hsb': - var old = color; - color = color.hsbToRgb(); - color.hsb = old; - break; - case 'hex': color = color.hexToRgb(true); break; - } - color.rgb = color.slice(0, 3); - color.hsb = color.hsb || color.rgbToHsb(); - color.hex = color.rgbToHex(); - return Object.append(color, this); -}); - -Color.implement({ - - mix: function(){ - var colors = Array.slice(arguments); - var alpha = (typeOf(colors.getLast()) == 'number') ? colors.pop() : 50; - var rgb = this.slice(); - colors.each(function(color){ - color = new Color(color); - for (var i = 0; i < 3; i++) rgb[i] = Math.round((rgb[i] / 100 * (100 - alpha)) + (color[i] / 100 * alpha)); - }); - return new Color(rgb, 'rgb'); - }, - - invert: function(){ - return new Color(this.map(function(value){ - return 255 - value; - })); - }, - - setHue: function(value){ - return new Color([value, this.hsb[1], this.hsb[2]], 'hsb'); - }, - - setSaturation: function(percent){ - return new Color([this.hsb[0], percent, this.hsb[2]], 'hsb'); - }, - - setBrightness: function(percent){ - return new Color([this.hsb[0], this.hsb[1], percent], 'hsb'); - } - -}); - -this.$RGB = function(r, g, b){ - return new Color([r, g, b], 'rgb'); -}; - -this.$HSB = function(h, s, b){ - return new Color([h, s, b], 'hsb'); -}; - -this.$HEX = function(hex){ - return new Color(hex, 'hex'); -}; - -Array.implement({ - - rgbToHsb: function(){ - var red = this[0], - green = this[1], - blue = this[2], - hue = 0; - var max = Math.max(red, green, blue), - min = Math.min(red, green, blue); - var delta = max - min; - var brightness = max / 255, - saturation = (max != 0) ? delta / max : 0; - if (saturation != 0){ - var rr = (max - red) / delta; - var gr = (max - green) / delta; - var br = (max - blue) / delta; - if (red == max) hue = br - gr; - else if (green == max) hue = 2 + rr - br; - else hue = 4 + gr - rr; - hue /= 6; - if (hue < 0) hue++; - } - return [Math.round(hue * 360), Math.round(saturation * 100), Math.round(brightness * 100)]; - }, - - hsbToRgb: function(){ - var br = Math.round(this[2] / 100 * 255); - if (this[1] == 0){ - return [br, br, br]; - } else { - var hue = this[0] % 360; - var f = hue % 60; - var p = Math.round((this[2] * (100 - this[1])) / 10000 * 255); - var q = Math.round((this[2] * (6000 - this[1] * f)) / 600000 * 255); - var t = Math.round((this[2] * (6000 - this[1] * (60 - f))) / 600000 * 255); - switch (Math.floor(hue / 60)){ - case 0: return [br, t, p]; - case 1: return [q, br, p]; - case 2: return [p, br, t]; - case 3: return [p, q, br]; - case 4: return [t, p, br]; - case 5: return [br, p, q]; - } - } - return false; - } - -}); - -String.implement({ - - rgbToHsb: function(){ - var rgb = this.match(/\d{1,3}/g); - return (rgb) ? rgb.rgbToHsb() : null; - }, - - hsbToRgb: function(){ - var hsb = this.match(/\d{1,3}/g); - return (hsb) ? hsb.hsbToRgb() : null; - } - -}); - -})(); - - diff --git a/pyload/webui/themes/Default/js/static/mootools-more.min.js b/pyload/webui/themes/Default/js/static/mootools-more.min.js deleted file mode 100644 index ce03a60fd..000000000 --- a/pyload/webui/themes/Default/js/static/mootools-more.min.js +++ /dev/null @@ -1,226 +0,0 @@ -/* ---- -MooTools: the javascript framework - -web build: - - http://mootools.net/more/c1cc18c2fff04bcc58921b4dff80a6f1 - -packager build: - - packager build More/Form.Request More/Fx.Reveal More/Sortables More/Request.Periodical More/Color - -copyrights: - - [MooTools](http://mootools.net) - -licenses: - - [MIT License](http://mootools.net/license.txt) -... -*/ - -MooTools.More={version:"1.5.0",build:"73db5e24e6e9c5c87b3a27aebef2248053f7db37"};Class.Mutators.Binds=function(a){if(!this.prototype.initialize){this.implement("initialize",function(){}); -}return Array.from(a).concat(this.prototype.Binds||[]);};Class.Mutators.initialize=function(a){return function(){Array.from(this.Binds).each(function(b){var c=this[b]; -if(c){this[b]=c.bind(this);}},this);return a.apply(this,arguments);};};Class.Occlude=new Class({occlude:function(c,b){b=document.id(b||this.element);var a=b.retrieve(c||this.property); -if(a&&!this.occluded){return(this.occluded=a);}this.occluded=false;b.store(c||this.property,this);return this.occluded;}});Class.refactor=function(b,a){Object.each(a,function(e,d){var c=b.prototype[d]; -c=(c&&c.$origin)||c||function(){};b.implement(d,(typeof e=="function")?function(){var f=this.previous;this.previous=c;var g=e.apply(this,arguments);this.previous=f; -return g;}:e);});return b;};(function(){var b=function(e,d){var f=[];Object.each(d,function(g){Object.each(g,function(h){e.each(function(i){f.push(i+"-"+h+(i=="border"?"-width":"")); -});});});return f;};var c=function(f,e){var d=0;Object.each(e,function(h,g){if(g.test(f)){d=d+h.toInt();}});return d;};var a=function(d){return !!(!d||d.offsetHeight||d.offsetWidth); -};Element.implement({measure:function(h){if(a(this)){return h.call(this);}var g=this.getParent(),e=[];while(!a(g)&&g!=document.body){e.push(g.expose()); -g=g.getParent();}var f=this.expose(),d=h.call(this);f();e.each(function(i){i();});return d;},expose:function(){if(this.getStyle("display")!="none"){return function(){}; -}var d=this.style.cssText;this.setStyles({display:"block",position:"absolute",visibility:"hidden"});return function(){this.style.cssText=d;}.bind(this); -},getDimensions:function(d){d=Object.merge({computeSize:false},d);var i={x:0,y:0};var h=function(j,e){return(e.computeSize)?j.getComputedSize(e):j.getSize(); -};var f=this.getParent("body");if(f&&this.getStyle("display")=="none"){i=this.measure(function(){return h(this,d);});}else{if(f){try{i=h(this,d);}catch(g){}}}return Object.append(i,(i.x||i.x===0)?{width:i.x,height:i.y}:{x:i.width,y:i.height}); -},getComputedSize:function(d){d=Object.merge({styles:["padding","border"],planes:{height:["top","bottom"],width:["left","right"]},mode:"both"},d);var g={},e={width:0,height:0},f; -if(d.mode=="vertical"){delete e.width;delete d.planes.width;}else{if(d.mode=="horizontal"){delete e.height;delete d.planes.height;}}b(d.styles,d.planes).each(function(h){g[h]=this.getStyle(h).toInt(); -},this);Object.each(d.planes,function(i,h){var k=h.capitalize(),j=this.getStyle(h);if(j=="auto"&&!f){f=this.getDimensions();}j=g[h]=(j=="auto")?f[h]:j.toInt(); -e["total"+k]=j;i.each(function(m){var l=c(m,g);e["computed"+m.capitalize()]=l;e["total"+k]+=l;});},this);return Object.append(e,g);}});})();(function(b){var a=Element.Position={options:{relativeTo:document.body,position:{x:"center",y:"center"},offset:{x:0,y:0}},getOptions:function(d,c){c=Object.merge({},a.options,c); -a.setPositionOption(c);a.setEdgeOption(c);a.setOffsetOption(d,c);a.setDimensionsOption(d,c);return c;},setPositionOption:function(c){c.position=a.getCoordinateFromValue(c.position); -},setEdgeOption:function(d){var c=a.getCoordinateFromValue(d.edge);d.edge=c?c:(d.position.x=="center"&&d.position.y=="center")?{x:"center",y:"center"}:{x:"left",y:"top"}; -},setOffsetOption:function(f,d){var c={x:0,y:0};var e={x:0,y:0};var g=f.measure(function(){return document.id(this.getOffsetParent());});if(!g||g==f.getDocument().body){return; -}e=g.getScroll();c=g.measure(function(){var i=this.getPosition();if(this.getStyle("position")=="fixed"){var h=window.getScroll();i.x+=h.x;i.y+=h.y;}return i; -});d.offset={parentPositioned:g!=document.id(d.relativeTo),x:d.offset.x-c.x+e.x,y:d.offset.y-c.y+e.y};},setDimensionsOption:function(d,c){c.dimensions=d.getDimensions({computeSize:true,styles:["padding","border","margin"]}); -},getPosition:function(e,d){var c={};d=a.getOptions(e,d);var f=document.id(d.relativeTo)||document.body;a.setPositionCoordinates(d,c,f);if(d.edge){a.toEdge(c,d); -}var g=d.offset;c.left=((c.x>=0||g.parentPositioned||d.allowNegative)?c.x:0).toInt();c.top=((c.y>=0||g.parentPositioned||d.allowNegative)?c.y:0).toInt(); -a.toMinMax(c,d);if(d.relFixedPosition||f.getStyle("position")=="fixed"){a.toRelFixedPosition(f,c);}if(d.ignoreScroll){a.toIgnoreScroll(f,c);}if(d.ignoreMargins){a.toIgnoreMargins(c,d); -}c.left=Math.ceil(c.left);c.top=Math.ceil(c.top);delete c.x;delete c.y;return c;},setPositionCoordinates:function(k,g,d){var f=k.offset.y,h=k.offset.x,e=(d==document.body)?window.getScroll():d.getPosition(),j=e.y,c=e.x,i=window.getSize(); -switch(k.position.x){case"left":g.x=c+h;break;case"right":g.x=c+h+d.offsetWidth;break;default:g.x=c+((d==document.body?i.x:d.offsetWidth)/2)+h;break;}switch(k.position.y){case"top":g.y=j+f; -break;case"bottom":g.y=j+f+d.offsetHeight;break;default:g.y=j+((d==document.body?i.y:d.offsetHeight)/2)+f;break;}},toMinMax:function(c,d){var f={left:"x",top:"y"},e; -["minimum","maximum"].each(function(g){["left","top"].each(function(h){e=d[g]?d[g][f[h]]:null;if(e!=null&&((g=="minimum")?c[h]e)){c[h]=e;}});}); -},toRelFixedPosition:function(e,c){var d=window.getScroll();c.top+=d.y;c.left+=d.x;},toIgnoreScroll:function(e,d){var c=e.getScroll();d.top-=c.y;d.left-=c.x; -},toIgnoreMargins:function(c,d){c.left+=d.edge.x=="right"?d.dimensions["margin-right"]:(d.edge.x!="center"?-d.dimensions["margin-left"]:-d.dimensions["margin-left"]+((d.dimensions["margin-right"]+d.dimensions["margin-left"])/2)); -c.top+=d.edge.y=="bottom"?d.dimensions["margin-bottom"]:(d.edge.y!="center"?-d.dimensions["margin-top"]:-d.dimensions["margin-top"]+((d.dimensions["margin-bottom"]+d.dimensions["margin-top"])/2)); -},toEdge:function(c,d){var e={},g=d.dimensions,f=d.edge;switch(f.x){case"left":e.x=0;break;case"right":e.x=-g.x-g.computedRight-g.computedLeft;break;default:e.x=-(Math.round(g.totalWidth/2)); -break;}switch(f.y){case"top":e.y=0;break;case"bottom":e.y=-g.y-g.computedTop-g.computedBottom;break;default:e.y=-(Math.round(g.totalHeight/2));break;}c.x+=e.x; -c.y+=e.y;},getCoordinateFromValue:function(c){if(typeOf(c)!="string"){return c;}c=c.toLowerCase();return{x:c.test("left")?"left":(c.test("right")?"right":"center"),y:c.test(/upper|top/)?"top":(c.test("bottom")?"bottom":"center")}; -}};Element.implement({position:function(d){if(d&&(d.x!=null||d.y!=null)){return(b?b.apply(this,arguments):this);}var c=this.setStyle("position","absolute").calculatePosition(d); -return(d&&d.returnPos)?c:this.setStyles(c);},calculatePosition:function(c){return a.getPosition(this,c);}});})(Element.prototype.position);(function(){var a=false; -this.IframeShim=new Class({Implements:[Options,Events,Class.Occlude],options:{className:"iframeShim",src:'javascript:false;document.write("");',display:false,zIndex:null,margin:0,offset:{x:0,y:0},browsers:a},property:"IframeShim",initialize:function(c,b){this.element=document.id(c); -if(this.occlude()){return this.occluded;}this.setOptions(b);this.makeShim();return this;},makeShim:function(){if(this.options.browsers){var d=this.element.getStyle("zIndex").toInt(); -if(!d){d=1;var c=this.element.getStyle("position");if(c=="static"||!c){this.element.setStyle("position","relative");}this.element.setStyle("zIndex",d); -}d=((this.options.zIndex!=null||this.options.zIndex===0)&&d>this.options.zIndex)?this.options.zIndex:d-1;if(d<0){d=1;}this.shim=new Element("iframe",{src:this.options.src,scrolling:"no",frameborder:0,styles:{zIndex:d,position:"absolute",border:"none",filter:"progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)"},"class":this.options.className}).store("IframeShim",this); -var b=(function(){this.shim.inject(this.element,"after");this[this.options.display?"show":"hide"]();this.fireEvent("inject");}).bind(this);if(!IframeShim.ready){window.addEvent("load",b); -}else{b();}}else{this.position=this.hide=this.show=this.dispose=Function.from(this);}},position:function(){if(!IframeShim.ready||!this.shim){return this; -}var b=this.element.measure(function(){return this.getSize();});if(this.options.margin!=undefined){b.x=b.x-(this.options.margin*2);b.y=b.y-(this.options.margin*2); -this.options.offset.x+=this.options.margin;this.options.offset.y+=this.options.margin;}this.shim.set({width:b.x,height:b.y}).position({relativeTo:this.element,offset:this.options.offset}); -return this;},hide:function(){if(this.shim){this.shim.setStyle("display","none");}return this;},show:function(){if(this.shim){this.shim.setStyle("display","block"); -}return this.position();},dispose:function(){if(this.shim){this.shim.dispose();}return this;},destroy:function(){if(this.shim){this.shim.destroy();}return this; -}});})();window.addEvent("load",function(){IframeShim.ready=true;});var Mask=new Class({Implements:[Options,Events],Binds:["position"],options:{style:{},"class":"mask",maskMargins:false,useIframeShim:true,iframeShimOptions:{}},initialize:function(b,a){this.target=document.id(b)||document.id(document.body); -this.target.store("mask",this);this.setOptions(a);this.render();this.inject();},render:function(){this.element=new Element("div",{"class":this.options["class"],id:this.options.id||"mask-"+String.uniqueID(),styles:Object.merge({},this.options.style,{display:"none"}),events:{click:function(a){this.fireEvent("click",a); -if(this.options.hideOnClick){this.hide();}}.bind(this)}});this.hidden=true;},toElement:function(){return this.element;},inject:function(b,a){a=a||(this.options.inject?this.options.inject.where:"")||(this.target==document.body?"inside":"after"); -b=b||(this.options.inject&&this.options.inject.target)||this.target;this.element.inject(b,a);if(this.options.useIframeShim){this.shim=new IframeShim(this.element,this.options.iframeShimOptions); -this.addEvents({show:this.shim.show.bind(this.shim),hide:this.shim.hide.bind(this.shim),destroy:this.shim.destroy.bind(this.shim)});}},position:function(){this.resize(this.options.width,this.options.height); -this.element.position({relativeTo:this.target,position:"topLeft",ignoreMargins:!this.options.maskMargins,ignoreScroll:this.target==document.body});return this; -},resize:function(a,e){var b={styles:["padding","border"]};if(this.options.maskMargins){b.styles.push("margin");}var d=this.target.getComputedSize(b);if(this.target==document.body){this.element.setStyles({width:0,height:0}); -var c=window.getScrollSize();if(d.totalHeight0&&b>0)?true:this.style.display!="none";},toggle:function(){return this[this.isDisplayed()?"hide":"show"](); -},hide:function(){var b;try{b=this.getStyle("display");}catch(a){}if(b=="none"){return this;}return this.store("element:_originalDisplay",b||"").setStyle("display","none"); -},show:function(a){if(!a&&this.isDisplayed()){return this;}a=a||this.retrieve("element:_originalDisplay")||"block";return this.setStyle("display",(a=="none")?"block":a); -},swapClass:function(a,b){return this.removeClass(a).addClass(b);}});Document.implement({clearSelection:function(){if(window.getSelection){var a=window.getSelection(); -if(a&&a.removeAllRanges){a.removeAllRanges();}}else{if(document.selection&&document.selection.empty){try{document.selection.empty();}catch(b){}}}}});(function(){var a=function(d){var b=d.options.hideInputs; -if(window.OverText){var c=[null];OverText.each(function(e){c.include("."+e.options.labelClass);});if(c){b+=c.join(", ");}}return(b)?d.element.getElements(b):null; -};Fx.Reveal=new Class({Extends:Fx.Morph,options:{link:"cancel",styles:["padding","border","margin"],transitionOpacity:"opacity" in document.documentElement,mode:"vertical",display:function(){return this.element.get("tag")!="tr"?"block":"table-row"; -},opacity:1,hideInputs:!("opacity" in document.documentElement)?"select, input, textarea, object, embed":null},dissolve:function(){if(!this.hiding&&!this.showing){if(this.element.getStyle("display")!="none"){this.hiding=true; -this.showing=false;this.hidden=true;this.cssText=this.element.style.cssText;var d=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode}); -if(this.options.transitionOpacity){d.opacity=this.options.opacity;}var c={};Object.each(d,function(f,e){c[e]=[f,0];});this.element.setStyles({display:Function.from(this.options.display).call(this),overflow:"hidden"}); -var b=a(this);if(b){b.setStyle("visibility","hidden");}this.$chain.unshift(function(){if(this.hidden){this.hiding=false;this.element.style.cssText=this.cssText; -this.element.setStyle("display","none");if(b){b.setStyle("visibility","visible");}}this.fireEvent("hide",this.element);this.callChain();}.bind(this));this.start(c); -}else{this.callChain.delay(10,this);this.fireEvent("complete",this.element);this.fireEvent("hide",this.element);}}else{if(this.options.link=="chain"){this.chain(this.dissolve.bind(this)); -}else{if(this.options.link=="cancel"&&!this.hiding){this.cancel();this.dissolve();}}}return this;},reveal:function(){if(!this.showing&&!this.hiding){if(this.element.getStyle("display")=="none"){this.hiding=false; -this.showing=true;this.hidden=false;this.cssText=this.element.style.cssText;var d;this.element.measure(function(){d=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode}); -}.bind(this));if(this.options.heightOverride!=null){d.height=this.options.heightOverride.toInt();}if(this.options.widthOverride!=null){d.width=this.options.widthOverride.toInt(); -}if(this.options.transitionOpacity){this.element.setStyle("opacity",0);d.opacity=this.options.opacity;}var c={height:0,display:Function.from(this.options.display).call(this)}; -Object.each(d,function(f,e){c[e]=0;});c.overflow="hidden";this.element.setStyles(c);var b=a(this);if(b){b.setStyle("visibility","hidden");}this.$chain.unshift(function(){this.element.style.cssText=this.cssText; -this.element.setStyle("display",Function.from(this.options.display).call(this));if(!this.hidden){this.showing=false;}if(b){b.setStyle("visibility","visible"); -}this.callChain();this.fireEvent("show",this.element);}.bind(this));this.start(d);}else{this.callChain();this.fireEvent("complete",this.element);this.fireEvent("show",this.element); -}}else{if(this.options.link=="chain"){this.chain(this.reveal.bind(this));}else{if(this.options.link=="cancel"&&!this.showing){this.cancel();this.reveal(); -}}}return this;},toggle:function(){if(this.element.getStyle("display")=="none"){this.reveal();}else{this.dissolve();}return this;},cancel:function(){this.parent.apply(this,arguments); -if(this.cssText!=null){this.element.style.cssText=this.cssText;}this.hiding=false;this.showing=false;return this;}});Element.Properties.reveal={set:function(b){this.get("reveal").cancel().setOptions(b); -return this;},get:function(){var b=this.retrieve("reveal");if(!b){b=new Fx.Reveal(this);this.store("reveal",b);}return b;}};Element.Properties.dissolve=Element.Properties.reveal; -Element.implement({reveal:function(b){this.get("reveal").setOptions(b).reveal();return this;},dissolve:function(b){this.get("reveal").setOptions(b).dissolve(); -return this;},nix:function(b){var c=Array.link(arguments,{destroy:Type.isBoolean,options:Type.isObject});this.get("reveal").setOptions(b).dissolve().chain(function(){this[c.destroy?"destroy":"dispose"](); -}.bind(this));return this;},wink:function(){var c=Array.link(arguments,{duration:Type.isNumber,options:Type.isObject});var b=this.get("reveal").setOptions(c.options); -b.reveal().chain(function(){(function(){b.dissolve();}).delay(c.duration||2000);});}});})();var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,stopPropagation:false,modifiers:{x:"left",y:"top"}},initialize:function(){var b=Array.link(arguments,{options:Type.isObject,element:function(c){return c!=null; -}});this.element=document.id(b.element);this.document=this.element.getDocument();this.setOptions(b.options||{});var a=typeOf(this.options.handle);this.handles=((a=="array"||a=="collection")?$$(this.options.handle):document.id(this.options.handle))||this.element; -this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection="selectstart" in document?"selectstart":"mousedown";if("ondragstart" in document&&!("FileReader" in window)&&!Drag.ondragstartFixed){document.ondragstart=Function.from(false); -Drag.ondragstartFixed=true;}this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:Function.from(false)}; -this.attach();},attach:function(){this.handles.addEvent("mousedown",this.bound.start);return this;},detach:function(){this.handles.removeEvent("mousedown",this.bound.start); -return this;},start:function(a){var j=this.options;if(a.rightClick){return;}if(j.preventDefault){a.preventDefault();}if(j.stopPropagation){a.stopPropagation(); -}this.mouse.start=a.page;this.fireEvent("beforeStart",this.element);var c=j.limit;this.limit={x:[],y:[]};var e,g;for(e in j.modifiers){if(!j.modifiers[e]){continue; -}var b=this.element.getStyle(j.modifiers[e]);if(b&&!b.match(/px$/)){if(!g){g=this.element.getCoordinates(this.element.getOffsetParent());}b=g[j.modifiers[e]]; -}if(j.style){this.value.now[e]=(b||0).toInt();}else{this.value.now[e]=this.element[j.modifiers[e]];}if(j.invert){this.value.now[e]*=-1;}this.mouse.pos[e]=a.page[e]-this.value.now[e]; -if(c&&c[e]){var d=2;while(d--){var f=c[e][d];if(f||f===0){this.limit[e][d]=(typeof f=="function")?f():f;}}}}if(typeOf(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid}; -}var h={mousemove:this.bound.check,mouseup:this.bound.cancel};h[this.selection]=this.bound.eventStop;this.document.addEvents(h);},check:function(a){if(this.options.preventDefault){a.preventDefault(); -}var b=Math.round(Math.sqrt(Math.pow(a.page.x-this.mouse.start.x,2)+Math.pow(a.page.y-this.mouse.start.y,2)));if(b>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop}); -this.fireEvent("start",[this.element,a]).fireEvent("snap",this.element);}},drag:function(b){var a=this.options;if(a.preventDefault){b.preventDefault(); -}this.mouse.now=b.page;for(var c in a.modifiers){if(!a.modifiers[c]){continue;}this.value.now[c]=this.mouse.now[c]-this.mouse.pos[c];if(a.invert){this.value.now[c]*=-1; -}if(a.limit&&this.limit[c]){if((this.limit[c][1]||this.limit[c][1]===0)&&(this.value.now[c]>this.limit[c][1])){this.value.now[c]=this.limit[c][1];}else{if((this.limit[c][0]||this.limit[c][0]===0)&&(this.value.now[c]d.left&&b.xd.top);},this).getLast();if(this.overed!=a){if(this.overed){this.fireEvent("leave",[this.element,this.overed]); -}if(a){this.fireEvent("enter",[this.element,a]);}this.overed=a;}},drag:function(a){this.parent(a);if(this.options.checkDroppables&&this.droppables.length){this.checkDroppables(); -}},stop:function(a){this.checkDroppables();this.fireEvent("drop",[this.element,this.overed,a]);this.overed=null;return this.parent(a);}});Element.implement({makeDraggable:function(a){var b=new Drag.Move(this,a); -this.store("dragger",b);return b;}});var Sortables=new Class({Implements:[Events,Options],options:{opacity:1,clone:false,revert:false,handle:false,dragOptions:{},unDraggableTags:["button","input","a","textarea","select","option"]},initialize:function(a,b){this.setOptions(b); -this.elements=[];this.lists=[];this.idle=true;this.addLists($$(document.id(a)||a));if(!this.options.clone){this.options.revert=false;}if(this.options.revert){this.effect=new Fx.Morph(null,Object.merge({duration:250,link:"cancel"},this.options.revert)); -}},attach:function(){this.addLists(this.lists);return this;},detach:function(){this.lists=this.removeLists(this.lists);return this;},addItems:function(){Array.flatten(arguments).each(function(a){this.elements.push(a); -var b=a.retrieve("sortables:start",function(c){this.start.call(this,c,a);}.bind(this));(this.options.handle?a.getElement(this.options.handle)||a:a).addEvent("mousedown",b); -},this);return this;},addLists:function(){Array.flatten(arguments).each(function(a){this.lists.include(a);this.addItems(a.getChildren());},this);return this; -},removeItems:function(){return $$(Array.flatten(arguments).map(function(a){this.elements.erase(a);var b=a.retrieve("sortables:start");(this.options.handle?a.getElement(this.options.handle)||a:a).removeEvent("mousedown",b); -return a;},this));},removeLists:function(){return $$(Array.flatten(arguments).map(function(a){this.lists.erase(a);this.removeItems(a.getChildren());return a; -},this));},getDroppableCoordinates:function(c){var d=c.getOffsetParent();var b=c.getPosition(d);var a={w:window.getScroll(),offsetParent:d.getScroll()}; -b.x+=a.offsetParent.x;b.y+=a.offsetParent.y;if(d.getStyle("position")=="fixed"){b.x-=a.w.x;b.y-=a.w.y;}return b;},getClone:function(b,a){if(!this.options.clone){return new Element(a.tagName).inject(document.body); -}if(typeOf(this.options.clone)=="function"){return this.options.clone.call(this,b,a,this.list);}var c=a.clone(true).setStyles({margin:0,position:"absolute",visibility:"hidden",width:a.getStyle("width")}).addEvent("mousedown",function(d){a.fireEvent("mousedown",d); -});if(c.get("html").test("radio")){c.getElements("input[type=radio]").each(function(d,e){d.set("name","clone_"+e);if(d.get("checked")){a.getElements("input[type=radio]")[e].set("checked",true); -}});}return c.inject(this.list).setPosition(this.getDroppableCoordinates(this.element));},getDroppables:function(){var a=this.list.getChildren().erase(this.clone).erase(this.element); -if(!this.options.constrain){a.append(this.lists).erase(this.list);}return a;},insert:function(c,b){var a="inside";if(this.lists.contains(b)){this.list=b; -this.drag.droppables=this.getDroppables();}else{a=this.element.getAllPrevious().contains(b)?"before":"after";}this.element.inject(b,a);this.fireEvent("sort",[this.element,this.clone]); -},start:function(b,a){if(!this.idle||b.rightClick||(!this.options.handle&&this.options.unDraggableTags.contains(b.target.get("tag")))){return;}this.idle=false; -this.element=a;this.opacity=a.getStyle("opacity");this.list=a.getParent();this.clone=this.getClone(b,a);this.drag=new Drag.Move(this.clone,Object.merge({droppables:this.getDroppables()},this.options.dragOptions)).addEvents({onSnap:function(){b.stop(); -this.clone.setStyle("visibility","visible");this.element.setStyle("opacity",this.options.opacity||0);this.fireEvent("start",[this.element,this.clone]); -}.bind(this),onEnter:this.insert.bind(this),onCancel:this.end.bind(this),onComplete:this.end.bind(this)});this.clone.inject(this.element,"before");this.drag.start(b); -},end:function(){this.drag.detach();this.element.setStyle("opacity",this.opacity);var a=this;if(this.effect){var c=this.element.getStyles("width","height"),e=this.clone,d=e.computePosition(this.getDroppableCoordinates(e)); -var b=function(){this.removeEvent("cancel",b);e.destroy();a.reset();};this.effect.element=e;this.effect.start({top:d.top,left:d.left,width:c.width,height:c.height,opacity:0.25}).addEvent("cancel",b).chain(b); -}else{this.clone.destroy();a.reset();}},reset:function(){this.idle=true;this.fireEvent("complete",this.element);},serialize:function(){var c=Array.link(arguments,{modifier:Type.isFunction,index:function(d){return d!=null; -}});var b=this.lists.map(function(d){return d.getChildren().map(c.modifier||function(e){return e.get("id");},this);},this);var a=c.index;if(this.lists.length==1){a=0; -}return(a||a===0)&&a>=0&&a=3){d="rgb";c=Array.slice(arguments,0,3);}else{if(typeof c=="string"){if(c.match(/rgb/)){c=c.rgbToHex().hexToRgb(true); -}else{if(c.match(/hsb/)){c=c.hsbToRgb();}else{c=c.hexToRgb(true);}}}}d=d||"rgb";switch(d){case"hsb":var b=c;c=c.hsbToRgb();c.hsb=b;break;case"hex":c=c.hexToRgb(true); -break;}c.rgb=c.slice(0,3);c.hsb=c.hsb||c.rgbToHsb();c.hex=c.rgbToHex();return Object.append(c,this);});a.implement({mix:function(){var b=Array.slice(arguments); -var d=(typeOf(b.getLast())=="number")?b.pop():50;var c=this.slice();b.each(function(e){e=new a(e);for(var f=0;f<3;f++){c[f]=Math.round((c[f]/100*(100-d))+(e[f]/100*d)); -}});return new a(c,"rgb");},invert:function(){return new a(this.map(function(b){return 255-b;}));},setHue:function(b){return new a([b,this.hsb[1],this.hsb[2]],"hsb"); -},setSaturation:function(b){return new a([this.hsb[0],b,this.hsb[2]],"hsb");},setBrightness:function(b){return new a([this.hsb[0],this.hsb[1],b],"hsb"); -}});this.$RGB=function(e,d,c){return new a([e,d,c],"rgb");};this.$HSB=function(e,d,c){return new a([e,d,c],"hsb");};this.$HEX=function(b){return new a(b,"hex"); -};Array.implement({rgbToHsb:function(){var c=this[0],d=this[1],k=this[2],h=0;var j=Math.max(c,d,k),f=Math.min(c,d,k);var l=j-f;var i=j/255,g=(j!=0)?l/j:0; -if(g!=0){var e=(j-c)/l;var b=(j-d)/l;var m=(j-k)/l;if(c==j){h=m-b;}else{if(d==j){h=2+e-m;}else{h=4+b-e;}}h/=6;if(h<0){h++;}}return[Math.round(h*360),Math.round(g*100),Math.round(i*100)]; -},hsbToRgb:function(){var d=Math.round(this[2]/100*255);if(this[1]==0){return[d,d,d];}else{var b=this[0]%360;var g=b%60;var h=Math.round((this[2]*(100-this[1]))/10000*255); -var e=Math.round((this[2]*(6000-this[1]*g))/600000*255);var c=Math.round((this[2]*(6000-this[1]*(60-g)))/600000*255);switch(Math.floor(b/60)){case 0:return[d,c,h]; -case 1:return[e,d,h];case 2:return[h,d,c];case 3:return[h,e,d];case 4:return[c,h,d];case 5:return[d,h,e];}}return false;}});String.implement({rgbToHsb:function(){var b=this.match(/\d{1,3}/g); -return(b)?b.rgbToHsb():null;},hsbToRgb:function(){var b=this.match(/\d{1,3}/g);return(b)?b.hsbToRgb():null;}});})(); \ No newline at end of file diff --git a/pyload/webui/themes/Default/js/static/purr.js b/pyload/webui/themes/Default/js/static/purr.js deleted file mode 100644 index 9cbc503d9..000000000 --- a/pyload/webui/themes/Default/js/static/purr.js +++ /dev/null @@ -1,309 +0,0 @@ -/* ---- -script: purr.js - -description: Class to create growl-style popup notifications. - -license: MIT-style - -authors: [atom smith] - -requires: -- core/1.3: [Core, Browser, Array, Function, Number, String, Hash, Event, Class.Extras, Element.Event, Element.Style, Element.Dimensions, Fx.CSS, FX.Tween, Fx.Morph] - -provides: [Purr, Element.alert] -... -*/ - - -var Purr = new Class({ - - 'options': { - 'mode': 'top', - 'position': 'left', - 'elementAlertClass': 'purr-element-alert', - 'elements': { - 'wrapper': 'div', - 'alert': 'div', - 'buttonWrapper': 'div', - 'button': 'button' - }, - 'elementOptions': { - 'wrapper': { - 'styles': { - 'position': 'fixed', - 'z-index': '9999' - }, - 'class': 'purr-wrapper' - }, - 'alert': { - 'class': 'purr-alert', - 'styles': { - 'opacity': '.85' - } - }, - 'buttonWrapper': { - 'class': 'purr-button-wrapper' - }, - 'button': { - 'class': 'purr-button' - } - }, - 'alert': { - 'buttons': [], - 'clickDismiss': true, - 'hoverWait': true, - 'hideAfter': 5000, - 'fx': { - 'duration': 500 - }, - 'highlight': false, - 'highlightRepeat': false, - 'highlight': { - 'start': '#FF0', - 'end': false - } - } - }, - - 'Implements': [Options, Events, Chain], - - 'initialize': function(options){ - this.setOptions(options); - this.createWrapper(); - return this; - }, - - 'bindAlert': function(){ - return this.alert.bind(this); - }, - - 'createWrapper': function(){ - this.wrapper = new Element(this.options.elements.wrapper, this.options.elementOptions.wrapper); - if(this.options.mode == 'top') - { - this.wrapper.setStyle('top', 0); - } - else - { - this.wrapper.setStyle('bottom', 0); - } - document.id(document.body).grab(this.wrapper); - this.positionWrapper(this.options.position); - }, - - 'positionWrapper': function(position){ - if(typeOf(position) == 'object') - { - - var wrapperCoords = this.getWrapperCoords(); - - this.wrapper.setStyles({ - 'bottom': '', - 'left': position.x, - 'top': position.y - wrapperCoords.height, - 'position': 'absolute' - }); - } - else if(position == 'left') - { - this.wrapper.setStyle('left', 0); - } - else if(position == 'right') - { - this.wrapper.setStyle('right', 0); - } - else - { - this.wrapper.setStyle('left', (window.innerWidth / 2) - (this.getWrapperCoords().width / 2)); - } - return this; - }, - - 'getWrapperCoords': function(){ - this.wrapper.setStyle('visibility', 'hidden'); - var measurer = this.alert('need something in here to measure'); - var coords = this.wrapper.getCoordinates(); - measurer.destroy(); - this.wrapper.setStyle('visibility',''); - return coords; - }, - - 'alert': function(msg, options){ - - options = Object.merge({}, this.options.alert, options || {}); - - var alert = new Element(this.options.elements.alert, this.options.elementOptions.alert); - - if(typeOf(msg) == 'string') - { - alert.set('html', msg); - } - else if(typeOf(msg) == 'element') - { - alert.grab(msg); - } - else if(typeOf(msg) == 'array') - { - var alerts = []; - msg.each(function(m){ - alerts.push(this.alert(m, options)); - }, this); - return alerts; - } - - alert.store('options', options); - - if(options.buttons.length > 0) - { - options.clickDismiss = false; - options.hideAfter = false; - options.hoverWait = false; - var buttonWrapper = new Element(this.options.elements.buttonWrapper, this.options.elementOptions.buttonWrapper); - alert.grab(buttonWrapper); - options.buttons.each(function(button){ - if(button.text != undefined) - { - var callbackButton = new Element(this.options.elements.button, this.options.elementOptions.button); - callbackButton.set('html', button.text); - if(button.callback != undefined) - { - callbackButton.addEvent('click', button.callback.pass(alert)); - } - if(button.dismiss != undefined && button.dismiss) - { - callbackButton.addEvent('click', this.dismiss.pass(alert, this)); - } - buttonWrapper.grab(callbackButton); - } - }, this); - } - if(options.className != undefined) - { - alert.addClass(options.className); - } - - this.wrapper.grab(alert, (this.options.mode == 'top') ? 'bottom' : 'top'); - - var fx = Object.merge(this.options.alert.fx, options.fx); - var alertFx = new Fx.Morph(alert, fx); - alert.store('fx', alertFx); - this.fadeIn(alert); - - if(options.highlight) - { - alertFx.addEvent('complete', function(){ - alert.highlight(options.highlight.start, options.highlight.end); - if(options.highlightRepeat) - { - alert.highlight.periodical(options.highlightRepeat, alert, [options.highlight.start, options.highlight.end]); - } - }); - } - if(options.hideAfter) - { - this.dismiss(alert); - } - - if(options.clickDismiss) - { - alert.addEvent('click', function(){ - this.holdUp = false; - this.dismiss(alert, true); - }.bind(this)); - } - - if(options.hoverWait) - { - alert.addEvents({ - 'mouseenter': function(){ - this.holdUp = true; - }.bind(this), - 'mouseleave': function(){ - this.holdUp = false; - }.bind(this) - }); - } - - return alert; - }, - - 'fadeIn': function(alert){ - var alertFx = alert.retrieve('fx'); - alertFx.set({ - 'opacity': 0 - }); - alertFx.start({ - 'opacity': [this.options.elementOptions.alert.styles.opacity, .9].pick(), - }); - }, - - 'dismiss': function(alert, now){ - now = now || false; - var options = alert.retrieve('options'); - if(now) - { - this.fadeOut(alert); - } - else - { - this.fadeOut.delay(options.hideAfter, this, alert); - } - }, - - 'fadeOut': function(alert){ - if(this.holdUp) - { - this.dismiss.delay(100, this, [alert, true]) - return null; - } - var alertFx = alert.retrieve('fx'); - if(!alertFx) - { - return null; - } - var to = { - 'opacity': 0 - } - if(this.options.mode == 'top') - { - to['margin-top'] = '-'+alert.offsetHeight+'px'; - } - else - { - to['margin-bottom'] = '-'+alert.offsetHeight+'px'; - } - alertFx.start(to); - alertFx.addEvent('complete', function(){ - alert.destroy(); - }); - } -}); - -Element.implement({ - - 'alert': function(msg, options){ - var alert = this.retrieve('alert'); - if(!alert) - { - options = options || { - 'mode':'top' - }; - alert = new Purr(options) - this.store('alert', alert); - } - - var coords = this.getCoordinates(); - - alert.alert(msg, options); - - alert.wrapper.setStyles({ - 'bottom': '', - 'left': (coords.left - (alert.wrapper.getWidth() / 2)) + (this.getWidth() / 2), - 'top': coords.top - (alert.wrapper.getHeight()), - 'position': 'absolute' - }); - - } - -}); \ No newline at end of file diff --git a/pyload/webui/themes/Default/js/static/purr.min.js b/pyload/webui/themes/Default/js/static/purr.min.js deleted file mode 100644 index bf70e357d..000000000 --- a/pyload/webui/themes/Default/js/static/purr.min.js +++ /dev/null @@ -1 +0,0 @@ -var Purr=new Class({options:{mode:"top",position:"left",elementAlertClass:"purr-element-alert",elements:{wrapper:"div",alert:"div",buttonWrapper:"div",button:"button"},elementOptions:{wrapper:{styles:{position:"fixed","z-index":"9999"},"class":"purr-wrapper"},alert:{"class":"purr-alert",styles:{opacity:".85"}},buttonWrapper:{"class":"purr-button-wrapper"},button:{"class":"purr-button"}},alert:{buttons:[],clickDismiss:!0,hoverWait:!0,hideAfter:5e3,fx:{duration:500},highlight:!1,highlightRepeat:!1,highlight:{start:"#FF0",end:!1}}},Implements:[Options,Events,Chain],initialize:function(t){return this.setOptions(t),this.createWrapper(),this},bindAlert:function(){return this.alert.bind(this)},createWrapper:function(){this.wrapper=new Element(this.options.elements.wrapper,this.options.elementOptions.wrapper),"top"==this.options.mode?this.wrapper.setStyle("top",0):this.wrapper.setStyle("bottom",0),document.id(document.body).grab(this.wrapper),this.positionWrapper(this.options.position)},positionWrapper:function(t){if("object"==typeOf(t)){var e=this.getWrapperCoords();this.wrapper.setStyles({bottom:"",left:t.x,top:t.y-e.height,position:"absolute"})}else"left"==t?this.wrapper.setStyle("left",0):"right"==t?this.wrapper.setStyle("right",0):this.wrapper.setStyle("left",window.innerWidth/2-this.getWrapperCoords().width/2);return this},getWrapperCoords:function(){this.wrapper.setStyle("visibility","hidden");var t=this.alert("need something in here to measure"),e=this.wrapper.getCoordinates();return t.destroy(),this.wrapper.setStyle("visibility",""),e},alert:function(t,e){e=Object.merge({},this.options.alert,e||{});var i=new Element(this.options.elements.alert,this.options.elementOptions.alert);if("string"==typeOf(t))i.set("html",t);else if("element"==typeOf(t))i.grab(t);else if("array"==typeOf(t)){var s=[];return t.each(function(t){s.push(this.alert(t,e))},this),s}if(i.store("options",e),e.buttons.length>0){e.clickDismiss=!1,e.hideAfter=!1,e.hoverWait=!1;var r=new Element(this.options.elements.buttonWrapper,this.options.elementOptions.buttonWrapper);i.grab(r),e.buttons.each(function(t){if(void 0!=t.text){var e=new Element(this.options.elements.button,this.options.elementOptions.button);e.set("html",t.text),void 0!=t.callback&&e.addEvent("click",t.callback.pass(i)),void 0!=t.dismiss&&t.dismiss&&e.addEvent("click",this.dismiss.pass(i,this)),r.grab(e)}},this)}void 0!=e.className&&i.addClass(e.className),this.wrapper.grab(i,"top"==this.options.mode?"bottom":"top");var o=Object.merge(this.options.alert.fx,e.fx),n=new Fx.Morph(i,o);return i.store("fx",n),this.fadeIn(i),e.highlight&&n.addEvent("complete",function(){i.highlight(e.highlight.start,e.highlight.end),e.highlightRepeat&&i.highlight.periodical(e.highlightRepeat,i,[e.highlight.start,e.highlight.end])}),e.hideAfter&&this.dismiss(i),e.clickDismiss&&i.addEvent("click",function(){this.holdUp=!1,this.dismiss(i,!0)}.bind(this)),e.hoverWait&&i.addEvents({mouseenter:function(){this.holdUp=!0}.bind(this),mouseleave:function(){this.holdUp=!1}.bind(this)}),i},fadeIn:function(t){var e=t.retrieve("fx");e.set({opacity:0}),e.start({opacity:[this.options.elementOptions.alert.styles.opacity,.9].pick()})},dismiss:function(t,e){e=e||!1;var i=t.retrieve("options");e?this.fadeOut(t):this.fadeOut.delay(i.hideAfter,this,t)},fadeOut:function(t){if(this.holdUp)return this.dismiss.delay(100,this,[t,!0]),null;var e=t.retrieve("fx");if(!e)return null;var i={opacity:0};"top"==this.options.mode?i["margin-top"]="-"+t.offsetHeight+"px":i["margin-bottom"]="-"+t.offsetHeight+"px",e.start(i),e.addEvent("complete",function(){t.destroy()})}});Element.implement({alert:function(t,e){var i=this.retrieve("alert");i||(e=e||{mode:"top"},i=new Purr(e),this.store("alert",i));var s=this.getCoordinates();i.alert(t,e),i.wrapper.setStyles({bottom:"",left:s.left-i.wrapper.getWidth()/2+this.getWidth()/2,top:s.top-i.wrapper.getHeight(),position:"absolute"})}}); \ No newline at end of file diff --git a/pyload/webui/themes/Default/js/static/tinytab.js b/pyload/webui/themes/Default/js/static/tinytab.js deleted file mode 100644 index de50279fc..000000000 --- a/pyload/webui/themes/Default/js/static/tinytab.js +++ /dev/null @@ -1,43 +0,0 @@ -/* ---- -description: TinyTab - Tiny and simple tab handler for Mootools. - -license: MIT-style - -authors: -- Danillo César de O. Melo - -requires: -- core/1.2.4: '*' - -provides: TinyTab - -... -*/ -(function($) { - this.TinyTab = new Class({ - Implements: Events, - initialize: function(tabs, contents, opt) { - this.tabs = tabs; - this.contents = contents; - if(!opt) opt = {}; - this.css = opt.selectedClass || 'selected'; - this.select(this.tabs[0]); - tabs.each(function(el){ - el.addEvent('click',function(e){ - this.select(el); - e.stop(); - }.bind(this)); - }.bind(this)); - }, - - select: function(el) { - this.tabs.removeClass(this.css); - el.addClass(this.css); - this.contents.setStyle('display','none'); - var content = this.contents[this.tabs.indexOf(el)]; - content.setStyle('display','block'); - this.fireEvent('change',[content,el]); - } - }); -})(document.id); \ No newline at end of file diff --git a/pyload/webui/themes/Default/js/static/tinytab.min.js b/pyload/webui/themes/Default/js/static/tinytab.min.js deleted file mode 100644 index 2f4fa0436..000000000 --- a/pyload/webui/themes/Default/js/static/tinytab.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(){this.TinyTab=new Class({Implements:Events,initialize:function(s,t,e){this.tabs=s,this.contents=t,e||(e={}),this.css=e.selectedClass||"selected",this.select(this.tabs[0]),s.each(function(s){s.addEvent("click",function(t){this.select(s),t.stop()}.bind(this))}.bind(this))},select:function(s){this.tabs.removeClass(this.css),s.addClass(this.css),this.contents.setStyle("display","none");var t=this.contents[this.tabs.indexOf(s)];t.setStyle("display","block"),this.fireEvent("change",[t,s])}})}(document.id); \ No newline at end of file diff --git a/pyload/webui/themes/Default/tml/admin.html b/pyload/webui/themes/Default/tml/admin.html deleted file mode 100644 index 0b7301fc8..000000000 --- a/pyload/webui/themes/Default/tml/admin.html +++ /dev/null @@ -1,98 +0,0 @@ -{% extends '/Default/tml/base.html' %} - -{% block head %} - -{% endblock %} - - -{% block title %}{{ _("Administrate") }} - {{ super() }} {% endblock %} -{% block subtitle %}{{ _("Administrate") }}{% endblock %} - -{% block content %} - - {{_("Quit pyLoad")}} | - {{_("Restart pyLoad")}} -
      -
      - - {{ _("To add user or change passwords use:") }} python pyload.py -u
      - {{ _("Important: Admin user have always all permissions!") }} - -
      - - - - - - - - - {% for name, data in users.iteritems() %} - - - - - - - {% endfor %} - - -
      - {{ _("Name") }} - - {{ _("Change Password") }} - - {{ _("Admin") }} - - {{ _("Permissions") }} -
      {{ name }}{{ _("change") }} - -
      - - -
      -{% endblock %} -{% block hidden %} -
      -
      -

      {{ _("Change Password") }}

      - -

      {{ _("Enter your current and desired Password.") }}

      - - - - - - - - - - - - - - - -
      - -
      - -
      -{% endblock %} diff --git a/pyload/webui/themes/Default/tml/base.html b/pyload/webui/themes/Default/tml/base.html deleted file mode 100644 index aac70a394..000000000 --- a/pyload/webui/themes/Default/tml/base.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - -{% block title %}pyLoad {{_("Webinterface")}}{% endblock %} - -{% block head %} -{% endblock %} - - - - -
      - - -
      - {% block headpanel %} - - {% if user.is_authenticated %} - - -{% if update %} - -{{_("New pyLoad version %s available!") % update}} - -{% endif %} - - -{% if plugins %} - -{{_("Plugins updated, please restart!")}} - -{% endif %} - - -Captcha: -{{_("Captcha waiting")}} - - - User:{{user.name}} - -{% else %} - {{_("Please Login!")}} -{% endif %} - - {% endblock %} -
      - - - -
      - -
      - -
      -
      - -{% if perms.STATUS %} - -{% endif %} - -{% if perms.LIST %} - -{% endif %} - -{% block pageactions %} -{% endblock %} -
      - -
      - -
      - -

      {% block subtitle %}pyLoad - {{_("Webinterface")}}{% endblock %}

      - -{% block statusbar %} -{% endblock %} - - -
      - -
      -
      - - -{% for message in messages %} -

      {{message}}

      -{% endfor %} - -
      - - {{_("loading")}} -
      - -{% block content %} -{% endblock content %} - -
      - - -
      -
      - -
      - {% include '/Default/tml/window.html' %} - {% include '/Default/tml/captcha.html' %} - {% block hidden %} - {% endblock %} -
      - - diff --git a/pyload/webui/themes/Default/tml/captcha.html b/pyload/webui/themes/Default/tml/captcha.html deleted file mode 100644 index 3bfa6cbcf..000000000 --- a/pyload/webui/themes/Default/tml/captcha.html +++ /dev/null @@ -1,42 +0,0 @@ - -
      - -
      - -

      {{_("Captcha reading")}}

      -

      {{_("Please read the text on the captcha.")}}

      - -
      - - - - - - - - - - - -
      - -
      - -
      - -
      - - - - -
      - -
      - -
      - -
      diff --git a/pyload/webui/themes/Default/tml/downloads.html b/pyload/webui/themes/Default/tml/downloads.html deleted file mode 100644 index fe0f4f1bc..000000000 --- a/pyload/webui/themes/Default/tml/downloads.html +++ /dev/null @@ -1,29 +0,0 @@ -{% extends '/Default/tml/base.html' %} - -{% block title %}Downloads - {{super()}} {% endblock %} - -{% block subtitle %} -{{_("Downloads")}} -{% endblock %} - -{% block content %} - -
        - {% for folder in files.folder %} -
      • - {{ folder.name }} -
          - {% for file in folder.files %} -
        • {{file}}
        • - {% endfor %} -
        -
      • - {% endfor %} - - {% for file in files.files %} -
      • {{ file }}
      • - {% endfor %} - -
      - -{% endblock %} diff --git a/pyload/webui/themes/Default/tml/filemanager.html b/pyload/webui/themes/Default/tml/filemanager.html deleted file mode 100644 index c2ac5df9d..000000000 --- a/pyload/webui/themes/Default/tml/filemanager.html +++ /dev/null @@ -1,76 +0,0 @@ -{% extends '/Default/tml/base.html' %} - -{% block head %} - - -{% endblock %} - -{% block title %}Downloads - {{super()}} {% endblock %} - - -{% block subtitle %} -{{_("FileManager")}} -{% endblock %} - -{% macro display_file(file) %} -
    • - - - - {{ file.name }} - - -    - - - -
    • -{%- endmacro %} - -{% macro display_folder(fld, open = false) -%} -
    • - - - - {{ fld.name }} - - -    - -    - - - - {% if (fld.folders|length + fld.files|length) > 0 %} - {% if open %} -
        - {% else %} -
          - {% endif %} - {% for child in fld.folders %} - {{ display_folder(child) }} - {% endfor %} - {% for child in fld.files %} - {{ display_file(child) }} - {% endfor %} -
        - {% else %} -
        {{ _("Folder is empty") }}
        - {% endif %} - -{%- endmacro %} - -{% block content %} - -
        - -
          -{{ display_folder(root, true) }} -
        - -{% endblock %} diff --git a/pyload/webui/themes/Default/tml/folder.html b/pyload/webui/themes/Default/tml/folder.html deleted file mode 100644 index 54dd72bb9..000000000 --- a/pyload/webui/themes/Default/tml/folder.html +++ /dev/null @@ -1,15 +0,0 @@ -
      • - - - - {{ name }} - - -    - -    - - - -
        {{ _("Folder is empty") }}
        -
      • diff --git a/pyload/webui/themes/Default/tml/home.html b/pyload/webui/themes/Default/tml/home.html deleted file mode 100644 index 09daae596..000000000 --- a/pyload/webui/themes/Default/tml/home.html +++ /dev/null @@ -1,263 +0,0 @@ -{% extends '/Default/tml/base.html' %} -{% block head %} - - - -{% endblock %} - -{% block subtitle %} -{{_("Active Downloads")}} -{% endblock %} - -{% block menu %} -
      • - {{_("Home")}} -
      • -
      • - {{_("Queue")}} -
      • -
      • - {{_("Collector")}} -
      • -
      • - {{_("Downloads")}} -
      • -
      • - {{_("Logs")}} -
      • -
      • - {{_("Config")}} -
      • -{% endblock %} - -{% block content %} - - - - - - - - - - - - - {% for link in content %} - - - - - - - - - - - {% endfor %} - - -
        {{_("Name")}}{{_("Status")}}{{_("Information")}}{{_("Size")}}{{_("Progress")}}
        -{% endblock %} diff --git a/pyload/webui/themes/Default/tml/info.html b/pyload/webui/themes/Default/tml/info.html deleted file mode 100644 index a5fc3c3f7..000000000 --- a/pyload/webui/themes/Default/tml/info.html +++ /dev/null @@ -1,81 +0,0 @@ -{% extends '/Default/tml/base.html' %} - -{% block head %} - -{% endblock %} - -{% block title %}{{ _("Information") }} - {{ super() }} {% endblock %} -{% block subtitle %}{{ _("Information") }}{% endblock %} - -{% block content %} -

        {{ _("News") }}

        -
        - -

        {{ _("Support") }}

        - - - -

        {{ _("System") }}

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        {{ _("Python:") }}{{ python }}
        {{ _("OS:") }}{{ os }}
        {{ _("pyLoad version:") }}{{ version }}
        {{ _("Installation Folder:") }}{{ folder }}
        {{ _("Config Folder:") }}{{ config }}
        {{ _("Download Folder:") }}{{ download }}
        {{ _("Free Space:") }}{{ freespace }}
        {{ _("Language:") }}{{ language }}
        {{ _("Webinterface Port:") }}{{ webif }}
        {{ _("Remote Interface Port:") }}{{ remote }}
        - -{% endblock %} diff --git a/pyload/webui/themes/Default/tml/login.html b/pyload/webui/themes/Default/tml/login.html deleted file mode 100644 index 538ce792d..000000000 --- a/pyload/webui/themes/Default/tml/login.html +++ /dev/null @@ -1,36 +0,0 @@ -{% extends '/Default/tml/base.html' %} - -{% block title %}{{_("Login")}} - {{super()}} {% endblock %} - -{% block content %} - -
        -
        -
        - -
        - Login - -
        - -
        - -
        -
        -
        - -{% if errors %} -

        {{_("Your username and password didn't match. Please try again.")}}

        - {{ _("To reset your login data or add an user run:") }} python pyload.py -u -{% endif %} - -
        -
        - -{% endblock %} diff --git a/pyload/webui/themes/Default/tml/logout.html b/pyload/webui/themes/Default/tml/logout.html deleted file mode 100644 index 19d673e7c..000000000 --- a/pyload/webui/themes/Default/tml/logout.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends '/Default/tml/base.html' %} - -{% block head %} - -{% endblock %} - -{% block content %} -

        {{_("You were successfully logged out.")}}

        -{% endblock %} diff --git a/pyload/webui/themes/Default/tml/logs.html b/pyload/webui/themes/Default/tml/logs.html deleted file mode 100644 index ccf992d04..000000000 --- a/pyload/webui/themes/Default/tml/logs.html +++ /dev/null @@ -1,41 +0,0 @@ -{% extends '/Default/tml/base.html' %} - -{% block title %}{{_("Logs")}} - {{super()}} {% endblock %} -{% block subtitle %}{{_("Logs")}}{% endblock %} -{% block head %} - -{% endblock %} - -{% block content %} -
        - - -
        -
        - -   - - -
        -
        -
        {{warning}}
        -
        -
        - - {% for line in log %} - - {% endfor %} -
        {{line.line}}{{line.date}}{{line.level}}{{line.message}}
        -
        -
        -
        - - -
        -
        -
         
        -{% endblock %} diff --git a/pyload/webui/themes/Default/tml/pathchooser.html b/pyload/webui/themes/Default/tml/pathchooser.html deleted file mode 100644 index 5cf08a6e2..000000000 --- a/pyload/webui/themes/Default/tml/pathchooser.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - -
        -
        -
        - - -
        - - {% if type == 'folder' %} - {{_("Path")}}: {{_("absolute")}} | {{_("relative")}} - {% else %} - {{_("Path")}}: {{_("absolute")}} | {{_("relative")}} - {% endif %} -
        - - - - - - - - {% if parentdir %} - - - - {% endif %} -{% for file in files %} - - {% if type == 'folder' %} - - {% else %} - - {% endif %} - - - - - -{% endfor %} -
        {{_("name")}}{{_("size")}}{{_("type")}}{{_("last modified")}}
        - {{_("parent directory")}} -
        {% if file.type == 'dir' %}{{ file.name|truncate(25) }}{% else %}{{ file.name|truncate(25) }}{% endif %}{% if file.type == 'dir' %}{{ file.name|truncate(25) }}{% else %}{{ file.name|truncate(25) }}{% endif %}{{ file.size|float|filesizeformat }}{% if file.type == 'dir' %}directory{% else %}{{ file.ext|default("file") }}{% endif %}{{ file.modified|date("d.m.Y - H:i:s") }}
        -
        - - diff --git a/pyload/webui/themes/Default/tml/queue.html b/pyload/webui/themes/Default/tml/queue.html deleted file mode 100644 index 0fa9580e0..000000000 --- a/pyload/webui/themes/Default/tml/queue.html +++ /dev/null @@ -1,104 +0,0 @@ -{% extends '/Default/tml/base.html' %} -{% block head %} - - - - -{% endblock %} - -{% if target %} - {% set name = _("Queue") %} -{% else %} - {% set name = _("Collector") %} -{% endif %} - -{% block title %}{{name}} - {{super()}} {% endblock %} -{% block subtitle %}{{name}}{% endblock %} - -{% block pageactions %} - -{% endblock %} - -{% block content %} -{% autoescape true %} - -
          -{% for package in content %} -
        • -
          - - -
          - - {{package.name}} -    - - -    - -    - -    - - -
          - {% set progress = (package.linksdone * 100) / package.linkstotal %} - -
          -
          - - -
          -
          - - -
          -
        • -{% endfor %} -
        -{% endautoescape %} -{% endblock %} - -{% block hidden %} -
        -
        -

        {{_("Edit Package")}}

        -

        {{_("Edit the package detais below.")}}

        - - - - - - - - - - - - -
        - -
        - -
        -{% endblock %} diff --git a/pyload/webui/themes/Default/tml/settings.html b/pyload/webui/themes/Default/tml/settings.html deleted file mode 100644 index 9205f011b..000000000 --- a/pyload/webui/themes/Default/tml/settings.html +++ /dev/null @@ -1,204 +0,0 @@ -{% extends '/Default/tml/base.html' %} - -{% block title %}{{ _("Config") }} - {{ super() }} {% endblock %} -{% block subtitle %}{{ _("Config") }}{% endblock %} - -{% block head %} - - - - -{% endblock %} - -{% block content %} - - - -
        - -
        - - - - - - -
        - -
        -

           {{ _("Choose a section from the menu") }}

        -
        -
        - - -
        -
        - - - - - - -
        - - -
        -

           {{ _("Choose a section from the menu") }}

        -
        -
        - -
        - -
        - - - -
        - - - - - - - - - - - - - - - - - - - - {% for account in conf.accs %} - {% set plugin = account.type %} - - - - - - - - - - - - - - {% endfor %} -
        {{ _("Plugin") }}{{ _("Name") }}{{ _("Password") }}{{ _("Status") }}{{ _("Premium") }}{{ _("Valid until") }}{{ _("Traffic left") }}{{ _("Time") }}{{ _("Max Parallel") }}{{ _("Delete?") }}
        - {{ plugin }} - - - - {% if account.valid %} - - {{ _("valid") }} - {% else %} - - {{ _("not valid") }} - {% endif %} - - - {% if account.premium %} - - {{ _("yes") }} - {% else %} - - {{ _("no") }} - {% endif %} - - - - {{ account.validuntil }} - - - - {{ account.trafficleft }} - - - - - - - -
        - - - -
        -
        -
        -{% endblock %} -{% block hidden %} -
        -
        -

        {{_("Add Account")}}

        -

        {{_("Enter your account data to use premium features.")}}

        - - - - - - - - - - - -
        - -
        - -
        -{% endblock %} diff --git a/pyload/webui/themes/Default/tml/settings_item.html b/pyload/webui/themes/Default/tml/settings_item.html deleted file mode 100644 index 6642d34b4..000000000 --- a/pyload/webui/themes/Default/tml/settings_item.html +++ /dev/null @@ -1,48 +0,0 @@ - - {% if section.outline %} - - {% endif %} - {% for okey, option in section.iteritems() %} - {% if okey not in ("desc", "outline") %} - - - - - {% endif %} - {% endfor %} -
        {{ section.outline }}
        - {% if option.type == "bool" %} - - {% elif ";" in option.type %} - - {% elif option.type == "folder" %} - - - {% elif option.type == "file" %} - - - {% elif option.type == "password" %} - - {% else %} - - {% endif %} -
        diff --git a/pyload/webui/themes/Default/tml/window.html b/pyload/webui/themes/Default/tml/window.html deleted file mode 100644 index 800874af0..000000000 --- a/pyload/webui/themes/Default/tml/window.html +++ /dev/null @@ -1,46 +0,0 @@ - - -
        -
        -

        {{_("Add Package")}}

        -

        {{_("Paste your links or upload a container.")}}

        - - - - - - - - - - - - - - - {{_("Queue")}} - - {{_("Collector")}} - - - - - -
        - -
        - -
        diff --git a/pyload/webui/themes/Flat/css/MooDialog.css b/pyload/webui/themes/Flat/css/MooDialog.css deleted file mode 100644 index 7d6e38ece..000000000 --- a/pyload/webui/themes/Flat/css/MooDialog.css +++ /dev/null @@ -1,85 +0,0 @@ -/* Created by Arian Stolwijk */ - -.MooDialog { -/* position: fixed;*/ - margin: 0 auto 0 -350px; - width:600px; - padding:14px; - left:50%; - top: 100px; - - position: absolute; - left: 50%; - z-index: 50000; - - background-color: #E44424; - color: black; - opacity:0.9; -} - -.MooDialogTitle { - padding-top: 30px; -} - -.MooDialog .title { - position: absolute; - top: 0; - left: 0; - right: 0; - padding: 3px 20px; - background: #b7c4dc; - border-bottom: 1px solid #a1aec5; - font-weight: bold; - text-shadow: 1px 1px 0 #fff; - color: black; - border-radius: 7px; - -moz-border-radius: 7px; - -webkit-border-radius: 7px; -} - -.MooDialog .close { - background: url(../img/control_cancel.png) no-repeat; - width: 16px; - height: 16px; - display: block; - cursor: pointer; - top: -5px; - left: -5px; - position: absolute; -} - -.MooDialog .buttons { - text-align: right; - margin: 0; - padding: 0; - border: 0; - background: none; -} - -.MooDialog .iframe { - width: 100%; - height: 100%; -} - -.MooDialog .textInput { - width: 200px; - float: left; -} - -.MooDialog .MooDialogAlert, -.MooDialog .MooDialogConfirm, -.MooDialog .MooDialogPrompt, -.MooDialog .MooDialogError { - background: url(../img/MooDialog/dialog-warning.png) no-repeat; - padding-left: 40px; - min-height: 40px; -} - -.MooDialog .MooDialogConfirm, -.MooDialog .MooDialogPromt { - background: url(../img/MooDialog/dialog-question.png) no-repeat; -} - -.MooDialog .MooDialogError { - background: url(../img/MooDialog/dialog-error.png) no-repeat; -} diff --git a/pyload/webui/themes/Flat/css/base.css b/pyload/webui/themes/Flat/css/base.css deleted file mode 100644 index fd73d0a19..000000000 --- a/pyload/webui/themes/Flat/css/base.css +++ /dev/null @@ -1,866 +0,0 @@ -.hidden { - display:none; -} -.leftalign { - text-align:left; -} -.centeralign { - text-align:center; -} -.rightalign { - text-align:right; -} -.dokuwiki div.plugin_translation ul li a.wikilink1:link, .dokuwiki div.plugin_translation ul li a.wikilink1:hover, .dokuwiki div.plugin_translation ul li a.wikilink1:active, .dokuwiki div.plugin_translation ul li a.wikilink1:visited { - background-color:#000080; - border:none !important; - color:#FFFFFF !important; - margin:0.1em 0.2em; - padding:0 0.2em; - text-decoration:none; -} -.dokuwiki div.plugin_translation ul li a.wikilink2:link, .dokuwiki div.plugin_translation ul li a.wikilink2:hover, .dokuwiki div.plugin_translation ul li a.wikilink2:active, .dokuwiki div.plugin_translation ul li a.wikilink2:visited { - background-color:#808080; - border:none !important; - color:#FFFFFF !important; - margin:0.1em 0.2em; - padding:0 0.2em; - text-decoration:none; -} -.dokuwiki div.plugin_translation ul li a:hover img { - height:15px; - opacity:1; -} -body { - background-color:white; - color:black; - font-family:'Open Sans', sans-serif; - font-size:12px; - font-style:normal; - font-variant:normal; - font-weight:300; - line-height:normal; - margin:0; - padding:0; -} -hr { - border-bottom-color:#AAAAAA; - border-bottom-style:dotted; -} -img { - border:none; -} -form { - background-color:transparent; - border:none; - display:inline; - margin:0; - padding:0; -} -ul li { - margin:5px; -} -textarea { - font-family:monospace; -} -table { - border-collapse:collapse; - margin:0.5em 0; -} -td { - border:1pt solid #ADB9CC; - padding:0.25em; -} -a { - color:#3465A4; - text-decoration:none; -} -a:hover { - text-decoration:underline; -} -option { - border:0 none #FFFFFF; -} -strong.highlight { - background-color:#FFCC99; - padding:1pt; -} -#pagebottom { - clear:both; -} -hr { - background-color:#C0C0C0; - border:none; - color:#C0C0C0; - margin:0.2em 0; -} -.invisible { - border:0; - height:0; - margin:0; - padding:0; - visibility:hidden; -} -.left { - float:left !important; -} -.right { - float:right !important; -} -.center { - text-align:center; -} -div#body-wrapper { - font-size:127%; - padding:40px 40px 10px; -} -div#content { - color:black; - font-size:14px; - line-height:1.5em; - margin-top:-20px; - padding:0; -} -h1, h2, h3, h4, h5, h6 { - background-attachment:scroll; - background-color:transparent; - background-image:none; - background-position:0 0; - background-repeat:repeat repeat; - color:black; - font-family:'Open Sans', sans-serif; - font-weight:normal; - margin:0; - padding:0.5em 0 0.17em; -} -h1 { - font-family:'Open Sans', sans-serif; - font-weight:300; - line-height:1.2em; - margin-bottom:0.1em; - padding-bottom:0; - margin-left:-25px; -} -h2 { - font-size:150%; -} -h3, h4, h5, h6 { - border-bottom-style:none; - font-weight:bold; -} -h3 { - font-size:132%; -} -h4 { - font-size:116%; -} -h5 { - font-size:100%; -} -h6 { - font-size:80%; -} -ul#page-actions, ul#page-actions-more { - background-color:#ECECEC; - color:black; - float:right; - list-style-type:none; - margin:10px 10px 0; - padding:6px; - white-space:nowrap; -} -ul#user-actions { - background-color:#67BCDB; - color:black; - display:inline; - list-style-type:none; - margin:0; - padding:10px; -} -ul#page-actions li, ul#user-actions li, ul#page-actions-more li { - display:inline; -} -ul#page-actions a, ul#user-actions a, ul#page-actions-more a { - color:black; - display:inline; - margin:0 3px; - padding:2px 0 2px 18px; - text-decoration:none; -} -ul#page-actions a:hover, ul#page-actions a:focus, ul#user-actions a:hover, ul#user-actions a:focus { -} -ul#page-actions2 { - background-color:#ECECEC; - color:black; - float:left; - list-style-type:none; - margin:10px 10px 0; - padding:6px; -} -ul#user-actions2 { - background-color:#ECECEC; - border-bottom-left-radius:3px; - border-bottom-right-radius:3px; - border-top-left-radius:3px; - border-top-right-radius:3px; - color:black; - display:inline; - list-style-type:none; - margin:0; - padding:5px; -} -ul#page-actions2 li, ul#user-actions2 li { - display:inline; -} -ul#page-actions2 a, ul#user-actions2 a { - color:black; - display:inline; - margin:0 3px; - padding:2px 0 2px 18px; - text-decoration:none; -} -ul#page-actions2 a:hover, ul#page-actions2 a:focus, ul#user-actions2 a:hover, ul#user-actions2 a:focus, ul#page-actions-more a:hover, ul#page-actions-more a:focus { - color:#4E7BB4; -} -.hidden { - display:none; -} -a.logout { - background-color:transparent; - background-image:url(../img/user-actions-logout.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.info { - background-color:transparent; - background-image:url(../img/user-info.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.admin { - background-color:transparent; - background-image:url(../img/user-actions-admin.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.profile { - background-color:transparent; - background-image:url(../img/user-actions-profile.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.create, a.edit { - background-color:transparent; - background-image:url(../img/page-tools-edit.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.source, a.show { - background-color:transparent; - background-image:url(../img/page-tools-source.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.revisions { - background-color:transparent; - background-image:url(../img/page-tools-revisions.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.subscribe, a.unsubscribe { - background-color:transparent; - background-image:url(../img/page-tools-subscribe.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.backlink { - background-color:transparent; - background-image:url(../img/page-tools-backlinks.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.play { - background-color:transparent; - background-image:url(../img/control_play.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -.time { - background-color:transparent; - background-image:url(../img/status_None.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; - margin:0 3px; - padding:2px 0 2px 18px; -} -.reconnect { - background-color:transparent; - background-image:url(../img/reconnect.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; - margin:0 3px; - padding:2px 0 2px 18px; -} -a.play:hover { - background-color:transparent; - background-image:url(../img/control_play_blue.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.cancel { - background-color:transparent; - background-image:url(../img/control_cancel.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.cancel:hover { - background-color:transparent; - background-image:url(../img/control_cancel_blue.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.pause { - background-color:transparent; - background-image:url(../img/control_pause.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.pause:hover { - background-color:transparent; - background-image:url(../img/control_pause_blue.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; - font-weight:bold; -} -a.stop { - background-color:transparent; - background-image:url(../img/control_stop.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.stop:hover { - background-color:transparent; - background-image:url(../img/control_stop_blue.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.add { - background-color:transparent; - background-image:url(../img/control_add.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.add:hover { - background-color:transparent; - background-image:url(../img/control_add_blue.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -a.cog { - background-color:transparent; - background-image:url(../img/cog.png); - background-position:0 1px; - background-repeat:no-repeat no-repeat; -} -#head-panel { - background-color:#67BCDB; - background-position:0 100%; - background-repeat:repeat no-repeat; -} -#head-panel h1 { - color:#EEEEEC; - display:none; - font-size:2.6em; - margin:0; - padding-left:3.3em; - padding-top:0.8em; - text-decoration:none; -} -#head-panel #head-logo { - float:left; - overflow:visible; - padding:11px 8px 0; -} -#head-menu { - float:left; - margin:0; - padding:1em 0 0; - width:100%; -} -#head-menu ul { - list-style:none; - margin:0 1em 0 2em; -} -#head-menu ul li { - float:left; - font-size:14px; - margin:0 0 4px 0.3em; -} -#head-menu ul li.selected, #head-menu ul li:hover { - margin-bottom:0; -} -#head-menu ul li a img { - height:22px; - padding-right:4px; - vertical-align:middle; - width:22px; -} -#head-menu ul li a, #head-menu ul li a:link { - background-color:#FFFFFF; - background-position:0 100%; - background-repeat:repeat no-repeat; - border-color:#CCCCCC #CCCCCC transparent; - color:#555555; - padding:7px 15px 8px; - text-decoration:none; - opacity:0.7; -} -#head-menu ul li a:hover, #head-menu ul li a:focus { - border-bottom-color:transparent; - border-bottom-left-radius:0; - border-bottom-right-radius:0; - border-bottom-style:none; - border-bottom-width:0; - outline:none; - padding-bottom:7px; - opacity:1; - background-color: #FF9009; - transition: background 0.2s ease-out, opacity 0.5s ease-in; -} -#head-menu ul li a:focus { - margin-bottom:-4px; -} -#head-menu ul li.selected a { - border-bottom-color:transparent; - color:#3566A5; - padding:7px 15px 8px; - opacity:1; -} -#head-menu ul li.selected a:hover, #head-menu ul li.selected a:focus { - color:#111111; -} -div#head-search-and-login { - float:right; - margin:0 12px 0 0; - padding:7px 0px 7px 7px; - white-space:nowrap; - background-color:#FFF056; - opacity:0.9; -} -div#head-search-and-login form { - display:inline; - padding:0 3px; -} -div#head-search-and-login form input { - background-color:#EEEEEE; - border:2px solid #888888; - border-bottom-left-radius:3px; - border-bottom-right-radius:3px; - border-top-left-radius:3px; - border-top-right-radius:3px; - font-size:14px; - padding:2px; -} -div#head-search-and-login form input:focus { - background-color:#FFFFFF; -} -#head-search { - font-size:14px; -} -#head-username, #head-password { - font-size:14px; - width:80px; -} -#pageinfo { - clear:both; - color:#888888; - margin:0; - padding:0.6em 0; -} -#foot { - color:#888888; - font-style:normal; - text-align:center; -} -#foot a { - color:#AAAAFF; -} -#foot img { - vertical-align:middle; -} -div.toc { - background-color:#F0F0F0; - border:1px dotted #888888; - float:right; - font-size:95%; - margin:1em 0 1em 1em; -} -div.toc .tocheader { - font-weight:bold; - margin:0.5em 1em; -} -div.toc ol { - margin:1em 0.5em 1em 1em; - padding:0; -} -div.toc ol li { - margin:0 0 0 1em; - padding:0; -} -div.toc ol ol { - margin:0.5em 0.5em 0.5em 1em; - padding:0; -} -div.recentchanges table { - clear:both; -} -div#editor-help { - background-color:#F7F6F2; - border:1px dotted #888888; - font-size:90%; - padding:0 1ex 1ex; -} -div#preview { - margin-top:1em; -} -label.block { - display:block; - font-weight:bold; - text-align:right; -} -label.simple { - display:block; - font-weight:normal; - text-align:left; -} -label.block input.edit { - width:50%; -} -div.editor { - margin:0; -} -table { - border-collapse:collapse; - margin:0.5em 0; -} -td { - border:1pt solid #ADB9CC; - padding:0.25em; -} -td p { - margin:0; - padding:0; -} -.u { - text-decoration:underline; -} -.footnotes ul { - margin:0 0 1em; - padding:0 2em; -} -.footnotes li { - list-style:none; -} -.userpref table, .userpref td { - border:none; -} -#message { - background-color:#EEEEEE; - border-bottom-color:#CCCCCC; - border-bottom-style:solid; - border-bottom-width:2px; - clear:both; - padding:5px 10px; -} -#message p { - font-weight:bold; - margin:5px 0; - padding:0; -} -#message div.buttons { - font-weight:normal; -} -.diff { - width:99%; -} -.diff-title { - background-color:#C0C0C0; -} -.searchresult dd span { - font-weight:400; -} -.boxtext { - color:#000000; - float:none; - font-family:tahoma, arial, sans-serif; - font-size:11px; - padding:3px 0 0 10px; -} -.statusbutton { - cursor:pointer; - float:left; - height:32px; - margin-left:-32px; - margin-right:5px; - opacity:0; - width:32px; -} -.dlsize { - float:left; - padding-right:8px; -} -.dlspeed { - float:left; - padding-right:8px; -} -.package { - margin-bottom:10px; -} -.packagename { - font-weight:300; -} -.child { - margin-left:20px; -} -.child_status { - margin-right:10px; -} -.child_secrow { - font-size:10px; -} -.header, .header th { - background-color:#ECECEC; - font-weight:300; - text-align:left; -} -.progress_bar { - background-color:#00CC00; - height:5px; -} -.queue { - border:none; -} -.queue tr td { - border:none; -} -.header, .header th { - font-weight:normal; - text-align:left; -} -.clearer { - clear:both; - height:1px; -} -.left { - float:left; -} -.right { - float:right; -} -.setfield { - display:table-cell; -} -ul.tabs li a { - border:none; - border-bottom-left-radius:0; - border-bottom-right-radius:0; - border-top-left-radius:5px; - border-top-right-radius:5px; - font-weight:bold; - padding:5px 16px 4px 15px; -} -#tabs span { - display:none; -} -#tabs span.selected { - display:inline; -} -#tabsback { - background-color:#525252; - border-top-left-radius:3px; - border-top-right-radius:30px; - margin:2px 0 0; - padding:6px 4px 1px; -} -ul.tabs { - list-style-type:none; - margin:0; - padding:0 40px 0 0; -} -ul.tabs li { - display:inline; - margin-left:8px; -} -ul.tabs li a { - background-color:#EAEAEA; - border:1px none #C9C3BA; - border-bottom-left-radius:0; - border-bottom-right-radius:0; - border-top-left-radius:5px; - border-top-right-radius:5px; - color:#42454A; - font-weight:bold; - margin:0; - outline:0; - padding:5px 16px 4px 15px; - text-decoration:none; -} -ul.tabs li a.selected, ul.tabs li a:hover { - background-color:white; - border-bottom-left-radius:0; - border-bottom-right-radius:0; - color:#000000; -} -ul.tabs li a:hover { - background-color:#F1F4EE; -} -ul.tabs li a.selected { - background-color:#525252; - color:white; - font-weight:bold; - padding-bottom:5px; -} -#tabs-body { - overflow:hidden; - position:relative; -} -span.tabContent { - border:2px solid #525252; - margin:0; - padding:0 0 10px; -} -#tabs-body > span { - display:none; -} -#tabs-body > span.active { - display:block; -} -.hide { - display:none; -} -.settable { - border:none; - margin:20px; -} -.settable td { - border:none; - margin:0; - padding:5px; -} -.settable th { - padding-bottom:8px; -} -.settable.wide td, .settable.wide th { - padding-left:15px; - padding-right:15px; -} -ul.nav { - list-style:none; - margin:-30px 0 0; - padding:0; - position:absolute; -} -ul.nav li { - float:left; - padding:5px; - position:relative; -} -ul.nav > li a { - background-color:white; - border-left-color:#C9C3BA; - border-right-color:#C9C3BA; - border-style:solid solid none; - border-top-color:#C9C3BA; - border-width:1px 1px medium; - color:black; -} -ul.nav ul { - -webkit-box-shadow:#AAAAAA 1px 1px 5px; - background-color:#F1F1F1; - border:1px solid #AAAAAA; - box-shadow:#AAAAAA 1px 1px 5px; - cursor:pointer; - left:10px; - list-style:none; - margin:0; - padding:0; - position:absolute; - top:26px; -} -ul.nav .open { - display:block; -} -ul.nav .close { - display:none; -} -ul.nav ul li { - float:none; - padding:0; -} -ul.nav ul li a { - background-color:#F1F1F1; - display:block; - font-weight:normal; - padding:3px; - width:130px; -} -ul.nav ul li a:hover { - background-color:#CDCDCD; -} -ul.nav ul ul { - left:137px; - top:0; -} -.purr-wrapper { - margin:10px; -} -.purr-alert { - background-color:#000000; - border-bottom-left-radius:5px; - border-bottom-right-radius:5px; - border-top-left-radius:5px; - border-top-right-radius:5px; - color:#FFFFFF; - font-size:13px; - font-weight:bold; - margin-bottom:10px; - padding:10px; - width:300px; -} -.purr-alert.error { - background-color:#000000; - background-image:url(../img/error.png); - background-position:7px 10px; - background-repeat:no-repeat no-repeat; - color:#FF5555; - padding-left:30px; - width:280px; -} -.purr-alert.success { - background-color:#000000; - background-image:url(../img/success.png); - background-position:7px 10px; - background-repeat:no-repeat no-repeat; - color:#55FF55; - padding-left:30px; - width:280px; -} -.purr-alert.notice { - background-color:#000000; - background-image:url(../img/notice.png); - background-position:7px 10px; - background-repeat:no-repeat no-repeat; - color:#9999FF; - padding-left:30px; - width:280px; -} -table.system { - border:none; - margin-left:10px; -} -table.system td { - border:none; -} -table.system tr > td:first-child { - font-weight:bold; - padding-right:10px; -} \ No newline at end of file diff --git a/pyload/webui/themes/Flat/css/log.css b/pyload/webui/themes/Flat/css/log.css deleted file mode 100644 index c2f21b506..000000000 --- a/pyload/webui/themes/Flat/css/log.css +++ /dev/null @@ -1,72 +0,0 @@ - -html, body, #content -{ - height: 100%; -} -#body-wrapper -{ - height: 70%; -} -.logdiv -{ - height: 90%; - width: 100%; - overflow: auto; - border: 2px solid #CCC; - outline: 1px solid #666; - background-color: #FFE; - margin-right: auto; - margin-left: auto; -} -.logform -{ - display: table; - margin: 0 auto 0 auto; - padding-top: 5px; -} -.logtable -{ - - margin: 0px; -} -.logtable td -{ - border: none; - white-space: nowrap; - - - font-family: monospace; - font-size: 16px; - margin: 0px; - padding: 0px 10px 0px 10px; - line-height: 110%; -} -td.logline -{ - background-color: #EEE; - text-align:right; - padding: 0px 5px 0px 5px; -} -td.loglevel -{ - text-align:right; -} -.logperpage -{ - float: right; - padding-bottom: 8px; -} -.logpaginator -{ - float: left; - padding-top: 5px; -} -.logpaginator a -{ - padding: 0px 8px 0px 8px; -} -.logwarn -{ - text-align: center; - color: red; -} \ No newline at end of file diff --git a/pyload/webui/themes/Flat/css/pathchooser.css b/pyload/webui/themes/Flat/css/pathchooser.css deleted file mode 100644 index 204812aa1..000000000 --- a/pyload/webui/themes/Flat/css/pathchooser.css +++ /dev/null @@ -1,68 +0,0 @@ -table { - width: 90%; - border: 1px dotted #888888; - font-family: sans-serif; - font-size: 10pt; -} - -th { - background-color: #525252; - color: #E0E0E0; -} - -table, tr, td { - background-color: #F0F0F0; -} - -a, a:visited { - text-decoration: none; - font-weight: bold; -} - -#paths { - width: 90%; - text-align: left; -} - -.file_directory { - color: #c0c0c0; -} -.path_directory { - color: #3c3c3c; -} -.file_file { - color: #3c3c3c; -} -.path_file { - color: #c0c0c0; -} - -.parentdir { - color: #000000; - font-size: 10pt; -} -.name { - text-align: left; -} -.size { - text-align: right; -} -.type { - text-align: left; -} -.mtime { - text-align: center; -} - -.path_abs_rel { - color: #3c3c3c; - text-decoration: none; - font-weight: bold; - font-family: sans-serif; - font-size: 10pt; -} - -.path_abs_rel a { - color: #3c3c3c; - font-style: italic; -} diff --git a/pyload/webui/themes/Flat/css/window.css b/pyload/webui/themes/Flat/css/window.css deleted file mode 100644 index 40c1aadca..000000000 --- a/pyload/webui/themes/Flat/css/window.css +++ /dev/null @@ -1,70 +0,0 @@ -/* ----------- stylized ----------- */ -.window_box h1{ - margin-bottom:8px; -} -.window_box p{ - font-size:11px; - color:#FFFFFF; - margin-bottom:20px; - border-bottom:solid 1px #b7ddf2; - padding-bottom:10px; -} -.window_box label{ - display:block; - font-weight:bold; - text-align:right; - width:240px; - float:left; -} -.window_box .small{ - color:#FFFFFF; - display:block; - font-size:11px; - font-weight:normal; - text-align:right; - width:240px; -} -.window_box select, .window_box input{ - float:left; - font-size:12px; - padding:4px 2px; - width:300px; - margin:2px 0 20px 10px; -} -.window_box .cont{ - float:left; - font-size:12px; - padding: 0px 10px 15px 0px; - width:300px; - margin:0px 0px 0px 10px; - color:#FFFFFF; -} -.window_box .cont input{ - float: none; - margin: 0px 15px 0px 1px; -} -.window_box textarea{ - float:left; - font-size:12px; - padding:4px 2px; - width:300px; - margin:2px 0 20px 10px; -} -.window_box button, .styled_button{ - clear:both; - margin-left:150px; - width:125px; - height:31px; - background:url(../img/button.png) no-repeat; - text-align:center; - line-height:31px; - color:#FFFFFF; - font-size:11px; - font-weight:bold; - border: 0px; -} - -.styled_button { - margin-left: 15px; - cursor: pointer; -} diff --git a/pyload/webui/themes/Flat/img/MooDialog/dialog-close.png b/pyload/webui/themes/Flat/img/MooDialog/dialog-close.png deleted file mode 100644 index 81ebb88b2..000000000 Binary files a/pyload/webui/themes/Flat/img/MooDialog/dialog-close.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/MooDialog/dialog-error.png b/pyload/webui/themes/Flat/img/MooDialog/dialog-error.png deleted file mode 100644 index d70328403..000000000 Binary files a/pyload/webui/themes/Flat/img/MooDialog/dialog-error.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/MooDialog/dialog-question.png b/pyload/webui/themes/Flat/img/MooDialog/dialog-question.png deleted file mode 100644 index b0af3db5b..000000000 Binary files a/pyload/webui/themes/Flat/img/MooDialog/dialog-question.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/MooDialog/dialog-warning.png b/pyload/webui/themes/Flat/img/MooDialog/dialog-warning.png deleted file mode 100644 index aad64d4be..000000000 Binary files a/pyload/webui/themes/Flat/img/MooDialog/dialog-warning.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/arrow_refresh.png b/pyload/webui/themes/Flat/img/arrow_refresh.png deleted file mode 100644 index b1b6fa4dc..000000000 Binary files a/pyload/webui/themes/Flat/img/arrow_refresh.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/arrow_right.png b/pyload/webui/themes/Flat/img/arrow_right.png deleted file mode 100644 index 68f379fc7..000000000 Binary files a/pyload/webui/themes/Flat/img/arrow_right.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/button.png b/pyload/webui/themes/Flat/img/button.png deleted file mode 100644 index bb408a7d6..000000000 Binary files a/pyload/webui/themes/Flat/img/button.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/cog.png b/pyload/webui/themes/Flat/img/cog.png deleted file mode 100644 index 833f779ac..000000000 Binary files a/pyload/webui/themes/Flat/img/cog.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/control_add.png b/pyload/webui/themes/Flat/img/control_add.png deleted file mode 100644 index e3f29fab2..000000000 Binary files a/pyload/webui/themes/Flat/img/control_add.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/control_add_blue.png b/pyload/webui/themes/Flat/img/control_add_blue.png deleted file mode 100644 index e3f29fab2..000000000 Binary files a/pyload/webui/themes/Flat/img/control_add_blue.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/control_cancel.png b/pyload/webui/themes/Flat/img/control_cancel.png deleted file mode 100644 index 07c9cad30..000000000 Binary files a/pyload/webui/themes/Flat/img/control_cancel.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/control_cancel_blue.png b/pyload/webui/themes/Flat/img/control_cancel_blue.png deleted file mode 100644 index 07c9cad30..000000000 Binary files a/pyload/webui/themes/Flat/img/control_cancel_blue.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/control_pause.png b/pyload/webui/themes/Flat/img/control_pause.png deleted file mode 100644 index 24e3705fa..000000000 Binary files a/pyload/webui/themes/Flat/img/control_pause.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/control_pause_blue.png b/pyload/webui/themes/Flat/img/control_pause_blue.png deleted file mode 100644 index 24e3705fa..000000000 Binary files a/pyload/webui/themes/Flat/img/control_pause_blue.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/control_play.png b/pyload/webui/themes/Flat/img/control_play.png deleted file mode 100644 index 15ced1e21..000000000 Binary files a/pyload/webui/themes/Flat/img/control_play.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/control_play_blue.png b/pyload/webui/themes/Flat/img/control_play_blue.png deleted file mode 100644 index 15ced1e21..000000000 Binary files a/pyload/webui/themes/Flat/img/control_play_blue.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/control_stop.png b/pyload/webui/themes/Flat/img/control_stop.png deleted file mode 100644 index 71215ef67..000000000 Binary files a/pyload/webui/themes/Flat/img/control_stop.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/control_stop_blue.png b/pyload/webui/themes/Flat/img/control_stop_blue.png deleted file mode 100644 index 71215ef67..000000000 Binary files a/pyload/webui/themes/Flat/img/control_stop_blue.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/default/add_folder.png b/pyload/webui/themes/Flat/img/default/add_folder.png deleted file mode 100644 index 8acbc411b..000000000 Binary files a/pyload/webui/themes/Flat/img/default/add_folder.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/default/ajax-loader.gif b/pyload/webui/themes/Flat/img/default/ajax-loader.gif deleted file mode 100644 index 2fd8e0737..000000000 Binary files a/pyload/webui/themes/Flat/img/default/ajax-loader.gif and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/default/big_button.gif b/pyload/webui/themes/Flat/img/default/big_button.gif deleted file mode 100644 index 7680490ea..000000000 Binary files a/pyload/webui/themes/Flat/img/default/big_button.gif and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/default/big_button_over.gif b/pyload/webui/themes/Flat/img/default/big_button_over.gif deleted file mode 100644 index 2e3ee10d2..000000000 Binary files a/pyload/webui/themes/Flat/img/default/big_button_over.gif and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/default/body.png b/pyload/webui/themes/Flat/img/default/body.png deleted file mode 100644 index 7ff1043e0..000000000 Binary files a/pyload/webui/themes/Flat/img/default/body.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/default/closebtn.gif b/pyload/webui/themes/Flat/img/default/closebtn.gif deleted file mode 100644 index 3e27e6030..000000000 Binary files a/pyload/webui/themes/Flat/img/default/closebtn.gif and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/default/drag_corner.gif b/pyload/webui/themes/Flat/img/default/drag_corner.gif deleted file mode 100644 index befb1adf1..000000000 Binary files a/pyload/webui/themes/Flat/img/default/drag_corner.gif and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/default/full.png b/pyload/webui/themes/Flat/img/default/full.png deleted file mode 100644 index fea52af76..000000000 Binary files a/pyload/webui/themes/Flat/img/default/full.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/default/head-menu-recent.png b/pyload/webui/themes/Flat/img/default/head-menu-recent.png deleted file mode 100644 index fc9b0497f..000000000 Binary files a/pyload/webui/themes/Flat/img/default/head-menu-recent.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/default/head_bg1.png b/pyload/webui/themes/Flat/img/default/head_bg1.png deleted file mode 100644 index f2848c3cc..000000000 Binary files a/pyload/webui/themes/Flat/img/default/head_bg1.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/default/images.png b/pyload/webui/themes/Flat/img/default/images.png deleted file mode 100644 index 184860d1e..000000000 Binary files a/pyload/webui/themes/Flat/img/default/images.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/default/parseUri.png b/pyload/webui/themes/Flat/img/default/parseUri.png deleted file mode 100644 index 937bded9d..000000000 Binary files a/pyload/webui/themes/Flat/img/default/parseUri.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/default/pyload-logo.png b/pyload/webui/themes/Flat/img/default/pyload-logo.png deleted file mode 100644 index 2443cd8b1..000000000 Binary files a/pyload/webui/themes/Flat/img/default/pyload-logo.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/default/tab-background.png b/pyload/webui/themes/Flat/img/default/tab-background.png deleted file mode 100644 index 29a5d1991..000000000 Binary files a/pyload/webui/themes/Flat/img/default/tab-background.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/default/tabs-border-bottom.png b/pyload/webui/themes/Flat/img/default/tabs-border-bottom.png deleted file mode 100644 index 02440f428..000000000 Binary files a/pyload/webui/themes/Flat/img/default/tabs-border-bottom.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/delete.png b/pyload/webui/themes/Flat/img/delete.png deleted file mode 100644 index 4539cff12..000000000 Binary files a/pyload/webui/themes/Flat/img/delete.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/error.png b/pyload/webui/themes/Flat/img/error.png deleted file mode 100644 index 6c565c99c..000000000 Binary files a/pyload/webui/themes/Flat/img/error.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/folder.png b/pyload/webui/themes/Flat/img/folder.png deleted file mode 100644 index 0b067dd3c..000000000 Binary files a/pyload/webui/themes/Flat/img/folder.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/head-login.png b/pyload/webui/themes/Flat/img/head-login.png deleted file mode 100644 index 6b57515bc..000000000 Binary files a/pyload/webui/themes/Flat/img/head-login.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/head-menu-collector.png b/pyload/webui/themes/Flat/img/head-menu-collector.png deleted file mode 100644 index bbcbe6406..000000000 Binary files a/pyload/webui/themes/Flat/img/head-menu-collector.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/head-menu-config.png b/pyload/webui/themes/Flat/img/head-menu-config.png deleted file mode 100644 index 93e8f83ac..000000000 Binary files a/pyload/webui/themes/Flat/img/head-menu-config.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/head-menu-development.png b/pyload/webui/themes/Flat/img/head-menu-development.png deleted file mode 100644 index 33d8b062f..000000000 Binary files a/pyload/webui/themes/Flat/img/head-menu-development.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/head-menu-download.png b/pyload/webui/themes/Flat/img/head-menu-download.png deleted file mode 100644 index 3691deebc..000000000 Binary files a/pyload/webui/themes/Flat/img/head-menu-download.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/head-menu-home.png b/pyload/webui/themes/Flat/img/head-menu-home.png deleted file mode 100644 index b77bef5eb..000000000 Binary files a/pyload/webui/themes/Flat/img/head-menu-home.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/head-menu-index.png b/pyload/webui/themes/Flat/img/head-menu-index.png deleted file mode 100644 index 8bc6e9604..000000000 Binary files a/pyload/webui/themes/Flat/img/head-menu-index.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/head-menu-news.png b/pyload/webui/themes/Flat/img/head-menu-news.png deleted file mode 100644 index 44e79a9a9..000000000 Binary files a/pyload/webui/themes/Flat/img/head-menu-news.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/head-menu-queue.png b/pyload/webui/themes/Flat/img/head-menu-queue.png deleted file mode 100644 index e4fa41ad8..000000000 Binary files a/pyload/webui/themes/Flat/img/head-menu-queue.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/head-menu-wiki.png b/pyload/webui/themes/Flat/img/head-menu-wiki.png deleted file mode 100644 index 61b0e54ea..000000000 Binary files a/pyload/webui/themes/Flat/img/head-menu-wiki.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/head-search-noshadow.png b/pyload/webui/themes/Flat/img/head-search-noshadow.png deleted file mode 100644 index 16d39bd06..000000000 Binary files a/pyload/webui/themes/Flat/img/head-search-noshadow.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/notice.png b/pyload/webui/themes/Flat/img/notice.png deleted file mode 100644 index a52b067cb..000000000 Binary files a/pyload/webui/themes/Flat/img/notice.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/package_go.png b/pyload/webui/themes/Flat/img/package_go.png deleted file mode 100644 index 80b2c42ee..000000000 Binary files a/pyload/webui/themes/Flat/img/package_go.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/page-tools-backlinks.png b/pyload/webui/themes/Flat/img/page-tools-backlinks.png deleted file mode 100644 index fb8f55b38..000000000 Binary files a/pyload/webui/themes/Flat/img/page-tools-backlinks.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/page-tools-edit.png b/pyload/webui/themes/Flat/img/page-tools-edit.png deleted file mode 100644 index 67177cf89..000000000 Binary files a/pyload/webui/themes/Flat/img/page-tools-edit.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/page-tools-revisions.png b/pyload/webui/themes/Flat/img/page-tools-revisions.png deleted file mode 100644 index 088fe0087..000000000 Binary files a/pyload/webui/themes/Flat/img/page-tools-revisions.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/pencil.png b/pyload/webui/themes/Flat/img/pencil.png deleted file mode 100644 index e39c93cd8..000000000 Binary files a/pyload/webui/themes/Flat/img/pencil.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/reconnect.png b/pyload/webui/themes/Flat/img/reconnect.png deleted file mode 100644 index cd35c9325..000000000 Binary files a/pyload/webui/themes/Flat/img/reconnect.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/status_None.png b/pyload/webui/themes/Flat/img/status_None.png deleted file mode 100644 index 1400d3eb3..000000000 Binary files a/pyload/webui/themes/Flat/img/status_None.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/status_downloading.png b/pyload/webui/themes/Flat/img/status_downloading.png deleted file mode 100644 index db8ad8cd6..000000000 Binary files a/pyload/webui/themes/Flat/img/status_downloading.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/status_failed.png b/pyload/webui/themes/Flat/img/status_failed.png deleted file mode 100644 index 6c565c99c..000000000 Binary files a/pyload/webui/themes/Flat/img/status_failed.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/status_finished.png b/pyload/webui/themes/Flat/img/status_finished.png deleted file mode 100644 index 2c4aca40d..000000000 Binary files a/pyload/webui/themes/Flat/img/status_finished.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/status_offline.png b/pyload/webui/themes/Flat/img/status_offline.png deleted file mode 100644 index 6c565c99c..000000000 Binary files a/pyload/webui/themes/Flat/img/status_offline.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/status_proc.png b/pyload/webui/themes/Flat/img/status_proc.png deleted file mode 100644 index 833f779ac..000000000 Binary files a/pyload/webui/themes/Flat/img/status_proc.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/status_queue.png b/pyload/webui/themes/Flat/img/status_queue.png deleted file mode 100644 index 1400d3eb3..000000000 Binary files a/pyload/webui/themes/Flat/img/status_queue.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/status_waiting.png b/pyload/webui/themes/Flat/img/status_waiting.png deleted file mode 100644 index fd038175e..000000000 Binary files a/pyload/webui/themes/Flat/img/status_waiting.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/success.png b/pyload/webui/themes/Flat/img/success.png deleted file mode 100644 index 2c4aca40d..000000000 Binary files a/pyload/webui/themes/Flat/img/success.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/user-actions-logout.png b/pyload/webui/themes/Flat/img/user-actions-logout.png deleted file mode 100644 index d4ef360e8..000000000 Binary files a/pyload/webui/themes/Flat/img/user-actions-logout.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/user-actions-profile.png b/pyload/webui/themes/Flat/img/user-actions-profile.png deleted file mode 100644 index 9ec410b13..000000000 Binary files a/pyload/webui/themes/Flat/img/user-actions-profile.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/img/user-info.png b/pyload/webui/themes/Flat/img/user-info.png deleted file mode 100644 index 345ed52e4..000000000 Binary files a/pyload/webui/themes/Flat/img/user-info.png and /dev/null differ diff --git a/pyload/webui/themes/Flat/js/render/admin.coffee b/pyload/webui/themes/Flat/js/render/admin.coffee deleted file mode 100644 index 5afbcbb66..000000000 --- a/pyload/webui/themes/Flat/js/render/admin.coffee +++ /dev/null @@ -1,58 +0,0 @@ -root = this - -window.addEvent "domready", -> - - root.passwordDialog = new MooDialog {destroyOnHide: false} - root.passwordDialog.setContent $ 'password_box' - - $("login_password_reset").addEvent "click", (e) -> root.passwordDialog.close() - $("login_password_button").addEvent "click", (e) -> - - newpw = $("login_new_password").get("value") - newpw2 = $("login_new_password2").get("value") - - if newpw is newpw2 - form = $("password_form") - form.set "send", { - onSuccess: (data) -> - root.notify.alert "Success", { - 'className': 'success' - } - onFailure: (data) -> - root.notify.alert "Error", { - 'className': 'error' - } - } - - form.send() - - root.passwordDialog.close() - else - alert '{{_("Passwords did not match.")}}' - - e.stop() - - for item in $$(".change_password") - id = item.get("id") - user = id.split("|")[1] - $("user_login").set("value", user) - item.addEvent "click", (e) -> root.passwordDialog.open() - - $('quit-pyload').addEvent "click", (e) -> - new MooDialog.Confirm "{{_('You are really sure you want to quit pyLoad?')}}", -> - new Request.JSON({ - url: '/api/kill' - method: 'get' - }).send() - , -> - e.stop() - - $('restart-pyload').addEvent "click", (e) -> - new MooDialog.Confirm "{{_('Are you sure you want to restart pyLoad?')}}", -> - new Request.JSON({ - url: '/api/restart' - method: 'get' - onSuccess: (data) -> alert "{{_('pyLoad restarted')}}" - }).send() - , -> - e.stop() diff --git a/pyload/webui/themes/Flat/js/render/admin.min.js b/pyload/webui/themes/Flat/js/render/admin.min.js deleted file mode 100644 index 94a5e494d..000000000 --- a/pyload/webui/themes/Flat/js/render/admin.min.js +++ /dev/null @@ -1,3 +0,0 @@ -{% autoescape true %} -var root;root=this;window.addEvent("domready",function(){var f,c,b,e,a,d;root.passwordDialog=new MooDialog({destroyOnHide:false});root.passwordDialog.setContent($("password_box"));$("login_password_reset").addEvent("click",function(g){return root.passwordDialog.close()});$("login_password_button").addEvent("click",function(j){var h,i,g;i=$("login_new_password").get("value");g=$("login_new_password2").get("value");if(i===g){h=$("password_form");h.set("send",{onSuccess:function(k){return root.notify.alert("Success",{className:"success"})},onFailure:function(k){return root.notify.alert("Error",{className:"error"})}});h.send();root.passwordDialog.close()}else{alert('{{_("Passwords did not match.")}}')}return j.stop()});d=$$(".change_password");for(e=0,a=d.length;e - filesizename = new Array("B", "KiB", "MiB", "GiB", "TiB", "PiB") - loga = Math.log(size) / Math.log(1024) - i = Math.floor(loga) - a = Math.pow(1024, i) - if size is 0 then "0 B" else (Math.round(size * 100 / a) / 100 + " " + filesizename[i]) - - -parseUri = () -> - oldString = $("add_links").value - regxp = new RegExp('(ht|f)tp(s?):\/\/[a-zA-Z0-9\-\.\/\?=_&%#]+[<| |\"|\'|\r|\n|\t]{1}', 'g') - resu = oldString.match regxp - return if resu == null - res = "" - - for part in resu - if part.indexOf(" ") != -1 - res = res + part.replace(" ", " \n") - else if part.indexOf("\t") != -1 - res = res + part.replace("\t", " \n") - else if part.indexOf("\r") != -1 - res = res + part.replace("\r", " \n") - else if part.indexOf("\"") != -1 - res = res + part.replace("\"", " \n") - else if part.indexOf("<") != -1 - res = res + part.replace("<", " \n") - else if part.indexOf("'") != -1 - res = res + part.replace("'", " \n") - else - res = res + part.replace("\n", " \n") - - $("add_links").value = res - - -Array::remove = (from, to) -> - rest = this.slice((to || from) + 1 || this.length) - this.length = from < 0 ? this.length + from : from - return [] if this.length == 0 - return this.push.apply(this, rest) - - -document.addEvent "domready", -> - - # global notification - root.notify = new Purr { - 'mode': 'top' - 'position': 'center' - } - - root.captchaBox = new MooDialog {destroyOnHide: false} - root.captchaBox.setContent $ 'cap_box' - - root.addBox = new MooDialog {destroyOnHide: false} - root.addBox.setContent $ 'add_box' - - $('add_form').onsubmit = -> - $('add_form').target = 'upload_target' - if $('add_name').value is "" and $('add_file').value is "" - alert '{{_("Please Enter a packagename.")}}' - return false - else - root.addBox.close() - return true - - $('add_reset').addEvent 'click', -> root.addBox.close() - - $('action_add').addEvent 'click', -> $("add_form").reset(); root.addBox.open() - $('action_play').addEvent 'click', -> new Request({method: 'get', url: '/api/unpauseServer'}).send() - $('action_cancel').addEvent 'click', -> new Request({method: 'get', url: '/api/stopAllDownloads'}).send() - $('action_stop').addEvent 'click', -> new Request({method: 'get', url: '/api/pauseServer'}).send() - - - # captcha events - - $('cap_info').addEvent 'click', -> - load_captcha "get", "" - root.captchaBox.open() - $('cap_reset').addEvent 'click', -> root.captchaBox.close() - $('cap_form').addEvent 'submit', (e) -> - submit_captcha() - e.stop() - - $('cap_positional').addEvent 'click', on_captcha_click - - new Request.JSON({ - url: "/json/status" - onSuccess: LoadJsonToContent - secure: false - async: true - initialDelay: 0 - delay: 4000 - limit: 3000 - }).startTimer() - - -LoadJsonToContent = (data) -> - $("speed").set 'text', humanFileSize(data.speed)+"/s" - $("aktiv").set 'text', data.active - $("aktiv_from").set 'text', data.queue - $("aktiv_total").set 'text', data.total - - if data.captcha - if $("cap_info").getStyle("display") != "inline" - $("cap_info").setStyle 'display', 'inline' - root.notify.alert '{{_("New Captcha Request")}}', { - 'className': 'notify' - } - else - $("cap_info").setStyle 'display', 'none' - - - if data.download - $("time").set 'text', ' {{_("on")}}' - $("time").setStyle 'background-color', "#8ffc25" - else - $("time").set 'text', ' {{_("off")}}' - $("time").setStyle 'background-color', "#fc6e26" - - if data.reconnect - $("reconnect").set 'text', ' {{_("on")}}' - $("reconnect").setStyle 'background-color', "#8ffc25" - else - $("reconnect").set 'text', ' {{_("off")}}' - $("reconnect").setStyle 'background-color', "#fc6e26" - - return null - - -set_captcha = (data) -> - $('cap_id').set 'value', data.id - if (data.result_type is 'textual') - $('cap_textual_img').set 'src', data.src - $('cap_title').set 'text', '{{_("Please read the text on the captcha.")}}' - $('cap_submit').setStyle 'display', 'inline' - $('cap_textual').setStyle 'display', 'block' - $('cap_positional').setStyle 'display', 'none' - - else if (data.result_type == 'positional') - $('cap_positional_img').set('src', data.src) - $('cap_title').set('text', '{{_("Please click on the right captcha position.")}}') - $('cap_submit').setStyle('display', 'none') - $('cap_textual').setStyle('display', 'none') - - -load_captcha = (method, post) -> - new Request.JSON({ - url: "/json/set_captcha" - onSuccess: (data) -> set_captcha(data) if data.captcha else clear_captcha() - secure: false - async: true - method: method - }).send(post) - - -clear_captcha = -> - $('cap_textual').setStyle 'display', 'none' - $('cap_textual_img').set 'src', '' - $('cap_positional').setStyle 'display', 'none' - $('cap_positional_img').set 'src', '' - $('cap_title').set 'text', '{{_("No Captchas to read.")}}' - - -submit_captcha = -> - load_captcha("post", "cap_id=" + $('cap_id').get('value') + "&cap_result=" + $('cap_result').get('value') ) - $('cap_result').set('value', '') - - -on_captcha_click = (e) -> - position = e.target.getPosition() - x = e.page.x - position.x - y = e.page.y - position.y - $('cap_result').value = x + "," + y - submit_captcha() diff --git a/pyload/webui/themes/Flat/js/render/base.min.js b/pyload/webui/themes/Flat/js/render/base.min.js deleted file mode 100644 index 1ba1d73f9..000000000 --- a/pyload/webui/themes/Flat/js/render/base.min.js +++ /dev/null @@ -1,3 +0,0 @@ -{% autoescape true %} -var LoadJsonToContent,clear_captcha,humanFileSize,load_captcha,on_captcha_click,parseUri,root,set_captcha,submit_captcha;root=this;humanFileSize=function(f){var c,d,e,b;d=new Array("B","KiB","MiB","GiB","TiB","PiB");b=Math.log(f)/Math.log(1024);e=Math.floor(b);c=Math.pow(1024,e);if(f===0){return"0 B"}else{return Math.round(f*100/c)/100+" "+d[e]}};parseUri=function(){var b,c,g,e,d,f,a;b=$("add_links").value;g=new RegExp("(ht|f)tp(s?)://[a-zA-Z0-9-./?=_&%#]+[<| |\"|'|\r|\n|\t]{1}","g");d=b.match(g);if(d===null){return}e="";for(f=0,a=d.length;f 0) - { - uls[0].getChildren("li.folder").each(function(fld) { - var path = fld.getElements("input.path")[0].get("value"); - var name = fld.getElements("input.name")[0].get("value"); - this.directories.push(new Item(this, path, name, fld)); - }.bind(this)); - uls[0].getChildren("li.file").each(function(fld) { - var path = fld.getElements("input.path")[0].get("value"); - var name = fld.getElements("input.name")[0].get("value"); - this.files.push(new Item(this, path, name, fld)); - }.bind(this)); - } - }, - - reorderElements: function() { - //TODO sort the main ul again (to keep data ordered after renaming something) - }, - - del: function(event) { - $("confirm_form").removeEvents("submit"); - $("confirm_form").addEvent("submit", this.deleteDirectory.bind(this)); - - $$("#confirm_form p").set('html', '{{_(("Are you sure you want to delete the selected item?"))}}'); - - show_confirm_box(); - event.stop(); - }, - - deleteDirectory: function(event) { - hide_confirm_box(); - new Request.JSON({ - method: 'POST', - url: "/json/filemanager/delete", - data: {'path': this.path, 'name': this.name}, - onSuccess: function(data) { - if(data.response == "success") - { - new Fx.Tween(this.ele).start('opacity', 0); - var ul = this.ele.parentNode; - this.ele.dispose(); - //if this was the only child, add a "empty folder" div - if(!ul.getChildren('li')[0]) - { - var div = new Element("div", { 'html': '{{ _("Folder is empty") }}' }); - div.replaces(ul); - } - - indicateSuccess(); - } else - { - //error from json code... - indicateFail(); - } - }.bind(this), - onFailure: indicateFail - }).send(); - - event.stop(); - }, - - rename: function(event) { - $("rename_form").removeEvents("submit"); - $("rename_form").addEvent("submit", this.renameDirectory.bind(this)); - - $("path").set("value", this.path); - $("old_name").set("value", this.name); - $("new_name").set("value", this.name); - - show_rename_box(); - event.stop(); - }, - - renameDirectory: function(event) { - hide_rename_box(); - new Request.JSON({ - method: 'POST', - url: "/json/filemanager/rename", - onSuccess: function(data) { - if(data.response == "success") - { - this.name = $("new_name").get("value"); - this.ele.getElements("b")[0].set('html', $("new_name").get("value")); - this.reorderElements(); - indicateSuccess(); - } else - { - //error from json code... - indicateFail(); - } - }.bind(this), - onFailure: indicateFail - }).send($("rename_form").toQueryString()); - - event.stop(); - }, - - mkdir: function(event) { - new Request.JSON({ - method: 'POST', - url: "/json/filemanager/mkdir", - data: {'path': this.path + "/" + this.name, 'name': '{{_("New folder")}}'}, - onSuccess: function(data) { - if(data.response == "success") - { - new Request.HTML({ - method: 'POST', - url: "/filemanager/get_dir", - data: {'path': data.path, 'name': data.name}, - onSuccess: function(li) { - //add node as first child of ul - var ul = this.ele.getChildren('ul')[0]; - if(!ul) - { - //remove the "Folder Empty" div - this.ele.getChildren('div').dispose(); - - //create new ul to contain subfolder - ul = new Element("ul"); - ul.inject(this.ele, 'bottom'); - } - li[0].inject(ul, 'top'); - - //add directory as a subdirectory of the current item - this.directories.push(new Item(this.ui, data.path, data.name, ul.firstChild)); - }.bind(this), - onFailure: indicateFail - }).send(); - indicateSuccess(); - } else - { - //error from json code... - indicateFail(); - } - }.bind(this), - onFailure: indicateFail - }).send(); - - event.stop(); - }, - - toggle: function() { - var child = this.ele.getElement('ul'); - if(child == null) - child = this.ele.getElement('div'); - - if(child != null) - { - if (child.getStyle('display') == "block") { - child.dissolve(); - } else { - child.reveal(); - } - } - } -}); diff --git a/pyload/webui/themes/Flat/js/render/package.js b/pyload/webui/themes/Flat/js/render/package.js deleted file mode 100644 index 659a8e6fc..000000000 --- a/pyload/webui/themes/Flat/js/render/package.js +++ /dev/null @@ -1,376 +0,0 @@ -var root = this; - -document.addEvent("domready", function() { - root.load = new Fx.Tween($("load-indicator"), {link: "cancel"}); - root.load.set("opacity", 0); - - - root.packageBox = new MooDialog({destroyOnHide: false}); - root.packageBox.setContent($('pack_box')); - - $('pack_reset').addEvent('click', function() { - $('pack_form').reset(); - root.packageBox.close(); - }); -}); - -function indicateLoad() { - //$("load-indicator").reveal(); - root.load.start("opacity", 1) -} - -function indicateFinish() { - root.load.start("opacity", 0) -} - -function indicateSuccess() { - indicateFinish(); - root.notify.alert('{{_("Success")}}.', { - 'className': 'success' - }); -} - -function indicateFail() { - indicateFinish(); - root.notify.alert('{{_("Failed")}}.', { - 'className': 'error' - }); -} - -var PackageUI = new Class({ - initialize: function(url, type) { - this.url = url; - this.type = type; - this.packages = []; - this.parsePackages(); - - this.sorts = new Sortables($("package-list"), { - constrain: false, - clone: true, - revert: true, - opacity: 0.4, - handle: ".package_drag", - onComplete: this.saveSort.bind(this) - }); - - $("del_finished").addEvent("click", this.deleteFinished.bind(this)); - $("restart_failed").addEvent("click", this.restartFailed.bind(this)); - - }, - - parsePackages: function() { - $("package-list").getChildren("li").each(function(ele) { - var id = ele.getFirst().get("id").match(/[0-9]+/); - this.packages.push(new Package(this, id, ele)) - }.bind(this)) - }, - - loadPackages: function() { - }, - - deleteFinished: function() { - indicateLoad(); - new Request.JSON({ - method: 'get', - url: '/api/deleteFinished', - onSuccess: function(data) { - if (data.length > 0) { - window.location.reload() - } else { - this.packages.each(function(pack) { - pack.close(); - }); - indicateSuccess(); - } - }.bind(this), - onFailure: indicateFail - }).send(); - }, - - restartFailed: function() { - indicateLoad(); - new Request.JSON({ - method: 'get', - url: '/api/restartFailed', - onSuccess: function(data) { - this.packages.each(function(pack) { - pack.close(); - }); - indicateSuccess(); - }.bind(this), - onFailure: indicateFail - }).send(); - }, - - startSort: function(ele, copy) { - }, - - saveSort: function(ele, copy) { - var order = []; - this.sorts.serialize(function(li, pos) { - if (li == ele && ele.retrieve("order") != pos) { - order.push(ele.retrieve("pid") + "|" + pos) - } - li.store("order", pos) - }); - if (order.length > 0) { - indicateLoad(); - new Request.JSON({ - method: 'get', - url: '/json/package_order/' + order[0], - onSuccess: indicateFinish, - onFailure: indicateFail - }).send(); - } - } - -}); - -var Package = new Class({ - initialize: function(ui, id, ele, data) { - this.ui = ui; - this.id = id; - this.linksLoaded = false; - - if (!ele) { - this.createElement(data); - } else { - this.ele = ele; - this.order = ele.getElements("div.order")[0].get("html"); - this.ele.store("order", this.order); - this.ele.store("pid", this.id); - this.parseElement(); - } - - var pname = this.ele.getElements(".packagename")[0]; - this.buttons = new Fx.Tween(this.ele.getElements(".buttons")[0], {link: "cancel"}); - this.buttons.set("opacity", 0); - - pname.addEvent("mouseenter", function(e) { - this.buttons.start("opacity", 1) - }.bind(this)); - - pname.addEvent("mouseleave", function(e) { - this.buttons.start("opacity", 0) - }.bind(this)); - - - }, - - createElement: function() { - alert("create") - }, - - parseElement: function() { - var imgs = this.ele.getElements('img'); - - this.name = this.ele.getElements('.name')[0]; - this.folder = this.ele.getElements('.folder')[0]; - this.password = this.ele.getElements('.password')[0]; - - imgs[1].addEvent('click', this.deletePackage.bind(this)); - imgs[2].addEvent('click', this.restartPackage.bind(this)); - imgs[3].addEvent('click', this.editPackage.bind(this)); - imgs[4].addEvent('click', this.movePackage.bind(this)); - - this.ele.getElement('.packagename').addEvent('click', this.toggle.bind(this)); - - }, - - loadLinks: function() { - indicateLoad(); - new Request.JSON({ - method: 'get', - url: '/json/package/' + this.id, - onSuccess: this.createLinks.bind(this), - onFailure: indicateFail - }).send(); - }, - - createLinks: function(data) { - var ul = $("sort_children_{id}".substitute({'id': this.id})); - ul.set("html", ""); - data.links.each(function(link) { - link.id = link.fid; - var li = new Element("li", { - 'style': { - 'margin-left': 0 - } - }); - - var html = "\n".substitute({'icon': link.icon}); - html += "{name}
        ".substitute({'url': link.url, 'name': link.name}); - html += "{statusmsg}{error} ".substitute({'statusmsg': link.statusmsg, 'error':link.error}); - html += "{format_size}".substitute({'format_size': link.format_size}); - html += "{plugin}  ".substitute({'plugin': link.plugin}); - html += "  "; - html += "
        "; - - var div = new Element("div", { - 'id': "file_" + link.id, - 'class': "child", - 'html': html - }); - - li.store("order", link.order); - li.store("lid", link.id); - - li.adopt(div); - ul.adopt(li); - }); - this.sorts = new Sortables(ul, { - constrain: false, - clone: true, - revert: true, - opacity: 0.4, - handle: ".sorthandle", - onComplete: this.saveSort.bind(this) - }); - this.registerLinkEvents(); - this.linksLoaded = true; - indicateFinish(); - this.toggle(); - }, - - registerLinkEvents: function() { - this.ele.getElements('.child').each(function(child) { - var lid = child.get('id').match(/[0-9]+/); - var imgs = child.getElements('.child_secrow img'); - imgs[0].addEvent('click', function(e) { - new Request({ - method: 'get', - url: '/api/deleteFiles/[' + this + "]", - onSuccess: function() { - $('file_' + this).nix() - }.bind(this), - onFailure: indicateFail - }).send(); - }.bind(lid)); - - imgs[1].addEvent('click', function(e) { - new Request({ - method: 'get', - url: '/api/restartFile/' + this, - onSuccess: function() { - var ele = $('file_' + this); - var imgs = ele.getElements("img"); - imgs[0].set("src", "../img/status_queue.png"); - var spans = ele.getElements(".child_status"); - spans[1].set("html", "queued"); - indicateSuccess(); - }.bind(this), - onFailure: indicateFail - }).send(); - }.bind(lid)); - }); - }, - - toggle: function() { - var child = this.ele.getElement('.children'); - if (child.getStyle('display') == "block") { - child.dissolve(); - } else { - if (!this.linksLoaded) { - this.loadLinks(); - } else { - child.reveal(); - } - } - }, - - - deletePackage: function(event) { - indicateLoad(); - new Request({ - method: 'get', - url: '/api/deletePackages/[' + this.id + "]", - onSuccess: function() { - this.ele.nix(); - indicateFinish(); - }.bind(this), - onFailure: indicateFail - }).send(); - //hide_pack(); - event.stop(); - }, - - restartPackage: function(event) { - indicateLoad(); - new Request({ - method: 'get', - url: '/api/restartPackage/' + this.id, - onSuccess: function() { - this.close(); - indicateSuccess(); - }.bind(this), - onFailure: indicateFail - }).send(); - event.stop(); - }, - - close: function() { - var child = this.ele.getElement('.children'); - if (child.getStyle('display') == "block") { - child.dissolve(); - } - var ul = $("sort_children_{id}".substitute({'id': this.id})); - ul.erase("html"); - this.linksLoaded = false; - }, - - movePackage: function(event) { - indicateLoad(); - new Request({ - method: 'get', - url: '/json/move_package/' + ((this.ui.type + 1) % 2) + "/" + this.id, - onSuccess: function() { - this.ele.nix(); - indicateFinish(); - }.bind(this), - onFailure: indicateFail - }).send(); - event.stop(); - }, - - editPackage: function(event) { - $("pack_form").removeEvents("submit"); - $("pack_form").addEvent("submit", this.savePackage.bind(this)); - - $("pack_id").set("value", this.id); - $("pack_name").set("value", this.name.get("text")); - $("pack_folder").set("value", this.folder.get("text")); - $("pack_pws").set("value", this.password.get("text")); - - root.packageBox.open(); - event.stop(); - }, - - savePackage: function(event) { - $("pack_form").send(); - this.name.set("text", $("pack_name").get("value")); - this.folder.set("text", $("pack_folder").get("value")); - this.password.set("text", $("pack_pws").get("value")); - root.packageBox.close(); - event.stop(); - }, - - saveSort: function(ele, copy) { - var order = []; - this.sorts.serialize(function(li, pos) { - if (li == ele && ele.retrieve("order") != pos) { - order.push(ele.retrieve("lid") + "|" + pos) - } - li.store("order", pos) - }); - if (order.length > 0) { - indicateLoad(); - new Request.JSON({ - method: 'get', - url: '/json/link_order/' + order[0], - onSuccess: indicateFinish, - onFailure: indicateFail - }).send(); - } - } - -}); diff --git a/pyload/webui/themes/Flat/js/render/settings.coffee b/pyload/webui/themes/Flat/js/render/settings.coffee deleted file mode 100644 index d522741b9..000000000 --- a/pyload/webui/themes/Flat/js/render/settings.coffee +++ /dev/null @@ -1,107 +0,0 @@ -root = this - -window.addEvent 'domready', -> - root.accountDialog = new MooDialog {destroyOnHide: false} - root.accountDialog.setContent $ 'account_box' - - new TinyTab $$('#toptabs li a'), $$('#tabs-body > span') - - $$('ul.nav').each (nav) -> - new MooDropMenu nav, { - onOpen: (el) -> el.fade 'in' - onClose: (el) -> el.fade 'out' - onInitialize: (el) -> el.fade('hide').set 'tween', {duration:500} - } - - new SettingsUI() - - -class SettingsUI - constructor: -> - @menu = $$ "#general-menu li" - @menu.append $$ "#plugin-menu li" - - @name = $ "tabsback" - @general = $ "general_form_content" - @plugin = $ "plugin_form_content" - - el.addEvent 'click', @menuClick.bind(this) for el in @menu - - $("general|submit").addEvent "click", @configSubmit.bind(this) - $("plugin|submit").addEvent "click", @configSubmit.bind(this) - - $("account_add").addEvent "click", (e) -> - root.accountDialog.open() - e.stop() - - $("account_reset").addEvent "click", (e) -> - root.accountDialog.close() - - $("account_add_button").addEvent "click", @addAccount.bind(this) - $("account_submit").addEvent "click", @submitAccounts.bind(this) - - - menuClick: (e) -> - [category, section] = e.target.get("id").split("|") - name = e.target.get "text" - - - target = if category is "general" then @general else @plugin - target.dissolve() - - new Request({ - "method" : "get" - "url" : "/json/load_config/#{category}/#{section}" - 'onSuccess': (data) => - target.set "html", data - target.reveal() - this.name.set "text", name - }).send() - - - configSubmit: (e) -> - category = e.target.get("id").split("|")[0] - form = $("#{category}_form") - - form.set "send", { - 'method': "post" - 'url': "/json/save_config/#{category}" - "onSuccess" : -> - root.notify.alert '{{ _("Settings saved.")}}', { - 'className': 'success' - } - 'onFailure': -> - root.notify.alert '{{ _("Error occured.")}}', { - 'className': 'error' - } - } - form.send() - e.stop() - - addAccount: (e) -> - form = $ "add_account_form" - form.set "send", { - 'method': "post" - "onSuccess" : -> window.location.reload() - 'onFailure': -> - root.notify.alert '{{_("Error occured.")}}', { - 'className': 'error' - } - } - - form.send() - e.stop() - - submitAccounts: (e) -> - form = $ "account_form" - form.set "send", { - 'method': "post", - "onSuccess" : -> window.location.reload() - 'onFailure': -> - root.notify.alert('{{ _("Error occured.") }}', { - 'className': 'error' - }) - } - - form.send() - e.stop() diff --git a/pyload/webui/themes/Flat/js/render/settings.min.js b/pyload/webui/themes/Flat/js/render/settings.min.js deleted file mode 100644 index 41d1cb25a..000000000 --- a/pyload/webui/themes/Flat/js/render/settings.min.js +++ /dev/null @@ -1,3 +0,0 @@ -{% autoescape true %} -var SettingsUI,root;var __bind=function(a,b){return function(){return a.apply(b,arguments)}};root=this;window.addEvent("domready",function(){root.accountDialog=new MooDialog({destroyOnHide:false});root.accountDialog.setContent($("account_box"));new TinyTab($$("#toptabs li a"),$$("#tabs-body > span"));$$("ul.nav").each(function(a){return new MooDropMenu(a,{onOpen:function(b){return b.fade("in")},onClose:function(b){return b.fade("out")},onInitialize:function(b){return b.fade("hide").set("tween",{duration:500})}})});return new SettingsUI()});SettingsUI=(function(){function a(){var c,e,b,d;this.menu=$$("#general-menu li");this.menu.append($$("#plugin-menu li"));this.name=$("tabsback");this.general=$("general_form_content");this.plugin=$("plugin_form_content");d=this.menu;for(e=0,b=d.length;e*/// IE 6 scroll - if ((options.scroll && Browser.ie6) || options.forceScroll){ - wrapper.setStyle('position', 'absolute'); - var position = wrapper.getPosition(options.inject); - window.addEvent('scroll', function(){ - var scroll = document.getScroll(); - wrapper.setPosition({ - x: position.x + scroll.x, - y: position.y + scroll.y - }); - }); - } - /**/ - - if (options.useEscKey){ - // Add event for the esc key - document.addEvent('keydown', function(e){ - if (e.key == 'esc') this.close(); - }.bind(this)); - } - - this.addEvent('hide', function(){ - if (options.destroyOnHide) this.destroy(); - }.bind(this)); - - this.fireEvent('initialize', wrapper); - }, - - setContent: function(){ - var content = Array.from(arguments); - if (content.length == 1) content = content[0]; - - this.content.empty(); - - var type = typeOf(content); - if (['string', 'number'].contains(type)) this.content.set('text', content); - else this.content.adopt(content); - - this.fireEvent('contentChange', this.content); - - return this; - }, - - open: function(){ - this.fireEvent('beforeOpen', this.wrapper).fireEvent('open'); - this.opened = true; - return this; - }, - - close: function(){ - this.fireEvent('beforeClose', this.wrapper).fireEvent('close'); - this.opened = false; - return this; - }, - - destroy: function(){ - this.wrapper.destroy(); - }, - - toElement: function(){ - return this.wrapper; - } - -}); - - -Element.implement({ - - MooDialog: function(options){ - this.store('MooDialog', - new MooDialog(options).setContent(this).open() - ); - return this; - } - -}); diff --git a/pyload/webui/themes/Flat/js/static/MooDialog.min.js b/pyload/webui/themes/Flat/js/static/MooDialog.min.js deleted file mode 100644 index 90b3ae100..000000000 --- a/pyload/webui/themes/Flat/js/static/MooDialog.min.js +++ /dev/null @@ -1 +0,0 @@ -var MooDialog=new Class({Implements:[Options,Events],options:{"class":"MooDialog",title:null,scroll:!0,forceScroll:!1,useEscKey:!0,destroyOnHide:!0,autoOpen:!0,closeButton:!0,onInitialize:function(){this.wrapper.setStyle("display","none")},onBeforeOpen:function(){this.wrapper.setStyle("display","block"),this.fireEvent("show")},onBeforeClose:function(){this.wrapper.setStyle("display","none"),this.fireEvent("hide")}},initialize:function(t){this.setOptions(t),this.options.inject=this.options.inject||document.body,t=this.options;var e=this.wrapper=new Element("div."+t["class"].replace(" ",".")).inject(t.inject);if(this.content=new Element("div.content").inject(e),t.title&&(this.title=new Element("div.title").set("text",t.title).inject(e),e.addClass("MooDialogTitle")),t.closeButton&&(this.closeButton=new Element("a.close",{events:{click:this.close.bind(this)}}).inject(e)),t.scroll&&Browser.ie6||t.forceScroll){e.setStyle("position","absolute");var n=e.getPosition(t.inject);window.addEvent("scroll",function(){var t=document.getScroll();e.setPosition({x:n.x+t.x,y:n.y+t.y})})}t.useEscKey&&document.addEvent("keydown",function(t){"esc"==t.key&&this.close()}.bind(this)),this.addEvent("hide",function(){t.destroyOnHide&&this.destroy()}.bind(this)),this.fireEvent("initialize",e)},setContent:function(){var t=Array.from(arguments);1==t.length&&(t=t[0]),this.content.empty();var e=typeOf(t);return["string","number"].contains(e)?this.content.set("text",t):this.content.adopt(t),this.fireEvent("contentChange",this.content),this},open:function(){return this.fireEvent("beforeOpen",this.wrapper).fireEvent("open"),this.opened=!0,this},close:function(){return this.fireEvent("beforeClose",this.wrapper).fireEvent("close"),this.opened=!1,this},destroy:function(){this.wrapper.destroy()},toElement:function(){return this.wrapper}});Element.implement({MooDialog:function(t){return this.store("MooDialog",new MooDialog(t).setContent(this).open()),this}}); \ No newline at end of file diff --git a/pyload/webui/themes/Flat/js/static/MooDropMenu.js b/pyload/webui/themes/Flat/js/static/MooDropMenu.js deleted file mode 100644 index ac0fa1874..000000000 --- a/pyload/webui/themes/Flat/js/static/MooDropMenu.js +++ /dev/null @@ -1,86 +0,0 @@ -/* ---- -description: This provides a simple Drop Down menu with infinit levels - -license: MIT-style - -authors: -- Arian Stolwijk - -requires: - - Core/Class.Extras - - Core/Element.Event - - Core/Selectors - -provides: [MooDropMenu, Element.MooDropMenu] - -... -*/ - -var MooDropMenu = new Class({ - - Implements: [Options, Events], - - options: { - onOpen: function(el){ - el.removeClass('close').addClass('open'); - }, - onClose: function(el){ - el.removeClass('open').addClass('close'); - }, - onInitialize: function(el){ - el.removeClass('open').addClass('close'); - }, - mouseoutDelay: 200, - mouseoverDelay: 0, - listSelector: 'ul', - itemSelector: 'li', - openEvent: 'mouseenter', - closeEvent: 'mouseleave' - }, - - initialize: function(menu, options, level){ - this.setOptions(options); - options = this.options; - - var menu = this.menu = document.id(menu); - - menu.getElements(options.itemSelector + ' > ' + options.listSelector).each(function(el){ - - this.fireEvent('initialize', el); - - var parent = el.getParent(options.itemSelector), - timer; - - parent.addEvent(options.openEvent, function(){ - parent.store('DropDownOpen', true); - - clearTimeout(timer); - if (options.mouseoverDelay) timer = this.fireEvent.delay(options.mouseoverDelay, this, ['open', el]); - else this.fireEvent('open', el); - - }.bind(this)).addEvent(options.closeEvent, function(){ - parent.store('DropDownOpen', false); - - clearTimeout(timer); - timer = (function(){ - if (!parent.retrieve('DropDownOpen')) this.fireEvent('close', el); - }).delay(options.mouseoutDelay, this); - - }.bind(this)); - - }, this); - }, - - toElement: function(){ - return this.menu - } - -}); - -/* So you can do like this $('nav').MooDropMenu(); or even $('nav').MooDropMenu().setStyle('border',1); */ -Element.implement({ - MooDropMenu: function(options){ - return this.store('MooDropMenu', new MooDropMenu(this, options)); - } -}); diff --git a/pyload/webui/themes/Flat/js/static/MooDropMenu.min.js b/pyload/webui/themes/Flat/js/static/MooDropMenu.min.js deleted file mode 100644 index 552ae247a..000000000 --- a/pyload/webui/themes/Flat/js/static/MooDropMenu.min.js +++ /dev/null @@ -1 +0,0 @@ -var MooDropMenu=new Class({Implements:[Options,Events],options:{onOpen:function(e){e.removeClass("close").addClass("open")},onClose:function(e){e.removeClass("open").addClass("close")},onInitialize:function(e){e.removeClass("open").addClass("close")},mouseoutDelay:200,mouseoverDelay:0,listSelector:"ul",itemSelector:"li",openEvent:"mouseenter",closeEvent:"mouseleave"},initialize:function(e,o){this.setOptions(o),o=this.options;var e=this.menu=document.id(e);e.getElements(o.itemSelector+" > "+o.listSelector).each(function(e){this.fireEvent("initialize",e);var n,t=e.getParent(o.itemSelector);t.addEvent(o.openEvent,function(){t.store("DropDownOpen",!0),clearTimeout(n),o.mouseoverDelay?n=this.fireEvent.delay(o.mouseoverDelay,this,["open",e]):this.fireEvent("open",e)}.bind(this)).addEvent(o.closeEvent,function(){t.store("DropDownOpen",!1),clearTimeout(n),n=function(){t.retrieve("DropDownOpen")||this.fireEvent("close",e)}.delay(o.mouseoutDelay,this)}.bind(this))},this)},toElement:function(){return this.menu}});Element.implement({MooDropMenu:function(e){return this.store("MooDropMenu",new MooDropMenu(this,e))}}); \ No newline at end of file diff --git a/pyload/webui/themes/Flat/js/static/mootools-core.js b/pyload/webui/themes/Flat/js/static/mootools-core.js deleted file mode 100644 index db83850fd..000000000 --- a/pyload/webui/themes/Flat/js/static/mootools-core.js +++ /dev/null @@ -1,5977 +0,0 @@ -/* ---- -MooTools: the javascript framework - -web build: - - http://mootools.net/core/8423c12ffd6a6bfcde9ea22554aec795 - -packager build: - - packager build Core/Core Core/Array Core/String Core/Number Core/Function Core/Object Core/Event Core/Browser Core/Class Core/Class.Extras Core/Slick.Parser Core/Slick.Finder Core/Element Core/Element.Style Core/Element.Event Core/Element.Delegation Core/Element.Dimensions Core/Fx Core/Fx.CSS Core/Fx.Tween Core/Fx.Morph Core/Fx.Transitions Core/Request Core/Request.HTML Core/Request.JSON Core/Cookie Core/JSON Core/DOMReady - -... -*/ - -/* ---- - -name: Core - -description: The heart of MooTools. - -license: MIT-style license. - -copyright: Copyright (c) 2006-2014 [Valerio Proietti](http://mad4milk.net/). - -authors: The MooTools production team (http://mootools.net/developers/) - -inspiration: - - Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php) - - Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php) - -provides: [Core, MooTools, Type, typeOf, instanceOf, Native] - -... -*/ - -(function(){ - -this.MooTools = { - version: '1.5.0', - build: '0f7b690afee9349b15909f33016a25d2e4d9f4e3' -}; - -// typeOf, instanceOf - -var typeOf = this.typeOf = function(item){ - if (item == null) return 'null'; - if (item.$family != null) return item.$family(); - - if (item.nodeName){ - if (item.nodeType == 1) return 'element'; - if (item.nodeType == 3) return (/\S/).test(item.nodeValue) ? 'textnode' : 'whitespace'; - } else if (typeof item.length == 'number'){ - if ('callee' in item) return 'arguments'; - if ('item' in item) return 'collection'; - } - - return typeof item; -}; - -var instanceOf = this.instanceOf = function(item, object){ - if (item == null) return false; - var constructor = item.$constructor || item.constructor; - while (constructor){ - if (constructor === object) return true; - constructor = constructor.parent; - } - /**/ - if (!item.hasOwnProperty) return false; - /**/ - return item instanceof object; -}; - -// Function overloading - -var Function = this.Function; - -var enumerables = true; -for (var i in {toString: 1}) enumerables = null; -if (enumerables) enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'constructor']; - -Function.prototype.overloadSetter = function(usePlural){ - var self = this; - return function(a, b){ - if (a == null) return this; - if (usePlural || typeof a != 'string'){ - for (var k in a) self.call(this, k, a[k]); - if (enumerables) for (var i = enumerables.length; i--;){ - k = enumerables[i]; - if (a.hasOwnProperty(k)) self.call(this, k, a[k]); - } - } else { - self.call(this, a, b); - } - return this; - }; -}; - -Function.prototype.overloadGetter = function(usePlural){ - var self = this; - return function(a){ - var args, result; - if (typeof a != 'string') args = a; - else if (arguments.length > 1) args = arguments; - else if (usePlural) args = [a]; - if (args){ - result = {}; - for (var i = 0; i < args.length; i++) result[args[i]] = self.call(this, args[i]); - } else { - result = self.call(this, a); - } - return result; - }; -}; - -Function.prototype.extend = function(key, value){ - this[key] = value; -}.overloadSetter(); - -Function.prototype.implement = function(key, value){ - this.prototype[key] = value; -}.overloadSetter(); - -// From - -var slice = Array.prototype.slice; - -Function.from = function(item){ - return (typeOf(item) == 'function') ? item : function(){ - return item; - }; -}; - -Array.from = function(item){ - if (item == null) return []; - return (Type.isEnumerable(item) && typeof item != 'string') ? (typeOf(item) == 'array') ? item : slice.call(item) : [item]; -}; - -Number.from = function(item){ - var number = parseFloat(item); - return isFinite(number) ? number : null; -}; - -String.from = function(item){ - return item + ''; -}; - -// hide, protect - -Function.implement({ - - hide: function(){ - this.$hidden = true; - return this; - }, - - protect: function(){ - this.$protected = true; - return this; - } - -}); - -// Type - -var Type = this.Type = function(name, object){ - if (name){ - var lower = name.toLowerCase(); - var typeCheck = function(item){ - return (typeOf(item) == lower); - }; - - Type['is' + name] = typeCheck; - if (object != null){ - object.prototype.$family = (function(){ - return lower; - }).hide(); - - } - } - - if (object == null) return null; - - object.extend(this); - object.$constructor = Type; - object.prototype.$constructor = object; - - return object; -}; - -var toString = Object.prototype.toString; - -Type.isEnumerable = function(item){ - return (item != null && typeof item.length == 'number' && toString.call(item) != '[object Function]' ); -}; - -var hooks = {}; - -var hooksOf = function(object){ - var type = typeOf(object.prototype); - return hooks[type] || (hooks[type] = []); -}; - -var implement = function(name, method){ - if (method && method.$hidden) return; - - var hooks = hooksOf(this); - - for (var i = 0; i < hooks.length; i++){ - var hook = hooks[i]; - if (typeOf(hook) == 'type') implement.call(hook, name, method); - else hook.call(this, name, method); - } - - var previous = this.prototype[name]; - if (previous == null || !previous.$protected) this.prototype[name] = method; - - if (this[name] == null && typeOf(method) == 'function') extend.call(this, name, function(item){ - return method.apply(item, slice.call(arguments, 1)); - }); -}; - -var extend = function(name, method){ - if (method && method.$hidden) return; - var previous = this[name]; - if (previous == null || !previous.$protected) this[name] = method; -}; - -Type.implement({ - - implement: implement.overloadSetter(), - - extend: extend.overloadSetter(), - - alias: function(name, existing){ - implement.call(this, name, this.prototype[existing]); - }.overloadSetter(), - - mirror: function(hook){ - hooksOf(this).push(hook); - return this; - } - -}); - -new Type('Type', Type); - -// Default Types - -var force = function(name, object, methods){ - var isType = (object != Object), - prototype = object.prototype; - - if (isType) object = new Type(name, object); - - for (var i = 0, l = methods.length; i < l; i++){ - var key = methods[i], - generic = object[key], - proto = prototype[key]; - - if (generic) generic.protect(); - if (isType && proto) object.implement(key, proto.protect()); - } - - if (isType){ - var methodsEnumerable = prototype.propertyIsEnumerable(methods[0]); - object.forEachMethod = function(fn){ - if (!methodsEnumerable) for (var i = 0, l = methods.length; i < l; i++){ - fn.call(prototype, prototype[methods[i]], methods[i]); - } - for (var key in prototype) fn.call(prototype, prototype[key], key); - }; - } - - return force; -}; - -force('String', String, [ - 'charAt', 'charCodeAt', 'concat', 'contains', 'indexOf', 'lastIndexOf', 'match', 'quote', 'replace', 'search', - 'slice', 'split', 'substr', 'substring', 'trim', 'toLowerCase', 'toUpperCase' -])('Array', Array, [ - 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice', - 'indexOf', 'lastIndexOf', 'filter', 'forEach', 'every', 'map', 'some', 'reduce', 'reduceRight' -])('Number', Number, [ - 'toExponential', 'toFixed', 'toLocaleString', 'toPrecision' -])('Function', Function, [ - 'apply', 'call', 'bind' -])('RegExp', RegExp, [ - 'exec', 'test' -])('Object', Object, [ - 'create', 'defineProperty', 'defineProperties', 'keys', - 'getPrototypeOf', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', - 'preventExtensions', 'isExtensible', 'seal', 'isSealed', 'freeze', 'isFrozen' -])('Date', Date, ['now']); - -Object.extend = extend.overloadSetter(); - -Date.extend('now', function(){ - return +(new Date); -}); - -new Type('Boolean', Boolean); - -// fixes NaN returning as Number - -Number.prototype.$family = function(){ - return isFinite(this) ? 'number' : 'null'; -}.hide(); - -// Number.random - -Number.extend('random', function(min, max){ - return Math.floor(Math.random() * (max - min + 1) + min); -}); - -// forEach, each - -var hasOwnProperty = Object.prototype.hasOwnProperty; -Object.extend('forEach', function(object, fn, bind){ - for (var key in object){ - if (hasOwnProperty.call(object, key)) fn.call(bind, object[key], key, object); - } -}); - -Object.each = Object.forEach; - -Array.implement({ - - /**/ - forEach: function(fn, bind){ - for (var i = 0, l = this.length; i < l; i++){ - if (i in this) fn.call(bind, this[i], i, this); - } - }, - /**/ - - each: function(fn, bind){ - Array.forEach(this, fn, bind); - return this; - } - -}); - -// Array & Object cloning, Object merging and appending - -var cloneOf = function(item){ - switch (typeOf(item)){ - case 'array': return item.clone(); - case 'object': return Object.clone(item); - default: return item; - } -}; - -Array.implement('clone', function(){ - var i = this.length, clone = new Array(i); - while (i--) clone[i] = cloneOf(this[i]); - return clone; -}); - -var mergeOne = function(source, key, current){ - switch (typeOf(current)){ - case 'object': - if (typeOf(source[key]) == 'object') Object.merge(source[key], current); - else source[key] = Object.clone(current); - break; - case 'array': source[key] = current.clone(); break; - default: source[key] = current; - } - return source; -}; - -Object.extend({ - - merge: function(source, k, v){ - if (typeOf(k) == 'string') return mergeOne(source, k, v); - for (var i = 1, l = arguments.length; i < l; i++){ - var object = arguments[i]; - for (var key in object) mergeOne(source, key, object[key]); - } - return source; - }, - - clone: function(object){ - var clone = {}; - for (var key in object) clone[key] = cloneOf(object[key]); - return clone; - }, - - append: function(original){ - for (var i = 1, l = arguments.length; i < l; i++){ - var extended = arguments[i] || {}; - for (var key in extended) original[key] = extended[key]; - } - return original; - } - -}); - -// Object-less types - -['Object', 'WhiteSpace', 'TextNode', 'Collection', 'Arguments'].each(function(name){ - new Type(name); -}); - -// Unique ID - -var UID = Date.now(); - -String.extend('uniqueID', function(){ - return (UID++).toString(36); -}); - - - -})(); - - -/* ---- - -name: Array - -description: Contains Array Prototypes like each, contains, and erase. - -license: MIT-style license. - -requires: [Type] - -provides: Array - -... -*/ - -Array.implement({ - - /**/ - every: function(fn, bind){ - for (var i = 0, l = this.length >>> 0; i < l; i++){ - if ((i in this) && !fn.call(bind, this[i], i, this)) return false; - } - return true; - }, - - filter: function(fn, bind){ - var results = []; - for (var value, i = 0, l = this.length >>> 0; i < l; i++) if (i in this){ - value = this[i]; - if (fn.call(bind, value, i, this)) results.push(value); - } - return results; - }, - - indexOf: function(item, from){ - var length = this.length >>> 0; - for (var i = (from < 0) ? Math.max(0, length + from) : from || 0; i < length; i++){ - if (this[i] === item) return i; - } - return -1; - }, - - map: function(fn, bind){ - var length = this.length >>> 0, results = Array(length); - for (var i = 0; i < length; i++){ - if (i in this) results[i] = fn.call(bind, this[i], i, this); - } - return results; - }, - - some: function(fn, bind){ - for (var i = 0, l = this.length >>> 0; i < l; i++){ - if ((i in this) && fn.call(bind, this[i], i, this)) return true; - } - return false; - }, - /**/ - - clean: function(){ - return this.filter(function(item){ - return item != null; - }); - }, - - invoke: function(methodName){ - var args = Array.slice(arguments, 1); - return this.map(function(item){ - return item[methodName].apply(item, args); - }); - }, - - associate: function(keys){ - var obj = {}, length = Math.min(this.length, keys.length); - for (var i = 0; i < length; i++) obj[keys[i]] = this[i]; - return obj; - }, - - link: function(object){ - var result = {}; - for (var i = 0, l = this.length; i < l; i++){ - for (var key in object){ - if (object[key](this[i])){ - result[key] = this[i]; - delete object[key]; - break; - } - } - } - return result; - }, - - contains: function(item, from){ - return this.indexOf(item, from) != -1; - }, - - append: function(array){ - this.push.apply(this, array); - return this; - }, - - getLast: function(){ - return (this.length) ? this[this.length - 1] : null; - }, - - getRandom: function(){ - return (this.length) ? this[Number.random(0, this.length - 1)] : null; - }, - - include: function(item){ - if (!this.contains(item)) this.push(item); - return this; - }, - - combine: function(array){ - for (var i = 0, l = array.length; i < l; i++) this.include(array[i]); - return this; - }, - - erase: function(item){ - for (var i = this.length; i--;){ - if (this[i] === item) this.splice(i, 1); - } - return this; - }, - - empty: function(){ - this.length = 0; - return this; - }, - - flatten: function(){ - var array = []; - for (var i = 0, l = this.length; i < l; i++){ - var type = typeOf(this[i]); - if (type == 'null') continue; - array = array.concat((type == 'array' || type == 'collection' || type == 'arguments' || instanceOf(this[i], Array)) ? Array.flatten(this[i]) : this[i]); - } - return array; - }, - - pick: function(){ - for (var i = 0, l = this.length; i < l; i++){ - if (this[i] != null) return this[i]; - } - return null; - }, - - hexToRgb: function(array){ - if (this.length != 3) return null; - var rgb = this.map(function(value){ - if (value.length == 1) value += value; - return parseInt(value, 16); - }); - return (array) ? rgb : 'rgb(' + rgb + ')'; - }, - - rgbToHex: function(array){ - if (this.length < 3) return null; - if (this.length == 4 && this[3] == 0 && !array) return 'transparent'; - var hex = []; - for (var i = 0; i < 3; i++){ - var bit = (this[i] - 0).toString(16); - hex.push((bit.length == 1) ? '0' + bit : bit); - } - return (array) ? hex : '#' + hex.join(''); - } - -}); - - - - -/* ---- - -name: String - -description: Contains String Prototypes like camelCase, capitalize, test, and toInt. - -license: MIT-style license. - -requires: [Type, Array] - -provides: String - -... -*/ - -String.implement({ - - // - contains: function(string, index){ - return (index ? String(this).slice(index) : String(this)).indexOf(string) > -1; - }, - // - - test: function(regex, params){ - return ((typeOf(regex) == 'regexp') ? regex : new RegExp('' + regex, params)).test(this); - }, - - trim: function(){ - return String(this).replace(/^\s+|\s+$/g, ''); - }, - - clean: function(){ - return String(this).replace(/\s+/g, ' ').trim(); - }, - - camelCase: function(){ - return String(this).replace(/-\D/g, function(match){ - return match.charAt(1).toUpperCase(); - }); - }, - - hyphenate: function(){ - return String(this).replace(/[A-Z]/g, function(match){ - return ('-' + match.charAt(0).toLowerCase()); - }); - }, - - capitalize: function(){ - return String(this).replace(/\b[a-z]/g, function(match){ - return match.toUpperCase(); - }); - }, - - escapeRegExp: function(){ - return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g, '\\$1'); - }, - - toInt: function(base){ - return parseInt(this, base || 10); - }, - - toFloat: function(){ - return parseFloat(this); - }, - - hexToRgb: function(array){ - var hex = String(this).match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/); - return (hex) ? hex.slice(1).hexToRgb(array) : null; - }, - - rgbToHex: function(array){ - var rgb = String(this).match(/\d{1,3}/g); - return (rgb) ? rgb.rgbToHex(array) : null; - }, - - substitute: function(object, regexp){ - return String(this).replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){ - if (match.charAt(0) == '\\') return match.slice(1); - return (object[name] != null) ? object[name] : ''; - }); - } - -}); - - - - -/* ---- - -name: Number - -description: Contains Number Prototypes like limit, round, times, and ceil. - -license: MIT-style license. - -requires: Type - -provides: Number - -... -*/ - -Number.implement({ - - limit: function(min, max){ - return Math.min(max, Math.max(min, this)); - }, - - round: function(precision){ - precision = Math.pow(10, precision || 0).toFixed(precision < 0 ? -precision : 0); - return Math.round(this * precision) / precision; - }, - - times: function(fn, bind){ - for (var i = 0; i < this; i++) fn.call(bind, i, this); - }, - - toFloat: function(){ - return parseFloat(this); - }, - - toInt: function(base){ - return parseInt(this, base || 10); - } - -}); - -Number.alias('each', 'times'); - -(function(math){ - var methods = {}; - math.each(function(name){ - if (!Number[name]) methods[name] = function(){ - return Math[name].apply(null, [this].concat(Array.from(arguments))); - }; - }); - Number.implement(methods); -})(['abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'exp', 'floor', 'log', 'max', 'min', 'pow', 'sin', 'sqrt', 'tan']); - - -/* ---- - -name: Function - -description: Contains Function Prototypes like create, bind, pass, and delay. - -license: MIT-style license. - -requires: Type - -provides: Function - -... -*/ - -Function.extend({ - - attempt: function(){ - for (var i = 0, l = arguments.length; i < l; i++){ - try { - return arguments[i](); - } catch (e){} - } - return null; - } - -}); - -Function.implement({ - - attempt: function(args, bind){ - try { - return this.apply(bind, Array.from(args)); - } catch (e){} - - return null; - }, - - /**/ - bind: function(that){ - var self = this, - args = arguments.length > 1 ? Array.slice(arguments, 1) : null, - F = function(){}; - - var bound = function(){ - var context = that, length = arguments.length; - if (this instanceof bound){ - F.prototype = self.prototype; - context = new F; - } - var result = (!args && !length) - ? self.call(context) - : self.apply(context, args && length ? args.concat(Array.slice(arguments)) : args || arguments); - return context == that ? result : context; - }; - return bound; - }, - /**/ - - pass: function(args, bind){ - var self = this; - if (args != null) args = Array.from(args); - return function(){ - return self.apply(bind, args || arguments); - }; - }, - - delay: function(delay, bind, args){ - return setTimeout(this.pass((args == null ? [] : args), bind), delay); - }, - - periodical: function(periodical, bind, args){ - return setInterval(this.pass((args == null ? [] : args), bind), periodical); - } - -}); - - - - -/* ---- - -name: Object - -description: Object generic methods - -license: MIT-style license. - -requires: Type - -provides: [Object, Hash] - -... -*/ - -(function(){ - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -Object.extend({ - - subset: function(object, keys){ - var results = {}; - for (var i = 0, l = keys.length; i < l; i++){ - var k = keys[i]; - if (k in object) results[k] = object[k]; - } - return results; - }, - - map: function(object, fn, bind){ - var results = {}; - for (var key in object){ - if (hasOwnProperty.call(object, key)) results[key] = fn.call(bind, object[key], key, object); - } - return results; - }, - - filter: function(object, fn, bind){ - var results = {}; - for (var key in object){ - var value = object[key]; - if (hasOwnProperty.call(object, key) && fn.call(bind, value, key, object)) results[key] = value; - } - return results; - }, - - every: function(object, fn, bind){ - for (var key in object){ - if (hasOwnProperty.call(object, key) && !fn.call(bind, object[key], key)) return false; - } - return true; - }, - - some: function(object, fn, bind){ - for (var key in object){ - if (hasOwnProperty.call(object, key) && fn.call(bind, object[key], key)) return true; - } - return false; - }, - - keys: function(object){ - var keys = []; - for (var key in object){ - if (hasOwnProperty.call(object, key)) keys.push(key); - } - return keys; - }, - - values: function(object){ - var values = []; - for (var key in object){ - if (hasOwnProperty.call(object, key)) values.push(object[key]); - } - return values; - }, - - getLength: function(object){ - return Object.keys(object).length; - }, - - keyOf: function(object, value){ - for (var key in object){ - if (hasOwnProperty.call(object, key) && object[key] === value) return key; - } - return null; - }, - - contains: function(object, value){ - return Object.keyOf(object, value) != null; - }, - - toQueryString: function(object, base){ - var queryString = []; - - Object.each(object, function(value, key){ - if (base) key = base + '[' + key + ']'; - var result; - switch (typeOf(value)){ - case 'object': result = Object.toQueryString(value, key); break; - case 'array': - var qs = {}; - value.each(function(val, i){ - qs[i] = val; - }); - result = Object.toQueryString(qs, key); - break; - default: result = key + '=' + encodeURIComponent(value); - } - if (value != null) queryString.push(result); - }); - - return queryString.join('&'); - } - -}); - -})(); - - - - -/* ---- - -name: Browser - -description: The Browser Object. Contains Browser initialization, Window and Document, and the Browser Hash. - -license: MIT-style license. - -requires: [Array, Function, Number, String] - -provides: [Browser, Window, Document] - -... -*/ - -(function(){ - -var document = this.document; -var window = document.window = this; - -var parse = function(ua, platform){ - ua = ua.toLowerCase(); - platform = (platform ? platform.toLowerCase() : ''); - - var UA = ua.match(/(opera|ie|firefox|chrome|trident|crios|version)[\s\/:]([\w\d\.]+)?.*?(safari|(?:rv[\s\/:]|version[\s\/:])([\w\d\.]+)|$)/) || [null, 'unknown', 0]; - - if (UA[1] == 'trident'){ - UA[1] = 'ie'; - if (UA[4]) UA[2] = UA[4]; - } else if (UA[1] == 'crios') { - UA[1] = 'chrome'; - } - - var platform = ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android)/) || platform.match(/mac|win|linux/) || ['other'])[0]; - if (platform == 'win') platform = 'windows'; - - return { - extend: Function.prototype.extend, - name: (UA[1] == 'version') ? UA[3] : UA[1], - version: parseFloat((UA[1] == 'opera' && UA[4]) ? UA[4] : UA[2]), - platform: platform - }; -}; - -var Browser = this.Browser = parse(navigator.userAgent, navigator.platform); - -if (Browser.ie){ - Browser.version = document.documentMode; -} - -Browser.extend({ - Features: { - xpath: !!(document.evaluate), - air: !!(window.runtime), - query: !!(document.querySelector), - json: !!(window.JSON) - }, - parseUA: parse -}); - - - -// Request - -Browser.Request = (function(){ - - var XMLHTTP = function(){ - return new XMLHttpRequest(); - }; - - var MSXML2 = function(){ - return new ActiveXObject('MSXML2.XMLHTTP'); - }; - - var MSXML = function(){ - return new ActiveXObject('Microsoft.XMLHTTP'); - }; - - return Function.attempt(function(){ - XMLHTTP(); - return XMLHTTP; - }, function(){ - MSXML2(); - return MSXML2; - }, function(){ - MSXML(); - return MSXML; - }); - -})(); - -Browser.Features.xhr = !!(Browser.Request); - - - -// String scripts - -Browser.exec = function(text){ - if (!text) return text; - if (window.execScript){ - window.execScript(text); - } else { - var script = document.createElement('script'); - script.setAttribute('type', 'text/javascript'); - script.text = text; - document.head.appendChild(script); - document.head.removeChild(script); - } - return text; -}; - -String.implement('stripScripts', function(exec){ - var scripts = ''; - var text = this.replace(/]*>([\s\S]*?)<\/script>/gi, function(all, code){ - scripts += code + '\n'; - return ''; - }); - if (exec === true) Browser.exec(scripts); - else if (typeOf(exec) == 'function') exec(scripts, text); - return text; -}); - -// Window, Document - -Browser.extend({ - Document: this.Document, - Window: this.Window, - Element: this.Element, - Event: this.Event -}); - -this.Window = this.$constructor = new Type('Window', function(){}); - -this.$family = Function.from('window').hide(); - -Window.mirror(function(name, method){ - window[name] = method; -}); - -this.Document = document.$constructor = new Type('Document', function(){}); - -document.$family = Function.from('document').hide(); - -Document.mirror(function(name, method){ - document[name] = method; -}); - -document.html = document.documentElement; -if (!document.head) document.head = document.getElementsByTagName('head')[0]; - -if (document.execCommand) try { - document.execCommand("BackgroundImageCache", false, true); -} catch (e){} - -/**/ -if (this.attachEvent && !this.addEventListener){ - var unloadEvent = function(){ - this.detachEvent('onunload', unloadEvent); - document.head = document.html = document.window = null; - }; - this.attachEvent('onunload', unloadEvent); -} - -// IE fails on collections and ) -var arrayFrom = Array.from; -try { - arrayFrom(document.html.childNodes); -} catch(e){ - Array.from = function(item){ - if (typeof item != 'string' && Type.isEnumerable(item) && typeOf(item) != 'array'){ - var i = item.length, array = new Array(i); - while (i--) array[i] = item[i]; - return array; - } - return arrayFrom(item); - }; - - var prototype = Array.prototype, - slice = prototype.slice; - ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice'].each(function(name){ - var method = prototype[name]; - Array[name] = function(item){ - return method.apply(Array.from(item), slice.call(arguments, 1)); - }; - }); -} -/**/ - - - -})(); - - -/* ---- - -name: Event - -description: Contains the Event Type, to make the event object cross-browser. - -license: MIT-style license. - -requires: [Window, Document, Array, Function, String, Object] - -provides: Event - -... -*/ - -(function() { - -var _keys = {}; - -var DOMEvent = this.DOMEvent = new Type('DOMEvent', function(event, win){ - if (!win) win = window; - event = event || win.event; - if (event.$extended) return event; - this.event = event; - this.$extended = true; - this.shift = event.shiftKey; - this.control = event.ctrlKey; - this.alt = event.altKey; - this.meta = event.metaKey; - var type = this.type = event.type; - var target = event.target || event.srcElement; - while (target && target.nodeType == 3) target = target.parentNode; - this.target = document.id(target); - - if (type.indexOf('key') == 0){ - var code = this.code = (event.which || event.keyCode); - this.key = _keys[code]; - if (type == 'keydown' || type == 'keyup'){ - if (code > 111 && code < 124) this.key = 'f' + (code - 111); - else if (code > 95 && code < 106) this.key = code - 96; - } - if (this.key == null) this.key = String.fromCharCode(code).toLowerCase(); - } else if (type == 'click' || type == 'dblclick' || type == 'contextmenu' || type == 'DOMMouseScroll' || type.indexOf('mouse') == 0){ - var doc = win.document; - doc = (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body; - this.page = { - x: (event.pageX != null) ? event.pageX : event.clientX + doc.scrollLeft, - y: (event.pageY != null) ? event.pageY : event.clientY + doc.scrollTop - }; - this.client = { - x: (event.pageX != null) ? event.pageX - win.pageXOffset : event.clientX, - y: (event.pageY != null) ? event.pageY - win.pageYOffset : event.clientY - }; - if (type == 'DOMMouseScroll' || type == 'mousewheel') - this.wheel = (event.wheelDelta) ? event.wheelDelta / 120 : -(event.detail || 0) / 3; - - this.rightClick = (event.which == 3 || event.button == 2); - if (type == 'mouseover' || type == 'mouseout'){ - var related = event.relatedTarget || event[(type == 'mouseover' ? 'from' : 'to') + 'Element']; - while (related && related.nodeType == 3) related = related.parentNode; - this.relatedTarget = document.id(related); - } - } else if (type.indexOf('touch') == 0 || type.indexOf('gesture') == 0){ - this.rotation = event.rotation; - this.scale = event.scale; - this.targetTouches = event.targetTouches; - this.changedTouches = event.changedTouches; - var touches = this.touches = event.touches; - if (touches && touches[0]){ - var touch = touches[0]; - this.page = {x: touch.pageX, y: touch.pageY}; - this.client = {x: touch.clientX, y: touch.clientY}; - } - } - - if (!this.client) this.client = {}; - if (!this.page) this.page = {}; -}); - -DOMEvent.implement({ - - stop: function(){ - return this.preventDefault().stopPropagation(); - }, - - stopPropagation: function(){ - if (this.event.stopPropagation) this.event.stopPropagation(); - else this.event.cancelBubble = true; - return this; - }, - - preventDefault: function(){ - if (this.event.preventDefault) this.event.preventDefault(); - else this.event.returnValue = false; - return this; - } - -}); - -DOMEvent.defineKey = function(code, key){ - _keys[code] = key; - return this; -}; - -DOMEvent.defineKeys = DOMEvent.defineKey.overloadSetter(true); - -DOMEvent.defineKeys({ - '38': 'up', '40': 'down', '37': 'left', '39': 'right', - '27': 'esc', '32': 'space', '8': 'backspace', '9': 'tab', - '46': 'delete', '13': 'enter' -}); - -})(); - - - - - - -/* ---- - -name: Class - -description: Contains the Class Function for easily creating, extending, and implementing reusable Classes. - -license: MIT-style license. - -requires: [Array, String, Function, Number] - -provides: Class - -... -*/ - -(function(){ - -var Class = this.Class = new Type('Class', function(params){ - if (instanceOf(params, Function)) params = {initialize: params}; - - var newClass = function(){ - reset(this); - if (newClass.$prototyping) return this; - this.$caller = null; - var value = (this.initialize) ? this.initialize.apply(this, arguments) : this; - this.$caller = this.caller = null; - return value; - }.extend(this).implement(params); - - newClass.$constructor = Class; - newClass.prototype.$constructor = newClass; - newClass.prototype.parent = parent; - - return newClass; -}); - -var parent = function(){ - if (!this.$caller) throw new Error('The method "parent" cannot be called.'); - var name = this.$caller.$name, - parent = this.$caller.$owner.parent, - previous = (parent) ? parent.prototype[name] : null; - if (!previous) throw new Error('The method "' + name + '" has no parent.'); - return previous.apply(this, arguments); -}; - -var reset = function(object){ - for (var key in object){ - var value = object[key]; - switch (typeOf(value)){ - case 'object': - var F = function(){}; - F.prototype = value; - object[key] = reset(new F); - break; - case 'array': object[key] = value.clone(); break; - } - } - return object; -}; - -var wrap = function(self, key, method){ - if (method.$origin) method = method.$origin; - var wrapper = function(){ - if (method.$protected && this.$caller == null) throw new Error('The method "' + key + '" cannot be called.'); - var caller = this.caller, current = this.$caller; - this.caller = current; this.$caller = wrapper; - var result = method.apply(this, arguments); - this.$caller = current; this.caller = caller; - return result; - }.extend({$owner: self, $origin: method, $name: key}); - return wrapper; -}; - -var implement = function(key, value, retain){ - if (Class.Mutators.hasOwnProperty(key)){ - value = Class.Mutators[key].call(this, value); - if (value == null) return this; - } - - if (typeOf(value) == 'function'){ - if (value.$hidden) return this; - this.prototype[key] = (retain) ? value : wrap(this, key, value); - } else { - Object.merge(this.prototype, key, value); - } - - return this; -}; - -var getInstance = function(klass){ - klass.$prototyping = true; - var proto = new klass; - delete klass.$prototyping; - return proto; -}; - -Class.implement('implement', implement.overloadSetter()); - -Class.Mutators = { - - Extends: function(parent){ - this.parent = parent; - this.prototype = getInstance(parent); - }, - - Implements: function(items){ - Array.from(items).each(function(item){ - var instance = new item; - for (var key in instance) implement.call(this, key, instance[key], true); - }, this); - } -}; - -})(); - - -/* ---- - -name: Class.Extras - -description: Contains Utility Classes that can be implemented into your own Classes to ease the execution of many common tasks. - -license: MIT-style license. - -requires: Class - -provides: [Class.Extras, Chain, Events, Options] - -... -*/ - -(function(){ - -this.Chain = new Class({ - - $chain: [], - - chain: function(){ - this.$chain.append(Array.flatten(arguments)); - return this; - }, - - callChain: function(){ - return (this.$chain.length) ? this.$chain.shift().apply(this, arguments) : false; - }, - - clearChain: function(){ - this.$chain.empty(); - return this; - } - -}); - -var removeOn = function(string){ - return string.replace(/^on([A-Z])/, function(full, first){ - return first.toLowerCase(); - }); -}; - -this.Events = new Class({ - - $events: {}, - - addEvent: function(type, fn, internal){ - type = removeOn(type); - - - - this.$events[type] = (this.$events[type] || []).include(fn); - if (internal) fn.internal = true; - return this; - }, - - addEvents: function(events){ - for (var type in events) this.addEvent(type, events[type]); - return this; - }, - - fireEvent: function(type, args, delay){ - type = removeOn(type); - var events = this.$events[type]; - if (!events) return this; - args = Array.from(args); - events.each(function(fn){ - if (delay) fn.delay(delay, this, args); - else fn.apply(this, args); - }, this); - return this; - }, - - removeEvent: function(type, fn){ - type = removeOn(type); - var events = this.$events[type]; - if (events && !fn.internal){ - var index = events.indexOf(fn); - if (index != -1) delete events[index]; - } - return this; - }, - - removeEvents: function(events){ - var type; - if (typeOf(events) == 'object'){ - for (type in events) this.removeEvent(type, events[type]); - return this; - } - if (events) events = removeOn(events); - for (type in this.$events){ - if (events && events != type) continue; - var fns = this.$events[type]; - for (var i = fns.length; i--;) if (i in fns){ - this.removeEvent(type, fns[i]); - } - } - return this; - } - -}); - -this.Options = new Class({ - - setOptions: function(){ - var options = this.options = Object.merge.apply(null, [{}, this.options].append(arguments)); - if (this.addEvent) for (var option in options){ - if (typeOf(options[option]) != 'function' || !(/^on[A-Z]/).test(option)) continue; - this.addEvent(option, options[option]); - delete options[option]; - } - return this; - } - -}); - -})(); - - -/* ---- -name: Slick.Parser -description: Standalone CSS3 Selector parser -provides: Slick.Parser -... -*/ - -;(function(){ - -var parsed, - separatorIndex, - combinatorIndex, - reversed, - cache = {}, - reverseCache = {}, - reUnescape = /\\/g; - -var parse = function(expression, isReversed){ - if (expression == null) return null; - if (expression.Slick === true) return expression; - expression = ('' + expression).replace(/^\s+|\s+$/g, ''); - reversed = !!isReversed; - var currentCache = (reversed) ? reverseCache : cache; - if (currentCache[expression]) return currentCache[expression]; - parsed = { - Slick: true, - expressions: [], - raw: expression, - reverse: function(){ - return parse(this.raw, true); - } - }; - separatorIndex = -1; - while (expression != (expression = expression.replace(regexp, parser))); - parsed.length = parsed.expressions.length; - return currentCache[parsed.raw] = (reversed) ? reverse(parsed) : parsed; -}; - -var reverseCombinator = function(combinator){ - if (combinator === '!') return ' '; - else if (combinator === ' ') return '!'; - else if ((/^!/).test(combinator)) return combinator.replace(/^!/, ''); - else return '!' + combinator; -}; - -var reverse = function(expression){ - var expressions = expression.expressions; - for (var i = 0; i < expressions.length; i++){ - var exp = expressions[i]; - var last = {parts: [], tag: '*', combinator: reverseCombinator(exp[0].combinator)}; - - for (var j = 0; j < exp.length; j++){ - var cexp = exp[j]; - if (!cexp.reverseCombinator) cexp.reverseCombinator = ' '; - cexp.combinator = cexp.reverseCombinator; - delete cexp.reverseCombinator; - } - - exp.reverse().push(last); - } - return expression; -}; - -var escapeRegExp = function(string){// Credit: XRegExp 0.6.1 (c) 2007-2008 Steven Levithan MIT License - return string.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, function(match){ - return '\\' + match; - }); -}; - -var regexp = new RegExp( -/* -#!/usr/bin/env ruby -puts "\t\t" + DATA.read.gsub(/\(\?x\)|\s+#.*$|\s+|\\$|\\n/,'') -__END__ - "(?x)^(?:\ - \\s* ( , ) \\s* # Separator \n\ - | \\s* ( + ) \\s* # Combinator \n\ - | ( \\s+ ) # CombinatorChildren \n\ - | ( + | \\* ) # Tag \n\ - | \\# ( + ) # ID \n\ - | \\. ( + ) # ClassName \n\ - | # Attribute \n\ - \\[ \ - \\s* (+) (?: \ - \\s* ([*^$!~|]?=) (?: \ - \\s* (?:\ - ([\"']?)(.*?)\\9 \ - )\ - ) \ - )? \\s* \ - \\](?!\\]) \n\ - | :+ ( + )(?:\ - \\( (?:\ - (?:([\"'])([^\\12]*)\\12)|((?:\\([^)]+\\)|[^()]*)+)\ - ) \\)\ - )?\ - )" -*/ - "^(?:\\s*(,)\\s*|\\s*(+)\\s*|(\\s+)|(+|\\*)|\\#(+)|\\.(+)|\\[\\s*(+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)" - .replace(//, '[' + escapeRegExp(">+~`!@$%^&={}\\;/g, '(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])') - .replace(//g, '(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])') -); - -function parser( - rawMatch, - - separator, - combinator, - combinatorChildren, - - tagName, - id, - className, - - attributeKey, - attributeOperator, - attributeQuote, - attributeValue, - - pseudoMarker, - pseudoClass, - pseudoQuote, - pseudoClassQuotedValue, - pseudoClassValue -){ - if (separator || separatorIndex === -1){ - parsed.expressions[++separatorIndex] = []; - combinatorIndex = -1; - if (separator) return ''; - } - - if (combinator || combinatorChildren || combinatorIndex === -1){ - combinator = combinator || ' '; - var currentSeparator = parsed.expressions[separatorIndex]; - if (reversed && currentSeparator[combinatorIndex]) - currentSeparator[combinatorIndex].reverseCombinator = reverseCombinator(combinator); - currentSeparator[++combinatorIndex] = {combinator: combinator, tag: '*'}; - } - - var currentParsed = parsed.expressions[separatorIndex][combinatorIndex]; - - if (tagName){ - currentParsed.tag = tagName.replace(reUnescape, ''); - - } else if (id){ - currentParsed.id = id.replace(reUnescape, ''); - - } else if (className){ - className = className.replace(reUnescape, ''); - - if (!currentParsed.classList) currentParsed.classList = []; - if (!currentParsed.classes) currentParsed.classes = []; - currentParsed.classList.push(className); - currentParsed.classes.push({ - value: className, - regexp: new RegExp('(^|\\s)' + escapeRegExp(className) + '(\\s|$)') - }); - - } else if (pseudoClass){ - pseudoClassValue = pseudoClassValue || pseudoClassQuotedValue; - pseudoClassValue = pseudoClassValue ? pseudoClassValue.replace(reUnescape, '') : null; - - if (!currentParsed.pseudos) currentParsed.pseudos = []; - currentParsed.pseudos.push({ - key: pseudoClass.replace(reUnescape, ''), - value: pseudoClassValue, - type: pseudoMarker.length == 1 ? 'class' : 'element' - }); - - } else if (attributeKey){ - attributeKey = attributeKey.replace(reUnescape, ''); - attributeValue = (attributeValue || '').replace(reUnescape, ''); - - var test, regexp; - - switch (attributeOperator){ - case '^=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) ); break; - case '$=' : regexp = new RegExp( escapeRegExp(attributeValue) +'$' ); break; - case '~=' : regexp = new RegExp( '(^|\\s)'+ escapeRegExp(attributeValue) +'(\\s|$)' ); break; - case '|=' : regexp = new RegExp( '^'+ escapeRegExp(attributeValue) +'(-|$)' ); break; - case '=' : test = function(value){ - return attributeValue == value; - }; break; - case '*=' : test = function(value){ - return value && value.indexOf(attributeValue) > -1; - }; break; - case '!=' : test = function(value){ - return attributeValue != value; - }; break; - default : test = function(value){ - return !!value; - }; - } - - if (attributeValue == '' && (/^[*$^]=$/).test(attributeOperator)) test = function(){ - return false; - }; - - if (!test) test = function(value){ - return value && regexp.test(value); - }; - - if (!currentParsed.attributes) currentParsed.attributes = []; - currentParsed.attributes.push({ - key: attributeKey, - operator: attributeOperator, - value: attributeValue, - test: test - }); - - } - - return ''; -}; - -// Slick NS - -var Slick = (this.Slick || {}); - -Slick.parse = function(expression){ - return parse(expression); -}; - -Slick.escapeRegExp = escapeRegExp; - -if (!this.Slick) this.Slick = Slick; - -}).apply(/**/(typeof exports != 'undefined') ? exports : /**/this); - - -/* ---- -name: Slick.Finder -description: The new, superfast css selector engine. -provides: Slick.Finder -requires: Slick.Parser -... -*/ - -;(function(){ - -var local = {}, - featuresCache = {}, - toString = Object.prototype.toString; - -// Feature / Bug detection - -local.isNativeCode = function(fn){ - return (/\{\s*\[native code\]\s*\}/).test('' + fn); -}; - -local.isXML = function(document){ - return (!!document.xmlVersion) || (!!document.xml) || (toString.call(document) == '[object XMLDocument]') || - (document.nodeType == 9 && document.documentElement.nodeName != 'HTML'); -}; - -local.setDocument = function(document){ - - // convert elements / window arguments to document. if document cannot be extrapolated, the function returns. - var nodeType = document.nodeType; - if (nodeType == 9); // document - else if (nodeType) document = document.ownerDocument; // node - else if (document.navigator) document = document.document; // window - else return; - - // check if it's the old document - - if (this.document === document) return; - this.document = document; - - // check if we have done feature detection on this document before - - var root = document.documentElement, - rootUid = this.getUIDXML(root), - features = featuresCache[rootUid], - feature; - - if (features){ - for (feature in features){ - this[feature] = features[feature]; - } - return; - } - - features = featuresCache[rootUid] = {}; - - features.root = root; - features.isXMLDocument = this.isXML(document); - - features.brokenStarGEBTN - = features.starSelectsClosedQSA - = features.idGetsName - = features.brokenMixedCaseQSA - = features.brokenGEBCN - = features.brokenCheckedQSA - = features.brokenEmptyAttributeQSA - = features.isHTMLDocument - = features.nativeMatchesSelector - = false; - - var starSelectsClosed, starSelectsComments, - brokenSecondClassNameGEBCN, cachedGetElementsByClassName, - brokenFormAttributeGetter; - - var selected, id = 'slick_uniqueid'; - var testNode = document.createElement('div'); - - var testRoot = document.body || document.getElementsByTagName('body')[0] || root; - testRoot.appendChild(testNode); - - // on non-HTML documents innerHTML and getElementsById doesnt work properly - try { - testNode.innerHTML = ''; - features.isHTMLDocument = !!document.getElementById(id); - } catch(e){}; - - if (features.isHTMLDocument){ - - testNode.style.display = 'none'; - - // IE returns comment nodes for getElementsByTagName('*') for some documents - testNode.appendChild(document.createComment('')); - starSelectsComments = (testNode.getElementsByTagName('*').length > 1); - - // IE returns closed nodes (EG:"") for getElementsByTagName('*') for some documents - try { - testNode.innerHTML = 'foo'; - selected = testNode.getElementsByTagName('*'); - starSelectsClosed = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/'); - } catch(e){}; - - features.brokenStarGEBTN = starSelectsComments || starSelectsClosed; - - // IE returns elements with the name instead of just id for getElementsById for some documents - try { - testNode.innerHTML = ''; - features.idGetsName = document.getElementById(id) === testNode.firstChild; - } catch(e){}; - - if (testNode.getElementsByClassName){ - - // Safari 3.2 getElementsByClassName caches results - try { - testNode.innerHTML = ''; - testNode.getElementsByClassName('b').length; - testNode.firstChild.className = 'b'; - cachedGetElementsByClassName = (testNode.getElementsByClassName('b').length != 2); - } catch(e){}; - - // Opera 9.6 getElementsByClassName doesnt detects the class if its not the first one - try { - testNode.innerHTML = ''; - brokenSecondClassNameGEBCN = (testNode.getElementsByClassName('a').length != 2); - } catch(e){}; - - features.brokenGEBCN = cachedGetElementsByClassName || brokenSecondClassNameGEBCN; - } - - if (testNode.querySelectorAll){ - // IE 8 returns closed nodes (EG:"") for querySelectorAll('*') for some documents - try { - testNode.innerHTML = 'foo'; - selected = testNode.querySelectorAll('*'); - features.starSelectsClosedQSA = (selected && !!selected.length && selected[0].nodeName.charAt(0) == '/'); - } catch(e){}; - - // Safari 3.2 querySelectorAll doesnt work with mixedcase on quirksmode - try { - testNode.innerHTML = ''; - features.brokenMixedCaseQSA = !testNode.querySelectorAll('.MiX').length; - } catch(e){}; - - // Webkit and Opera dont return selected options on querySelectorAll - try { - testNode.innerHTML = ''; - features.brokenCheckedQSA = (testNode.querySelectorAll(':checked').length == 0); - } catch(e){}; - - // IE returns incorrect results for attr[*^$]="" selectors on querySelectorAll - try { - testNode.innerHTML = ''; - features.brokenEmptyAttributeQSA = (testNode.querySelectorAll('[class*=""]').length != 0); - } catch(e){}; - - } - - // IE6-7, if a form has an input of id x, form.getAttribute(x) returns a reference to the input - try { - testNode.innerHTML = '
        '; - brokenFormAttributeGetter = (testNode.firstChild.getAttribute('action') != 's'); - } catch(e){}; - - // native matchesSelector function - - features.nativeMatchesSelector = root.matches || /*root.msMatchesSelector ||*/ root.mozMatchesSelector || root.webkitMatchesSelector; - if (features.nativeMatchesSelector) try { - // if matchesSelector trows errors on incorrect sintaxes we can use it - features.nativeMatchesSelector.call(root, ':slick'); - features.nativeMatchesSelector = null; - } catch(e){}; - - } - - try { - root.slick_expando = 1; - delete root.slick_expando; - features.getUID = this.getUIDHTML; - } catch(e) { - features.getUID = this.getUIDXML; - } - - testRoot.removeChild(testNode); - testNode = selected = testRoot = null; - - // getAttribute - - features.getAttribute = (features.isHTMLDocument && brokenFormAttributeGetter) ? function(node, name){ - var method = this.attributeGetters[name]; - if (method) return method.call(node); - var attributeNode = node.getAttributeNode(name); - return (attributeNode) ? attributeNode.nodeValue : null; - } : function(node, name){ - var method = this.attributeGetters[name]; - return (method) ? method.call(node) : node.getAttribute(name); - }; - - // hasAttribute - - features.hasAttribute = (root && this.isNativeCode(root.hasAttribute)) ? function(node, attribute) { - return node.hasAttribute(attribute); - } : function(node, attribute) { - node = node.getAttributeNode(attribute); - return !!(node && (node.specified || node.nodeValue)); - }; - - // contains - // FIXME: Add specs: local.contains should be different for xml and html documents? - var nativeRootContains = root && this.isNativeCode(root.contains), - nativeDocumentContains = document && this.isNativeCode(document.contains); - - features.contains = (nativeRootContains && nativeDocumentContains) ? function(context, node){ - return context.contains(node); - } : (nativeRootContains && !nativeDocumentContains) ? function(context, node){ - // IE8 does not have .contains on document. - return context === node || ((context === document) ? document.documentElement : context).contains(node); - } : (root && root.compareDocumentPosition) ? function(context, node){ - return context === node || !!(context.compareDocumentPosition(node) & 16); - } : function(context, node){ - if (node) do { - if (node === context) return true; - } while ((node = node.parentNode)); - return false; - }; - - // document order sorting - // credits to Sizzle (http://sizzlejs.com/) - - features.documentSorter = (root.compareDocumentPosition) ? function(a, b){ - if (!a.compareDocumentPosition || !b.compareDocumentPosition) return 0; - return a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; - } : ('sourceIndex' in root) ? function(a, b){ - if (!a.sourceIndex || !b.sourceIndex) return 0; - return a.sourceIndex - b.sourceIndex; - } : (document.createRange) ? function(a, b){ - if (!a.ownerDocument || !b.ownerDocument) return 0; - var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); - aRange.setStart(a, 0); - aRange.setEnd(a, 0); - bRange.setStart(b, 0); - bRange.setEnd(b, 0); - return aRange.compareBoundaryPoints(Range.START_TO_END, bRange); - } : null ; - - root = null; - - for (feature in features){ - this[feature] = features[feature]; - } -}; - -// Main Method - -var reSimpleSelector = /^([#.]?)((?:[\w-]+|\*))$/, - reEmptyAttribute = /\[.+[*$^]=(?:""|'')?\]/, - qsaFailExpCache = {}; - -local.search = function(context, expression, append, first){ - - var found = this.found = (first) ? null : (append || []); - - if (!context) return found; - else if (context.navigator) context = context.document; // Convert the node from a window to a document - else if (!context.nodeType) return found; - - // setup - - var parsed, i, - uniques = this.uniques = {}, - hasOthers = !!(append && append.length), - contextIsDocument = (context.nodeType == 9); - - if (this.document !== (contextIsDocument ? context : context.ownerDocument)) this.setDocument(context); - - // avoid duplicating items already in the append array - if (hasOthers) for (i = found.length; i--;) uniques[this.getUID(found[i])] = true; - - // expression checks - - if (typeof expression == 'string'){ // expression is a string - - /**/ - var simpleSelector = expression.match(reSimpleSelector); - simpleSelectors: if (simpleSelector) { - - var symbol = simpleSelector[1], - name = simpleSelector[2], - node, nodes; - - if (!symbol){ - - if (name == '*' && this.brokenStarGEBTN) break simpleSelectors; - nodes = context.getElementsByTagName(name); - if (first) return nodes[0] || null; - for (i = 0; node = nodes[i++];){ - if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); - } - - } else if (symbol == '#'){ - - if (!this.isHTMLDocument || !contextIsDocument) break simpleSelectors; - node = context.getElementById(name); - if (!node) return found; - if (this.idGetsName && node.getAttributeNode('id').nodeValue != name) break simpleSelectors; - if (first) return node || null; - if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); - - } else if (symbol == '.'){ - - if (!this.isHTMLDocument || ((!context.getElementsByClassName || this.brokenGEBCN) && context.querySelectorAll)) break simpleSelectors; - if (context.getElementsByClassName && !this.brokenGEBCN){ - nodes = context.getElementsByClassName(name); - if (first) return nodes[0] || null; - for (i = 0; node = nodes[i++];){ - if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); - } - } else { - var matchClass = new RegExp('(^|\\s)'+ Slick.escapeRegExp(name) +'(\\s|$)'); - nodes = context.getElementsByTagName('*'); - for (i = 0; node = nodes[i++];){ - className = node.className; - if (!(className && matchClass.test(className))) continue; - if (first) return node; - if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); - } - } - - } - - if (hasOthers) this.sort(found); - return (first) ? null : found; - - } - /**/ - - /**/ - querySelector: if (context.querySelectorAll) { - - if (!this.isHTMLDocument - || qsaFailExpCache[expression] - //TODO: only skip when expression is actually mixed case - || this.brokenMixedCaseQSA - || (this.brokenCheckedQSA && expression.indexOf(':checked') > -1) - || (this.brokenEmptyAttributeQSA && reEmptyAttribute.test(expression)) - || (!contextIsDocument //Abort when !contextIsDocument and... - // there are multiple expressions in the selector - // since we currently only fix non-document rooted QSA for single expression selectors - && expression.indexOf(',') > -1 - ) - || Slick.disableQSA - ) break querySelector; - - var _expression = expression, _context = context; - if (!contextIsDocument){ - // non-document rooted QSA - // credits to Andrew Dupont - var currentId = _context.getAttribute('id'), slickid = 'slickid__'; - _context.setAttribute('id', slickid); - _expression = '#' + slickid + ' ' + _expression; - context = _context.parentNode; - } - - try { - if (first) return context.querySelector(_expression) || null; - else nodes = context.querySelectorAll(_expression); - } catch(e) { - qsaFailExpCache[expression] = 1; - break querySelector; - } finally { - if (!contextIsDocument){ - if (currentId) _context.setAttribute('id', currentId); - else _context.removeAttribute('id'); - context = _context; - } - } - - if (this.starSelectsClosedQSA) for (i = 0; node = nodes[i++];){ - if (node.nodeName > '@' && !(hasOthers && uniques[this.getUID(node)])) found.push(node); - } else for (i = 0; node = nodes[i++];){ - if (!(hasOthers && uniques[this.getUID(node)])) found.push(node); - } - - if (hasOthers) this.sort(found); - return found; - - } - /**/ - - parsed = this.Slick.parse(expression); - if (!parsed.length) return found; - } else if (expression == null){ // there is no expression - return found; - } else if (expression.Slick){ // expression is a parsed Slick object - parsed = expression; - } else if (this.contains(context.documentElement || context, expression)){ // expression is a node - (found) ? found.push(expression) : found = expression; - return found; - } else { // other junk - return found; - } - - /**//**/ - - // cache elements for the nth selectors - - this.posNTH = {}; - this.posNTHLast = {}; - this.posNTHType = {}; - this.posNTHTypeLast = {}; - - /**//**/ - - // if append is null and there is only a single selector with one expression use pushArray, else use pushUID - this.push = (!hasOthers && (first || (parsed.length == 1 && parsed.expressions[0].length == 1))) ? this.pushArray : this.pushUID; - - if (found == null) found = []; - - // default engine - - var j, m, n; - var combinator, tag, id, classList, classes, attributes, pseudos; - var currentItems, currentExpression, currentBit, lastBit, expressions = parsed.expressions; - - search: for (i = 0; (currentExpression = expressions[i]); i++) for (j = 0; (currentBit = currentExpression[j]); j++){ - - combinator = 'combinator:' + currentBit.combinator; - if (!this[combinator]) continue search; - - tag = (this.isXMLDocument) ? currentBit.tag : currentBit.tag.toUpperCase(); - id = currentBit.id; - classList = currentBit.classList; - classes = currentBit.classes; - attributes = currentBit.attributes; - pseudos = currentBit.pseudos; - lastBit = (j === (currentExpression.length - 1)); - - this.bitUniques = {}; - - if (lastBit){ - this.uniques = uniques; - this.found = found; - } else { - this.uniques = {}; - this.found = []; - } - - if (j === 0){ - this[combinator](context, tag, id, classes, attributes, pseudos, classList); - if (first && lastBit && found.length) break search; - } else { - if (first && lastBit) for (m = 0, n = currentItems.length; m < n; m++){ - this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList); - if (found.length) break search; - } else for (m = 0, n = currentItems.length; m < n; m++) this[combinator](currentItems[m], tag, id, classes, attributes, pseudos, classList); - } - - currentItems = this.found; - } - - // should sort if there are nodes in append and if you pass multiple expressions. - if (hasOthers || (parsed.expressions.length > 1)) this.sort(found); - - return (first) ? (found[0] || null) : found; -}; - -// Utils - -local.uidx = 1; -local.uidk = 'slick-uniqueid'; - -local.getUIDXML = function(node){ - var uid = node.getAttribute(this.uidk); - if (!uid){ - uid = this.uidx++; - node.setAttribute(this.uidk, uid); - } - return uid; -}; - -local.getUIDHTML = function(node){ - return node.uniqueNumber || (node.uniqueNumber = this.uidx++); -}; - -// sort based on the setDocument documentSorter method. - -local.sort = function(results){ - if (!this.documentSorter) return results; - results.sort(this.documentSorter); - return results; -}; - -/**//**/ - -local.cacheNTH = {}; - -local.matchNTH = /^([+-]?\d*)?([a-z]+)?([+-]\d+)?$/; - -local.parseNTHArgument = function(argument){ - var parsed = argument.match(this.matchNTH); - if (!parsed) return false; - var special = parsed[2] || false; - var a = parsed[1] || 1; - if (a == '-') a = -1; - var b = +parsed[3] || 0; - parsed = - (special == 'n') ? {a: a, b: b} : - (special == 'odd') ? {a: 2, b: 1} : - (special == 'even') ? {a: 2, b: 0} : {a: 0, b: a}; - - return (this.cacheNTH[argument] = parsed); -}; - -local.createNTHPseudo = function(child, sibling, positions, ofType){ - return function(node, argument){ - var uid = this.getUID(node); - if (!this[positions][uid]){ - var parent = node.parentNode; - if (!parent) return false; - var el = parent[child], count = 1; - if (ofType){ - var nodeName = node.nodeName; - do { - if (el.nodeName != nodeName) continue; - this[positions][this.getUID(el)] = count++; - } while ((el = el[sibling])); - } else { - do { - if (el.nodeType != 1) continue; - this[positions][this.getUID(el)] = count++; - } while ((el = el[sibling])); - } - } - argument = argument || 'n'; - var parsed = this.cacheNTH[argument] || this.parseNTHArgument(argument); - if (!parsed) return false; - var a = parsed.a, b = parsed.b, pos = this[positions][uid]; - if (a == 0) return b == pos; - if (a > 0){ - if (pos < b) return false; - } else { - if (b < pos) return false; - } - return ((pos - b) % a) == 0; - }; -}; - -/**//**/ - -local.pushArray = function(node, tag, id, classes, attributes, pseudos){ - if (this.matchSelector(node, tag, id, classes, attributes, pseudos)) this.found.push(node); -}; - -local.pushUID = function(node, tag, id, classes, attributes, pseudos){ - var uid = this.getUID(node); - if (!this.uniques[uid] && this.matchSelector(node, tag, id, classes, attributes, pseudos)){ - this.uniques[uid] = true; - this.found.push(node); - } -}; - -local.matchNode = function(node, selector){ - if (this.isHTMLDocument && this.nativeMatchesSelector){ - try { - return this.nativeMatchesSelector.call(node, selector.replace(/\[([^=]+)=\s*([^'"\]]+?)\s*\]/g, '[$1="$2"]')); - } catch(matchError) {} - } - - var parsed = this.Slick.parse(selector); - if (!parsed) return true; - - // simple (single) selectors - var expressions = parsed.expressions, simpleExpCounter = 0, i; - for (i = 0; (currentExpression = expressions[i]); i++){ - if (currentExpression.length == 1){ - var exp = currentExpression[0]; - if (this.matchSelector(node, (this.isXMLDocument) ? exp.tag : exp.tag.toUpperCase(), exp.id, exp.classes, exp.attributes, exp.pseudos)) return true; - simpleExpCounter++; - } - } - - if (simpleExpCounter == parsed.length) return false; - - var nodes = this.search(this.document, parsed), item; - for (i = 0; item = nodes[i++];){ - if (item === node) return true; - } - return false; -}; - -local.matchPseudo = function(node, name, argument){ - var pseudoName = 'pseudo:' + name; - if (this[pseudoName]) return this[pseudoName](node, argument); - var attribute = this.getAttribute(node, name); - return (argument) ? argument == attribute : !!attribute; -}; - -local.matchSelector = function(node, tag, id, classes, attributes, pseudos){ - if (tag){ - var nodeName = (this.isXMLDocument) ? node.nodeName : node.nodeName.toUpperCase(); - if (tag == '*'){ - if (nodeName < '@') return false; // Fix for comment nodes and closed nodes - } else { - if (nodeName != tag) return false; - } - } - - if (id && node.getAttribute('id') != id) return false; - - var i, part, cls; - if (classes) for (i = classes.length; i--;){ - cls = this.getAttribute(node, 'class'); - if (!(cls && classes[i].regexp.test(cls))) return false; - } - if (attributes) for (i = attributes.length; i--;){ - part = attributes[i]; - if (part.operator ? !part.test(this.getAttribute(node, part.key)) : !this.hasAttribute(node, part.key)) return false; - } - if (pseudos) for (i = pseudos.length; i--;){ - part = pseudos[i]; - if (!this.matchPseudo(node, part.key, part.value)) return false; - } - return true; -}; - -var combinators = { - - ' ': function(node, tag, id, classes, attributes, pseudos, classList){ // all child nodes, any level - - var i, item, children; - - if (this.isHTMLDocument){ - getById: if (id){ - item = this.document.getElementById(id); - if ((!item && node.all) || (this.idGetsName && item && item.getAttributeNode('id').nodeValue != id)){ - // all[id] returns all the elements with that name or id inside node - // if theres just one it will return the element, else it will be a collection - children = node.all[id]; - if (!children) return; - if (!children[0]) children = [children]; - for (i = 0; item = children[i++];){ - var idNode = item.getAttributeNode('id'); - if (idNode && idNode.nodeValue == id){ - this.push(item, tag, null, classes, attributes, pseudos); - break; - } - } - return; - } - if (!item){ - // if the context is in the dom we return, else we will try GEBTN, breaking the getById label - if (this.contains(this.root, node)) return; - else break getById; - } else if (this.document !== node && !this.contains(node, item)) return; - this.push(item, tag, null, classes, attributes, pseudos); - return; - } - getByClass: if (classes && node.getElementsByClassName && !this.brokenGEBCN){ - children = node.getElementsByClassName(classList.join(' ')); - if (!(children && children.length)) break getByClass; - for (i = 0; item = children[i++];) this.push(item, tag, id, null, attributes, pseudos); - return; - } - } - getByTag: { - children = node.getElementsByTagName(tag); - if (!(children && children.length)) break getByTag; - if (!this.brokenStarGEBTN) tag = null; - for (i = 0; item = children[i++];) this.push(item, tag, id, classes, attributes, pseudos); - } - }, - - '>': function(node, tag, id, classes, attributes, pseudos){ // direct children - if ((node = node.firstChild)) do { - if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos); - } while ((node = node.nextSibling)); - }, - - '+': function(node, tag, id, classes, attributes, pseudos){ // next sibling - while ((node = node.nextSibling)) if (node.nodeType == 1){ - this.push(node, tag, id, classes, attributes, pseudos); - break; - } - }, - - '^': function(node, tag, id, classes, attributes, pseudos){ // first child - node = node.firstChild; - if (node){ - if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos); - else this['combinator:+'](node, tag, id, classes, attributes, pseudos); - } - }, - - '~': function(node, tag, id, classes, attributes, pseudos){ // next siblings - while ((node = node.nextSibling)){ - if (node.nodeType != 1) continue; - var uid = this.getUID(node); - if (this.bitUniques[uid]) break; - this.bitUniques[uid] = true; - this.push(node, tag, id, classes, attributes, pseudos); - } - }, - - '++': function(node, tag, id, classes, attributes, pseudos){ // next sibling and previous sibling - this['combinator:+'](node, tag, id, classes, attributes, pseudos); - this['combinator:!+'](node, tag, id, classes, attributes, pseudos); - }, - - '~~': function(node, tag, id, classes, attributes, pseudos){ // next siblings and previous siblings - this['combinator:~'](node, tag, id, classes, attributes, pseudos); - this['combinator:!~'](node, tag, id, classes, attributes, pseudos); - }, - - '!': function(node, tag, id, classes, attributes, pseudos){ // all parent nodes up to document - while ((node = node.parentNode)) if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos); - }, - - '!>': function(node, tag, id, classes, attributes, pseudos){ // direct parent (one level) - node = node.parentNode; - if (node !== this.document) this.push(node, tag, id, classes, attributes, pseudos); - }, - - '!+': function(node, tag, id, classes, attributes, pseudos){ // previous sibling - while ((node = node.previousSibling)) if (node.nodeType == 1){ - this.push(node, tag, id, classes, attributes, pseudos); - break; - } - }, - - '!^': function(node, tag, id, classes, attributes, pseudos){ // last child - node = node.lastChild; - if (node){ - if (node.nodeType == 1) this.push(node, tag, id, classes, attributes, pseudos); - else this['combinator:!+'](node, tag, id, classes, attributes, pseudos); - } - }, - - '!~': function(node, tag, id, classes, attributes, pseudos){ // previous siblings - while ((node = node.previousSibling)){ - if (node.nodeType != 1) continue; - var uid = this.getUID(node); - if (this.bitUniques[uid]) break; - this.bitUniques[uid] = true; - this.push(node, tag, id, classes, attributes, pseudos); - } - } - -}; - -for (var c in combinators) local['combinator:' + c] = combinators[c]; - -var pseudos = { - - /**/ - - 'empty': function(node){ - var child = node.firstChild; - return !(child && child.nodeType == 1) && !(node.innerText || node.textContent || '').length; - }, - - 'not': function(node, expression){ - return !this.matchNode(node, expression); - }, - - 'contains': function(node, text){ - return (node.innerText || node.textContent || '').indexOf(text) > -1; - }, - - 'first-child': function(node){ - while ((node = node.previousSibling)) if (node.nodeType == 1) return false; - return true; - }, - - 'last-child': function(node){ - while ((node = node.nextSibling)) if (node.nodeType == 1) return false; - return true; - }, - - 'only-child': function(node){ - var prev = node; - while ((prev = prev.previousSibling)) if (prev.nodeType == 1) return false; - var next = node; - while ((next = next.nextSibling)) if (next.nodeType == 1) return false; - return true; - }, - - /**/ - - 'nth-child': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTH'), - - 'nth-last-child': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHLast'), - - 'nth-of-type': local.createNTHPseudo('firstChild', 'nextSibling', 'posNTHType', true), - - 'nth-last-of-type': local.createNTHPseudo('lastChild', 'previousSibling', 'posNTHTypeLast', true), - - 'index': function(node, index){ - return this['pseudo:nth-child'](node, '' + (index + 1)); - }, - - 'even': function(node){ - return this['pseudo:nth-child'](node, '2n'); - }, - - 'odd': function(node){ - return this['pseudo:nth-child'](node, '2n+1'); - }, - - /**/ - - /**/ - - 'first-of-type': function(node){ - var nodeName = node.nodeName; - while ((node = node.previousSibling)) if (node.nodeName == nodeName) return false; - return true; - }, - - 'last-of-type': function(node){ - var nodeName = node.nodeName; - while ((node = node.nextSibling)) if (node.nodeName == nodeName) return false; - return true; - }, - - 'only-of-type': function(node){ - var prev = node, nodeName = node.nodeName; - while ((prev = prev.previousSibling)) if (prev.nodeName == nodeName) return false; - var next = node; - while ((next = next.nextSibling)) if (next.nodeName == nodeName) return false; - return true; - }, - - /**/ - - // custom pseudos - - 'enabled': function(node){ - return !node.disabled; - }, - - 'disabled': function(node){ - return node.disabled; - }, - - 'checked': function(node){ - return node.checked || node.selected; - }, - - 'focus': function(node){ - return this.isHTMLDocument && this.document.activeElement === node && (node.href || node.type || this.hasAttribute(node, 'tabindex')); - }, - - 'root': function(node){ - return (node === this.root); - }, - - 'selected': function(node){ - return node.selected; - } - - /**/ -}; - -for (var p in pseudos) local['pseudo:' + p] = pseudos[p]; - -// attributes methods - -var attributeGetters = local.attributeGetters = { - - 'for': function(){ - return ('htmlFor' in this) ? this.htmlFor : this.getAttribute('for'); - }, - - 'href': function(){ - return ('href' in this) ? this.getAttribute('href', 2) : this.getAttribute('href'); - }, - - 'style': function(){ - return (this.style) ? this.style.cssText : this.getAttribute('style'); - }, - - 'tabindex': function(){ - var attributeNode = this.getAttributeNode('tabindex'); - return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null; - }, - - 'type': function(){ - return this.getAttribute('type'); - }, - - 'maxlength': function(){ - var attributeNode = this.getAttributeNode('maxLength'); - return (attributeNode && attributeNode.specified) ? attributeNode.nodeValue : null; - } - -}; - -attributeGetters.MAXLENGTH = attributeGetters.maxLength = attributeGetters.maxlength; - -// Slick - -var Slick = local.Slick = (this.Slick || {}); - -Slick.version = '1.1.7'; - -// Slick finder - -Slick.search = function(context, expression, append){ - return local.search(context, expression, append); -}; - -Slick.find = function(context, expression){ - return local.search(context, expression, null, true); -}; - -// Slick containment checker - -Slick.contains = function(container, node){ - local.setDocument(container); - return local.contains(container, node); -}; - -// Slick attribute getter - -Slick.getAttribute = function(node, name){ - local.setDocument(node); - return local.getAttribute(node, name); -}; - -Slick.hasAttribute = function(node, name){ - local.setDocument(node); - return local.hasAttribute(node, name); -}; - -// Slick matcher - -Slick.match = function(node, selector){ - if (!(node && selector)) return false; - if (!selector || selector === node) return true; - local.setDocument(node); - return local.matchNode(node, selector); -}; - -// Slick attribute accessor - -Slick.defineAttributeGetter = function(name, fn){ - local.attributeGetters[name] = fn; - return this; -}; - -Slick.lookupAttributeGetter = function(name){ - return local.attributeGetters[name]; -}; - -// Slick pseudo accessor - -Slick.definePseudo = function(name, fn){ - local['pseudo:' + name] = function(node, argument){ - return fn.call(node, argument); - }; - return this; -}; - -Slick.lookupPseudo = function(name){ - var pseudo = local['pseudo:' + name]; - if (pseudo) return function(argument){ - return pseudo.call(this, argument); - }; - return null; -}; - -// Slick overrides accessor - -Slick.override = function(regexp, fn){ - local.override(regexp, fn); - return this; -}; - -Slick.isXML = local.isXML; - -Slick.uidOf = function(node){ - return local.getUIDHTML(node); -}; - -if (!this.Slick) this.Slick = Slick; - -}).apply(/**/(typeof exports != 'undefined') ? exports : /**/this); - - -/* ---- - -name: Element - -description: One of the most important items in MooTools. Contains the dollar function, the dollars function, and an handful of cross-browser, time-saver methods to let you easily work with HTML Elements. - -license: MIT-style license. - -requires: [Window, Document, Array, String, Function, Object, Number, Slick.Parser, Slick.Finder] - -provides: [Element, Elements, $, $$, IFrame, Selectors] - -... -*/ - -var Element = this.Element = function(tag, props){ - var konstructor = Element.Constructors[tag]; - if (konstructor) return konstructor(props); - if (typeof tag != 'string') return document.id(tag).set(props); - - if (!props) props = {}; - - if (!(/^[\w-]+$/).test(tag)){ - var parsed = Slick.parse(tag).expressions[0][0]; - tag = (parsed.tag == '*') ? 'div' : parsed.tag; - if (parsed.id && props.id == null) props.id = parsed.id; - - var attributes = parsed.attributes; - if (attributes) for (var attr, i = 0, l = attributes.length; i < l; i++){ - attr = attributes[i]; - if (props[attr.key] != null) continue; - - if (attr.value != null && attr.operator == '=') props[attr.key] = attr.value; - else if (!attr.value && !attr.operator) props[attr.key] = true; - } - - if (parsed.classList && props['class'] == null) props['class'] = parsed.classList.join(' '); - } - - return document.newElement(tag, props); -}; - - -if (Browser.Element){ - Element.prototype = Browser.Element.prototype; - // IE8 and IE9 require the wrapping. - Element.prototype._fireEvent = (function(fireEvent){ - return function(type, event){ - return fireEvent.call(this, type, event); - }; - })(Element.prototype.fireEvent); -} - -new Type('Element', Element).mirror(function(name){ - if (Array.prototype[name]) return; - - var obj = {}; - obj[name] = function(){ - var results = [], args = arguments, elements = true; - for (var i = 0, l = this.length; i < l; i++){ - var element = this[i], result = results[i] = element[name].apply(element, args); - elements = (elements && typeOf(result) == 'element'); - } - return (elements) ? new Elements(results) : results; - }; - - Elements.implement(obj); -}); - -if (!Browser.Element){ - Element.parent = Object; - - Element.Prototype = { - '$constructor': Element, - '$family': Function.from('element').hide() - }; - - Element.mirror(function(name, method){ - Element.Prototype[name] = method; - }); -} - -Element.Constructors = {}; - - - -var IFrame = new Type('IFrame', function(){ - var params = Array.link(arguments, { - properties: Type.isObject, - iframe: function(obj){ - return (obj != null); - } - }); - - var props = params.properties || {}, iframe; - if (params.iframe) iframe = document.id(params.iframe); - var onload = props.onload || function(){}; - delete props.onload; - props.id = props.name = [props.id, props.name, iframe ? (iframe.id || iframe.name) : 'IFrame_' + String.uniqueID()].pick(); - iframe = new Element(iframe || 'iframe', props); - - var onLoad = function(){ - onload.call(iframe.contentWindow); - }; - - if (window.frames[props.id]) onLoad(); - else iframe.addListener('load', onLoad); - return iframe; -}); - -var Elements = this.Elements = function(nodes){ - if (nodes && nodes.length){ - var uniques = {}, node; - for (var i = 0; node = nodes[i++];){ - var uid = Slick.uidOf(node); - if (!uniques[uid]){ - uniques[uid] = true; - this.push(node); - } - } - } -}; - -Elements.prototype = {length: 0}; -Elements.parent = Array; - -new Type('Elements', Elements).implement({ - - filter: function(filter, bind){ - if (!filter) return this; - return new Elements(Array.filter(this, (typeOf(filter) == 'string') ? function(item){ - return item.match(filter); - } : filter, bind)); - }.protect(), - - push: function(){ - var length = this.length; - for (var i = 0, l = arguments.length; i < l; i++){ - var item = document.id(arguments[i]); - if (item) this[length++] = item; - } - return (this.length = length); - }.protect(), - - unshift: function(){ - var items = []; - for (var i = 0, l = arguments.length; i < l; i++){ - var item = document.id(arguments[i]); - if (item) items.push(item); - } - return Array.prototype.unshift.apply(this, items); - }.protect(), - - concat: function(){ - var newElements = new Elements(this); - for (var i = 0, l = arguments.length; i < l; i++){ - var item = arguments[i]; - if (Type.isEnumerable(item)) newElements.append(item); - else newElements.push(item); - } - return newElements; - }.protect(), - - append: function(collection){ - for (var i = 0, l = collection.length; i < l; i++) this.push(collection[i]); - return this; - }.protect(), - - empty: function(){ - while (this.length) delete this[--this.length]; - return this; - }.protect() - -}); - - - -(function(){ - -// FF, IE -var splice = Array.prototype.splice, object = {'0': 0, '1': 1, length: 2}; - -splice.call(object, 1, 1); -if (object[1] == 1) Elements.implement('splice', function(){ - var length = this.length; - var result = splice.apply(this, arguments); - while (length >= this.length) delete this[length--]; - return result; -}.protect()); - -Array.forEachMethod(function(method, name){ - Elements.implement(name, method); -}); - -Array.mirror(Elements); - -/**/ -var createElementAcceptsHTML; -try { - createElementAcceptsHTML = (document.createElement('').name == 'x'); -} catch (e){} - -var escapeQuotes = function(html){ - return ('' + html).replace(/&/g, '&').replace(/"/g, '"'); -}; -/**/ - -Document.implement({ - - newElement: function(tag, props){ - if (props && props.checked != null) props.defaultChecked = props.checked; - /**/// Fix for readonly name and type properties in IE < 8 - if (createElementAcceptsHTML && props){ - tag = '<' + tag; - if (props.name) tag += ' name="' + escapeQuotes(props.name) + '"'; - if (props.type) tag += ' type="' + escapeQuotes(props.type) + '"'; - tag += '>'; - delete props.name; - delete props.type; - } - /**/ - return this.id(this.createElement(tag)).set(props); - } - -}); - -})(); - -(function(){ - -Slick.uidOf(window); -Slick.uidOf(document); - -Document.implement({ - - newTextNode: function(text){ - return this.createTextNode(text); - }, - - getDocument: function(){ - return this; - }, - - getWindow: function(){ - return this.window; - }, - - id: (function(){ - - var types = { - - string: function(id, nocash, doc){ - id = Slick.find(doc, '#' + id.replace(/(\W)/g, '\\$1')); - return (id) ? types.element(id, nocash) : null; - }, - - element: function(el, nocash){ - Slick.uidOf(el); - if (!nocash && !el.$family && !(/^(?:object|embed)$/i).test(el.tagName)){ - var fireEvent = el.fireEvent; - // wrapping needed in IE7, or else crash - el._fireEvent = function(type, event){ - return fireEvent(type, event); - }; - Object.append(el, Element.Prototype); - } - return el; - }, - - object: function(obj, nocash, doc){ - if (obj.toElement) return types.element(obj.toElement(doc), nocash); - return null; - } - - }; - - types.textnode = types.whitespace = types.window = types.document = function(zero){ - return zero; - }; - - return function(el, nocash, doc){ - if (el && el.$family && el.uniqueNumber) return el; - var type = typeOf(el); - return (types[type]) ? types[type](el, nocash, doc || document) : null; - }; - - })() - -}); - -if (window.$ == null) Window.implement('$', function(el, nc){ - return document.id(el, nc, this.document); -}); - -Window.implement({ - - getDocument: function(){ - return this.document; - }, - - getWindow: function(){ - return this; - } - -}); - -[Document, Element].invoke('implement', { - - getElements: function(expression){ - return Slick.search(this, expression, new Elements); - }, - - getElement: function(expression){ - return document.id(Slick.find(this, expression)); - } - -}); - -var contains = {contains: function(element){ - return Slick.contains(this, element); -}}; - -if (!document.contains) Document.implement(contains); -if (!document.createElement('div').contains) Element.implement(contains); - - - -// tree walking - -var injectCombinator = function(expression, combinator){ - if (!expression) return combinator; - - expression = Object.clone(Slick.parse(expression)); - - var expressions = expression.expressions; - for (var i = expressions.length; i--;) - expressions[i][0].combinator = combinator; - - return expression; -}; - -Object.forEach({ - getNext: '~', - getPrevious: '!~', - getParent: '!' -}, function(combinator, method){ - Element.implement(method, function(expression){ - return this.getElement(injectCombinator(expression, combinator)); - }); -}); - -Object.forEach({ - getAllNext: '~', - getAllPrevious: '!~', - getSiblings: '~~', - getChildren: '>', - getParents: '!' -}, function(combinator, method){ - Element.implement(method, function(expression){ - return this.getElements(injectCombinator(expression, combinator)); - }); -}); - -Element.implement({ - - getFirst: function(expression){ - return document.id(Slick.search(this, injectCombinator(expression, '>'))[0]); - }, - - getLast: function(expression){ - return document.id(Slick.search(this, injectCombinator(expression, '>')).getLast()); - }, - - getWindow: function(){ - return this.ownerDocument.window; - }, - - getDocument: function(){ - return this.ownerDocument; - }, - - getElementById: function(id){ - return document.id(Slick.find(this, '#' + ('' + id).replace(/(\W)/g, '\\$1'))); - }, - - match: function(expression){ - return !expression || Slick.match(this, expression); - } - -}); - - - -if (window.$$ == null) Window.implement('$$', function(selector){ - if (arguments.length == 1){ - if (typeof selector == 'string') return Slick.search(this.document, selector, new Elements); - else if (Type.isEnumerable(selector)) return new Elements(selector); - } - return new Elements(arguments); -}); - -// Inserters - -var inserters = { - - before: function(context, element){ - var parent = element.parentNode; - if (parent) parent.insertBefore(context, element); - }, - - after: function(context, element){ - var parent = element.parentNode; - if (parent) parent.insertBefore(context, element.nextSibling); - }, - - bottom: function(context, element){ - element.appendChild(context); - }, - - top: function(context, element){ - element.insertBefore(context, element.firstChild); - } - -}; - -inserters.inside = inserters.bottom; - - - -// getProperty / setProperty - -var propertyGetters = {}, propertySetters = {}; - -// properties - -var properties = {}; -Array.forEach([ - 'type', 'value', 'defaultValue', 'accessKey', 'cellPadding', 'cellSpacing', 'colSpan', - 'frameBorder', 'rowSpan', 'tabIndex', 'useMap' -], function(property){ - properties[property.toLowerCase()] = property; -}); - -properties.html = 'innerHTML'; -properties.text = (document.createElement('div').textContent == null) ? 'innerText': 'textContent'; - -Object.forEach(properties, function(real, key){ - propertySetters[key] = function(node, value){ - node[real] = value; - }; - propertyGetters[key] = function(node){ - return node[real]; - }; -}); - -// Booleans - -var bools = [ - 'compact', 'nowrap', 'ismap', 'declare', 'noshade', 'checked', - 'disabled', 'readOnly', 'multiple', 'selected', 'noresize', - 'defer', 'defaultChecked', 'autofocus', 'controls', 'autoplay', - 'loop' -]; - -var booleans = {}; -Array.forEach(bools, function(bool){ - var lower = bool.toLowerCase(); - booleans[lower] = bool; - propertySetters[lower] = function(node, value){ - node[bool] = !!value; - }; - propertyGetters[lower] = function(node){ - return !!node[bool]; - }; -}); - -// Special cases - -Object.append(propertySetters, { - - 'class': function(node, value){ - ('className' in node) ? node.className = (value || '') : node.setAttribute('class', value); - }, - - 'for': function(node, value){ - ('htmlFor' in node) ? node.htmlFor = value : node.setAttribute('for', value); - }, - - 'style': function(node, value){ - (node.style) ? node.style.cssText = value : node.setAttribute('style', value); - }, - - 'value': function(node, value){ - node.value = (value != null) ? value : ''; - } - -}); - -propertyGetters['class'] = function(node){ - return ('className' in node) ? node.className || null : node.getAttribute('class'); -}; - -/* */ -var el = document.createElement('button'); -// IE sets type as readonly and throws -try { el.type = 'button'; } catch(e){} -if (el.type != 'button') propertySetters.type = function(node, value){ - node.setAttribute('type', value); -}; -el = null; -/* */ - -/**/ -var input = document.createElement('input'); -input.value = 't'; -input.type = 'submit'; -if (input.value != 't') propertySetters.type = function(node, type){ - var value = node.value; - node.type = type; - node.value = value; -}; -input = null; -/**/ - -/* getProperty, setProperty */ - -/* */ -var pollutesGetAttribute = (function(div){ - div.random = 'attribute'; - return (div.getAttribute('random') == 'attribute'); -})(document.createElement('div')); - -var hasCloneBug = (function(test){ - test.innerHTML = ''; - return test.cloneNode(true).firstChild.childNodes.length != 1; -})(document.createElement('div')); -/* */ - -var hasClassList = !!document.createElement('div').classList; - -var classes = function(className){ - var classNames = (className || '').clean().split(" "), uniques = {}; - return classNames.filter(function(className){ - if (className !== "" && !uniques[className]) return uniques[className] = className; - }); -}; - -var addToClassList = function(name){ - this.classList.add(name); -}; - -var removeFromClassList = function(name){ - this.classList.remove(name); -}; - -Element.implement({ - - setProperty: function(name, value){ - var setter = propertySetters[name.toLowerCase()]; - if (setter){ - setter(this, value); - } else { - /* */ - var attributeWhiteList; - if (pollutesGetAttribute) attributeWhiteList = this.retrieve('$attributeWhiteList', {}); - /* */ - - if (value == null){ - this.removeAttribute(name); - /* */ - if (pollutesGetAttribute) delete attributeWhiteList[name]; - /* */ - } else { - this.setAttribute(name, '' + value); - /* */ - if (pollutesGetAttribute) attributeWhiteList[name] = true; - /* */ - } - } - return this; - }, - - setProperties: function(attributes){ - for (var attribute in attributes) this.setProperty(attribute, attributes[attribute]); - return this; - }, - - getProperty: function(name){ - var getter = propertyGetters[name.toLowerCase()]; - if (getter) return getter(this); - /* */ - if (pollutesGetAttribute){ - var attr = this.getAttributeNode(name), attributeWhiteList = this.retrieve('$attributeWhiteList', {}); - if (!attr) return null; - if (attr.expando && !attributeWhiteList[name]){ - var outer = this.outerHTML; - // segment by the opening tag and find mention of attribute name - if (outer.substr(0, outer.search(/\/?['"]?>(?![^<]*<['"])/)).indexOf(name) < 0) return null; - attributeWhiteList[name] = true; - } - } - /* */ - var result = Slick.getAttribute(this, name); - return (!result && !Slick.hasAttribute(this, name)) ? null : result; - }, - - getProperties: function(){ - var args = Array.from(arguments); - return args.map(this.getProperty, this).associate(args); - }, - - removeProperty: function(name){ - return this.setProperty(name, null); - }, - - removeProperties: function(){ - Array.each(arguments, this.removeProperty, this); - return this; - }, - - set: function(prop, value){ - var property = Element.Properties[prop]; - (property && property.set) ? property.set.call(this, value) : this.setProperty(prop, value); - }.overloadSetter(), - - get: function(prop){ - var property = Element.Properties[prop]; - return (property && property.get) ? property.get.apply(this) : this.getProperty(prop); - }.overloadGetter(), - - erase: function(prop){ - var property = Element.Properties[prop]; - (property && property.erase) ? property.erase.apply(this) : this.removeProperty(prop); - return this; - }, - - hasClass: hasClassList ? function(className){ - return this.classList.contains(className); - } : function(className){ - return this.className.clean().contains(className, ' '); - }, - - addClass: hasClassList ? function(className){ - classes(className).forEach(addToClassList, this); - return this; - } : function(className){ - this.className = classes(className + ' ' + this.className).join(' '); - return this; - }, - - removeClass: hasClassList ? function(className){ - classes(className).forEach(removeFromClassList, this); - return this; - } : function(className){ - var classNames = classes(this.className); - classes(className).forEach(classNames.erase, classNames); - this.className = classNames.join(' '); - return this; - }, - - toggleClass: function(className, force){ - if (force == null) force = !this.hasClass(className); - return (force) ? this.addClass(className) : this.removeClass(className); - }, - - adopt: function(){ - var parent = this, fragment, elements = Array.flatten(arguments), length = elements.length; - if (length > 1) parent = fragment = document.createDocumentFragment(); - - for (var i = 0; i < length; i++){ - var element = document.id(elements[i], true); - if (element) parent.appendChild(element); - } - - if (fragment) this.appendChild(fragment); - - return this; - }, - - appendText: function(text, where){ - return this.grab(this.getDocument().newTextNode(text), where); - }, - - grab: function(el, where){ - inserters[where || 'bottom'](document.id(el, true), this); - return this; - }, - - inject: function(el, where){ - inserters[where || 'bottom'](this, document.id(el, true)); - return this; - }, - - replaces: function(el){ - el = document.id(el, true); - el.parentNode.replaceChild(this, el); - return this; - }, - - wraps: function(el, where){ - el = document.id(el, true); - return this.replaces(el).grab(el, where); - }, - - getSelected: function(){ - this.selectedIndex; // Safari 3.2.1 - return new Elements(Array.from(this.options).filter(function(option){ - return option.selected; - })); - }, - - toQueryString: function(){ - var queryString = []; - this.getElements('input, select, textarea').each(function(el){ - var type = el.type; - if (!el.name || el.disabled || type == 'submit' || type == 'reset' || type == 'file' || type == 'image') return; - - var value = (el.get('tag') == 'select') ? el.getSelected().map(function(opt){ - // IE - return document.id(opt).get('value'); - }) : ((type == 'radio' || type == 'checkbox') && !el.checked) ? null : el.get('value'); - - Array.from(value).each(function(val){ - if (typeof val != 'undefined') queryString.push(encodeURIComponent(el.name) + '=' + encodeURIComponent(val)); - }); - }); - return queryString.join('&'); - } - -}); - - -// appendHTML - -var appendInserters = { - before: 'beforeBegin', - after: 'afterEnd', - bottom: 'beforeEnd', - top: 'afterBegin', - inside: 'beforeEnd' -}; - -Element.implement('appendHTML', ('insertAdjacentHTML' in document.createElement('div')) ? function(html, where){ - this.insertAdjacentHTML(appendInserters[where || 'bottom'], html); - return this; -} : function(html, where){ - var temp = new Element('div', {html: html}), - children = temp.childNodes, - fragment = temp.firstChild; - - if (!fragment) return this; - if (children.length > 1){ - fragment = document.createDocumentFragment(); - for (var i = 0, l = children.length; i < l; i++){ - fragment.appendChild(children[i]); - } - } - - inserters[where || 'bottom'](fragment, this); - return this; -}); - -var collected = {}, storage = {}; - -var get = function(uid){ - return (storage[uid] || (storage[uid] = {})); -}; - -var clean = function(item){ - var uid = item.uniqueNumber; - if (item.removeEvents) item.removeEvents(); - if (item.clearAttributes) item.clearAttributes(); - if (uid != null){ - delete collected[uid]; - delete storage[uid]; - } - return item; -}; - -var formProps = {input: 'checked', option: 'selected', textarea: 'value'}; - -Element.implement({ - - destroy: function(){ - var children = clean(this).getElementsByTagName('*'); - Array.each(children, clean); - Element.dispose(this); - return null; - }, - - empty: function(){ - Array.from(this.childNodes).each(Element.dispose); - return this; - }, - - dispose: function(){ - return (this.parentNode) ? this.parentNode.removeChild(this) : this; - }, - - clone: function(contents, keepid){ - contents = contents !== false; - var clone = this.cloneNode(contents), ce = [clone], te = [this], i; - - if (contents){ - ce.append(Array.from(clone.getElementsByTagName('*'))); - te.append(Array.from(this.getElementsByTagName('*'))); - } - - for (i = ce.length; i--;){ - var node = ce[i], element = te[i]; - if (!keepid) node.removeAttribute('id'); - /**/ - if (node.clearAttributes){ - node.clearAttributes(); - node.mergeAttributes(element); - node.removeAttribute('uniqueNumber'); - if (node.options){ - var no = node.options, eo = element.options; - for (var j = no.length; j--;) no[j].selected = eo[j].selected; - } - } - /**/ - var prop = formProps[element.tagName.toLowerCase()]; - if (prop && element[prop]) node[prop] = element[prop]; - } - - /**/ - if (hasCloneBug){ - var co = clone.getElementsByTagName('object'), to = this.getElementsByTagName('object'); - for (i = co.length; i--;) co[i].outerHTML = to[i].outerHTML; - } - /**/ - return document.id(clone); - } - -}); - -[Element, Window, Document].invoke('implement', { - - addListener: function(type, fn){ - if (window.attachEvent && !window.addEventListener){ - collected[Slick.uidOf(this)] = this; - } - if (this.addEventListener) this.addEventListener(type, fn, !!arguments[2]); - else this.attachEvent('on' + type, fn); - return this; - }, - - removeListener: function(type, fn){ - if (this.removeEventListener) this.removeEventListener(type, fn, !!arguments[2]); - else this.detachEvent('on' + type, fn); - return this; - }, - - retrieve: function(property, dflt){ - var storage = get(Slick.uidOf(this)), prop = storage[property]; - if (dflt != null && prop == null) prop = storage[property] = dflt; - return prop != null ? prop : null; - }, - - store: function(property, value){ - var storage = get(Slick.uidOf(this)); - storage[property] = value; - return this; - }, - - eliminate: function(property){ - var storage = get(Slick.uidOf(this)); - delete storage[property]; - return this; - } - -}); - -/**/ -if (window.attachEvent && !window.addEventListener){ - var gc = function(){ - Object.each(collected, clean); - if (window.CollectGarbage) CollectGarbage(); - window.removeListener('unload', gc); - } - window.addListener('unload', gc); -} -/**/ - -Element.Properties = {}; - - - -Element.Properties.style = { - - set: function(style){ - this.style.cssText = style; - }, - - get: function(){ - return this.style.cssText; - }, - - erase: function(){ - this.style.cssText = ''; - } - -}; - -Element.Properties.tag = { - - get: function(){ - return this.tagName.toLowerCase(); - } - -}; - -Element.Properties.html = { - - set: function(html){ - if (html == null) html = ''; - else if (typeOf(html) == 'array') html = html.join(''); - this.innerHTML = html; - }, - - erase: function(){ - this.innerHTML = ''; - } - -}; - -var supportsHTML5Elements = true, supportsTableInnerHTML = true, supportsTRInnerHTML = true; - -/**/ -// technique by jdbarlett - http://jdbartlett.com/innershiv/ -var div = document.createElement('div'); -div.innerHTML = ''; -supportsHTML5Elements = (div.childNodes.length == 1); -if (!supportsHTML5Elements){ - var tags = 'abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video'.split(' '), - fragment = document.createDocumentFragment(), l = tags.length; - while (l--) fragment.createElement(tags[l]); -} -div = null; -/**/ - -/**/ -supportsTableInnerHTML = Function.attempt(function(){ - var table = document.createElement('table'); - table.innerHTML = ''; - return true; -}); - -/**/ -var tr = document.createElement('tr'), html = ''; -tr.innerHTML = html; -supportsTRInnerHTML = (tr.innerHTML == html); -tr = null; -/**/ - -if (!supportsTableInnerHTML || !supportsTRInnerHTML || !supportsHTML5Elements){ - - Element.Properties.html.set = (function(set){ - - var translations = { - table: [1, '', '
        '], - select: [1, ''], - tbody: [2, '', '
        '], - tr: [3, '', '
        '] - }; - - translations.thead = translations.tfoot = translations.tbody; - - return function(html){ - var wrap = translations[this.get('tag')]; - if (!wrap && !supportsHTML5Elements) wrap = [0, '', '']; - if (!wrap) return set.call(this, html); - - var level = wrap[0], wrapper = document.createElement('div'), target = wrapper; - if (!supportsHTML5Elements) fragment.appendChild(wrapper); - wrapper.innerHTML = [wrap[1], html, wrap[2]].flatten().join(''); - while (level--) target = target.firstChild; - this.empty().adopt(target.childNodes); - if (!supportsHTML5Elements) fragment.removeChild(wrapper); - wrapper = null; - }; - - })(Element.Properties.html.set); -} -/*
        */ - -/**/ -var testForm = document.createElement('form'); -testForm.innerHTML = ''; - -if (testForm.firstChild.value != 's') Element.Properties.value = { - - set: function(value){ - var tag = this.get('tag'); - if (tag != 'select') return this.setProperty('value', value); - var options = this.getElements('option'); - value = String(value); - for (var i = 0; i < options.length; i++){ - var option = options[i], - attr = option.getAttributeNode('value'), - optionValue = (attr && attr.specified) ? option.value : option.get('text'); - if (optionValue === value) return option.selected = true; - } - }, - - get: function(){ - var option = this, tag = option.get('tag'); - - if (tag != 'select' && tag != 'option') return this.getProperty('value'); - - if (tag == 'select' && !(option = option.getSelected()[0])) return ''; - - var attr = option.getAttributeNode('value'); - return (attr && attr.specified) ? option.value : option.get('text'); - } - -}; -testForm = null; -/**/ - -/**/ -if (document.createElement('div').getAttributeNode('id')) Element.Properties.id = { - set: function(id){ - this.id = this.getAttributeNode('id').value = id; - }, - get: function(){ - return this.id || null; - }, - erase: function(){ - this.id = this.getAttributeNode('id').value = ''; - } -}; -/**/ - -})(); - - -/* ---- - -name: Element.Style - -description: Contains methods for interacting with the styles of Elements in a fashionable way. - -license: MIT-style license. - -requires: Element - -provides: Element.Style - -... -*/ - -(function(){ - -var html = document.html, el; - -// -// Check for oldIE, which does not remove styles when they're set to null -el = document.createElement('div'); -el.style.color = 'red'; -el.style.color = null; -var doesNotRemoveStyles = el.style.color == 'red'; - -// check for oldIE, which returns border* shorthand styles in the wrong order (color-width-style instead of width-style-color) -var border = '1px solid #123abc'; -el.style.border = border; -var returnsBordersInWrongOrder = el.style.border != border; -el = null; -// - -var hasGetComputedStyle = !!window.getComputedStyle; - -Element.Properties.styles = {set: function(styles){ - this.setStyles(styles); -}}; - -var hasOpacity = (html.style.opacity != null), - hasFilter = (html.style.filter != null), - reAlpha = /alpha\(opacity=([\d.]+)\)/i; - -var setVisibility = function(element, opacity){ - element.store('$opacity', opacity); - element.style.visibility = opacity > 0 || opacity == null ? 'visible' : 'hidden'; -}; - -// -var setFilter = function(element, regexp, value){ - var style = element.style, - filter = style.filter || element.getComputedStyle('filter') || ''; - style.filter = (regexp.test(filter) ? filter.replace(regexp, value) : filter + ' ' + value).trim(); - if (!style.filter) style.removeAttribute('filter'); -}; -// - -var setOpacity = (hasOpacity ? function(element, opacity){ - element.style.opacity = opacity; -} : (hasFilter ? function(element, opacity){ - if (!element.currentStyle || !element.currentStyle.hasLayout) element.style.zoom = 1; - if (opacity == null || opacity == 1){ - setFilter(element, reAlpha, ''); - if (opacity == 1 && getOpacity(element) != 1) setFilter(element, reAlpha, 'alpha(opacity=100)'); - } else { - setFilter(element, reAlpha, 'alpha(opacity=' + (opacity * 100).limit(0, 100).round() + ')'); - } -} : setVisibility)); - -var getOpacity = (hasOpacity ? function(element){ - var opacity = element.style.opacity || element.getComputedStyle('opacity'); - return (opacity == '') ? 1 : opacity.toFloat(); -} : (hasFilter ? function(element){ - var filter = (element.style.filter || element.getComputedStyle('filter')), - opacity; - if (filter) opacity = filter.match(reAlpha); - return (opacity == null || filter == null) ? 1 : (opacity[1] / 100); -} : function(element){ - var opacity = element.retrieve('$opacity'); - if (opacity == null) opacity = (element.style.visibility == 'hidden' ? 0 : 1); - return opacity; -})); - -var floatName = (html.style.cssFloat == null) ? 'styleFloat' : 'cssFloat', - namedPositions = {left: '0%', top: '0%', center: '50%', right: '100%', bottom: '100%'}, - hasBackgroundPositionXY = (html.style.backgroundPositionX != null); - -// -var removeStyle = function(style, property){ - if (property == 'backgroundPosition'){ - style.removeAttribute(property + 'X'); - property += 'Y'; - } - style.removeAttribute(property); -}; -// - -Element.implement({ - - getComputedStyle: function(property){ - if (!hasGetComputedStyle && this.currentStyle) return this.currentStyle[property.camelCase()]; - var defaultView = Element.getDocument(this).defaultView, - computed = defaultView ? defaultView.getComputedStyle(this, null) : null; - return (computed) ? computed.getPropertyValue((property == floatName) ? 'float' : property.hyphenate()) : ''; - }, - - setStyle: function(property, value){ - if (property == 'opacity'){ - if (value != null) value = parseFloat(value); - setOpacity(this, value); - return this; - } - property = (property == 'float' ? floatName : property).camelCase(); - if (typeOf(value) != 'string'){ - var map = (Element.Styles[property] || '@').split(' '); - value = Array.from(value).map(function(val, i){ - if (!map[i]) return ''; - return (typeOf(val) == 'number') ? map[i].replace('@', Math.round(val)) : val; - }).join(' '); - } else if (value == String(Number(value))){ - value = Math.round(value); - } - this.style[property] = value; - // - if ((value == '' || value == null) && doesNotRemoveStyles && this.style.removeAttribute){ - removeStyle(this.style, property); - } - // - return this; - }, - - getStyle: function(property){ - if (property == 'opacity') return getOpacity(this); - property = (property == 'float' ? floatName : property).camelCase(); - var result = this.style[property]; - if (!result || property == 'zIndex'){ - if (Element.ShortStyles.hasOwnProperty(property)){ - result = []; - for (var s in Element.ShortStyles[property]) result.push(this.getStyle(s)); - return result.join(' '); - } - result = this.getComputedStyle(property); - } - if (hasBackgroundPositionXY && /^backgroundPosition[XY]?$/.test(property)){ - return result.replace(/(top|right|bottom|left)/g, function(position){ - return namedPositions[position]; - }) || '0px'; - } - if (!result && property == 'backgroundPosition') return '0px 0px'; - if (result){ - result = String(result); - var color = result.match(/rgba?\([\d\s,]+\)/); - if (color) result = result.replace(color[0], color[0].rgbToHex()); - } - if (!hasGetComputedStyle && !this.style[property]){ - if ((/^(height|width)$/).test(property) && !(/px$/.test(result))){ - var values = (property == 'width') ? ['left', 'right'] : ['top', 'bottom'], size = 0; - values.each(function(value){ - size += this.getStyle('border-' + value + '-width').toInt() + this.getStyle('padding-' + value).toInt(); - }, this); - return this['offset' + property.capitalize()] - size + 'px'; - } - if ((/^border(.+)Width|margin|padding/).test(property) && isNaN(parseFloat(result))){ - return '0px'; - } - } - // - if (returnsBordersInWrongOrder && /^border(Top|Right|Bottom|Left)?$/.test(property) && /^#/.test(result)){ - return result.replace(/^(.+)\s(.+)\s(.+)$/, '$2 $3 $1'); - } - // - return result; - }, - - setStyles: function(styles){ - for (var style in styles) this.setStyle(style, styles[style]); - return this; - }, - - getStyles: function(){ - var result = {}; - Array.flatten(arguments).each(function(key){ - result[key] = this.getStyle(key); - }, this); - return result; - } - -}); - -Element.Styles = { - left: '@px', top: '@px', bottom: '@px', right: '@px', - width: '@px', height: '@px', maxWidth: '@px', maxHeight: '@px', minWidth: '@px', minHeight: '@px', - backgroundColor: 'rgb(@, @, @)', backgroundSize: '@px', backgroundPosition: '@px @px', color: 'rgb(@, @, @)', - fontSize: '@px', letterSpacing: '@px', lineHeight: '@px', clip: 'rect(@px @px @px @px)', - margin: '@px @px @px @px', padding: '@px @px @px @px', border: '@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)', - borderWidth: '@px @px @px @px', borderStyle: '@ @ @ @', borderColor: 'rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)', - zIndex: '@', 'zoom': '@', fontWeight: '@', textIndent: '@px', opacity: '@' -}; - - - - - -Element.ShortStyles = {margin: {}, padding: {}, border: {}, borderWidth: {}, borderStyle: {}, borderColor: {}}; - -['Top', 'Right', 'Bottom', 'Left'].each(function(direction){ - var Short = Element.ShortStyles; - var All = Element.Styles; - ['margin', 'padding'].each(function(style){ - var sd = style + direction; - Short[style][sd] = All[sd] = '@px'; - }); - var bd = 'border' + direction; - Short.border[bd] = All[bd] = '@px @ rgb(@, @, @)'; - var bdw = bd + 'Width', bds = bd + 'Style', bdc = bd + 'Color'; - Short[bd] = {}; - Short.borderWidth[bdw] = Short[bd][bdw] = All[bdw] = '@px'; - Short.borderStyle[bds] = Short[bd][bds] = All[bds] = '@'; - Short.borderColor[bdc] = Short[bd][bdc] = All[bdc] = 'rgb(@, @, @)'; -}); - -if (hasBackgroundPositionXY) Element.ShortStyles.backgroundPosition = {backgroundPositionX: '@', backgroundPositionY: '@'}; -})(); - - -/* ---- - -name: Element.Event - -description: Contains Element methods for dealing with events. This file also includes mouseenter and mouseleave custom Element Events, if necessary. - -license: MIT-style license. - -requires: [Element, Event] - -provides: Element.Event - -... -*/ - -(function(){ - -Element.Properties.events = {set: function(events){ - this.addEvents(events); -}}; - -[Element, Window, Document].invoke('implement', { - - addEvent: function(type, fn){ - var events = this.retrieve('events', {}); - if (!events[type]) events[type] = {keys: [], values: []}; - if (events[type].keys.contains(fn)) return this; - events[type].keys.push(fn); - var realType = type, - custom = Element.Events[type], - condition = fn, - self = this; - if (custom){ - if (custom.onAdd) custom.onAdd.call(this, fn, type); - if (custom.condition){ - condition = function(event){ - if (custom.condition.call(this, event, type)) return fn.call(this, event); - return true; - }; - } - if (custom.base) realType = Function.from(custom.base).call(this, type); - } - var defn = function(){ - return fn.call(self); - }; - var nativeEvent = Element.NativeEvents[realType]; - if (nativeEvent){ - if (nativeEvent == 2){ - defn = function(event){ - event = new DOMEvent(event, self.getWindow()); - if (condition.call(self, event) === false) event.stop(); - }; - } - this.addListener(realType, defn, arguments[2]); - } - events[type].values.push(defn); - return this; - }, - - removeEvent: function(type, fn){ - var events = this.retrieve('events'); - if (!events || !events[type]) return this; - var list = events[type]; - var index = list.keys.indexOf(fn); - if (index == -1) return this; - var value = list.values[index]; - delete list.keys[index]; - delete list.values[index]; - var custom = Element.Events[type]; - if (custom){ - if (custom.onRemove) custom.onRemove.call(this, fn, type); - if (custom.base) type = Function.from(custom.base).call(this, type); - } - return (Element.NativeEvents[type]) ? this.removeListener(type, value, arguments[2]) : this; - }, - - addEvents: function(events){ - for (var event in events) this.addEvent(event, events[event]); - return this; - }, - - removeEvents: function(events){ - var type; - if (typeOf(events) == 'object'){ - for (type in events) this.removeEvent(type, events[type]); - return this; - } - var attached = this.retrieve('events'); - if (!attached) return this; - if (!events){ - for (type in attached) this.removeEvents(type); - this.eliminate('events'); - } else if (attached[events]){ - attached[events].keys.each(function(fn){ - this.removeEvent(events, fn); - }, this); - delete attached[events]; - } - return this; - }, - - fireEvent: function(type, args, delay){ - var events = this.retrieve('events'); - if (!events || !events[type]) return this; - args = Array.from(args); - - events[type].keys.each(function(fn){ - if (delay) fn.delay(delay, this, args); - else fn.apply(this, args); - }, this); - return this; - }, - - cloneEvents: function(from, type){ - from = document.id(from); - var events = from.retrieve('events'); - if (!events) return this; - if (!type){ - for (var eventType in events) this.cloneEvents(from, eventType); - } else if (events[type]){ - events[type].keys.each(function(fn){ - this.addEvent(type, fn); - }, this); - } - return this; - } - -}); - -Element.NativeEvents = { - click: 2, dblclick: 2, mouseup: 2, mousedown: 2, contextmenu: 2, //mouse buttons - mousewheel: 2, DOMMouseScroll: 2, //mouse wheel - mouseover: 2, mouseout: 2, mousemove: 2, selectstart: 2, selectend: 2, //mouse movement - keydown: 2, keypress: 2, keyup: 2, //keyboard - orientationchange: 2, // mobile - touchstart: 2, touchmove: 2, touchend: 2, touchcancel: 2, // touch - gesturestart: 2, gesturechange: 2, gestureend: 2, // gesture - focus: 2, blur: 2, change: 2, reset: 2, select: 2, submit: 2, paste: 2, input: 2, //form elements - load: 2, unload: 1, beforeunload: 2, resize: 1, move: 1, DOMContentLoaded: 1, readystatechange: 1, //window - hashchange: 1, popstate: 2, // history - error: 1, abort: 1, scroll: 1 //misc -}; - -Element.Events = { - mousewheel: { - base: 'onwheel' in document ? 'wheel' : 'onmousewheel' in document ? 'mousewheel' : 'DOMMouseScroll' - } -}; - -var check = function(event){ - var related = event.relatedTarget; - if (related == null) return true; - if (!related) return false; - return (related != this && related.prefix != 'xul' && typeOf(this) != 'document' && !this.contains(related)); -}; - -if ('onmouseenter' in document.documentElement){ - Element.NativeEvents.mouseenter = Element.NativeEvents.mouseleave = 2; - Element.MouseenterCheck = check; -} else { - Element.Events.mouseenter = { - base: 'mouseover', - condition: check - }; - - Element.Events.mouseleave = { - base: 'mouseout', - condition: check - }; -} - -/**/ -if (!window.addEventListener){ - Element.NativeEvents.propertychange = 2; - Element.Events.change = { - base: function(){ - var type = this.type; - return (this.get('tag') == 'input' && (type == 'radio' || type == 'checkbox')) ? 'propertychange' : 'change'; - }, - condition: function(event){ - return event.type != 'propertychange' || event.event.propertyName == 'checked'; - } - }; -} -/**/ - - - -})(); - - -/* ---- - -name: Element.Delegation - -description: Extends the Element native object to include the delegate method for more efficient event management. - -license: MIT-style license. - -requires: [Element.Event] - -provides: [Element.Delegation] - -... -*/ - -(function(){ - -var eventListenerSupport = !!window.addEventListener; - -Element.NativeEvents.focusin = Element.NativeEvents.focusout = 2; - -var bubbleUp = function(self, match, fn, event, target){ - while (target && target != self){ - if (match(target, event)) return fn.call(target, event, target); - target = document.id(target.parentNode); - } -}; - -var map = { - mouseenter: { - base: 'mouseover', - condition: Element.MouseenterCheck - }, - mouseleave: { - base: 'mouseout', - condition: Element.MouseenterCheck - }, - focus: { - base: 'focus' + (eventListenerSupport ? '' : 'in'), - capture: true - }, - blur: { - base: eventListenerSupport ? 'blur' : 'focusout', - capture: true - } -}; - -/**/ -var _key = '$delegation:'; -var formObserver = function(type){ - - return { - - base: 'focusin', - - remove: function(self, uid){ - var list = self.retrieve(_key + type + 'listeners', {})[uid]; - if (list && list.forms) for (var i = list.forms.length; i--;){ - list.forms[i].removeEvent(type, list.fns[i]); - } - }, - - listen: function(self, match, fn, event, target, uid){ - var form = (target.get('tag') == 'form') ? target : event.target.getParent('form'); - if (!form) return; - - var listeners = self.retrieve(_key + type + 'listeners', {}), - listener = listeners[uid] || {forms: [], fns: []}, - forms = listener.forms, fns = listener.fns; - - if (forms.indexOf(form) != -1) return; - forms.push(form); - - var _fn = function(event){ - bubbleUp(self, match, fn, event, target); - }; - form.addEvent(type, _fn); - fns.push(_fn); - - listeners[uid] = listener; - self.store(_key + type + 'listeners', listeners); - } - }; -}; - -var inputObserver = function(type){ - return { - base: 'focusin', - listen: function(self, match, fn, event, target){ - var events = {blur: function(){ - this.removeEvents(events); - }}; - events[type] = function(event){ - bubbleUp(self, match, fn, event, target); - }; - event.target.addEvents(events); - } - }; -}; - -if (!eventListenerSupport) Object.append(map, { - submit: formObserver('submit'), - reset: formObserver('reset'), - change: inputObserver('change'), - select: inputObserver('select') -}); -/**/ - -var proto = Element.prototype, - addEvent = proto.addEvent, - removeEvent = proto.removeEvent; - -var relay = function(old, method){ - return function(type, fn, useCapture){ - if (type.indexOf(':relay') == -1) return old.call(this, type, fn, useCapture); - var parsed = Slick.parse(type).expressions[0][0]; - if (parsed.pseudos[0].key != 'relay') return old.call(this, type, fn, useCapture); - var newType = parsed.tag; - parsed.pseudos.slice(1).each(function(pseudo){ - newType += ':' + pseudo.key + (pseudo.value ? '(' + pseudo.value + ')' : ''); - }); - old.call(this, type, fn); - return method.call(this, newType, parsed.pseudos[0].value, fn); - }; -}; - -var delegation = { - - addEvent: function(type, match, fn){ - var storage = this.retrieve('$delegates', {}), stored = storage[type]; - if (stored) for (var _uid in stored){ - if (stored[_uid].fn == fn && stored[_uid].match == match) return this; - } - - var _type = type, _match = match, _fn = fn, _map = map[type] || {}; - type = _map.base || _type; - - match = function(target){ - return Slick.match(target, _match); - }; - - var elementEvent = Element.Events[_type]; - if (_map.condition || elementEvent && elementEvent.condition){ - var __match = match, condition = _map.condition || elementEvent.condition; - match = function(target, event){ - return __match(target, event) && condition.call(target, event, type); - }; - } - - var self = this, uid = String.uniqueID(); - var delegator = _map.listen ? function(event, target){ - if (!target && event && event.target) target = event.target; - if (target) _map.listen(self, match, fn, event, target, uid); - } : function(event, target){ - if (!target && event && event.target) target = event.target; - if (target) bubbleUp(self, match, fn, event, target); - }; - - if (!stored) stored = {}; - stored[uid] = { - match: _match, - fn: _fn, - delegator: delegator - }; - storage[_type] = stored; - return addEvent.call(this, type, delegator, _map.capture); - }, - - removeEvent: function(type, match, fn, _uid){ - var storage = this.retrieve('$delegates', {}), stored = storage[type]; - if (!stored) return this; - - if (_uid){ - var _type = type, delegator = stored[_uid].delegator, _map = map[type] || {}; - type = _map.base || _type; - if (_map.remove) _map.remove(this, _uid); - delete stored[_uid]; - storage[_type] = stored; - return removeEvent.call(this, type, delegator, _map.capture); - } - - var __uid, s; - if (fn) for (__uid in stored){ - s = stored[__uid]; - if (s.match == match && s.fn == fn) return delegation.removeEvent.call(this, type, match, fn, __uid); - } else for (__uid in stored){ - s = stored[__uid]; - if (s.match == match) delegation.removeEvent.call(this, type, match, s.fn, __uid); - } - return this; - } - -}; - -[Element, Window, Document].invoke('implement', { - addEvent: relay(addEvent, delegation.addEvent), - removeEvent: relay(removeEvent, delegation.removeEvent) -}); - -})(); - - -/* ---- - -name: Element.Dimensions - -description: Contains methods to work with size, scroll, or positioning of Elements and the window object. - -license: MIT-style license. - -credits: - - Element positioning based on the [qooxdoo](http://qooxdoo.org/) code and smart browser fixes, [LGPL License](http://www.gnu.org/licenses/lgpl.html). - - Viewport dimensions based on [YUI](http://developer.yahoo.com/yui/) code, [BSD License](http://developer.yahoo.com/yui/license.html). - -requires: [Element, Element.Style] - -provides: [Element.Dimensions] - -... -*/ - -(function(){ - -var element = document.createElement('div'), - child = document.createElement('div'); -element.style.height = '0'; -element.appendChild(child); -var brokenOffsetParent = (child.offsetParent === element); -element = child = null; - -var isOffset = function(el){ - return styleString(el, 'position') != 'static' || isBody(el); -}; - -var isOffsetStatic = function(el){ - return isOffset(el) || (/^(?:table|td|th)$/i).test(el.tagName); -}; - -Element.implement({ - - scrollTo: function(x, y){ - if (isBody(this)){ - this.getWindow().scrollTo(x, y); - } else { - this.scrollLeft = x; - this.scrollTop = y; - } - return this; - }, - - getSize: function(){ - if (isBody(this)) return this.getWindow().getSize(); - return {x: this.offsetWidth, y: this.offsetHeight}; - }, - - getScrollSize: function(){ - if (isBody(this)) return this.getWindow().getScrollSize(); - return {x: this.scrollWidth, y: this.scrollHeight}; - }, - - getScroll: function(){ - if (isBody(this)) return this.getWindow().getScroll(); - return {x: this.scrollLeft, y: this.scrollTop}; - }, - - getScrolls: function(){ - var element = this.parentNode, position = {x: 0, y: 0}; - while (element && !isBody(element)){ - position.x += element.scrollLeft; - position.y += element.scrollTop; - element = element.parentNode; - } - return position; - }, - - getOffsetParent: brokenOffsetParent ? function(){ - var element = this; - if (isBody(element) || styleString(element, 'position') == 'fixed') return null; - - var isOffsetCheck = (styleString(element, 'position') == 'static') ? isOffsetStatic : isOffset; - while ((element = element.parentNode)){ - if (isOffsetCheck(element)) return element; - } - return null; - } : function(){ - var element = this; - if (isBody(element) || styleString(element, 'position') == 'fixed') return null; - - try { - return element.offsetParent; - } catch(e) {} - return null; - }, - - getOffsets: function(){ - var hasGetBoundingClientRect = this.getBoundingClientRect; - - if (hasGetBoundingClientRect){ - var bound = this.getBoundingClientRect(), - html = document.id(this.getDocument().documentElement), - htmlScroll = html.getScroll(), - elemScrolls = this.getScrolls(), - isFixed = (styleString(this, 'position') == 'fixed'); - - return { - x: bound.left.toInt() + elemScrolls.x + ((isFixed) ? 0 : htmlScroll.x) - html.clientLeft, - y: bound.top.toInt() + elemScrolls.y + ((isFixed) ? 0 : htmlScroll.y) - html.clientTop - }; - } - - var element = this, position = {x: 0, y: 0}; - if (isBody(this)) return position; - - while (element && !isBody(element)){ - position.x += element.offsetLeft; - position.y += element.offsetTop; - - element = element.offsetParent; - } - - return position; - }, - - getPosition: function(relative){ - var offset = this.getOffsets(), - scroll = this.getScrolls(); - var position = { - x: offset.x - scroll.x, - y: offset.y - scroll.y - }; - - if (relative && (relative = document.id(relative))){ - var relativePosition = relative.getPosition(); - return {x: position.x - relativePosition.x - leftBorder(relative), y: position.y - relativePosition.y - topBorder(relative)}; - } - return position; - }, - - getCoordinates: function(element){ - if (isBody(this)) return this.getWindow().getCoordinates(); - var position = this.getPosition(element), - size = this.getSize(); - var obj = { - left: position.x, - top: position.y, - width: size.x, - height: size.y - }; - obj.right = obj.left + obj.width; - obj.bottom = obj.top + obj.height; - return obj; - }, - - computePosition: function(obj){ - return { - left: obj.x - styleNumber(this, 'margin-left'), - top: obj.y - styleNumber(this, 'margin-top') - }; - }, - - setPosition: function(obj){ - return this.setStyles(this.computePosition(obj)); - } - -}); - - -[Document, Window].invoke('implement', { - - getSize: function(){ - var doc = getCompatElement(this); - return {x: doc.clientWidth, y: doc.clientHeight}; - }, - - getScroll: function(){ - var win = this.getWindow(), doc = getCompatElement(this); - return {x: win.pageXOffset || doc.scrollLeft, y: win.pageYOffset || doc.scrollTop}; - }, - - getScrollSize: function(){ - var doc = getCompatElement(this), - min = this.getSize(), - body = this.getDocument().body; - - return {x: Math.max(doc.scrollWidth, body.scrollWidth, min.x), y: Math.max(doc.scrollHeight, body.scrollHeight, min.y)}; - }, - - getPosition: function(){ - return {x: 0, y: 0}; - }, - - getCoordinates: function(){ - var size = this.getSize(); - return {top: 0, left: 0, bottom: size.y, right: size.x, height: size.y, width: size.x}; - } - -}); - -// private methods - -var styleString = Element.getComputedStyle; - -function styleNumber(element, style){ - return styleString(element, style).toInt() || 0; -} - -function borderBox(element){ - return styleString(element, '-moz-box-sizing') == 'border-box'; -} - -function topBorder(element){ - return styleNumber(element, 'border-top-width'); -} - -function leftBorder(element){ - return styleNumber(element, 'border-left-width'); -} - -function isBody(element){ - return (/^(?:body|html)$/i).test(element.tagName); -} - -function getCompatElement(element){ - var doc = element.getDocument(); - return (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body; -} - -})(); - -//aliases -Element.alias({position: 'setPosition'}); //compatability - -[Window, Document, Element].invoke('implement', { - - getHeight: function(){ - return this.getSize().y; - }, - - getWidth: function(){ - return this.getSize().x; - }, - - getScrollTop: function(){ - return this.getScroll().y; - }, - - getScrollLeft: function(){ - return this.getScroll().x; - }, - - getScrollHeight: function(){ - return this.getScrollSize().y; - }, - - getScrollWidth: function(){ - return this.getScrollSize().x; - }, - - getTop: function(){ - return this.getPosition().y; - }, - - getLeft: function(){ - return this.getPosition().x; - } - -}); - - -/* ---- - -name: Fx - -description: Contains the basic animation logic to be extended by all other Fx Classes. - -license: MIT-style license. - -requires: [Chain, Events, Options] - -provides: Fx - -... -*/ - -(function(){ - -var Fx = this.Fx = new Class({ - - Implements: [Chain, Events, Options], - - options: { - /* - onStart: nil, - onCancel: nil, - onComplete: nil, - */ - fps: 60, - unit: false, - duration: 500, - frames: null, - frameSkip: true, - link: 'ignore' - }, - - initialize: function(options){ - this.subject = this.subject || this; - this.setOptions(options); - }, - - getTransition: function(){ - return function(p){ - return -(Math.cos(Math.PI * p) - 1) / 2; - }; - }, - - step: function(now){ - if (this.options.frameSkip){ - var diff = (this.time != null) ? (now - this.time) : 0, frames = diff / this.frameInterval; - this.time = now; - this.frame += frames; - } else { - this.frame++; - } - - if (this.frame < this.frames){ - var delta = this.transition(this.frame / this.frames); - this.set(this.compute(this.from, this.to, delta)); - } else { - this.frame = this.frames; - this.set(this.compute(this.from, this.to, 1)); - this.stop(); - } - }, - - set: function(now){ - return now; - }, - - compute: function(from, to, delta){ - return Fx.compute(from, to, delta); - }, - - check: function(){ - if (!this.isRunning()) return true; - switch (this.options.link){ - case 'cancel': this.cancel(); return true; - case 'chain': this.chain(this.caller.pass(arguments, this)); return false; - } - return false; - }, - - start: function(from, to){ - if (!this.check(from, to)) return this; - this.from = from; - this.to = to; - this.frame = (this.options.frameSkip) ? 0 : -1; - this.time = null; - this.transition = this.getTransition(); - var frames = this.options.frames, fps = this.options.fps, duration = this.options.duration; - this.duration = Fx.Durations[duration] || duration.toInt(); - this.frameInterval = 1000 / fps; - this.frames = frames || Math.round(this.duration / this.frameInterval); - this.fireEvent('start', this.subject); - pushInstance.call(this, fps); - return this; - }, - - stop: function(){ - if (this.isRunning()){ - this.time = null; - pullInstance.call(this, this.options.fps); - if (this.frames == this.frame){ - this.fireEvent('complete', this.subject); - if (!this.callChain()) this.fireEvent('chainComplete', this.subject); - } else { - this.fireEvent('stop', this.subject); - } - } - return this; - }, - - cancel: function(){ - if (this.isRunning()){ - this.time = null; - pullInstance.call(this, this.options.fps); - this.frame = this.frames; - this.fireEvent('cancel', this.subject).clearChain(); - } - return this; - }, - - pause: function(){ - if (this.isRunning()){ - this.time = null; - pullInstance.call(this, this.options.fps); - } - return this; - }, - - resume: function(){ - if (this.isPaused()) pushInstance.call(this, this.options.fps); - return this; - }, - - isRunning: function(){ - var list = instances[this.options.fps]; - return list && list.contains(this); - }, - - isPaused: function(){ - return (this.frame < this.frames) && !this.isRunning(); - } - -}); - -Fx.compute = function(from, to, delta){ - return (to - from) * delta + from; -}; - -Fx.Durations = {'short': 250, 'normal': 500, 'long': 1000}; - -// global timers - -var instances = {}, timers = {}; - -var loop = function(){ - var now = Date.now(); - for (var i = this.length; i--;){ - var instance = this[i]; - if (instance) instance.step(now); - } -}; - -var pushInstance = function(fps){ - var list = instances[fps] || (instances[fps] = []); - list.push(this); - if (!timers[fps]) timers[fps] = loop.periodical(Math.round(1000 / fps), list); -}; - -var pullInstance = function(fps){ - var list = instances[fps]; - if (list){ - list.erase(this); - if (!list.length && timers[fps]){ - delete instances[fps]; - timers[fps] = clearInterval(timers[fps]); - } - } -}; - -})(); - - -/* ---- - -name: Fx.CSS - -description: Contains the CSS animation logic. Used by Fx.Tween, Fx.Morph, Fx.Elements. - -license: MIT-style license. - -requires: [Fx, Element.Style] - -provides: Fx.CSS - -... -*/ - -Fx.CSS = new Class({ - - Extends: Fx, - - //prepares the base from/to object - - prepare: function(element, property, values){ - values = Array.from(values); - var from = values[0], to = values[1]; - if (to == null){ - to = from; - from = element.getStyle(property); - var unit = this.options.unit; - // adapted from: https://github.com/ryanmorr/fx/blob/master/fx.js#L299 - if (unit && from && typeof from == 'string' && from.slice(-unit.length) != unit && parseFloat(from) != 0){ - element.setStyle(property, to + unit); - var value = element.getComputedStyle(property); - // IE and Opera support pixelLeft or pixelWidth - if (!(/px$/.test(value))){ - value = element.style[('pixel-' + property).camelCase()]; - if (value == null){ - // adapted from Dean Edwards' http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - var left = element.style.left; - element.style.left = to + unit; - value = element.style.pixelLeft; - element.style.left = left; - } - } - from = (to || 1) / (parseFloat(value) || 1) * (parseFloat(from) || 0); - element.setStyle(property, from + unit); - } - } - return {from: this.parse(from), to: this.parse(to)}; - }, - - //parses a value into an array - - parse: function(value){ - value = Function.from(value)(); - value = (typeof value == 'string') ? value.split(' ') : Array.from(value); - return value.map(function(val){ - val = String(val); - var found = false; - Object.each(Fx.CSS.Parsers, function(parser, key){ - if (found) return; - var parsed = parser.parse(val); - if (parsed || parsed === 0) found = {value: parsed, parser: parser}; - }); - found = found || {value: val, parser: Fx.CSS.Parsers.String}; - return found; - }); - }, - - //computes by a from and to prepared objects, using their parsers. - - compute: function(from, to, delta){ - var computed = []; - (Math.min(from.length, to.length)).times(function(i){ - computed.push({value: from[i].parser.compute(from[i].value, to[i].value, delta), parser: from[i].parser}); - }); - computed.$family = Function.from('fx:css:value'); - return computed; - }, - - //serves the value as settable - - serve: function(value, unit){ - if (typeOf(value) != 'fx:css:value') value = this.parse(value); - var returned = []; - value.each(function(bit){ - returned = returned.concat(bit.parser.serve(bit.value, unit)); - }); - return returned; - }, - - //renders the change to an element - - render: function(element, property, value, unit){ - element.setStyle(property, this.serve(value, unit)); - }, - - //searches inside the page css to find the values for a selector - - search: function(selector){ - if (Fx.CSS.Cache[selector]) return Fx.CSS.Cache[selector]; - var to = {}, selectorTest = new RegExp('^' + selector.escapeRegExp() + '$'); - - var searchStyles = function(rules){ - Array.each(rules, function(rule, i){ - if (rule.media){ - searchStyles(rule.rules || rule.cssRules); - return; - } - if (!rule.style) return; - var selectorText = (rule.selectorText) ? rule.selectorText.replace(/^\w+/, function(m){ - return m.toLowerCase(); - }) : null; - if (!selectorText || !selectorTest.test(selectorText)) return; - Object.each(Element.Styles, function(value, style){ - if (!rule.style[style] || Element.ShortStyles[style]) return; - value = String(rule.style[style]); - to[style] = ((/^rgb/).test(value)) ? value.rgbToHex() : value; - }); - }); - }; - - Array.each(document.styleSheets, function(sheet, j){ - var href = sheet.href; - if (href && href.indexOf('://') > -1 && href.indexOf(document.domain) == -1) return; - var rules = sheet.rules || sheet.cssRules; - searchStyles(rules); - }); - return Fx.CSS.Cache[selector] = to; - } - -}); - -Fx.CSS.Cache = {}; - -Fx.CSS.Parsers = { - - Color: { - parse: function(value){ - if (value.match(/^#[0-9a-f]{3,6}$/i)) return value.hexToRgb(true); - return ((value = value.match(/(\d+),\s*(\d+),\s*(\d+)/))) ? [value[1], value[2], value[3]] : false; - }, - compute: function(from, to, delta){ - return from.map(function(value, i){ - return Math.round(Fx.compute(from[i], to[i], delta)); - }); - }, - serve: function(value){ - return value.map(Number); - } - }, - - Number: { - parse: parseFloat, - compute: Fx.compute, - serve: function(value, unit){ - return (unit) ? value + unit : value; - } - }, - - String: { - parse: Function.from(false), - compute: function(zero, one){ - return one; - }, - serve: function(zero){ - return zero; - } - } - -}; - - - - -/* ---- - -name: Fx.Tween - -description: Formerly Fx.Style, effect to transition any CSS property for an element. - -license: MIT-style license. - -requires: Fx.CSS - -provides: [Fx.Tween, Element.fade, Element.highlight] - -... -*/ - -Fx.Tween = new Class({ - - Extends: Fx.CSS, - - initialize: function(element, options){ - this.element = this.subject = document.id(element); - this.parent(options); - }, - - set: function(property, now){ - if (arguments.length == 1){ - now = property; - property = this.property || this.options.property; - } - this.render(this.element, property, now, this.options.unit); - return this; - }, - - start: function(property, from, to){ - if (!this.check(property, from, to)) return this; - var args = Array.flatten(arguments); - this.property = this.options.property || args.shift(); - var parsed = this.prepare(this.element, this.property, args); - return this.parent(parsed.from, parsed.to); - } - -}); - -Element.Properties.tween = { - - set: function(options){ - this.get('tween').cancel().setOptions(options); - return this; - }, - - get: function(){ - var tween = this.retrieve('tween'); - if (!tween){ - tween = new Fx.Tween(this, {link: 'cancel'}); - this.store('tween', tween); - } - return tween; - } - -}; - -Element.implement({ - - tween: function(property, from, to){ - this.get('tween').start(property, from, to); - return this; - }, - - fade: function(how){ - var fade = this.get('tween'), method, args = ['opacity'].append(arguments), toggle; - if (args[1] == null) args[1] = 'toggle'; - switch (args[1]){ - case 'in': method = 'start'; args[1] = 1; break; - case 'out': method = 'start'; args[1] = 0; break; - case 'show': method = 'set'; args[1] = 1; break; - case 'hide': method = 'set'; args[1] = 0; break; - case 'toggle': - var flag = this.retrieve('fade:flag', this.getStyle('opacity') == 1); - method = 'start'; - args[1] = flag ? 0 : 1; - this.store('fade:flag', !flag); - toggle = true; - break; - default: method = 'start'; - } - if (!toggle) this.eliminate('fade:flag'); - fade[method].apply(fade, args); - var to = args[args.length - 1]; - if (method == 'set' || to != 0) this.setStyle('visibility', to == 0 ? 'hidden' : 'visible'); - else fade.chain(function(){ - this.element.setStyle('visibility', 'hidden'); - this.callChain(); - }); - return this; - }, - - highlight: function(start, end){ - if (!end){ - end = this.retrieve('highlight:original', this.getStyle('background-color')); - end = (end == 'transparent') ? '#fff' : end; - } - var tween = this.get('tween'); - tween.start('background-color', start || '#ffff88', end).chain(function(){ - this.setStyle('background-color', this.retrieve('highlight:original')); - tween.callChain(); - }.bind(this)); - return this; - } - -}); - - -/* ---- - -name: Fx.Morph - -description: Formerly Fx.Styles, effect to transition any number of CSS properties for an element using an object of rules, or CSS based selector rules. - -license: MIT-style license. - -requires: Fx.CSS - -provides: Fx.Morph - -... -*/ - -Fx.Morph = new Class({ - - Extends: Fx.CSS, - - initialize: function(element, options){ - this.element = this.subject = document.id(element); - this.parent(options); - }, - - set: function(now){ - if (typeof now == 'string') now = this.search(now); - for (var p in now) this.render(this.element, p, now[p], this.options.unit); - return this; - }, - - compute: function(from, to, delta){ - var now = {}; - for (var p in from) now[p] = this.parent(from[p], to[p], delta); - return now; - }, - - start: function(properties){ - if (!this.check(properties)) return this; - if (typeof properties == 'string') properties = this.search(properties); - var from = {}, to = {}; - for (var p in properties){ - var parsed = this.prepare(this.element, p, properties[p]); - from[p] = parsed.from; - to[p] = parsed.to; - } - return this.parent(from, to); - } - -}); - -Element.Properties.morph = { - - set: function(options){ - this.get('morph').cancel().setOptions(options); - return this; - }, - - get: function(){ - var morph = this.retrieve('morph'); - if (!morph){ - morph = new Fx.Morph(this, {link: 'cancel'}); - this.store('morph', morph); - } - return morph; - } - -}; - -Element.implement({ - - morph: function(props){ - this.get('morph').start(props); - return this; - } - -}); - - -/* ---- - -name: Fx.Transitions - -description: Contains a set of advanced transitions to be used with any of the Fx Classes. - -license: MIT-style license. - -credits: - - Easing Equations by Robert Penner, , modified and optimized to be used with MooTools. - -requires: Fx - -provides: Fx.Transitions - -... -*/ - -Fx.implement({ - - getTransition: function(){ - var trans = this.options.transition || Fx.Transitions.Sine.easeInOut; - if (typeof trans == 'string'){ - var data = trans.split(':'); - trans = Fx.Transitions; - trans = trans[data[0]] || trans[data[0].capitalize()]; - if (data[1]) trans = trans['ease' + data[1].capitalize() + (data[2] ? data[2].capitalize() : '')]; - } - return trans; - } - -}); - -Fx.Transition = function(transition, params){ - params = Array.from(params); - var easeIn = function(pos){ - return transition(pos, params); - }; - return Object.append(easeIn, { - easeIn: easeIn, - easeOut: function(pos){ - return 1 - transition(1 - pos, params); - }, - easeInOut: function(pos){ - return (pos <= 0.5 ? transition(2 * pos, params) : (2 - transition(2 * (1 - pos), params))) / 2; - } - }); -}; - -Fx.Transitions = { - - linear: function(zero){ - return zero; - } - -}; - - - -Fx.Transitions.extend = function(transitions){ - for (var transition in transitions) Fx.Transitions[transition] = new Fx.Transition(transitions[transition]); -}; - -Fx.Transitions.extend({ - - Pow: function(p, x){ - return Math.pow(p, x && x[0] || 6); - }, - - Expo: function(p){ - return Math.pow(2, 8 * (p - 1)); - }, - - Circ: function(p){ - return 1 - Math.sin(Math.acos(p)); - }, - - Sine: function(p){ - return 1 - Math.cos(p * Math.PI / 2); - }, - - Back: function(p, x){ - x = x && x[0] || 1.618; - return Math.pow(p, 2) * ((x + 1) * p - x); - }, - - Bounce: function(p){ - var value; - for (var a = 0, b = 1; 1; a += b, b /= 2){ - if (p >= (7 - 4 * a) / 11){ - value = b * b - Math.pow((11 - 6 * a - 11 * p) / 4, 2); - break; - } - } - return value; - }, - - Elastic: function(p, x){ - return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x && x[0] || 1) / 3); - } - -}); - -['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){ - Fx.Transitions[transition] = new Fx.Transition(function(p){ - return Math.pow(p, i + 2); - }); -}); - - -/* ---- - -name: Request - -description: Powerful all purpose Request Class. Uses XMLHTTPRequest. - -license: MIT-style license. - -requires: [Object, Element, Chain, Events, Options, Browser] - -provides: Request - -... -*/ - -(function(){ - -var empty = function(){}, - progressSupport = ('onprogress' in new Browser.Request); - -var Request = this.Request = new Class({ - - Implements: [Chain, Events, Options], - - options: {/* - onRequest: function(){}, - onLoadstart: function(event, xhr){}, - onProgress: function(event, xhr){}, - onComplete: function(){}, - onCancel: function(){}, - onSuccess: function(responseText, responseXML){}, - onFailure: function(xhr){}, - onException: function(headerName, value){}, - onTimeout: function(){}, - user: '', - password: '',*/ - url: '', - data: '', - headers: { - 'X-Requested-With': 'XMLHttpRequest', - 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' - }, - async: true, - format: false, - method: 'post', - link: 'ignore', - isSuccess: null, - emulation: true, - urlEncoded: true, - encoding: 'utf-8', - evalScripts: false, - evalResponse: false, - timeout: 0, - noCache: false - }, - - initialize: function(options){ - this.xhr = new Browser.Request(); - this.setOptions(options); - this.headers = this.options.headers; - }, - - onStateChange: function(){ - var xhr = this.xhr; - if (xhr.readyState != 4 || !this.running) return; - this.running = false; - this.status = 0; - Function.attempt(function(){ - var status = xhr.status; - this.status = (status == 1223) ? 204 : status; - }.bind(this)); - xhr.onreadystatechange = empty; - if (progressSupport) xhr.onprogress = xhr.onloadstart = empty; - clearTimeout(this.timer); - - this.response = {text: this.xhr.responseText || '', xml: this.xhr.responseXML}; - if (this.options.isSuccess.call(this, this.status)) - this.success(this.response.text, this.response.xml); - else - this.failure(); - }, - - isSuccess: function(){ - var status = this.status; - return (status >= 200 && status < 300); - }, - - isRunning: function(){ - return !!this.running; - }, - - processScripts: function(text){ - if (this.options.evalResponse || (/(ecma|java)script/).test(this.getHeader('Content-type'))) return Browser.exec(text); - return text.stripScripts(this.options.evalScripts); - }, - - success: function(text, xml){ - this.onSuccess(this.processScripts(text), xml); - }, - - onSuccess: function(){ - this.fireEvent('complete', arguments).fireEvent('success', arguments).callChain(); - }, - - failure: function(){ - this.onFailure(); - }, - - onFailure: function(){ - this.fireEvent('complete').fireEvent('failure', this.xhr); - }, - - loadstart: function(event){ - this.fireEvent('loadstart', [event, this.xhr]); - }, - - progress: function(event){ - this.fireEvent('progress', [event, this.xhr]); - }, - - timeout: function(){ - this.fireEvent('timeout', this.xhr); - }, - - setHeader: function(name, value){ - this.headers[name] = value; - return this; - }, - - getHeader: function(name){ - return Function.attempt(function(){ - return this.xhr.getResponseHeader(name); - }.bind(this)); - }, - - check: function(){ - if (!this.running) return true; - switch (this.options.link){ - case 'cancel': this.cancel(); return true; - case 'chain': this.chain(this.caller.pass(arguments, this)); return false; - } - return false; - }, - - send: function(options){ - if (!this.check(options)) return this; - - this.options.isSuccess = this.options.isSuccess || this.isSuccess; - this.running = true; - - var type = typeOf(options); - if (type == 'string' || type == 'element') options = {data: options}; - - var old = this.options; - options = Object.append({data: old.data, url: old.url, method: old.method}, options); - var data = options.data, url = String(options.url), method = options.method.toLowerCase(); - - switch (typeOf(data)){ - case 'element': data = document.id(data).toQueryString(); break; - case 'object': case 'hash': data = Object.toQueryString(data); - } - - if (this.options.format){ - var format = 'format=' + this.options.format; - data = (data) ? format + '&' + data : format; - } - - if (this.options.emulation && !['get', 'post'].contains(method)){ - var _method = '_method=' + method; - data = (data) ? _method + '&' + data : _method; - method = 'post'; - } - - if (this.options.urlEncoded && ['post', 'put'].contains(method)){ - var encoding = (this.options.encoding) ? '; charset=' + this.options.encoding : ''; - this.headers['Content-type'] = 'application/x-www-form-urlencoded' + encoding; - } - - if (!url) url = document.location.pathname; - - var trimPosition = url.lastIndexOf('/'); - if (trimPosition > -1 && (trimPosition = url.indexOf('#')) > -1) url = url.substr(0, trimPosition); - - if (this.options.noCache) - url += (url.indexOf('?') > -1 ? '&' : '?') + String.uniqueID(); - - if (data && (method == 'get' || method == 'delete')){ - url += (url.indexOf('?') > -1 ? '&' : '?') + data; - data = null; - } - - var xhr = this.xhr; - if (progressSupport){ - xhr.onloadstart = this.loadstart.bind(this); - xhr.onprogress = this.progress.bind(this); - } - - xhr.open(method.toUpperCase(), url, this.options.async, this.options.user, this.options.password); - if (this.options.user && 'withCredentials' in xhr) xhr.withCredentials = true; - - xhr.onreadystatechange = this.onStateChange.bind(this); - - Object.each(this.headers, function(value, key){ - try { - xhr.setRequestHeader(key, value); - } catch (e){ - this.fireEvent('exception', [key, value]); - } - }, this); - - this.fireEvent('request'); - xhr.send(data); - if (!this.options.async) this.onStateChange(); - else if (this.options.timeout) this.timer = this.timeout.delay(this.options.timeout, this); - return this; - }, - - cancel: function(){ - if (!this.running) return this; - this.running = false; - var xhr = this.xhr; - xhr.abort(); - clearTimeout(this.timer); - xhr.onreadystatechange = empty; - if (progressSupport) xhr.onprogress = xhr.onloadstart = empty; - this.xhr = new Browser.Request(); - this.fireEvent('cancel'); - return this; - } - -}); - -var methods = {}; -['get', 'post', 'put', 'delete', 'GET', 'POST', 'PUT', 'DELETE'].each(function(method){ - methods[method] = function(data){ - var object = { - method: method - }; - if (data != null) object.data = data; - return this.send(object); - }; -}); - -Request.implement(methods); - -Element.Properties.send = { - - set: function(options){ - var send = this.get('send').cancel(); - send.setOptions(options); - return this; - }, - - get: function(){ - var send = this.retrieve('send'); - if (!send){ - send = new Request({ - data: this, link: 'cancel', method: this.get('method') || 'post', url: this.get('action') - }); - this.store('send', send); - } - return send; - } - -}; - -Element.implement({ - - send: function(url){ - var sender = this.get('send'); - sender.send({data: this, url: url || sender.options.url}); - return this; - } - -}); - -})(); - - -/* ---- - -name: Request.HTML - -description: Extends the basic Request Class with additional methods for interacting with HTML responses. - -license: MIT-style license. - -requires: [Element, Request] - -provides: Request.HTML - -... -*/ - -Request.HTML = new Class({ - - Extends: Request, - - options: { - update: false, - append: false, - evalScripts: true, - filter: false, - headers: { - Accept: 'text/html, application/xml, text/xml, */*' - } - }, - - success: function(text){ - var options = this.options, response = this.response; - - response.html = text.stripScripts(function(script){ - response.javascript = script; - }); - - var match = response.html.match(/]*>([\s\S]*?)<\/body>/i); - if (match) response.html = match[1]; - var temp = new Element('div').set('html', response.html); - - response.tree = temp.childNodes; - response.elements = temp.getElements(options.filter || '*'); - - if (options.filter) response.tree = response.elements; - if (options.update){ - var update = document.id(options.update).empty(); - if (options.filter) update.adopt(response.elements); - else update.set('html', response.html); - } else if (options.append){ - var append = document.id(options.append); - if (options.filter) response.elements.reverse().inject(append); - else append.adopt(temp.getChildren()); - } - if (options.evalScripts) Browser.exec(response.javascript); - - this.onSuccess(response.tree, response.elements, response.html, response.javascript); - } - -}); - -Element.Properties.load = { - - set: function(options){ - var load = this.get('load').cancel(); - load.setOptions(options); - return this; - }, - - get: function(){ - var load = this.retrieve('load'); - if (!load){ - load = new Request.HTML({data: this, link: 'cancel', update: this, method: 'get'}); - this.store('load', load); - } - return load; - } - -}; - -Element.implement({ - - load: function(){ - this.get('load').send(Array.link(arguments, {data: Type.isObject, url: Type.isString})); - return this; - } - -}); - - -/* ---- - -name: JSON - -description: JSON encoder and decoder. - -license: MIT-style license. - -SeeAlso: - -requires: [Array, String, Number, Function] - -provides: JSON - -... -*/ - -if (typeof JSON == 'undefined') this.JSON = {}; - - - -(function(){ - -var special = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'}; - -var escape = function(chr){ - return special[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16)).slice(-4); -}; - -JSON.validate = function(string){ - string = string.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@'). - replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'). - replace(/(?:^|:|,)(?:\s*\[)+/g, ''); - - return (/^[\],:{}\s]*$/).test(string); -}; - -JSON.encode = JSON.stringify ? function(obj){ - return JSON.stringify(obj); -} : function(obj){ - if (obj && obj.toJSON) obj = obj.toJSON(); - - switch (typeOf(obj)){ - case 'string': - return '"' + obj.replace(/[\x00-\x1f\\"]/g, escape) + '"'; - case 'array': - return '[' + obj.map(JSON.encode).clean() + ']'; - case 'object': case 'hash': - var string = []; - Object.each(obj, function(value, key){ - var json = JSON.encode(value); - if (json) string.push(JSON.encode(key) + ':' + json); - }); - return '{' + string + '}'; - case 'number': case 'boolean': return '' + obj; - case 'null': return 'null'; - } - - return null; -}; - -JSON.secure = true; - - -JSON.decode = function(string, secure){ - if (!string || typeOf(string) != 'string') return null; - - if (secure == null) secure = JSON.secure; - if (secure){ - if (JSON.parse) return JSON.parse(string); - if (!JSON.validate(string)) throw new Error('JSON could not decode the input; security is enabled and the value is not secure.'); - } - - return eval('(' + string + ')'); -}; - -})(); - - -/* ---- - -name: Request.JSON - -description: Extends the basic Request Class with additional methods for sending and receiving JSON data. - -license: MIT-style license. - -requires: [Request, JSON] - -provides: Request.JSON - -... -*/ - -Request.JSON = new Class({ - - Extends: Request, - - options: { - /*onError: function(text, error){},*/ - secure: true - }, - - initialize: function(options){ - this.parent(options); - Object.append(this.headers, { - 'Accept': 'application/json', - 'X-Request': 'JSON' - }); - }, - - success: function(text){ - var json; - try { - json = this.response.json = JSON.decode(text, this.options.secure); - } catch (error){ - this.fireEvent('error', [text, error]); - return; - } - if (json == null) this.onFailure(); - else this.onSuccess(json, text); - } - -}); - - -/* ---- - -name: Cookie - -description: Class for creating, reading, and deleting browser Cookies. - -license: MIT-style license. - -credits: - - Based on the functions by Peter-Paul Koch (http://quirksmode.org). - -requires: [Options, Browser] - -provides: Cookie - -... -*/ - -var Cookie = new Class({ - - Implements: Options, - - options: { - path: '/', - domain: false, - duration: false, - secure: false, - document: document, - encode: true - }, - - initialize: function(key, options){ - this.key = key; - this.setOptions(options); - }, - - write: function(value){ - if (this.options.encode) value = encodeURIComponent(value); - if (this.options.domain) value += '; domain=' + this.options.domain; - if (this.options.path) value += '; path=' + this.options.path; - if (this.options.duration){ - var date = new Date(); - date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000); - value += '; expires=' + date.toGMTString(); - } - if (this.options.secure) value += '; secure'; - this.options.document.cookie = this.key + '=' + value; - return this; - }, - - read: function(){ - var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key.escapeRegExp() + '=([^;]*)'); - return (value) ? decodeURIComponent(value[1]) : null; - }, - - dispose: function(){ - new Cookie(this.key, Object.merge({}, this.options, {duration: -1})).write(''); - return this; - } - -}); - -Cookie.write = function(key, value, options){ - return new Cookie(key, options).write(value); -}; - -Cookie.read = function(key){ - return new Cookie(key).read(); -}; - -Cookie.dispose = function(key, options){ - return new Cookie(key, options).dispose(); -}; - - -/* ---- - -name: DOMReady - -description: Contains the custom event domready. - -license: MIT-style license. - -requires: [Browser, Element, Element.Event] - -provides: [DOMReady, DomReady] - -... -*/ - -(function(window, document){ - -var ready, - loaded, - checks = [], - shouldPoll, - timer, - testElement = document.createElement('div'); - -var domready = function(){ - clearTimeout(timer); - if (ready) return; - Browser.loaded = ready = true; - document.removeListener('DOMContentLoaded', domready).removeListener('readystatechange', check); - - document.fireEvent('domready'); - window.fireEvent('domready'); -}; - -var check = function(){ - for (var i = checks.length; i--;) if (checks[i]()){ - domready(); - return true; - } - return false; -}; - -var poll = function(){ - clearTimeout(timer); - if (!check()) timer = setTimeout(poll, 10); -}; - -document.addListener('DOMContentLoaded', domready); - -/**/ -// doScroll technique by Diego Perini http://javascript.nwbox.com/IEContentLoaded/ -// testElement.doScroll() throws when the DOM is not ready, only in the top window -var doScrollWorks = function(){ - try { - testElement.doScroll(); - return true; - } catch (e){} - return false; -}; -// If doScroll works already, it can't be used to determine domready -// e.g. in an iframe -if (testElement.doScroll && !doScrollWorks()){ - checks.push(doScrollWorks); - shouldPoll = true; -} -/**/ - -if (document.readyState) checks.push(function(){ - var state = document.readyState; - return (state == 'loaded' || state == 'complete'); -}); - -if ('onreadystatechange' in document) document.addListener('readystatechange', check); -else shouldPoll = true; - -if (shouldPoll) poll(); - -Element.Events.domready = { - onAdd: function(fn){ - if (ready) fn.call(this); - } -}; - -// Make sure that domready fires before load -Element.Events.load = { - base: 'load', - onAdd: function(fn){ - if (loaded && this == window) fn.call(this); - }, - condition: function(){ - if (this == window){ - domready(); - delete Element.Events.load; - } - return true; - } -}; - -// This is based on the custom load event -window.addEvent('load', function(){ - loaded = true; -}); - -})(window, document); - diff --git a/pyload/webui/themes/Flat/js/static/mootools-core.min.js b/pyload/webui/themes/Flat/js/static/mootools-core.min.js deleted file mode 100644 index 354f94196..000000000 --- a/pyload/webui/themes/Flat/js/static/mootools-core.min.js +++ /dev/null @@ -1,491 +0,0 @@ -/* ---- -MooTools: the javascript framework - -web build: - - http://mootools.net/core/8423c12ffd6a6bfcde9ea22554aec795 - -packager build: - - packager build Core/Core Core/Array Core/String Core/Number Core/Function Core/Object Core/Event Core/Browser Core/Class Core/Class.Extras Core/Slick.Parser Core/Slick.Finder Core/Element Core/Element.Style Core/Element.Event Core/Element.Delegation Core/Element.Dimensions Core/Fx Core/Fx.CSS Core/Fx.Tween Core/Fx.Morph Core/Fx.Transitions Core/Request Core/Request.HTML Core/Request.JSON Core/Cookie Core/JSON Core/DOMReady - -copyrights: - - [MooTools](http://mootools.net) - -licenses: - - [MIT License](http://mootools.net/license.txt) -... -*/ - -(function(){this.MooTools={version:"1.5.0",build:"0f7b690afee9349b15909f33016a25d2e4d9f4e3"};var o=this.typeOf=function(i){if(i==null){return"null";}if(i.$family!=null){return i.$family(); -}if(i.nodeName){if(i.nodeType==1){return"element";}if(i.nodeType==3){return(/\S/).test(i.nodeValue)?"textnode":"whitespace";}}else{if(typeof i.length=="number"){if("callee" in i){return"arguments"; -}if("item" in i){return"collection";}}}return typeof i;};var j=this.instanceOf=function(t,i){if(t==null){return false;}var s=t.$constructor||t.constructor; -while(s){if(s===i){return true;}s=s.parent;}if(!t.hasOwnProperty){return false;}return t instanceof i;};var f=this.Function;var p=true;for(var k in {toString:1}){p=null; -}if(p){p=["hasOwnProperty","valueOf","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","constructor"];}f.prototype.overloadSetter=function(s){var i=this; -return function(u,t){if(u==null){return this;}if(s||typeof u!="string"){for(var v in u){i.call(this,v,u[v]);}if(p){for(var w=p.length;w--;){v=p[w];if(u.hasOwnProperty(v)){i.call(this,v,u[v]); -}}}}else{i.call(this,u,t);}return this;};};f.prototype.overloadGetter=function(s){var i=this;return function(u){var v,t;if(typeof u!="string"){v=u;}else{if(arguments.length>1){v=arguments; -}else{if(s){v=[u];}}}if(v){t={};for(var w=0;w>>0; -b>>0;b>>0;for(var a=(d<0)?Math.max(0,b+d):d||0;a>>0,b=Array(d);for(var a=0;a>>0; -b-1;},test:function(a,b){return((typeOf(a)=="regexp")?a:new RegExp(""+a,b)).test(this); -},trim:function(){return String(this).replace(/^\s+|\s+$/g,"");},clean:function(){return String(this).replace(/\s+/g," ").trim();},camelCase:function(){return String(this).replace(/-\D/g,function(a){return a.charAt(1).toUpperCase(); -});},hyphenate:function(){return String(this).replace(/[A-Z]/g,function(a){return("-"+a.charAt(0).toLowerCase());});},capitalize:function(){return String(this).replace(/\b[a-z]/g,function(a){return a.toUpperCase(); -});},escapeRegExp:function(){return String(this).replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1");},toInt:function(a){return parseInt(this,a||10);},toFloat:function(){return parseFloat(this); -},hexToRgb:function(b){var a=String(this).match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);return(a)?a.slice(1).hexToRgb(b):null;},rgbToHex:function(b){var a=String(this).match(/\d{1,3}/g); -return(a)?a.rgbToHex(b):null;},substitute:function(a,b){return String(this).replace(b||(/\\?\{([^{}]+)\}/g),function(d,c){if(d.charAt(0)=="\\"){return d.slice(1); -}return(a[c]!=null)?a[c]:"";});}});Number.implement({limit:function(b,a){return Math.min(a,Math.max(b,this));},round:function(a){a=Math.pow(10,a||0).toFixed(a<0?-a:0); -return Math.round(this*a)/a;},times:function(b,c){for(var a=0;a1?Array.slice(arguments,1):null,d=function(){};var c=function(){var g=e,h=arguments.length;if(this instanceof c){d.prototype=a.prototype; -g=new d;}var f=(!b&&!h)?a.call(g):a.apply(g,b&&h?b.concat(Array.slice(arguments)):b||arguments);return g==e?f:g;};return c;},pass:function(b,c){var a=this; -if(b!=null){b=Array.from(b);}return function(){return a.apply(c,b||arguments);};},delay:function(b,c,a){return setTimeout(this.pass((a==null?[]:a),c),b); -},periodical:function(c,b,a){return setInterval(this.pass((a==null?[]:a),b),c);}});(function(){var a=Object.prototype.hasOwnProperty;Object.extend({subset:function(d,g){var f={}; -for(var e=0,b=g.length;e]*>([\s\S]*?)<\/script>/gi,function(m,n){e+=n+"\n";return""; -});if(k===true){j.exec(e);}else{if(typeOf(k)=="function"){k(e,l);}}return l;});j.extend({Document:this.Document,Window:this.Window,Element:this.Element,Event:this.Event}); -this.Window=this.$constructor=new Type("Window",function(){});this.$family=Function.from("window").hide();Window.mirror(function(e,k){d[e]=k;});this.Document=f.$constructor=new Type("Document",function(){}); -f.$family=Function.from("document").hide();Document.mirror(function(e,k){f[e]=k;});f.html=f.documentElement;if(!f.head){f.head=f.getElementsByTagName("head")[0]; -}if(f.execCommand){try{f.execCommand("BackgroundImageCache",false,true);}catch(c){}}if(this.attachEvent&&!this.addEventListener){var b=function(){this.detachEvent("onunload",b); -f.head=f.html=f.window=null;};this.attachEvent("onunload",b);}var g=Array.from;try{g(f.html.childNodes);}catch(c){Array.from=function(k){if(typeof k!="string"&&Type.isEnumerable(k)&&typeOf(k)!="array"){var e=k.length,l=new Array(e); -while(e--){l[e]=k[e];}return l;}return g(k);};var h=Array.prototype,i=h.slice;["pop","push","reverse","shift","sort","splice","unshift","concat","join","slice"].each(function(e){var k=h[e]; -Array[e]=function(l){return k.apply(Array.from(l),i.call(arguments,1));};});}})();(function(){var b={};var a=this.DOMEvent=new Type("DOMEvent",function(c,g){if(!g){g=window; -}c=c||g.event;if(c.$extended){return c;}this.event=c;this.$extended=true;this.shift=c.shiftKey;this.control=c.ctrlKey;this.alt=c.altKey;this.meta=c.metaKey; -var i=this.type=c.type;var h=c.target||c.srcElement;while(h&&h.nodeType==3){h=h.parentNode;}this.target=document.id(h);if(i.indexOf("key")==0){var d=this.code=(c.which||c.keyCode); -this.key=b[d];if(i=="keydown"||i=="keyup"){if(d>111&&d<124){this.key="f"+(d-111);}else{if(d>95&&d<106){this.key=d-96;}}}if(this.key==null){this.key=String.fromCharCode(d).toLowerCase(); -}}else{if(i=="click"||i=="dblclick"||i=="contextmenu"||i=="DOMMouseScroll"||i.indexOf("mouse")==0){var j=g.document;j=(!j.compatMode||j.compatMode=="CSS1Compat")?j.html:j.body; -this.page={x:(c.pageX!=null)?c.pageX:c.clientX+j.scrollLeft,y:(c.pageY!=null)?c.pageY:c.clientY+j.scrollTop};this.client={x:(c.pageX!=null)?c.pageX-g.pageXOffset:c.clientX,y:(c.pageY!=null)?c.pageY-g.pageYOffset:c.clientY}; -if(i=="DOMMouseScroll"||i=="mousewheel"){this.wheel=(c.wheelDelta)?c.wheelDelta/120:-(c.detail||0)/3;}this.rightClick=(c.which==3||c.button==2);if(i=="mouseover"||i=="mouseout"){var k=c.relatedTarget||c[(i=="mouseover"?"from":"to")+"Element"]; -while(k&&k.nodeType==3){k=k.parentNode;}this.relatedTarget=document.id(k);}}else{if(i.indexOf("touch")==0||i.indexOf("gesture")==0){this.rotation=c.rotation; -this.scale=c.scale;this.targetTouches=c.targetTouches;this.changedTouches=c.changedTouches;var f=this.touches=c.touches;if(f&&f[0]){var e=f[0];this.page={x:e.pageX,y:e.pageY}; -this.client={x:e.clientX,y:e.clientY};}}}}if(!this.client){this.client={};}if(!this.page){this.page={};}});a.implement({stop:function(){return this.preventDefault().stopPropagation(); -},stopPropagation:function(){if(this.event.stopPropagation){this.event.stopPropagation();}else{this.event.cancelBubble=true;}return this;},preventDefault:function(){if(this.event.preventDefault){this.event.preventDefault(); -}else{this.event.returnValue=false;}return this;}});a.defineKey=function(d,c){b[d]=c;return this;};a.defineKeys=a.defineKey.overloadSetter(true);a.defineKeys({"38":"up","40":"down","37":"left","39":"right","27":"esc","32":"space","8":"backspace","9":"tab","46":"delete","13":"enter"}); -})();(function(){var a=this.Class=new Type("Class",function(h){if(instanceOf(h,Function)){h={initialize:h};}var g=function(){e(this);if(g.$prototyping){return this; -}this.$caller=null;var i=(this.initialize)?this.initialize.apply(this,arguments):this;this.$caller=this.caller=null;return i;}.extend(this).implement(h); -g.$constructor=a;g.prototype.$constructor=g;g.prototype.parent=c;return g;});var c=function(){if(!this.$caller){throw new Error('The method "parent" cannot be called.'); -}var g=this.$caller.$name,h=this.$caller.$owner.parent,i=(h)?h.prototype[g]:null;if(!i){throw new Error('The method "'+g+'" has no parent.');}return i.apply(this,arguments); -};var e=function(g){for(var h in g){var j=g[h];switch(typeOf(j)){case"object":var i=function(){};i.prototype=j;g[h]=e(new i);break;case"array":g[h]=j.clone(); -break;}}return g;};var b=function(g,h,j){if(j.$origin){j=j.$origin;}var i=function(){if(j.$protected&&this.$caller==null){throw new Error('The method "'+h+'" cannot be called.'); -}var l=this.caller,m=this.$caller;this.caller=m;this.$caller=i;var k=j.apply(this,arguments);this.$caller=m;this.caller=l;return k;}.extend({$owner:g,$origin:j,$name:h}); -return i;};var f=function(h,i,g){if(a.Mutators.hasOwnProperty(h)){i=a.Mutators[h].call(this,i);if(i==null){return this;}}if(typeOf(i)=="function"){if(i.$hidden){return this; -}this.prototype[h]=(g)?i:b(this,h,i);}else{Object.merge(this.prototype,h,i);}return this;};var d=function(g){g.$prototyping=true;var h=new g;delete g.$prototyping; -return h;};a.implement("implement",f.overloadSetter());a.Mutators={Extends:function(g){this.parent=g;this.prototype=d(g);},Implements:function(g){Array.from(g).each(function(j){var h=new j; -for(var i in h){f.call(this,i,h[i],true);}},this);}};})();(function(){this.Chain=new Class({$chain:[],chain:function(){this.$chain.append(Array.flatten(arguments)); -return this;},callChain:function(){return(this.$chain.length)?this.$chain.shift().apply(this,arguments):false;},clearChain:function(){this.$chain.empty(); -return this;}});var a=function(b){return b.replace(/^on([A-Z])/,function(c,d){return d.toLowerCase();});};this.Events=new Class({$events:{},addEvent:function(d,c,b){d=a(d); -this.$events[d]=(this.$events[d]||[]).include(c);if(b){c.internal=true;}return this;},addEvents:function(b){for(var c in b){this.addEvent(c,b[c]);}return this; -},fireEvent:function(e,c,b){e=a(e);var d=this.$events[e];if(!d){return this;}c=Array.from(c);d.each(function(f){if(b){f.delay(b,this,c);}else{f.apply(this,c); -}},this);return this;},removeEvent:function(e,d){e=a(e);var c=this.$events[e];if(c&&!d.internal){var b=c.indexOf(d);if(b!=-1){delete c[b];}}return this; -},removeEvents:function(d){var e;if(typeOf(d)=="object"){for(e in d){this.removeEvent(e,d[e]);}return this;}if(d){d=a(d);}for(e in this.$events){if(d&&d!=e){continue; -}var c=this.$events[e];for(var b=c.length;b--;){if(b in c){this.removeEvent(e,c[b]);}}}return this;}});this.Options=new Class({setOptions:function(){var b=this.options=Object.merge.apply(null,[{},this.options].append(arguments)); -if(this.addEvent){for(var c in b){if(typeOf(b[c])!="function"||!(/^on[A-Z]/).test(c)){continue;}this.addEvent(c,b[c]);delete b[c];}}return this;}});})(); -(function(){var k,n,l,g,a={},c={},m=/\\/g;var e=function(q,p){if(q==null){return null;}if(q.Slick===true){return q;}q=(""+q).replace(/^\s+|\s+$/g,"");g=!!p; -var o=(g)?c:a;if(o[q]){return o[q];}k={Slick:true,expressions:[],raw:q,reverse:function(){return e(this.raw,true);}};n=-1;while(q!=(q=q.replace(j,b))){}k.length=k.expressions.length; -return o[k.raw]=(g)?h(k):k;};var i=function(o){if(o==="!"){return" ";}else{if(o===" "){return"!";}else{if((/^!/).test(o)){return o.replace(/^!/,"");}else{return"!"+o; -}}}};var h=function(u){var r=u.expressions;for(var p=0;p+)\\s*|(\\s+)|(+|\\*)|\\#(+)|\\.(+)|\\[\\s*(+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)".replace(//,"["+f(">+~`!@$%^&={}\\;/g,"(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])").replace(//g,"(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])")); -function b(x,s,D,z,r,C,q,B,A,y,u,F,G,v,p,w){if(s||n===-1){k.expressions[++n]=[];l=-1;if(s){return"";}}if(D||z||l===-1){D=D||" ";var t=k.expressions[n]; -if(g&&t[l]){t[l].reverseCombinator=i(D);}t[++l]={combinator:D,tag:"*"};}var o=k.expressions[n][l];if(r){o.tag=r.replace(m,"");}else{if(C){o.id=C.replace(m,""); -}else{if(q){q=q.replace(m,"");if(!o.classList){o.classList=[];}if(!o.classes){o.classes=[];}o.classList.push(q);o.classes.push({value:q,regexp:new RegExp("(^|\\s)"+f(q)+"(\\s|$)")}); -}else{if(G){w=w||p;w=w?w.replace(m,""):null;if(!o.pseudos){o.pseudos=[];}o.pseudos.push({key:G.replace(m,""),value:w,type:F.length==1?"class":"element"}); -}else{if(B){B=B.replace(m,"");u=(u||"").replace(m,"");var E,H;switch(A){case"^=":H=new RegExp("^"+f(u));break;case"$=":H=new RegExp(f(u)+"$");break;case"~=":H=new RegExp("(^|\\s)"+f(u)+"(\\s|$)"); -break;case"|=":H=new RegExp("^"+f(u)+"(-|$)");break;case"=":E=function(I){return u==I;};break;case"*=":E=function(I){return I&&I.indexOf(u)>-1;};break; -case"!=":E=function(I){return u!=I;};break;default:E=function(I){return !!I;};}if(u==""&&(/^[*$^]=$/).test(A)){E=function(){return false;};}if(!E){E=function(I){return I&&H.test(I); -};}if(!o.attributes){o.attributes=[];}o.attributes.push({key:B,operator:A,value:u,test:E});}}}}}return"";}var d=(this.Slick||{});d.parse=function(o){return e(o); -};d.escapeRegExp=f;if(!this.Slick){this.Slick=d;}}).apply((typeof exports!="undefined")?exports:this);(function(){var k={},m={},d=Object.prototype.toString; -k.isNativeCode=function(c){return(/\{\s*\[native code\]\s*\}/).test(""+c);};k.isXML=function(c){return(!!c.xmlVersion)||(!!c.xml)||(d.call(c)=="[object XMLDocument]")||(c.nodeType==9&&c.documentElement.nodeName!="HTML"); -};k.setDocument=function(w){var p=w.nodeType;if(p==9){}else{if(p){w=w.ownerDocument;}else{if(w.navigator){w=w.document;}else{return;}}}if(this.document===w){return; -}this.document=w;var A=w.documentElement,o=this.getUIDXML(A),s=m[o],r;if(s){for(r in s){this[r]=s[r];}return;}s=m[o]={};s.root=A;s.isXMLDocument=this.isXML(w); -s.brokenStarGEBTN=s.starSelectsClosedQSA=s.idGetsName=s.brokenMixedCaseQSA=s.brokenGEBCN=s.brokenCheckedQSA=s.brokenEmptyAttributeQSA=s.isHTMLDocument=s.nativeMatchesSelector=false; -var q,u,y,z,t;var x,v="slick_uniqueid";var c=w.createElement("div");var n=w.body||w.getElementsByTagName("body")[0]||A;n.appendChild(c);try{c.innerHTML=''; -s.isHTMLDocument=!!w.getElementById(v);}catch(C){}if(s.isHTMLDocument){c.style.display="none";c.appendChild(w.createComment(""));u=(c.getElementsByTagName("*").length>1); -try{c.innerHTML="foo";x=c.getElementsByTagName("*");q=(x&&!!x.length&&x[0].nodeName.charAt(0)=="/");}catch(C){}s.brokenStarGEBTN=u||q;try{c.innerHTML=''; -s.idGetsName=w.getElementById(v)===c.firstChild;}catch(C){}if(c.getElementsByClassName){try{c.innerHTML='';c.getElementsByClassName("b").length; -c.firstChild.className="b";z=(c.getElementsByClassName("b").length!=2);}catch(C){}try{c.innerHTML='';y=(c.getElementsByClassName("a").length!=2); -}catch(C){}s.brokenGEBCN=z||y;}if(c.querySelectorAll){try{c.innerHTML="foo";x=c.querySelectorAll("*");s.starSelectsClosedQSA=(x&&!!x.length&&x[0].nodeName.charAt(0)=="/"); -}catch(C){}try{c.innerHTML='';s.brokenMixedCaseQSA=!c.querySelectorAll(".MiX").length;}catch(C){}try{c.innerHTML=''; -s.brokenCheckedQSA=(c.querySelectorAll(":checked").length==0);}catch(C){}try{c.innerHTML='';s.brokenEmptyAttributeQSA=(c.querySelectorAll('[class*=""]').length!=0); -}catch(C){}}try{c.innerHTML='
        ';t=(c.firstChild.getAttribute("action")!="s");}catch(C){}s.nativeMatchesSelector=A.matches||A.mozMatchesSelector||A.webkitMatchesSelector; -if(s.nativeMatchesSelector){try{s.nativeMatchesSelector.call(A,":slick");s.nativeMatchesSelector=null;}catch(C){}}}try{A.slick_expando=1;delete A.slick_expando; -s.getUID=this.getUIDHTML;}catch(C){s.getUID=this.getUIDXML;}n.removeChild(c);c=x=n=null;s.getAttribute=(s.isHTMLDocument&&t)?function(G,E){var H=this.attributeGetters[E]; -if(H){return H.call(G);}var F=G.getAttributeNode(E);return(F)?F.nodeValue:null;}:function(F,E){var G=this.attributeGetters[E];return(G)?G.call(F):F.getAttribute(E); -};s.hasAttribute=(A&&this.isNativeCode(A.hasAttribute))?function(F,E){return F.hasAttribute(E);}:function(F,E){F=F.getAttributeNode(E);return !!(F&&(F.specified||F.nodeValue)); -};var D=A&&this.isNativeCode(A.contains),B=w&&this.isNativeCode(w.contains);s.contains=(D&&B)?function(E,F){return E.contains(F);}:(D&&!B)?function(E,F){return E===F||((E===w)?w.documentElement:E).contains(F); -}:(A&&A.compareDocumentPosition)?function(E,F){return E===F||!!(E.compareDocumentPosition(F)&16);}:function(E,F){if(F){do{if(F===E){return true;}}while((F=F.parentNode)); -}return false;};s.documentSorter=(A.compareDocumentPosition)?function(F,E){if(!F.compareDocumentPosition||!E.compareDocumentPosition){return 0;}return F.compareDocumentPosition(E)&4?-1:F===E?0:1; -}:("sourceIndex" in A)?function(F,E){if(!F.sourceIndex||!E.sourceIndex){return 0;}return F.sourceIndex-E.sourceIndex;}:(w.createRange)?function(H,F){if(!H.ownerDocument||!F.ownerDocument){return 0; -}var G=H.ownerDocument.createRange(),E=F.ownerDocument.createRange();G.setStart(H,0);G.setEnd(H,0);E.setStart(F,0);E.setEnd(F,0);return G.compareBoundaryPoints(Range.START_TO_END,E); -}:null;A=null;for(r in s){this[r]=s[r];}};var f=/^([#.]?)((?:[\w-]+|\*))$/,h=/\[.+[*$^]=(?:""|'')?\]/,g={};k.search=function(U,z,H,s){var p=this.found=(s)?null:(H||[]); -if(!U){return p;}else{if(U.navigator){U=U.document;}else{if(!U.nodeType){return p;}}}var F,O,V=this.uniques={},I=!!(H&&H.length),y=(U.nodeType==9);if(this.document!==(y?U:U.ownerDocument)){this.setDocument(U); -}if(I){for(O=p.length;O--;){V[this.getUID(p[O])]=true;}}if(typeof z=="string"){var r=z.match(f);simpleSelectors:if(r){var u=r[1],v=r[2],A,E;if(!u){if(v=="*"&&this.brokenStarGEBTN){break simpleSelectors; -}E=U.getElementsByTagName(v);if(s){return E[0]||null;}for(O=0;A=E[O++];){if(!(I&&V[this.getUID(A)])){p.push(A);}}}else{if(u=="#"){if(!this.isHTMLDocument||!y){break simpleSelectors; -}A=U.getElementById(v);if(!A){return p;}if(this.idGetsName&&A.getAttributeNode("id").nodeValue!=v){break simpleSelectors;}if(s){return A||null;}if(!(I&&V[this.getUID(A)])){p.push(A); -}}else{if(u=="."){if(!this.isHTMLDocument||((!U.getElementsByClassName||this.brokenGEBCN)&&U.querySelectorAll)){break simpleSelectors;}if(U.getElementsByClassName&&!this.brokenGEBCN){E=U.getElementsByClassName(v); -if(s){return E[0]||null;}for(O=0;A=E[O++];){if(!(I&&V[this.getUID(A)])){p.push(A);}}}else{var T=new RegExp("(^|\\s)"+e.escapeRegExp(v)+"(\\s|$)");E=U.getElementsByTagName("*"); -for(O=0;A=E[O++];){className=A.className;if(!(className&&T.test(className))){continue;}if(s){return A;}if(!(I&&V[this.getUID(A)])){p.push(A);}}}}}}if(I){this.sort(p); -}return(s)?null:p;}querySelector:if(U.querySelectorAll){if(!this.isHTMLDocument||g[z]||this.brokenMixedCaseQSA||(this.brokenCheckedQSA&&z.indexOf(":checked")>-1)||(this.brokenEmptyAttributeQSA&&h.test(z))||(!y&&z.indexOf(",")>-1)||e.disableQSA){break querySelector; -}var S=z,x=U;if(!y){var C=x.getAttribute("id"),t="slickid__";x.setAttribute("id",t);S="#"+t+" "+S;U=x.parentNode;}try{if(s){return U.querySelector(S)||null; -}else{E=U.querySelectorAll(S);}}catch(Q){g[z]=1;break querySelector;}finally{if(!y){if(C){x.setAttribute("id",C);}else{x.removeAttribute("id");}U=x;}}if(this.starSelectsClosedQSA){for(O=0; -A=E[O++];){if(A.nodeName>"@"&&!(I&&V[this.getUID(A)])){p.push(A);}}}else{for(O=0;A=E[O++];){if(!(I&&V[this.getUID(A)])){p.push(A);}}}if(I){this.sort(p); -}return p;}F=this.Slick.parse(z);if(!F.length){return p;}}else{if(z==null){return p;}else{if(z.Slick){F=z;}else{if(this.contains(U.documentElement||U,z)){(p)?p.push(z):p=z; -return p;}else{return p;}}}}this.posNTH={};this.posNTHLast={};this.posNTHType={};this.posNTHTypeLast={};this.push=(!I&&(s||(F.length==1&&F.expressions[0].length==1)))?this.pushArray:this.pushUID; -if(p==null){p=[];}var M,L,K;var B,J,D,c,q,G,W;var N,P,o,w,R=F.expressions;search:for(O=0;(P=R[O]);O++){for(M=0;(o=P[M]);M++){B="combinator:"+o.combinator; -if(!this[B]){continue search;}J=(this.isXMLDocument)?o.tag:o.tag.toUpperCase();D=o.id;c=o.classList;q=o.classes;G=o.attributes;W=o.pseudos;w=(M===(P.length-1)); -this.bitUniques={};if(w){this.uniques=V;this.found=p;}else{this.uniques={};this.found=[];}if(M===0){this[B](U,J,D,q,G,W,c);if(s&&w&&p.length){break search; -}}else{if(s&&w){for(L=0,K=N.length;L1)){this.sort(p);}return(s)?(p[0]||null):p;};k.uidx=1;k.uidk="slick-uniqueid";k.getUIDXML=function(n){var c=n.getAttribute(this.uidk); -if(!c){c=this.uidx++;n.setAttribute(this.uidk,c);}return c;};k.getUIDHTML=function(c){return c.uniqueNumber||(c.uniqueNumber=this.uidx++);};k.sort=function(c){if(!this.documentSorter){return c; -}c.sort(this.documentSorter);return c;};k.cacheNTH={};k.matchNTH=/^([+-]?\d*)?([a-z]+)?([+-]\d+)?$/;k.parseNTHArgument=function(q){var o=q.match(this.matchNTH); -if(!o){return false;}var p=o[2]||false;var n=o[1]||1;if(n=="-"){n=-1;}var c=+o[3]||0;o=(p=="n")?{a:n,b:c}:(p=="odd")?{a:2,b:1}:(p=="even")?{a:2,b:0}:{a:0,b:n}; -return(this.cacheNTH[q]=o);};k.createNTHPseudo=function(p,n,c,o){return function(s,q){var u=this.getUID(s);if(!this[c][u]){var A=s.parentNode;if(!A){return false; -}var r=A[p],t=1;if(o){var z=s.nodeName;do{if(r.nodeName!=z){continue;}this[c][this.getUID(r)]=t++;}while((r=r[n]));}else{do{if(r.nodeType!=1){continue; -}this[c][this.getUID(r)]=t++;}while((r=r[n]));}}q=q||"n";var v=this.cacheNTH[q]||this.parseNTHArgument(q);if(!v){return false;}var y=v.a,x=v.b,w=this[c][u]; -if(y==0){return x==w;}if(y>0){if(w":function(p,c,r,o,n,q){if((p=p.firstChild)){do{if(p.nodeType==1){this.push(p,c,r,o,n,q); -}}while((p=p.nextSibling));}},"+":function(p,c,r,o,n,q){while((p=p.nextSibling)){if(p.nodeType==1){this.push(p,c,r,o,n,q);break;}}},"^":function(p,c,r,o,n,q){p=p.firstChild; -if(p){if(p.nodeType==1){this.push(p,c,r,o,n,q);}else{this["combinator:+"](p,c,r,o,n,q);}}},"~":function(q,c,s,p,n,r){while((q=q.nextSibling)){if(q.nodeType!=1){continue; -}var o=this.getUID(q);if(this.bitUniques[o]){break;}this.bitUniques[o]=true;this.push(q,c,s,p,n,r);}},"++":function(p,c,r,o,n,q){this["combinator:+"](p,c,r,o,n,q); -this["combinator:!+"](p,c,r,o,n,q);},"~~":function(p,c,r,o,n,q){this["combinator:~"](p,c,r,o,n,q);this["combinator:!~"](p,c,r,o,n,q);},"!":function(p,c,r,o,n,q){while((p=p.parentNode)){if(p!==this.document){this.push(p,c,r,o,n,q); -}}},"!>":function(p,c,r,o,n,q){p=p.parentNode;if(p!==this.document){this.push(p,c,r,o,n,q);}},"!+":function(p,c,r,o,n,q){while((p=p.previousSibling)){if(p.nodeType==1){this.push(p,c,r,o,n,q); -break;}}},"!^":function(p,c,r,o,n,q){p=p.lastChild;if(p){if(p.nodeType==1){this.push(p,c,r,o,n,q);}else{this["combinator:!+"](p,c,r,o,n,q);}}},"!~":function(q,c,s,p,n,r){while((q=q.previousSibling)){if(q.nodeType!=1){continue; -}var o=this.getUID(q);if(this.bitUniques[o]){break;}this.bitUniques[o]=true;this.push(q,c,s,p,n,r);}}};for(var i in j){k["combinator:"+i]=j[i];}var l={empty:function(c){var n=c.firstChild; -return !(n&&n.nodeType==1)&&!(c.innerText||c.textContent||"").length;},not:function(c,n){return !this.matchNode(c,n);},contains:function(c,n){return(c.innerText||c.textContent||"").indexOf(n)>-1; -},"first-child":function(c){while((c=c.previousSibling)){if(c.nodeType==1){return false;}}return true;},"last-child":function(c){while((c=c.nextSibling)){if(c.nodeType==1){return false; -}}return true;},"only-child":function(o){var n=o;while((n=n.previousSibling)){if(n.nodeType==1){return false;}}var c=o;while((c=c.nextSibling)){if(c.nodeType==1){return false; -}}return true;},"nth-child":k.createNTHPseudo("firstChild","nextSibling","posNTH"),"nth-last-child":k.createNTHPseudo("lastChild","previousSibling","posNTHLast"),"nth-of-type":k.createNTHPseudo("firstChild","nextSibling","posNTHType",true),"nth-last-of-type":k.createNTHPseudo("lastChild","previousSibling","posNTHTypeLast",true),index:function(n,c){return this["pseudo:nth-child"](n,""+(c+1)); -},even:function(c){return this["pseudo:nth-child"](c,"2n");},odd:function(c){return this["pseudo:nth-child"](c,"2n+1");},"first-of-type":function(c){var n=c.nodeName; -while((c=c.previousSibling)){if(c.nodeName==n){return false;}}return true;},"last-of-type":function(c){var n=c.nodeName;while((c=c.nextSibling)){if(c.nodeName==n){return false; -}}return true;},"only-of-type":function(o){var n=o,p=o.nodeName;while((n=n.previousSibling)){if(n.nodeName==p){return false;}}var c=o;while((c=c.nextSibling)){if(c.nodeName==p){return false; -}}return true;},enabled:function(c){return !c.disabled;},disabled:function(c){return c.disabled;},checked:function(c){return c.checked||c.selected;},focus:function(c){return this.isHTMLDocument&&this.document.activeElement===c&&(c.href||c.type||this.hasAttribute(c,"tabindex")); -},root:function(c){return(c===this.root);},selected:function(c){return c.selected;}};for(var b in l){k["pseudo:"+b]=l[b];}var a=k.attributeGetters={"for":function(){return("htmlFor" in this)?this.htmlFor:this.getAttribute("for"); -},href:function(){return("href" in this)?this.getAttribute("href",2):this.getAttribute("href");},style:function(){return(this.style)?this.style.cssText:this.getAttribute("style"); -},tabindex:function(){var c=this.getAttributeNode("tabindex");return(c&&c.specified)?c.nodeValue:null;},type:function(){return this.getAttribute("type"); -},maxlength:function(){var c=this.getAttributeNode("maxLength");return(c&&c.specified)?c.nodeValue:null;}};a.MAXLENGTH=a.maxLength=a.maxlength;var e=k.Slick=(this.Slick||{}); -e.version="1.1.7";e.search=function(n,o,c){return k.search(n,o,c);};e.find=function(c,n){return k.search(c,n,null,true);};e.contains=function(c,n){k.setDocument(c); -return k.contains(c,n);};e.getAttribute=function(n,c){k.setDocument(n);return k.getAttribute(n,c);};e.hasAttribute=function(n,c){k.setDocument(n);return k.hasAttribute(n,c); -};e.match=function(n,c){if(!(n&&c)){return false;}if(!c||c===n){return true;}k.setDocument(n);return k.matchNode(n,c);};e.defineAttributeGetter=function(c,n){k.attributeGetters[c]=n; -return this;};e.lookupAttributeGetter=function(c){return k.attributeGetters[c];};e.definePseudo=function(c,n){k["pseudo:"+c]=function(p,o){return n.call(p,o); -};return this;};e.lookupPseudo=function(c){var n=k["pseudo:"+c];if(n){return function(o){return n.call(this,o);};}return null;};e.override=function(n,c){k.override(n,c); -return this;};e.isXML=k.isXML;e.uidOf=function(c){return k.getUIDHTML(c);};if(!this.Slick){this.Slick=e;}}).apply((typeof exports!="undefined")?exports:this); -var Element=this.Element=function(b,g){var h=Element.Constructors[b];if(h){return h(g);}if(typeof b!="string"){return document.id(b).set(g);}if(!g){g={}; -}if(!(/^[\w-]+$/).test(b)){var e=Slick.parse(b).expressions[0][0];b=(e.tag=="*")?"div":e.tag;if(e.id&&g.id==null){g.id=e.id;}var d=e.attributes;if(d){for(var a,f=0,c=d.length; -f=this.length){delete this[g--]; -}return e;}.protect());}Array.forEachMethod(function(g,e){Elements.implement(e,g);});Array.mirror(Elements);var d;try{d=(document.createElement("").name=="x"); -}catch(b){}var c=function(e){return(""+e).replace(/&/g,"&").replace(/"/g,""");};Document.implement({newElement:function(e,g){if(g&&g.checked!=null){g.defaultChecked=g.checked; -}if(d&&g){e="<"+e;if(g.name){e+=' name="'+c(g.name)+'"';}if(g.type){e+=' type="'+c(g.type)+'"';}e+=">";delete g.name;delete g.type;}return this.id(this.createElement(e)).set(g); -}});})();(function(){Slick.uidOf(window);Slick.uidOf(document);Document.implement({newTextNode:function(e){return this.createTextNode(e);},getDocument:function(){return this; -},getWindow:function(){return this.window;},id:(function(){var e={string:function(L,K,l){L=Slick.find(l,"#"+L.replace(/(\W)/g,"\\$1"));return(L)?e.element(L,K):null; -},element:function(K,L){Slick.uidOf(K);if(!L&&!K.$family&&!(/^(?:object|embed)$/i).test(K.tagName)){var l=K.fireEvent;K._fireEvent=function(M,N){return l(M,N); -};Object.append(K,Element.Prototype);}return K;},object:function(K,L,l){if(K.toElement){return e.element(K.toElement(l),L);}return null;}};e.textnode=e.whitespace=e.window=e.document=function(l){return l; -};return function(K,M,L){if(K&&K.$family&&K.uniqueNumber){return K;}var l=typeOf(K);return(e[l])?e[l](K,M,L||document):null;};})()});if(window.$==null){Window.implement("$",function(e,l){return document.id(e,l,this.document); -});}Window.implement({getDocument:function(){return this.document;},getWindow:function(){return this;}});[Document,Element].invoke("implement",{getElements:function(e){return Slick.search(this,e,new Elements); -},getElement:function(e){return document.id(Slick.find(this,e));}});var p={contains:function(e){return Slick.contains(this,e);}};if(!document.contains){Document.implement(p); -}if(!document.createElement("div").contains){Element.implement(p);}var v=function(L,K){if(!L){return K;}L=Object.clone(Slick.parse(L));var l=L.expressions; -for(var e=l.length;e--;){l[e][0].combinator=K;}return L;};Object.forEach({getNext:"~",getPrevious:"!~",getParent:"!"},function(e,l){Element.implement(l,function(K){return this.getElement(v(K,e)); -});});Object.forEach({getAllNext:"~",getAllPrevious:"!~",getSiblings:"~~",getChildren:">",getParents:"!"},function(e,l){Element.implement(l,function(K){return this.getElements(v(K,e)); -});});Element.implement({getFirst:function(e){return document.id(Slick.search(this,v(e,">"))[0]);},getLast:function(e){return document.id(Slick.search(this,v(e,">")).getLast()); -},getWindow:function(){return this.ownerDocument.window;},getDocument:function(){return this.ownerDocument;},getElementById:function(e){return document.id(Slick.find(this,"#"+(""+e).replace(/(\W)/g,"\\$1"))); -},match:function(e){return !e||Slick.match(this,e);}});if(window.$$==null){Window.implement("$$",function(e){if(arguments.length==1){if(typeof e=="string"){return Slick.search(this.document,e,new Elements); -}else{if(Type.isEnumerable(e)){return new Elements(e);}}}return new Elements(arguments);});}var A={before:function(l,e){var K=e.parentNode;if(K){K.insertBefore(l,e); -}},after:function(l,e){var K=e.parentNode;if(K){K.insertBefore(l,e.nextSibling);}},bottom:function(l,e){e.appendChild(l);},top:function(l,e){e.insertBefore(l,e.firstChild); -}};A.inside=A.bottom;var n={},d={};var o={};Array.forEach(["type","value","defaultValue","accessKey","cellPadding","cellSpacing","colSpan","frameBorder","rowSpan","tabIndex","useMap"],function(e){o[e.toLowerCase()]=e; -});o.html="innerHTML";o.text=(document.createElement("div").textContent==null)?"innerText":"textContent";Object.forEach(o,function(l,e){d[e]=function(K,L){K[l]=L; -};n[e]=function(K){return K[l];};});var B=["compact","nowrap","ismap","declare","noshade","checked","disabled","readOnly","multiple","selected","noresize","defer","defaultChecked","autofocus","controls","autoplay","loop"]; -var k={};Array.forEach(B,function(e){var l=e.toLowerCase();k[l]=e;d[l]=function(K,L){K[e]=!!L;};n[l]=function(K){return !!K[e];};});Object.append(d,{"class":function(e,l){("className" in e)?e.className=(l||""):e.setAttribute("class",l); -},"for":function(e,l){("htmlFor" in e)?e.htmlFor=l:e.setAttribute("for",l);},style:function(e,l){(e.style)?e.style.cssText=l:e.setAttribute("style",l); -},value:function(e,l){e.value=(l!=null)?l:"";}});n["class"]=function(e){return("className" in e)?e.className||null:e.getAttribute("class");};var f=document.createElement("button"); -try{f.type="button";}catch(E){}if(f.type!="button"){d.type=function(e,l){e.setAttribute("type",l);};}f=null;var s=document.createElement("input");s.value="t"; -s.type="submit";if(s.value!="t"){d.type=function(l,e){var K=l.value;l.type=e;l.value=K;};}s=null;var u=(function(e){e.random="attribute";return(e.getAttribute("random")=="attribute"); -})(document.createElement("div"));var i=(function(e){e.innerHTML='';return e.cloneNode(true).firstChild.childNodes.length!=1; -})(document.createElement("div"));var j=!!document.createElement("div").classList;var F=function(e){var l=(e||"").clean().split(" "),K={};return l.filter(function(L){if(L!==""&&!K[L]){return K[L]=L; -}});};var t=function(e){this.classList.add(e);};var g=function(e){this.classList.remove(e);};Element.implement({setProperty:function(l,K){var L=d[l.toLowerCase()]; -if(L){L(this,K);}else{var e;if(u){e=this.retrieve("$attributeWhiteList",{});}if(K==null){this.removeAttribute(l);if(u){delete e[l];}}else{this.setAttribute(l,""+K); -if(u){e[l]=true;}}}return this;},setProperties:function(e){for(var l in e){this.setProperty(l,e[l]);}return this;},getProperty:function(M){var K=n[M.toLowerCase()]; -if(K){return K(this);}if(u){var l=this.getAttributeNode(M),L=this.retrieve("$attributeWhiteList",{});if(!l){return null;}if(l.expando&&!L[M]){var N=this.outerHTML; -if(N.substr(0,N.search(/\/?['"]?>(?![^<]*<['"])/)).indexOf(M)<0){return null;}L[M]=true;}}var e=Slick.getAttribute(this,M);return(!e&&!Slick.hasAttribute(this,M))?null:e; -},getProperties:function(){var e=Array.from(arguments);return e.map(this.getProperty,this).associate(e);},removeProperty:function(e){return this.setProperty(e,null); -},removeProperties:function(){Array.each(arguments,this.removeProperty,this);return this;},set:function(K,l){var e=Element.Properties[K];(e&&e.set)?e.set.call(this,l):this.setProperty(K,l); -}.overloadSetter(),get:function(l){var e=Element.Properties[l];return(e&&e.get)?e.get.apply(this):this.getProperty(l);}.overloadGetter(),erase:function(l){var e=Element.Properties[l]; -(e&&e.erase)?e.erase.apply(this):this.removeProperty(l);return this;},hasClass:j?function(e){return this.classList.contains(e);}:function(e){return this.className.clean().contains(e," "); -},addClass:j?function(e){F(e).forEach(t,this);return this;}:function(e){this.className=F(e+" "+this.className).join(" ");return this;},removeClass:j?function(e){F(e).forEach(g,this); -return this;}:function(e){var l=F(this.className);F(e).forEach(l.erase,l);this.className=l.join(" ");return this;},toggleClass:function(e,l){if(l==null){l=!this.hasClass(e); -}return(l)?this.addClass(e):this.removeClass(e);},adopt:function(){var L=this,e,N=Array.flatten(arguments),M=N.length;if(M>1){L=e=document.createDocumentFragment(); -}for(var K=0;K1){L=document.createDocumentFragment(); -for(var N=0,e=O.length;N";a=(x.childNodes.length==1);if(!a){var w="abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video".split(" "),b=document.createDocumentFragment(),y=w.length; -while(y--){b.createElement(w[y]);}}x=null;h=Function.attempt(function(){var e=document.createElement("table");e.innerHTML="";return true; -});var c=document.createElement("tr"),r="";c.innerHTML=r;C=(c.innerHTML==r);c=null;if(!h||!C||!a){Element.Properties.html.set=(function(l){var e={table:[1,"","
        "],select:[1,""],tbody:[2,"","
        "],tr:[3,"","
        "]}; -e.thead=e.tfoot=e.tbody;return function(K){var L=e[this.get("tag")];if(!L&&!a){L=[0,"",""];}if(!L){return l.call(this,K);}var O=L[0],N=document.createElement("div"),M=N; -if(!a){b.appendChild(N);}N.innerHTML=[L[1],K,L[2]].flatten().join("");while(O--){M=M.firstChild;}this.empty().adopt(M.childNodes);if(!a){b.removeChild(N); -}N=null;};})(Element.Properties.html.set);}var q=document.createElement("form");q.innerHTML="";if(q.firstChild.value!="s"){Element.Properties.value={set:function(N){var l=this.get("tag"); -if(l!="select"){return this.setProperty("value",N);}var K=this.getElements("option");N=String(N);for(var L=0;L0||r==null?"visible":"hidden";};var p=function(r,v,u){var t=r.style,s=t.filter||r.getComputedStyle("filter")||"";t.filter=(v.test(s)?s.replace(v,u):s+" "+u).trim(); -if(!t.filter){t.removeAttribute("filter");}};var h=(j?function(s,r){s.style.opacity=r;}:(g?function(s,r){if(!s.currentStyle||!s.currentStyle.hasLayout){s.style.zoom=1; -}if(r==null||r==1){p(s,q,"");if(r==1&&i(s)!=1){p(s,q,"alpha(opacity=100)");}}else{p(s,q,"alpha(opacity="+(r*100).limit(0,100).round()+")");}}:b));var i=(j?function(s){var r=s.style.opacity||s.getComputedStyle("opacity"); -return(r=="")?1:r.toFloat();}:(g?function(s){var t=(s.style.filter||s.getComputedStyle("filter")),r;if(t){r=t.match(q);}return(r==null||t==null)?1:(r[1]/100); -}:function(s){var r=s.retrieve("$opacity");if(r==null){r=(s.style.visibility=="hidden"?0:1);}return r;}));var d=(l.style.cssFloat==null)?"styleFloat":"cssFloat",a={left:"0%",top:"0%",center:"50%",right:"100%",bottom:"100%"},c=(l.style.backgroundPositionX!=null); -var m=function(r,s){if(s=="backgroundPosition"){r.removeAttribute(s+"X");s+="Y";}r.removeAttribute(s);};Element.implement({getComputedStyle:function(t){if(!n&&this.currentStyle){return this.currentStyle[t.camelCase()]; -}var s=Element.getDocument(this).defaultView,r=s?s.getComputedStyle(this,null):null;return(r)?r.getPropertyValue((t==d)?"float":t.hyphenate()):"";},setStyle:function(s,r){if(s=="opacity"){if(r!=null){r=parseFloat(r); -}h(this,r);return this;}s=(s=="float"?d:s).camelCase();if(typeOf(r)!="string"){var t=(Element.Styles[s]||"@").split(" ");r=Array.from(r).map(function(v,u){if(!t[u]){return""; -}return(typeOf(v)=="number")?t[u].replace("@",Math.round(v)):v;}).join(" ");}else{if(r==String(Number(r))){r=Math.round(r);}}this.style[s]=r;if((r==""||r==null)&&e&&this.style.removeAttribute){m(this.style,s); -}return this;},getStyle:function(x){if(x=="opacity"){return i(this);}x=(x=="float"?d:x).camelCase();var r=this.style[x];if(!r||x=="zIndex"){if(Element.ShortStyles.hasOwnProperty(x)){r=[]; -for(var w in Element.ShortStyles[x]){r.push(this.getStyle(w));}return r.join(" ");}r=this.getComputedStyle(x);}if(c&&/^backgroundPosition[XY]?$/.test(x)){return r.replace(/(top|right|bottom|left)/g,function(s){return a[s]; -})||"0px";}if(!r&&x=="backgroundPosition"){return"0px 0px";}if(r){r=String(r);var u=r.match(/rgba?\([\d\s,]+\)/);if(u){r=r.replace(u[0],u[0].rgbToHex()); -}}if(!n&&!this.style[x]){if((/^(height|width)$/).test(x)&&!(/px$/.test(r))){var t=(x=="width")?["left","right"]:["top","bottom"],v=0;t.each(function(s){v+=this.getStyle("border-"+s+"-width").toInt()+this.getStyle("padding-"+s).toInt(); -},this);return this["offset"+x.capitalize()]-v+"px";}if((/^border(.+)Width|margin|padding/).test(x)&&isNaN(parseFloat(r))){return"0px";}}if(o&&/^border(Top|Right|Bottom|Left)?$/.test(x)&&/^#/.test(r)){return r.replace(/^(.+)\s(.+)\s(.+)$/,"$2 $3 $1"); -}return r;},setStyles:function(s){for(var r in s){this.setStyle(r,s[r]);}return this;},getStyles:function(){var r={};Array.flatten(arguments).each(function(s){r[s]=this.getStyle(s); -},this);return r;}});Element.Styles={left:"@px",top:"@px",bottom:"@px",right:"@px",width:"@px",height:"@px",maxWidth:"@px",maxHeight:"@px",minWidth:"@px",minHeight:"@px",backgroundColor:"rgb(@, @, @)",backgroundSize:"@px",backgroundPosition:"@px @px",color:"rgb(@, @, @)",fontSize:"@px",letterSpacing:"@px",lineHeight:"@px",clip:"rect(@px @px @px @px)",margin:"@px @px @px @px",padding:"@px @px @px @px",border:"@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)",borderWidth:"@px @px @px @px",borderStyle:"@ @ @ @",borderColor:"rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)",zIndex:"@",zoom:"@",fontWeight:"@",textIndent:"@px",opacity:"@"}; -Element.ShortStyles={margin:{},padding:{},border:{},borderWidth:{},borderStyle:{},borderColor:{}};["Top","Right","Bottom","Left"].each(function(x){var w=Element.ShortStyles; -var s=Element.Styles;["margin","padding"].each(function(y){var z=y+x;w[y][z]=s[z]="@px";});var v="border"+x;w.border[v]=s[v]="@px @ rgb(@, @, @)";var u=v+"Width",r=v+"Style",t=v+"Color"; -w[v]={};w.borderWidth[u]=w[v][u]=s[u]="@px";w.borderStyle[r]=w[v][r]=s[r]="@";w.borderColor[t]=w[v][t]=s[t]="rgb(@, @, @)";});if(c){Element.ShortStyles.backgroundPosition={backgroundPositionX:"@",backgroundPositionY:"@"}; -}})();(function(){Element.Properties.events={set:function(b){this.addEvents(b);}};[Element,Window,Document].invoke("implement",{addEvent:function(f,h){var i=this.retrieve("events",{}); -if(!i[f]){i[f]={keys:[],values:[]};}if(i[f].keys.contains(h)){return this;}i[f].keys.push(h);var g=f,b=Element.Events[f],d=h,j=this;if(b){if(b.onAdd){b.onAdd.call(this,h,f); -}if(b.condition){d=function(k){if(b.condition.call(this,k,f)){return h.call(this,k);}return true;};}if(b.base){g=Function.from(b.base).call(this,f);}}var e=function(){return h.call(j); -};var c=Element.NativeEvents[g];if(c){if(c==2){e=function(k){k=new DOMEvent(k,j.getWindow());if(d.call(j,k)===false){k.stop();}};}this.addListener(g,e,arguments[2]); -}i[f].values.push(e);return this;},removeEvent:function(e,d){var c=this.retrieve("events");if(!c||!c[e]){return this;}var h=c[e];var b=h.keys.indexOf(d); -if(b==-1){return this;}var g=h.values[b];delete h.keys[b];delete h.values[b];var f=Element.Events[e];if(f){if(f.onRemove){f.onRemove.call(this,d,e);}if(f.base){e=Function.from(f.base).call(this,e); -}}return(Element.NativeEvents[e])?this.removeListener(e,g,arguments[2]):this;},addEvents:function(b){for(var c in b){this.addEvent(c,b[c]);}return this; -},removeEvents:function(b){var d;if(typeOf(b)=="object"){for(d in b){this.removeEvent(d,b[d]);}return this;}var c=this.retrieve("events");if(!c){return this; -}if(!b){for(d in c){this.removeEvents(d);}this.eliminate("events");}else{if(c[b]){c[b].keys.each(function(e){this.removeEvent(b,e);},this);delete c[b]; -}}return this;},fireEvent:function(e,c,b){var d=this.retrieve("events");if(!d||!d[e]){return this;}c=Array.from(c);d[e].keys.each(function(f){if(b){f.delay(b,this,c); -}else{f.apply(this,c);}},this);return this;},cloneEvents:function(e,d){e=document.id(e);var c=e.retrieve("events");if(!c){return this;}if(!d){for(var b in c){this.cloneEvents(e,b); -}}else{if(c[d]){c[d].keys.each(function(f){this.addEvent(d,f);},this);}}return this;}});Element.NativeEvents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,DOMMouseScroll:2,mouseover:2,mouseout:2,mousemove:2,selectstart:2,selectend:2,keydown:2,keypress:2,keyup:2,orientationchange:2,touchstart:2,touchmove:2,touchend:2,touchcancel:2,gesturestart:2,gesturechange:2,gestureend:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,paste:2,input:2,load:2,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,hashchange:1,popstate:2,error:1,abort:1,scroll:1}; -Element.Events={mousewheel:{base:"onwheel" in document?"wheel":"onmousewheel" in document?"mousewheel":"DOMMouseScroll"}};var a=function(b){var c=b.relatedTarget; -if(c==null){return true;}if(!c){return false;}return(c!=this&&c.prefix!="xul"&&typeOf(this)!="document"&&!this.contains(c));};if("onmouseenter" in document.documentElement){Element.NativeEvents.mouseenter=Element.NativeEvents.mouseleave=2; -Element.MouseenterCheck=a;}else{Element.Events.mouseenter={base:"mouseover",condition:a};Element.Events.mouseleave={base:"mouseout",condition:a};}if(!window.addEventListener){Element.NativeEvents.propertychange=2; -Element.Events.change={base:function(){var b=this.type;return(this.get("tag")=="input"&&(b=="radio"||b=="checkbox"))?"propertychange":"change";},condition:function(b){return b.type!="propertychange"||b.event.propertyName=="checked"; -}};}})();(function(){var c=!!window.addEventListener;Element.NativeEvents.focusin=Element.NativeEvents.focusout=2;var k=function(l,m,n,o,p){while(p&&p!=l){if(m(p,o)){return n.call(p,o,p); -}p=document.id(p.parentNode);}};var a={mouseenter:{base:"mouseover",condition:Element.MouseenterCheck},mouseleave:{base:"mouseout",condition:Element.MouseenterCheck},focus:{base:"focus"+(c?"":"in"),capture:true},blur:{base:c?"blur":"focusout",capture:true}}; -var b="$delegation:";var i=function(l){return{base:"focusin",remove:function(m,o){var p=m.retrieve(b+l+"listeners",{})[o];if(p&&p.forms){for(var n=p.forms.length; -n--;){p.forms[n].removeEvent(l,p.fns[n]);}}},listen:function(x,r,v,n,t,s){var o=(t.get("tag")=="form")?t:n.target.getParent("form");if(!o){return;}var u=x.retrieve(b+l+"listeners",{}),p=u[s]||{forms:[],fns:[]},m=p.forms,w=p.fns; -if(m.indexOf(o)!=-1){return;}m.push(o);var q=function(y){k(x,r,v,y,t);};o.addEvent(l,q);w.push(q);u[s]=p;x.store(b+l+"listeners",u);}};};var d=function(l){return{base:"focusin",listen:function(m,n,p,q,r){var o={blur:function(){this.removeEvents(o); -}};o[l]=function(s){k(m,n,p,s,r);};q.target.addEvents(o);}};};if(!c){Object.append(a,{submit:i("submit"),reset:i("reset"),change:d("change"),select:d("select")}); -}var h=Element.prototype,f=h.addEvent,j=h.removeEvent;var e=function(l,m){return function(r,q,n){if(r.indexOf(":relay")==-1){return l.call(this,r,q,n); -}var o=Slick.parse(r).expressions[0][0];if(o.pseudos[0].key!="relay"){return l.call(this,r,q,n);}var p=o.tag;o.pseudos.slice(1).each(function(s){p+=":"+s.key+(s.value?"("+s.value+")":""); -});l.call(this,r,q);return m.call(this,p,o.pseudos[0].value,q);};};var g={addEvent:function(v,q,x){var t=this.retrieve("$delegates",{}),r=t[v];if(r){for(var y in r){if(r[y].fn==x&&r[y].match==q){return this; -}}}var p=v,u=q,o=x,n=a[v]||{};v=n.base||p;q=function(B){return Slick.match(B,u);};var w=Element.Events[p];if(n.condition||w&&w.condition){var l=q,m=n.condition||w.condition; -q=function(C,B){return l(C,B)&&m.call(C,B,v);};}var z=this,s=String.uniqueID();var A=n.listen?function(B,C){if(!C&&B&&B.target){C=B.target;}if(C){n.listen(z,q,x,B,C,s); -}}:function(B,C){if(!C&&B&&B.target){C=B.target;}if(C){k(z,q,x,B,C);}};if(!r){r={};}r[s]={match:u,fn:o,delegator:A};t[p]=r;return f.call(this,v,A,n.capture); -},removeEvent:function(r,n,t,u){var q=this.retrieve("$delegates",{}),p=q[r];if(!p){return this;}if(u){var m=r,w=p[u].delegator,l=a[r]||{};r=l.base||m;if(l.remove){l.remove(this,u); -}delete p[u];q[m]=p;return j.call(this,r,w,l.capture);}var o,v;if(t){for(o in p){v=p[o];if(v.match==n&&v.fn==t){return g.removeEvent.call(this,r,n,t,o); -}}}else{for(o in p){v=p[o];if(v.match==n){g.removeEvent.call(this,r,n,v.fn,o);}}}return this;}};[Element,Window,Document].invoke("implement",{addEvent:e(f,g.addEvent),removeEvent:e(j,g.removeEvent)}); -})();(function(){var h=document.createElement("div"),e=document.createElement("div");h.style.height="0";h.appendChild(e);var d=(e.offsetParent===h);h=e=null; -var l=function(m){return k(m,"position")!="static"||a(m);};var i=function(m){return l(m)||(/^(?:table|td|th)$/i).test(m.tagName);};Element.implement({scrollTo:function(m,n){if(a(this)){this.getWindow().scrollTo(m,n); -}else{this.scrollLeft=m;this.scrollTop=n;}return this;},getSize:function(){if(a(this)){return this.getWindow().getSize();}return{x:this.offsetWidth,y:this.offsetHeight}; -},getScrollSize:function(){if(a(this)){return this.getWindow().getScrollSize();}return{x:this.scrollWidth,y:this.scrollHeight};},getScroll:function(){if(a(this)){return this.getWindow().getScroll(); -}return{x:this.scrollLeft,y:this.scrollTop};},getScrolls:function(){var n=this.parentNode,m={x:0,y:0};while(n&&!a(n)){m.x+=n.scrollLeft;m.y+=n.scrollTop; -n=n.parentNode;}return m;},getOffsetParent:d?function(){var m=this;if(a(m)||k(m,"position")=="fixed"){return null;}var n=(k(m,"position")=="static")?i:l; -while((m=m.parentNode)){if(n(m)){return m;}}return null;}:function(){var m=this;if(a(m)||k(m,"position")=="fixed"){return null;}try{return m.offsetParent; -}catch(n){}return null;},getOffsets:function(){var n=this.getBoundingClientRect;if(n){var r=this.getBoundingClientRect(),p=document.id(this.getDocument().documentElement),q=p.getScroll(),t=this.getScrolls(),s=(k(this,"position")=="fixed"); -return{x:r.left.toInt()+t.x+((s)?0:q.x)-p.clientLeft,y:r.top.toInt()+t.y+((s)?0:q.y)-p.clientTop};}var o=this,m={x:0,y:0};if(a(this)){return m;}while(o&&!a(o)){m.x+=o.offsetLeft; -m.y+=o.offsetTop;o=o.offsetParent;}return m;},getPosition:function(p){var q=this.getOffsets(),n=this.getScrolls();var m={x:q.x-n.x,y:q.y-n.y};if(p&&(p=document.id(p))){var o=p.getPosition(); -return{x:m.x-o.x-b(p),y:m.y-o.y-g(p)};}return m;},getCoordinates:function(o){if(a(this)){return this.getWindow().getCoordinates();}var m=this.getPosition(o),n=this.getSize(); -var p={left:m.x,top:m.y,width:n.x,height:n.y};p.right=p.left+p.width;p.bottom=p.top+p.height;return p;},computePosition:function(m){return{left:m.x-j(this,"margin-left"),top:m.y-j(this,"margin-top")}; -},setPosition:function(m){return this.setStyles(this.computePosition(m));}});[Document,Window].invoke("implement",{getSize:function(){var m=f(this);return{x:m.clientWidth,y:m.clientHeight}; -},getScroll:function(){var n=this.getWindow(),m=f(this);return{x:n.pageXOffset||m.scrollLeft,y:n.pageYOffset||m.scrollTop};},getScrollSize:function(){var o=f(this),n=this.getSize(),m=this.getDocument().body; -return{x:Math.max(o.scrollWidth,m.scrollWidth,n.x),y:Math.max(o.scrollHeight,m.scrollHeight,n.y)};},getPosition:function(){return{x:0,y:0};},getCoordinates:function(){var m=this.getSize(); -return{top:0,left:0,bottom:m.y,right:m.x,height:m.y,width:m.x};}});var k=Element.getComputedStyle;function j(m,n){return k(m,n).toInt()||0;}function c(m){return k(m,"-moz-box-sizing")=="border-box"; -}function g(m){return j(m,"border-top-width");}function b(m){return j(m,"border-left-width");}function a(m){return(/^(?:body|html)$/i).test(m.tagName); -}function f(m){var n=m.getDocument();return(!n.compatMode||n.compatMode=="CSS1Compat")?n.html:n.body;}})();Element.alias({position:"setPosition"});[Window,Document,Element].invoke("implement",{getHeight:function(){return this.getSize().y; -},getWidth:function(){return this.getSize().x;},getScrollTop:function(){return this.getScroll().y;},getScrollLeft:function(){return this.getScroll().x; -},getScrollHeight:function(){return this.getScrollSize().y;},getScrollWidth:function(){return this.getScrollSize().x;},getTop:function(){return this.getPosition().y; -},getLeft:function(){return this.getPosition().x;}});(function(){var f=this.Fx=new Class({Implements:[Chain,Events,Options],options:{fps:60,unit:false,duration:500,frames:null,frameSkip:true,link:"ignore"},initialize:function(g){this.subject=this.subject||this; -this.setOptions(g);},getTransition:function(){return function(g){return -(Math.cos(Math.PI*g)-1)/2;};},step:function(g){if(this.options.frameSkip){var h=(this.time!=null)?(g-this.time):0,i=h/this.frameInterval; -this.time=g;this.frame+=i;}else{this.frame++;}if(this.frame-1&&e.indexOf(document.domain)==-1){return;}var h=g.rules||g.cssRules; -b(h);});return Fx.CSS.Cache[a]=d;}});Fx.CSS.Cache={};Fx.CSS.Parsers={Color:{parse:function(a){if(a.match(/^#[0-9a-f]{3,6}$/i)){return a.hexToRgb(true); -}return((a=a.match(/(\d+),\s*(\d+),\s*(\d+)/)))?[a[1],a[2],a[3]]:false;},compute:function(c,b,a){return c.map(function(e,d){return Math.round(Fx.compute(c[d],b[d],a)); -});},serve:function(a){return a.map(Number);}},Number:{parse:parseFloat,compute:Fx.compute,serve:function(b,a){return(a)?b+a:b;}},String:{parse:Function.from(false),compute:function(b,a){return a; -},serve:function(a){return a;}}};Fx.Tween=new Class({Extends:Fx.CSS,initialize:function(b,a){this.element=this.subject=document.id(b);this.parent(a);},set:function(b,a){if(arguments.length==1){a=b; -b=this.property||this.options.property;}this.render(this.element,b,a,this.options.unit);return this;},start:function(c,e,d){if(!this.check(c,e,d)){return this; -}var b=Array.flatten(arguments);this.property=this.options.property||b.shift();var a=this.prepare(this.element,this.property,b);return this.parent(a.from,a.to); -}});Element.Properties.tween={set:function(a){this.get("tween").cancel().setOptions(a);return this;},get:function(){var a=this.retrieve("tween");if(!a){a=new Fx.Tween(this,{link:"cancel"}); -this.store("tween",a);}return a;}};Element.implement({tween:function(a,c,b){this.get("tween").start(a,c,b);return this;},fade:function(d){var e=this.get("tween"),g,c=["opacity"].append(arguments),a; -if(c[1]==null){c[1]="toggle";}switch(c[1]){case"in":g="start";c[1]=1;break;case"out":g="start";c[1]=0;break;case"show":g="set";c[1]=1;break;case"hide":g="set"; -c[1]=0;break;case"toggle":var b=this.retrieve("fade:flag",this.getStyle("opacity")==1);g="start";c[1]=b?0:1;this.store("fade:flag",!b);a=true;break;default:g="start"; -}if(!a){this.eliminate("fade:flag");}e[g].apply(e,c);var f=c[c.length-1];if(g=="set"||f!=0){this.setStyle("visibility",f==0?"hidden":"visible");}else{e.chain(function(){this.element.setStyle("visibility","hidden"); -this.callChain();});}return this;},highlight:function(c,a){if(!a){a=this.retrieve("highlight:original",this.getStyle("background-color"));a=(a=="transparent")?"#fff":a; -}var b=this.get("tween");b.start("background-color",c||"#ffff88",a).chain(function(){this.setStyle("background-color",this.retrieve("highlight:original")); -b.callChain();}.bind(this));return this;}});Fx.Morph=new Class({Extends:Fx.CSS,initialize:function(b,a){this.element=this.subject=document.id(b);this.parent(a); -},set:function(a){if(typeof a=="string"){a=this.search(a);}for(var b in a){this.render(this.element,b,a[b],this.options.unit);}return this;},compute:function(e,d,c){var a={}; -for(var b in e){a[b]=this.parent(e[b],d[b],c);}return a;},start:function(b){if(!this.check(b)){return this;}if(typeof b=="string"){b=this.search(b);}var e={},d={}; -for(var c in b){var a=this.prepare(this.element,c,b[c]);e[c]=a.from;d[c]=a.to;}return this.parent(e,d);}});Element.Properties.morph={set:function(a){this.get("morph").cancel().setOptions(a); -return this;},get:function(){var a=this.retrieve("morph");if(!a){a=new Fx.Morph(this,{link:"cancel"});this.store("morph",a);}return a;}};Element.implement({morph:function(a){this.get("morph").start(a); -return this;}});Fx.implement({getTransition:function(){var a=this.options.transition||Fx.Transitions.Sine.easeInOut;if(typeof a=="string"){var b=a.split(":"); -a=Fx.Transitions;a=a[b[0]]||a[b[0].capitalize()];if(b[1]){a=a["ease"+b[1].capitalize()+(b[2]?b[2].capitalize():"")];}}return a;}});Fx.Transition=function(c,b){b=Array.from(b); -var a=function(d){return c(d,b);};return Object.append(a,{easeIn:a,easeOut:function(d){return 1-c(1-d,b);},easeInOut:function(d){return(d<=0.5?c(2*d,b):(2-c(2*(1-d),b)))/2; -}});};Fx.Transitions={linear:function(a){return a;}};Fx.Transitions.extend=function(a){for(var b in a){Fx.Transitions[b]=new Fx.Transition(a[b]);}};Fx.Transitions.extend({Pow:function(b,a){return Math.pow(b,a&&a[0]||6); -},Expo:function(a){return Math.pow(2,8*(a-1));},Circ:function(a){return 1-Math.sin(Math.acos(a));},Sine:function(a){return 1-Math.cos(a*Math.PI/2);},Back:function(b,a){a=a&&a[0]||1.618; -return Math.pow(b,2)*((a+1)*b-a);},Bounce:function(f){var e;for(var d=0,c=1;1;d+=c,c/=2){if(f>=(7-4*d)/11){e=c*c-Math.pow((11-6*d-11*f)/4,2);break;}}return e; -},Elastic:function(b,a){return Math.pow(2,10*--b)*Math.cos(20*b*Math.PI*(a&&a[0]||1)/3);}});["Quad","Cubic","Quart","Quint"].each(function(b,a){Fx.Transitions[b]=new Fx.Transition(function(c){return Math.pow(c,a+2); -});});(function(){var d=function(){},a=("onprogress" in new Browser.Request);var c=this.Request=new Class({Implements:[Chain,Events,Options],options:{url:"",data:"",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript, text/html, application/xml, text/xml, */*"},async:true,format:false,method:"post",link:"ignore",isSuccess:null,emulation:true,urlEncoded:true,encoding:"utf-8",evalScripts:false,evalResponse:false,timeout:0,noCache:false},initialize:function(e){this.xhr=new Browser.Request(); -this.setOptions(e);this.headers=this.options.headers;},onStateChange:function(){var e=this.xhr;if(e.readyState!=4||!this.running){return;}this.running=false; -this.status=0;Function.attempt(function(){var f=e.status;this.status=(f==1223)?204:f;}.bind(this));e.onreadystatechange=d;if(a){e.onprogress=e.onloadstart=d; -}clearTimeout(this.timer);this.response={text:this.xhr.responseText||"",xml:this.xhr.responseXML};if(this.options.isSuccess.call(this,this.status)){this.success(this.response.text,this.response.xml); -}else{this.failure();}},isSuccess:function(){var e=this.status;return(e>=200&&e<300);},isRunning:function(){return !!this.running;},processScripts:function(e){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader("Content-type"))){return Browser.exec(e); -}return e.stripScripts(this.options.evalScripts);},success:function(f,e){this.onSuccess(this.processScripts(f),e);},onSuccess:function(){this.fireEvent("complete",arguments).fireEvent("success",arguments).callChain(); -},failure:function(){this.onFailure();},onFailure:function(){this.fireEvent("complete").fireEvent("failure",this.xhr);},loadstart:function(e){this.fireEvent("loadstart",[e,this.xhr]); -},progress:function(e){this.fireEvent("progress",[e,this.xhr]);},timeout:function(){this.fireEvent("timeout",this.xhr);},setHeader:function(e,f){this.headers[e]=f; -return this;},getHeader:function(e){return Function.attempt(function(){return this.xhr.getResponseHeader(e);}.bind(this));},check:function(){if(!this.running){return true; -}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(this.caller.pass(arguments,this));return false;}return false;},send:function(o){if(!this.check(o)){return this; -}this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.running=true;var l=typeOf(o);if(l=="string"||l=="element"){o={data:o};}var h=this.options; -o=Object.append({data:h.data,url:h.url,method:h.method},o);var j=o.data,f=String(o.url),e=o.method.toLowerCase();switch(typeOf(j)){case"element":j=document.id(j).toQueryString(); -break;case"object":case"hash":j=Object.toQueryString(j);}if(this.options.format){var m="format="+this.options.format;j=(j)?m+"&"+j:m;}if(this.options.emulation&&!["get","post"].contains(e)){var k="_method="+e; -j=(j)?k+"&"+j:k;e="post";}if(this.options.urlEncoded&&["post","put"].contains(e)){var g=(this.options.encoding)?"; charset="+this.options.encoding:"";this.headers["Content-type"]="application/x-www-form-urlencoded"+g; -}if(!f){f=document.location.pathname;}var i=f.lastIndexOf("/");if(i>-1&&(i=f.indexOf("#"))>-1){f=f.substr(0,i);}if(this.options.noCache){f+=(f.indexOf("?")>-1?"&":"?")+String.uniqueID(); -}if(j&&(e=="get"||e=="delete")){f+=(f.indexOf("?")>-1?"&":"?")+j;j=null;}var n=this.xhr;if(a){n.onloadstart=this.loadstart.bind(this);n.onprogress=this.progress.bind(this); -}n.open(e.toUpperCase(),f,this.options.async,this.options.user,this.options.password);if(this.options.user&&"withCredentials" in n){n.withCredentials=true; -}n.onreadystatechange=this.onStateChange.bind(this);Object.each(this.headers,function(q,p){try{n.setRequestHeader(p,q);}catch(r){this.fireEvent("exception",[p,q]); -}},this);this.fireEvent("request");n.send(j);if(!this.options.async){this.onStateChange();}else{if(this.options.timeout){this.timer=this.timeout.delay(this.options.timeout,this); -}}return this;},cancel:function(){if(!this.running){return this;}this.running=false;var e=this.xhr;e.abort();clearTimeout(this.timer);e.onreadystatechange=d; -if(a){e.onprogress=e.onloadstart=d;}this.xhr=new Browser.Request();this.fireEvent("cancel");return this;}});var b={};["get","post","put","delete","GET","POST","PUT","DELETE"].each(function(e){b[e]=function(g){var f={method:e}; -if(g!=null){f.data=g;}return this.send(f);};});c.implement(b);Element.Properties.send={set:function(e){var f=this.get("send").cancel();f.setOptions(e); -return this;},get:function(){var e=this.retrieve("send");if(!e){e=new c({data:this,link:"cancel",method:this.get("method")||"post",url:this.get("action")}); -this.store("send",e);}return e;}};Element.implement({send:function(e){var f=this.get("send");f.send({data:this,url:e||f.options.url});return this;}});})(); -Request.HTML=new Class({Extends:Request,options:{update:false,append:false,evalScripts:true,filter:false,headers:{Accept:"text/html, application/xml, text/xml, */*"}},success:function(f){var e=this.options,c=this.response; -c.html=f.stripScripts(function(h){c.javascript=h;});var d=c.html.match(/]*>([\s\S]*?)<\/body>/i);if(d){c.html=d[1];}var b=new Element("div").set("html",c.html); -c.tree=b.childNodes;c.elements=b.getElements(e.filter||"*");if(e.filter){c.tree=c.elements;}if(e.update){var g=document.id(e.update).empty();if(e.filter){g.adopt(c.elements); -}else{g.set("html",c.html);}}else{if(e.append){var a=document.id(e.append);if(e.filter){c.elements.reverse().inject(a);}else{a.adopt(b.getChildren());}}}if(e.evalScripts){Browser.exec(c.javascript); -}this.onSuccess(c.tree,c.elements,c.html,c.javascript);}});Element.Properties.load={set:function(a){var b=this.get("load").cancel();b.setOptions(a);return this; -},get:function(){var a=this.retrieve("load");if(!a){a=new Request.HTML({data:this,link:"cancel",update:this,method:"get"});this.store("load",a);}return a; -}};Element.implement({load:function(){this.get("load").send(Array.link(arguments,{data:Type.isObject,url:Type.isString}));return this;}});if(typeof JSON=="undefined"){this.JSON={}; -}(function(){var special={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};var escape=function(chr){return special[chr]||"\\u"+("0000"+chr.charCodeAt(0).toString(16)).slice(-4); -};JSON.validate=function(string){string=string.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""); -return(/^[\],:{}\s]*$/).test(string);};JSON.encode=JSON.stringify?function(obj){return JSON.stringify(obj);}:function(obj){if(obj&&obj.toJSON){obj=obj.toJSON(); -}switch(typeOf(obj)){case"string":return'"'+obj.replace(/[\x00-\x1f\\"]/g,escape)+'"';case"array":return"["+obj.map(JSON.encode).clean()+"]";case"object":case"hash":var string=[]; -Object.each(obj,function(value,key){var json=JSON.encode(value);if(json){string.push(JSON.encode(key)+":"+json);}});return"{"+string+"}";case"number":case"boolean":return""+obj; -case"null":return"null";}return null;};JSON.secure=true;JSON.decode=function(string,secure){if(!string||typeOf(string)!="string"){return null;}if(secure==null){secure=JSON.secure; -}if(secure){if(JSON.parse){return JSON.parse(string);}if(!JSON.validate(string)){throw new Error("JSON could not decode the input; security is enabled and the value is not secure."); -}}return eval("("+string+")");};})();Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(a){this.parent(a);Object.append(this.headers,{Accept:"application/json","X-Request":"JSON"}); -},success:function(c){var b;try{b=this.response.json=JSON.decode(c,this.options.secure);}catch(a){this.fireEvent("error",[c,a]);return;}if(b==null){this.onFailure(); -}else{this.onSuccess(b,c);}}});var Cookie=new Class({Implements:Options,options:{path:"/",domain:false,duration:false,secure:false,document:document,encode:true},initialize:function(b,a){this.key=b; -this.setOptions(a);},write:function(b){if(this.options.encode){b=encodeURIComponent(b);}if(this.options.domain){b+="; domain="+this.options.domain;}if(this.options.path){b+="; path="+this.options.path; -}if(this.options.duration){var a=new Date();a.setTime(a.getTime()+this.options.duration*24*60*60*1000);b+="; expires="+a.toGMTString();}if(this.options.secure){b+="; secure"; -}this.options.document.cookie=this.key+"="+b;return this;},read:function(){var a=this.options.document.cookie.match("(?:^|;)\\s*"+this.key.escapeRegExp()+"=([^;]*)"); -return(a)?decodeURIComponent(a[1]):null;},dispose:function(){new Cookie(this.key,Object.merge({},this.options,{duration:-1})).write("");return this;}}); -Cookie.write=function(b,c,a){return new Cookie(b,a).write(c);};Cookie.read=function(a){return new Cookie(a).read();};Cookie.dispose=function(b,a){return new Cookie(b,a).dispose(); -};(function(i,k){var l,f,e=[],c,b,d=k.createElement("div");var g=function(){clearTimeout(b);if(l){return;}Browser.loaded=l=true;k.removeListener("DOMContentLoaded",g).removeListener("readystatechange",a); -k.fireEvent("domready");i.fireEvent("domready");};var a=function(){for(var m=e.length;m--;){if(e[m]()){g();return true;}}return false;};var j=function(){clearTimeout(b); -if(!a()){b=setTimeout(j,10);}};k.addListener("DOMContentLoaded",g);var h=function(){try{d.doScroll();return true;}catch(m){}return false;};if(d.doScroll&&!h()){e.push(h); -c=true;}if(k.readyState){e.push(function(){var m=k.readyState;return(m=="loaded"||m=="complete");});}if("onreadystatechange" in k){k.addListener("readystatechange",a); -}else{c=true;}if(c){j();}Element.Events.domready={onAdd:function(m){if(l){m.call(this);}}};Element.Events.load={base:"load",onAdd:function(m){if(f&&this==i){m.call(this); -}},condition:function(){if(this==i){g();delete Element.Events.load;}return true;}};i.addEvent("load",function(){f=true;});})(window,document); \ No newline at end of file diff --git a/pyload/webui/themes/Flat/js/static/mootools-more.js b/pyload/webui/themes/Flat/js/static/mootools-more.js deleted file mode 100644 index c7f4a1a0e..000000000 --- a/pyload/webui/themes/Flat/js/static/mootools-more.js +++ /dev/null @@ -1,2856 +0,0 @@ -/* ---- -MooTools: the javascript framework - -web build: - - http://mootools.net/more/c1cc18c2fff04bcc58921b4dff80a6f1 - -packager build: - - packager build More/Form.Request More/Fx.Reveal More/Sortables More/Request.Periodical More/Color - -... -*/ - -/* ---- - -script: More.js - -name: More - -description: MooTools More - -license: MIT-style license - -authors: - - Guillermo Rauch - - Thomas Aylott - - Scott Kyle - - Arian Stolwijk - - Tim Wienk - - Christoph Pojer - - Aaron Newton - - Jacob Thornton - -requires: - - Core/MooTools - -provides: [MooTools.More] - -... -*/ - -MooTools.More = { - version: '1.5.0', - build: '73db5e24e6e9c5c87b3a27aebef2248053f7db37' -}; - - -/* ---- - -script: Class.Binds.js - -name: Class.Binds - -description: Automagically binds specified methods in a class to the instance of the class. - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Class - - MooTools.More - -provides: [Class.Binds] - -... -*/ - -Class.Mutators.Binds = function(binds){ - if (!this.prototype.initialize) this.implement('initialize', function(){}); - return Array.from(binds).concat(this.prototype.Binds || []); -}; - -Class.Mutators.initialize = function(initialize){ - return function(){ - Array.from(this.Binds).each(function(name){ - var original = this[name]; - if (original) this[name] = original.bind(this); - }, this); - return initialize.apply(this, arguments); - }; -}; - - -/* ---- - -script: Class.Occlude.js - -name: Class.Occlude - -description: Prevents a class from being applied to a DOM element twice. - -license: MIT-style license. - -authors: - - Aaron Newton - -requires: - - Core/Class - - Core/Element - - MooTools.More - -provides: [Class.Occlude] - -... -*/ - -Class.Occlude = new Class({ - - occlude: function(property, element){ - element = document.id(element || this.element); - var instance = element.retrieve(property || this.property); - if (instance && !this.occluded) - return (this.occluded = instance); - - this.occluded = false; - element.store(property || this.property, this); - return this.occluded; - } - -}); - - -/* ---- - -script: Class.Refactor.js - -name: Class.Refactor - -description: Extends a class onto itself with new property, preserving any items attached to the class's namespace. - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Class - - MooTools.More - -# Some modules declare themselves dependent on Class.Refactor -provides: [Class.refactor, Class.Refactor] - -... -*/ - -Class.refactor = function(original, refactors){ - - Object.each(refactors, function(item, name){ - var origin = original.prototype[name]; - origin = (origin && origin.$origin) || origin || function(){}; - original.implement(name, (typeof item == 'function') ? function(){ - var old = this.previous; - this.previous = origin; - var value = item.apply(this, arguments); - this.previous = old; - return value; - } : item); - }); - - return original; - -}; - - -/* ---- - -script: Element.Measure.js - -name: Element.Measure - -description: Extends the Element native object to include methods useful in measuring dimensions. - -credits: "Element.measure / .expose methods by Daniel Steigerwald License: MIT-style license. Copyright: Copyright (c) 2008 Daniel Steigerwald, daniel.steigerwald.cz" - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Element.Style - - Core/Element.Dimensions - - MooTools.More - -provides: [Element.Measure] - -... -*/ - -(function(){ - -var getStylesList = function(styles, planes){ - var list = []; - Object.each(planes, function(directions){ - Object.each(directions, function(edge){ - styles.each(function(style){ - list.push(style + '-' + edge + (style == 'border' ? '-width' : '')); - }); - }); - }); - return list; -}; - -var calculateEdgeSize = function(edge, styles){ - var total = 0; - Object.each(styles, function(value, style){ - if (style.test(edge)) total = total + value.toInt(); - }); - return total; -}; - -var isVisible = function(el){ - return !!(!el || el.offsetHeight || el.offsetWidth); -}; - - -Element.implement({ - - measure: function(fn){ - if (isVisible(this)) return fn.call(this); - var parent = this.getParent(), - toMeasure = []; - while (!isVisible(parent) && parent != document.body){ - toMeasure.push(parent.expose()); - parent = parent.getParent(); - } - var restore = this.expose(), - result = fn.call(this); - restore(); - toMeasure.each(function(restore){ - restore(); - }); - return result; - }, - - expose: function(){ - if (this.getStyle('display') != 'none') return function(){}; - var before = this.style.cssText; - this.setStyles({ - display: 'block', - position: 'absolute', - visibility: 'hidden' - }); - return function(){ - this.style.cssText = before; - }.bind(this); - }, - - getDimensions: function(options){ - options = Object.merge({computeSize: false}, options); - var dim = {x: 0, y: 0}; - - var getSize = function(el, options){ - return (options.computeSize) ? el.getComputedSize(options) : el.getSize(); - }; - - var parent = this.getParent('body'); - - if (parent && this.getStyle('display') == 'none'){ - dim = this.measure(function(){ - return getSize(this, options); - }); - } else if (parent){ - try { //safari sometimes crashes here, so catch it - dim = getSize(this, options); - }catch(e){} - } - - return Object.append(dim, (dim.x || dim.x === 0) ? { - width: dim.x, - height: dim.y - } : { - x: dim.width, - y: dim.height - } - ); - }, - - getComputedSize: function(options){ - - - options = Object.merge({ - styles: ['padding','border'], - planes: { - height: ['top','bottom'], - width: ['left','right'] - }, - mode: 'both' - }, options); - - var styles = {}, - size = {width: 0, height: 0}, - dimensions; - - if (options.mode == 'vertical'){ - delete size.width; - delete options.planes.width; - } else if (options.mode == 'horizontal'){ - delete size.height; - delete options.planes.height; - } - - getStylesList(options.styles, options.planes).each(function(style){ - styles[style] = this.getStyle(style).toInt(); - }, this); - - Object.each(options.planes, function(edges, plane){ - - var capitalized = plane.capitalize(), - style = this.getStyle(plane); - - if (style == 'auto' && !dimensions) dimensions = this.getDimensions(); - - style = styles[plane] = (style == 'auto') ? dimensions[plane] : style.toInt(); - size['total' + capitalized] = style; - - edges.each(function(edge){ - var edgesize = calculateEdgeSize(edge, styles); - size['computed' + edge.capitalize()] = edgesize; - size['total' + capitalized] += edgesize; - }); - - }, this); - - return Object.append(size, styles); - } - -}); - -})(); - - -/* ---- - -script: Element.Position.js - -name: Element.Position - -description: Extends the Element native object to include methods useful positioning elements relative to others. - -license: MIT-style license - -authors: - - Aaron Newton - - Jacob Thornton - -requires: - - Core/Options - - Core/Element.Dimensions - - Element.Measure - -provides: [Element.Position] - -... -*/ - -(function(original){ - -var local = Element.Position = { - - options: {/* - edge: false, - returnPos: false, - minimum: {x: 0, y: 0}, - maximum: {x: 0, y: 0}, - relFixedPosition: false, - ignoreMargins: false, - ignoreScroll: false, - allowNegative: false,*/ - relativeTo: document.body, - position: { - x: 'center', //left, center, right - y: 'center' //top, center, bottom - }, - offset: {x: 0, y: 0} - }, - - getOptions: function(element, options){ - options = Object.merge({}, local.options, options); - local.setPositionOption(options); - local.setEdgeOption(options); - local.setOffsetOption(element, options); - local.setDimensionsOption(element, options); - return options; - }, - - setPositionOption: function(options){ - options.position = local.getCoordinateFromValue(options.position); - }, - - setEdgeOption: function(options){ - var edgeOption = local.getCoordinateFromValue(options.edge); - options.edge = edgeOption ? edgeOption : - (options.position.x == 'center' && options.position.y == 'center') ? {x: 'center', y: 'center'} : - {x: 'left', y: 'top'}; - }, - - setOffsetOption: function(element, options){ - var parentOffset = {x: 0, y: 0}; - var parentScroll = {x: 0, y: 0}; - var offsetParent = element.measure(function(){ - return document.id(this.getOffsetParent()); - }); - - if (!offsetParent || offsetParent == element.getDocument().body) return; - - parentScroll = offsetParent.getScroll(); - parentOffset = offsetParent.measure(function(){ - var position = this.getPosition(); - if (this.getStyle('position') == 'fixed'){ - var scroll = window.getScroll(); - position.x += scroll.x; - position.y += scroll.y; - } - return position; - }); - - options.offset = { - parentPositioned: offsetParent != document.id(options.relativeTo), - x: options.offset.x - parentOffset.x + parentScroll.x, - y: options.offset.y - parentOffset.y + parentScroll.y - }; - }, - - setDimensionsOption: function(element, options){ - options.dimensions = element.getDimensions({ - computeSize: true, - styles: ['padding', 'border', 'margin'] - }); - }, - - getPosition: function(element, options){ - var position = {}; - options = local.getOptions(element, options); - var relativeTo = document.id(options.relativeTo) || document.body; - - local.setPositionCoordinates(options, position, relativeTo); - if (options.edge) local.toEdge(position, options); - - var offset = options.offset; - position.left = ((position.x >= 0 || offset.parentPositioned || options.allowNegative) ? position.x : 0).toInt(); - position.top = ((position.y >= 0 || offset.parentPositioned || options.allowNegative) ? position.y : 0).toInt(); - - local.toMinMax(position, options); - - if (options.relFixedPosition || relativeTo.getStyle('position') == 'fixed') local.toRelFixedPosition(relativeTo, position); - if (options.ignoreScroll) local.toIgnoreScroll(relativeTo, position); - if (options.ignoreMargins) local.toIgnoreMargins(position, options); - - position.left = Math.ceil(position.left); - position.top = Math.ceil(position.top); - delete position.x; - delete position.y; - - return position; - }, - - setPositionCoordinates: function(options, position, relativeTo){ - var offsetY = options.offset.y, - offsetX = options.offset.x, - calc = (relativeTo == document.body) ? window.getScroll() : relativeTo.getPosition(), - top = calc.y, - left = calc.x, - winSize = window.getSize(); - - switch(options.position.x){ - case 'left': position.x = left + offsetX; break; - case 'right': position.x = left + offsetX + relativeTo.offsetWidth; break; - default: position.x = left + ((relativeTo == document.body ? winSize.x : relativeTo.offsetWidth) / 2) + offsetX; break; - } - - switch(options.position.y){ - case 'top': position.y = top + offsetY; break; - case 'bottom': position.y = top + offsetY + relativeTo.offsetHeight; break; - default: position.y = top + ((relativeTo == document.body ? winSize.y : relativeTo.offsetHeight) / 2) + offsetY; break; - } - }, - - toMinMax: function(position, options){ - var xy = {left: 'x', top: 'y'}, value; - ['minimum', 'maximum'].each(function(minmax){ - ['left', 'top'].each(function(lr){ - value = options[minmax] ? options[minmax][xy[lr]] : null; - if (value != null && ((minmax == 'minimum') ? position[lr] < value : position[lr] > value)) position[lr] = value; - }); - }); - }, - - toRelFixedPosition: function(relativeTo, position){ - var winScroll = window.getScroll(); - position.top += winScroll.y; - position.left += winScroll.x; - }, - - toIgnoreScroll: function(relativeTo, position){ - var relScroll = relativeTo.getScroll(); - position.top -= relScroll.y; - position.left -= relScroll.x; - }, - - toIgnoreMargins: function(position, options){ - position.left += options.edge.x == 'right' - ? options.dimensions['margin-right'] - : (options.edge.x != 'center' - ? -options.dimensions['margin-left'] - : -options.dimensions['margin-left'] + ((options.dimensions['margin-right'] + options.dimensions['margin-left']) / 2)); - - position.top += options.edge.y == 'bottom' - ? options.dimensions['margin-bottom'] - : (options.edge.y != 'center' - ? -options.dimensions['margin-top'] - : -options.dimensions['margin-top'] + ((options.dimensions['margin-bottom'] + options.dimensions['margin-top']) / 2)); - }, - - toEdge: function(position, options){ - var edgeOffset = {}, - dimensions = options.dimensions, - edge = options.edge; - - switch(edge.x){ - case 'left': edgeOffset.x = 0; break; - case 'right': edgeOffset.x = -dimensions.x - dimensions.computedRight - dimensions.computedLeft; break; - // center - default: edgeOffset.x = -(Math.round(dimensions.totalWidth / 2)); break; - } - - switch(edge.y){ - case 'top': edgeOffset.y = 0; break; - case 'bottom': edgeOffset.y = -dimensions.y - dimensions.computedTop - dimensions.computedBottom; break; - // center - default: edgeOffset.y = -(Math.round(dimensions.totalHeight / 2)); break; - } - - position.x += edgeOffset.x; - position.y += edgeOffset.y; - }, - - getCoordinateFromValue: function(option){ - if (typeOf(option) != 'string') return option; - option = option.toLowerCase(); - - return { - x: option.test('left') ? 'left' - : (option.test('right') ? 'right' : 'center'), - y: option.test(/upper|top/) ? 'top' - : (option.test('bottom') ? 'bottom' : 'center') - }; - } - -}; - -Element.implement({ - - position: function(options){ - if (options && (options.x != null || options.y != null)){ - return (original ? original.apply(this, arguments) : this); - } - var position = this.setStyle('position', 'absolute').calculatePosition(options); - return (options && options.returnPos) ? position : this.setStyles(position); - }, - - calculatePosition: function(options){ - return local.getPosition(this, options); - } - -}); - -})(Element.prototype.position); - - -/* ---- - -script: IframeShim.js - -name: IframeShim - -description: Defines IframeShim, a class for obscuring select lists and flash objects in IE. - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Element.Event - - Core/Element.Style - - Core/Options - - Core/Events - - Element.Position - - Class.Occlude - -provides: [IframeShim] - -... -*/ - -(function(){ - -var browsers = false; - - -this.IframeShim = new Class({ - - Implements: [Options, Events, Class.Occlude], - - options: { - className: 'iframeShim', - src: 'javascript:false;document.write("");', - display: false, - zIndex: null, - margin: 0, - offset: {x: 0, y: 0}, - browsers: browsers - }, - - property: 'IframeShim', - - initialize: function(element, options){ - this.element = document.id(element); - if (this.occlude()) return this.occluded; - this.setOptions(options); - this.makeShim(); - return this; - }, - - makeShim: function(){ - if (this.options.browsers){ - var zIndex = this.element.getStyle('zIndex').toInt(); - - if (!zIndex){ - zIndex = 1; - var pos = this.element.getStyle('position'); - if (pos == 'static' || !pos) this.element.setStyle('position', 'relative'); - this.element.setStyle('zIndex', zIndex); - } - zIndex = ((this.options.zIndex != null || this.options.zIndex === 0) && zIndex > this.options.zIndex) ? this.options.zIndex : zIndex - 1; - if (zIndex < 0) zIndex = 1; - this.shim = new Element('iframe', { - src: this.options.src, - scrolling: 'no', - frameborder: 0, - styles: { - zIndex: zIndex, - position: 'absolute', - border: 'none', - filter: 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)' - }, - 'class': this.options.className - }).store('IframeShim', this); - var inject = (function(){ - this.shim.inject(this.element, 'after'); - this[this.options.display ? 'show' : 'hide'](); - this.fireEvent('inject'); - }).bind(this); - if (!IframeShim.ready) window.addEvent('load', inject); - else inject(); - } else { - this.position = this.hide = this.show = this.dispose = Function.from(this); - } - }, - - position: function(){ - if (!IframeShim.ready || !this.shim) return this; - var size = this.element.measure(function(){ - return this.getSize(); - }); - if (this.options.margin != undefined){ - size.x = size.x - (this.options.margin * 2); - size.y = size.y - (this.options.margin * 2); - this.options.offset.x += this.options.margin; - this.options.offset.y += this.options.margin; - } - this.shim.set({width: size.x, height: size.y}).position({ - relativeTo: this.element, - offset: this.options.offset - }); - return this; - }, - - hide: function(){ - if (this.shim) this.shim.setStyle('display', 'none'); - return this; - }, - - show: function(){ - if (this.shim) this.shim.setStyle('display', 'block'); - return this.position(); - }, - - dispose: function(){ - if (this.shim) this.shim.dispose(); - return this; - }, - - destroy: function(){ - if (this.shim) this.shim.destroy(); - return this; - } - -}); - -})(); - -window.addEvent('load', function(){ - IframeShim.ready = true; -}); - - -/* ---- - -script: Mask.js - -name: Mask - -description: Creates a mask element to cover another. - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Options - - Core/Events - - Core/Element.Event - - Class.Binds - - Element.Position - - IframeShim - -provides: [Mask] - -... -*/ - -var Mask = new Class({ - - Implements: [Options, Events], - - Binds: ['position'], - - options: {/* - onShow: function(){}, - onHide: function(){}, - onDestroy: function(){}, - onClick: function(event){}, - inject: { - where: 'after', - target: null, - }, - hideOnClick: false, - id: null, - destroyOnHide: false,*/ - style: {}, - 'class': 'mask', - maskMargins: false, - useIframeShim: true, - iframeShimOptions: {} - }, - - initialize: function(target, options){ - this.target = document.id(target) || document.id(document.body); - this.target.store('mask', this); - this.setOptions(options); - this.render(); - this.inject(); - }, - - render: function(){ - this.element = new Element('div', { - 'class': this.options['class'], - id: this.options.id || 'mask-' + String.uniqueID(), - styles: Object.merge({}, this.options.style, { - display: 'none' - }), - events: { - click: function(event){ - this.fireEvent('click', event); - if (this.options.hideOnClick) this.hide(); - }.bind(this) - } - }); - - this.hidden = true; - }, - - toElement: function(){ - return this.element; - }, - - inject: function(target, where){ - where = where || (this.options.inject ? this.options.inject.where : '') || (this.target == document.body ? 'inside' : 'after'); - target = target || (this.options.inject && this.options.inject.target) || this.target; - - this.element.inject(target, where); - - if (this.options.useIframeShim){ - this.shim = new IframeShim(this.element, this.options.iframeShimOptions); - - this.addEvents({ - show: this.shim.show.bind(this.shim), - hide: this.shim.hide.bind(this.shim), - destroy: this.shim.destroy.bind(this.shim) - }); - } - }, - - position: function(){ - this.resize(this.options.width, this.options.height); - - this.element.position({ - relativeTo: this.target, - position: 'topLeft', - ignoreMargins: !this.options.maskMargins, - ignoreScroll: this.target == document.body - }); - - return this; - }, - - resize: function(x, y){ - var opt = { - styles: ['padding', 'border'] - }; - if (this.options.maskMargins) opt.styles.push('margin'); - - var dim = this.target.getComputedSize(opt); - if (this.target == document.body){ - this.element.setStyles({width: 0, height: 0}); - var win = window.getScrollSize(); - if (dim.totalHeight < win.y) dim.totalHeight = win.y; - if (dim.totalWidth < win.x) dim.totalWidth = win.x; - } - this.element.setStyles({ - width: Array.pick([x, dim.totalWidth, dim.x]), - height: Array.pick([y, dim.totalHeight, dim.y]) - }); - - return this; - }, - - show: function(){ - if (!this.hidden) return this; - - window.addEvent('resize', this.position); - this.position(); - this.showMask.apply(this, arguments); - - return this; - }, - - showMask: function(){ - this.element.setStyle('display', 'block'); - this.hidden = false; - this.fireEvent('show'); - }, - - hide: function(){ - if (this.hidden) return this; - - window.removeEvent('resize', this.position); - this.hideMask.apply(this, arguments); - if (this.options.destroyOnHide) return this.destroy(); - - return this; - }, - - hideMask: function(){ - this.element.setStyle('display', 'none'); - this.hidden = true; - this.fireEvent('hide'); - }, - - toggle: function(){ - this[this.hidden ? 'show' : 'hide'](); - }, - - destroy: function(){ - this.hide(); - this.element.destroy(); - this.fireEvent('destroy'); - this.target.eliminate('mask'); - } - -}); - -Element.Properties.mask = { - - set: function(options){ - var mask = this.retrieve('mask'); - if (mask) mask.destroy(); - return this.eliminate('mask').store('mask:options', options); - }, - - get: function(){ - var mask = this.retrieve('mask'); - if (!mask){ - mask = new Mask(this, this.retrieve('mask:options')); - this.store('mask', mask); - } - return mask; - } - -}; - -Element.implement({ - - mask: function(options){ - if (options) this.set('mask', options); - this.get('mask').show(); - return this; - }, - - unmask: function(){ - this.get('mask').hide(); - return this; - } - -}); - - -/* ---- - -script: Spinner.js - -name: Spinner - -description: Adds a semi-transparent overlay over a dom element with a spinnin ajax icon. - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Fx.Tween - - Core/Request - - Class.refactor - - Mask - -provides: [Spinner] - -... -*/ - -var Spinner = new Class({ - - Extends: Mask, - - Implements: Chain, - - options: {/* - message: false,*/ - 'class': 'spinner', - containerPosition: {}, - content: { - 'class': 'spinner-content' - }, - messageContainer: { - 'class': 'spinner-msg' - }, - img: { - 'class': 'spinner-img' - }, - fxOptions: { - link: 'chain' - } - }, - - initialize: function(target, options){ - this.target = document.id(target) || document.id(document.body); - this.target.store('spinner', this); - this.setOptions(options); - this.render(); - this.inject(); - - // Add this to events for when noFx is true; parent methods handle hide/show. - var deactivate = function(){ this.active = false; }.bind(this); - this.addEvents({ - hide: deactivate, - show: deactivate - }); - }, - - render: function(){ - this.parent(); - - this.element.set('id', this.options.id || 'spinner-' + String.uniqueID()); - - this.content = document.id(this.options.content) || new Element('div', this.options.content); - this.content.inject(this.element); - - if (this.options.message){ - this.msg = document.id(this.options.message) || new Element('p', this.options.messageContainer).appendText(this.options.message); - this.msg.inject(this.content); - } - - if (this.options.img){ - this.img = document.id(this.options.img) || new Element('div', this.options.img); - this.img.inject(this.content); - } - - this.element.set('tween', this.options.fxOptions); - }, - - show: function(noFx){ - if (this.active) return this.chain(this.show.bind(this)); - if (!this.hidden){ - this.callChain.delay(20, this); - return this; - } - - this.target.set('aria-busy', 'true'); - this.active = true; - - return this.parent(noFx); - }, - - showMask: function(noFx){ - var pos = function(){ - this.content.position(Object.merge({ - relativeTo: this.element - }, this.options.containerPosition)); - }.bind(this); - - if (noFx){ - this.parent(); - pos(); - } else { - if (!this.options.style.opacity) this.options.style.opacity = this.element.getStyle('opacity').toFloat(); - this.element.setStyles({ - display: 'block', - opacity: 0 - }).tween('opacity', this.options.style.opacity); - pos(); - this.hidden = false; - this.fireEvent('show'); - this.callChain(); - } - }, - - hide: function(noFx){ - if (this.active) return this.chain(this.hide.bind(this)); - if (this.hidden){ - this.callChain.delay(20, this); - return this; - } - - this.target.set('aria-busy', 'false'); - this.active = true; - - return this.parent(noFx); - }, - - hideMask: function(noFx){ - if (noFx) return this.parent(); - this.element.tween('opacity', 0).get('tween').chain(function(){ - this.element.setStyle('display', 'none'); - this.hidden = true; - this.fireEvent('hide'); - this.callChain(); - }.bind(this)); - }, - - destroy: function(){ - this.content.destroy(); - this.parent(); - this.target.eliminate('spinner'); - } - -}); - -Request = Class.refactor(Request, { - - options: { - useSpinner: false, - spinnerOptions: {}, - spinnerTarget: false - }, - - initialize: function(options){ - this._send = this.send; - this.send = function(options){ - var spinner = this.getSpinner(); - if (spinner) spinner.chain(this._send.pass(options, this)).show(); - else this._send(options); - return this; - }; - this.previous(options); - }, - - getSpinner: function(){ - if (!this.spinner){ - var update = document.id(this.options.spinnerTarget) || document.id(this.options.update); - if (this.options.useSpinner && update){ - update.set('spinner', this.options.spinnerOptions); - var spinner = this.spinner = update.get('spinner'); - ['complete', 'exception', 'cancel'].each(function(event){ - this.addEvent(event, spinner.hide.bind(spinner)); - }, this); - } - } - return this.spinner; - } - -}); - -Element.Properties.spinner = { - - set: function(options){ - var spinner = this.retrieve('spinner'); - if (spinner) spinner.destroy(); - return this.eliminate('spinner').store('spinner:options', options); - }, - - get: function(){ - var spinner = this.retrieve('spinner'); - if (!spinner){ - spinner = new Spinner(this, this.retrieve('spinner:options')); - this.store('spinner', spinner); - } - return spinner; - } - -}; - -Element.implement({ - - spin: function(options){ - if (options) this.set('spinner', options); - this.get('spinner').show(); - return this; - }, - - unspin: function(){ - this.get('spinner').hide(); - return this; - } - -}); - - -/* ---- - -script: String.QueryString.js - -name: String.QueryString - -description: Methods for dealing with URI query strings. - -license: MIT-style license - -authors: - - Sebastian Markbåge - - Aaron Newton - - Lennart Pilon - - Valerio Proietti - -requires: - - Core/Array - - Core/String - - MooTools.More - -provides: [String.QueryString] - -... -*/ - -String.implement({ - - parseQueryString: function(decodeKeys, decodeValues){ - if (decodeKeys == null) decodeKeys = true; - if (decodeValues == null) decodeValues = true; - - var vars = this.split(/[&;]/), - object = {}; - if (!vars.length) return object; - - vars.each(function(val){ - var index = val.indexOf('=') + 1, - value = index ? val.substr(index) : '', - keys = index ? val.substr(0, index - 1).match(/([^\]\[]+|(\B)(?=\]))/g) : [val], - obj = object; - if (!keys) return; - if (decodeValues) value = decodeURIComponent(value); - keys.each(function(key, i){ - if (decodeKeys) key = decodeURIComponent(key); - var current = obj[key]; - - if (i < keys.length - 1) obj = obj[key] = current || {}; - else if (typeOf(current) == 'array') current.push(value); - else obj[key] = current != null ? [current, value] : value; - }); - }); - - return object; - }, - - cleanQueryString: function(method){ - return this.split('&').filter(function(val){ - var index = val.indexOf('='), - key = index < 0 ? '' : val.substr(0, index), - value = val.substr(index + 1); - - return method ? method.call(null, key, value) : (value || value === 0); - }).join('&'); - } - -}); - - -/* ---- - -name: Events.Pseudos - -description: Adds the functionality to add pseudo events - -license: MIT-style license - -authors: - - Arian Stolwijk - -requires: [Core/Class.Extras, Core/Slick.Parser, MooTools.More] - -provides: [Events.Pseudos] - -... -*/ - -(function(){ - -Events.Pseudos = function(pseudos, addEvent, removeEvent){ - - var storeKey = '_monitorEvents:'; - - var storageOf = function(object){ - return { - store: object.store ? function(key, value){ - object.store(storeKey + key, value); - } : function(key, value){ - (object._monitorEvents || (object._monitorEvents = {}))[key] = value; - }, - retrieve: object.retrieve ? function(key, dflt){ - return object.retrieve(storeKey + key, dflt); - } : function(key, dflt){ - if (!object._monitorEvents) return dflt; - return object._monitorEvents[key] || dflt; - } - }; - }; - - var splitType = function(type){ - if (type.indexOf(':') == -1 || !pseudos) return null; - - var parsed = Slick.parse(type).expressions[0][0], - parsedPseudos = parsed.pseudos, - l = parsedPseudos.length, - splits = []; - - while (l--){ - var pseudo = parsedPseudos[l].key, - listener = pseudos[pseudo]; - if (listener != null) splits.push({ - event: parsed.tag, - value: parsedPseudos[l].value, - pseudo: pseudo, - original: type, - listener: listener - }); - } - return splits.length ? splits : null; - }; - - return { - - addEvent: function(type, fn, internal){ - var split = splitType(type); - if (!split) return addEvent.call(this, type, fn, internal); - - var storage = storageOf(this), - events = storage.retrieve(type, []), - eventType = split[0].event, - args = Array.slice(arguments, 2), - stack = fn, - self = this; - - split.each(function(item){ - var listener = item.listener, - stackFn = stack; - if (listener == false) eventType += ':' + item.pseudo + '(' + item.value + ')'; - else stack = function(){ - listener.call(self, item, stackFn, arguments, stack); - }; - }); - - events.include({type: eventType, event: fn, monitor: stack}); - storage.store(type, events); - - if (type != eventType) addEvent.apply(this, [type, fn].concat(args)); - return addEvent.apply(this, [eventType, stack].concat(args)); - }, - - removeEvent: function(type, fn){ - var split = splitType(type); - if (!split) return removeEvent.call(this, type, fn); - - var storage = storageOf(this), - events = storage.retrieve(type); - if (!events) return this; - - var args = Array.slice(arguments, 2); - - removeEvent.apply(this, [type, fn].concat(args)); - events.each(function(monitor, i){ - if (!fn || monitor.event == fn) removeEvent.apply(this, [monitor.type, monitor.monitor].concat(args)); - delete events[i]; - }, this); - - storage.store(type, events); - return this; - } - - }; - -}; - -var pseudos = { - - once: function(split, fn, args, monitor){ - fn.apply(this, args); - this.removeEvent(split.event, monitor) - .removeEvent(split.original, fn); - }, - - throttle: function(split, fn, args){ - if (!fn._throttled){ - fn.apply(this, args); - fn._throttled = setTimeout(function(){ - fn._throttled = false; - }, split.value || 250); - } - }, - - pause: function(split, fn, args){ - clearTimeout(fn._pause); - fn._pause = fn.delay(split.value || 250, this, args); - } - -}; - -Events.definePseudo = function(key, listener){ - pseudos[key] = listener; - return this; -}; - -Events.lookupPseudo = function(key){ - return pseudos[key]; -}; - -var proto = Events.prototype; -Events.implement(Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent)); - -['Request', 'Fx'].each(function(klass){ - if (this[klass]) this[klass].implement(Events.prototype); -}); - -})(); - - -/* ---- - -name: Element.Event.Pseudos - -description: Adds the functionality to add pseudo events for Elements - -license: MIT-style license - -authors: - - Arian Stolwijk - -requires: [Core/Element.Event, Core/Element.Delegation, Events.Pseudos] - -provides: [Element.Event.Pseudos, Element.Delegation.Pseudo] - -... -*/ - -(function(){ - -var pseudos = {relay: false}, - copyFromEvents = ['once', 'throttle', 'pause'], - count = copyFromEvents.length; - -while (count--) pseudos[copyFromEvents[count]] = Events.lookupPseudo(copyFromEvents[count]); - -DOMEvent.definePseudo = function(key, listener){ - pseudos[key] = listener; - return this; -}; - -var proto = Element.prototype; -[Element, Window, Document].invoke('implement', Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent)); - -})(); - - -/* ---- - -script: Form.Request.js - -name: Form.Request - -description: Handles the basic functionality of submitting a form and updating a dom element with the result. - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Request.HTML - - Class.Binds - - Class.Occlude - - Spinner - - String.QueryString - - Element.Delegation.Pseudo - -provides: [Form.Request] - -... -*/ - -if (!window.Form) window.Form = {}; - -(function(){ - - Form.Request = new Class({ - - Binds: ['onSubmit', 'onFormValidate'], - - Implements: [Options, Events, Class.Occlude], - - options: {/* - onFailure: function(){}, - onSuccess: function(){}, // aliased to onComplete, - onSend: function(){}*/ - requestOptions: { - evalScripts: true, - useSpinner: true, - emulation: false, - link: 'ignore' - }, - sendButtonClicked: true, - extraData: {}, - resetForm: true - }, - - property: 'form.request', - - initialize: function(form, target, options){ - this.element = document.id(form); - if (this.occlude()) return this.occluded; - this.setOptions(options) - .setTarget(target) - .attach(); - }, - - setTarget: function(target){ - this.target = document.id(target); - if (!this.request){ - this.makeRequest(); - } else { - this.request.setOptions({ - update: this.target - }); - } - return this; - }, - - toElement: function(){ - return this.element; - }, - - makeRequest: function(){ - var self = this; - this.request = new Request.HTML(Object.merge({ - update: this.target, - emulation: false, - spinnerTarget: this.element, - method: this.element.get('method') || 'post' - }, this.options.requestOptions)).addEvents({ - success: function(tree, elements, html, javascript){ - ['complete', 'success'].each(function(evt){ - self.fireEvent(evt, [self.target, tree, elements, html, javascript]); - }); - }, - failure: function(){ - self.fireEvent('complete', arguments).fireEvent('failure', arguments); - }, - exception: function(){ - self.fireEvent('failure', arguments); - } - }); - return this.attachReset(); - }, - - attachReset: function(){ - if (!this.options.resetForm) return this; - this.request.addEvent('success', function(){ - Function.attempt(function(){ - this.element.reset(); - }.bind(this)); - if (window.OverText) OverText.update(); - }.bind(this)); - return this; - }, - - attach: function(attach){ - var method = (attach != false) ? 'addEvent' : 'removeEvent'; - this.element[method]('click:relay(button, input[type=submit])', this.saveClickedButton.bind(this)); - - var fv = this.element.retrieve('validator'); - if (fv) fv[method]('onFormValidate', this.onFormValidate); - else this.element[method]('submit', this.onSubmit); - - return this; - }, - - detach: function(){ - return this.attach(false); - }, - - //public method - enable: function(){ - return this.attach(); - }, - - //public method - disable: function(){ - return this.detach(); - }, - - onFormValidate: function(valid, form, event){ - //if there's no event, then this wasn't a submit event - if (!event) return; - var fv = this.element.retrieve('validator'); - if (valid || (fv && !fv.options.stopOnFailure)){ - event.stop(); - this.send(); - } - }, - - onSubmit: function(event){ - var fv = this.element.retrieve('validator'); - if (fv){ - //form validator was created after Form.Request - this.element.removeEvent('submit', this.onSubmit); - fv.addEvent('onFormValidate', this.onFormValidate); - fv.validate(event); - return; - } - if (event) event.stop(); - this.send(); - }, - - saveClickedButton: function(event, target){ - var targetName = target.get('name'); - if (!targetName || !this.options.sendButtonClicked) return; - this.options.extraData[targetName] = target.get('value') || true; - this.clickedCleaner = function(){ - delete this.options.extraData[targetName]; - this.clickedCleaner = function(){}; - }.bind(this); - }, - - clickedCleaner: function(){}, - - send: function(){ - var str = this.element.toQueryString().trim(), - data = Object.toQueryString(this.options.extraData); - - if (str) str += "&" + data; - else str = data; - - this.fireEvent('send', [this.element, str.parseQueryString()]); - this.request.send({ - data: str, - url: this.options.requestOptions.url || this.element.get('action') - }); - this.clickedCleaner(); - return this; - } - - }); - - Element.implement('formUpdate', function(update, options){ - var fq = this.retrieve('form.request'); - if (!fq){ - fq = new Form.Request(this, update, options); - } else { - if (update) fq.setTarget(update); - if (options) fq.setOptions(options).makeRequest(); - } - fq.send(); - return this; - }); - -})(); - - -/* ---- - -script: Element.Shortcuts.js - -name: Element.Shortcuts - -description: Extends the Element native object to include some shortcut methods. - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Element.Style - - MooTools.More - -provides: [Element.Shortcuts] - -... -*/ - -Element.implement({ - - isDisplayed: function(){ - return this.getStyle('display') != 'none'; - }, - - isVisible: function(){ - var w = this.offsetWidth, - h = this.offsetHeight; - return (w == 0 && h == 0) ? false : (w > 0 && h > 0) ? true : this.style.display != 'none'; - }, - - toggle: function(){ - return this[this.isDisplayed() ? 'hide' : 'show'](); - }, - - hide: function(){ - var d; - try { - //IE fails here if the element is not in the dom - d = this.getStyle('display'); - } catch(e){} - if (d == 'none') return this; - return this.store('element:_originalDisplay', d || '').setStyle('display', 'none'); - }, - - show: function(display){ - if (!display && this.isDisplayed()) return this; - display = display || this.retrieve('element:_originalDisplay') || 'block'; - return this.setStyle('display', (display == 'none') ? 'block' : display); - }, - - swapClass: function(remove, add){ - return this.removeClass(remove).addClass(add); - } - -}); - -Document.implement({ - - clearSelection: function(){ - if (window.getSelection){ - var selection = window.getSelection(); - if (selection && selection.removeAllRanges) selection.removeAllRanges(); - } else if (document.selection && document.selection.empty){ - try { - //IE fails here if selected element is not in dom - document.selection.empty(); - } catch(e){} - } - } - -}); - - -/* ---- - -script: Fx.Reveal.js - -name: Fx.Reveal - -description: Defines Fx.Reveal, a class that shows and hides elements with a transition. - -license: MIT-style license - -authors: - - Aaron Newton - -requires: - - Core/Fx.Morph - - Element.Shortcuts - - Element.Measure - -provides: [Fx.Reveal] - -... -*/ - -(function(){ - - -var hideTheseOf = function(object){ - var hideThese = object.options.hideInputs; - if (window.OverText){ - var otClasses = [null]; - OverText.each(function(ot){ - otClasses.include('.' + ot.options.labelClass); - }); - if (otClasses) hideThese += otClasses.join(', '); - } - return (hideThese) ? object.element.getElements(hideThese) : null; -}; - - -Fx.Reveal = new Class({ - - Extends: Fx.Morph, - - options: {/* - onShow: function(thisElement){}, - onHide: function(thisElement){}, - onComplete: function(thisElement){}, - heightOverride: null, - widthOverride: null,*/ - link: 'cancel', - styles: ['padding', 'border', 'margin'], - transitionOpacity: 'opacity' in document.documentElement, - mode: 'vertical', - display: function(){ - return this.element.get('tag') != 'tr' ? 'block' : 'table-row'; - }, - opacity: 1, - hideInputs: !('opacity' in document.documentElement) ? 'select, input, textarea, object, embed' : null - }, - - dissolve: function(){ - if (!this.hiding && !this.showing){ - if (this.element.getStyle('display') != 'none'){ - this.hiding = true; - this.showing = false; - this.hidden = true; - this.cssText = this.element.style.cssText; - - var startStyles = this.element.getComputedSize({ - styles: this.options.styles, - mode: this.options.mode - }); - if (this.options.transitionOpacity) startStyles.opacity = this.options.opacity; - - var zero = {}; - Object.each(startStyles, function(style, name){ - zero[name] = [style, 0]; - }); - - this.element.setStyles({ - display: Function.from(this.options.display).call(this), - overflow: 'hidden' - }); - - var hideThese = hideTheseOf(this); - if (hideThese) hideThese.setStyle('visibility', 'hidden'); - - this.$chain.unshift(function(){ - if (this.hidden){ - this.hiding = false; - this.element.style.cssText = this.cssText; - this.element.setStyle('display', 'none'); - if (hideThese) hideThese.setStyle('visibility', 'visible'); - } - this.fireEvent('hide', this.element); - this.callChain(); - }.bind(this)); - - this.start(zero); - } else { - this.callChain.delay(10, this); - this.fireEvent('complete', this.element); - this.fireEvent('hide', this.element); - } - } else if (this.options.link == 'chain'){ - this.chain(this.dissolve.bind(this)); - } else if (this.options.link == 'cancel' && !this.hiding){ - this.cancel(); - this.dissolve(); - } - return this; - }, - - reveal: function(){ - if (!this.showing && !this.hiding){ - if (this.element.getStyle('display') == 'none'){ - this.hiding = false; - this.showing = true; - this.hidden = false; - this.cssText = this.element.style.cssText; - - var startStyles; - this.element.measure(function(){ - startStyles = this.element.getComputedSize({ - styles: this.options.styles, - mode: this.options.mode - }); - }.bind(this)); - if (this.options.heightOverride != null) startStyles.height = this.options.heightOverride.toInt(); - if (this.options.widthOverride != null) startStyles.width = this.options.widthOverride.toInt(); - if (this.options.transitionOpacity){ - this.element.setStyle('opacity', 0); - startStyles.opacity = this.options.opacity; - } - - var zero = { - height: 0, - display: Function.from(this.options.display).call(this) - }; - Object.each(startStyles, function(style, name){ - zero[name] = 0; - }); - zero.overflow = 'hidden'; - - this.element.setStyles(zero); - - var hideThese = hideTheseOf(this); - if (hideThese) hideThese.setStyle('visibility', 'hidden'); - - this.$chain.unshift(function(){ - this.element.style.cssText = this.cssText; - this.element.setStyle('display', Function.from(this.options.display).call(this)); - if (!this.hidden) this.showing = false; - if (hideThese) hideThese.setStyle('visibility', 'visible'); - this.callChain(); - this.fireEvent('show', this.element); - }.bind(this)); - - this.start(startStyles); - } else { - this.callChain(); - this.fireEvent('complete', this.element); - this.fireEvent('show', this.element); - } - } else if (this.options.link == 'chain'){ - this.chain(this.reveal.bind(this)); - } else if (this.options.link == 'cancel' && !this.showing){ - this.cancel(); - this.reveal(); - } - return this; - }, - - toggle: function(){ - if (this.element.getStyle('display') == 'none'){ - this.reveal(); - } else { - this.dissolve(); - } - return this; - }, - - cancel: function(){ - this.parent.apply(this, arguments); - if (this.cssText != null) this.element.style.cssText = this.cssText; - this.hiding = false; - this.showing = false; - return this; - } - -}); - -Element.Properties.reveal = { - - set: function(options){ - this.get('reveal').cancel().setOptions(options); - return this; - }, - - get: function(){ - var reveal = this.retrieve('reveal'); - if (!reveal){ - reveal = new Fx.Reveal(this); - this.store('reveal', reveal); - } - return reveal; - } - -}; - -Element.Properties.dissolve = Element.Properties.reveal; - -Element.implement({ - - reveal: function(options){ - this.get('reveal').setOptions(options).reveal(); - return this; - }, - - dissolve: function(options){ - this.get('reveal').setOptions(options).dissolve(); - return this; - }, - - nix: function(options){ - var params = Array.link(arguments, {destroy: Type.isBoolean, options: Type.isObject}); - this.get('reveal').setOptions(options).dissolve().chain(function(){ - this[params.destroy ? 'destroy' : 'dispose'](); - }.bind(this)); - return this; - }, - - wink: function(){ - var params = Array.link(arguments, {duration: Type.isNumber, options: Type.isObject}); - var reveal = this.get('reveal').setOptions(params.options); - reveal.reveal().chain(function(){ - (function(){ - reveal.dissolve(); - }).delay(params.duration || 2000); - }); - } - -}); - -})(); - - -/* ---- - -script: Drag.js - -name: Drag - -description: The base Drag Class. Can be used to drag and resize Elements using mouse events. - -license: MIT-style license - -authors: - - Valerio Proietti - - Tom Occhinno - - Jan Kassens - -requires: - - Core/Events - - Core/Options - - Core/Element.Event - - Core/Element.Style - - Core/Element.Dimensions - - MooTools.More - -provides: [Drag] -... - -*/ - -var Drag = new Class({ - - Implements: [Events, Options], - - options: {/* - onBeforeStart: function(thisElement){}, - onStart: function(thisElement, event){}, - onSnap: function(thisElement){}, - onDrag: function(thisElement, event){}, - onCancel: function(thisElement){}, - onComplete: function(thisElement, event){},*/ - snap: 6, - unit: 'px', - grid: false, - style: true, - limit: false, - handle: false, - invert: false, - preventDefault: false, - stopPropagation: false, - modifiers: {x: 'left', y: 'top'} - }, - - initialize: function(){ - var params = Array.link(arguments, { - 'options': Type.isObject, - 'element': function(obj){ - return obj != null; - } - }); - - this.element = document.id(params.element); - this.document = this.element.getDocument(); - this.setOptions(params.options || {}); - var htype = typeOf(this.options.handle); - this.handles = ((htype == 'array' || htype == 'collection') ? $$(this.options.handle) : document.id(this.options.handle)) || this.element; - this.mouse = {'now': {}, 'pos': {}}; - this.value = {'start': {}, 'now': {}}; - - this.selection = 'selectstart' in document ? 'selectstart' : 'mousedown'; - - - if ('ondragstart' in document && !('FileReader' in window) && !Drag.ondragstartFixed){ - document.ondragstart = Function.from(false); - Drag.ondragstartFixed = true; - } - - this.bound = { - start: this.start.bind(this), - check: this.check.bind(this), - drag: this.drag.bind(this), - stop: this.stop.bind(this), - cancel: this.cancel.bind(this), - eventStop: Function.from(false) - }; - this.attach(); - }, - - attach: function(){ - this.handles.addEvent('mousedown', this.bound.start); - return this; - }, - - detach: function(){ - this.handles.removeEvent('mousedown', this.bound.start); - return this; - }, - - start: function(event){ - var options = this.options; - - if (event.rightClick) return; - - if (options.preventDefault) event.preventDefault(); - if (options.stopPropagation) event.stopPropagation(); - this.mouse.start = event.page; - - this.fireEvent('beforeStart', this.element); - - var limit = options.limit; - this.limit = {x: [], y: []}; - - var z, coordinates; - for (z in options.modifiers){ - if (!options.modifiers[z]) continue; - - var style = this.element.getStyle(options.modifiers[z]); - - // Some browsers (IE and Opera) don't always return pixels. - if (style && !style.match(/px$/)){ - if (!coordinates) coordinates = this.element.getCoordinates(this.element.getOffsetParent()); - style = coordinates[options.modifiers[z]]; - } - - if (options.style) this.value.now[z] = (style || 0).toInt(); - else this.value.now[z] = this.element[options.modifiers[z]]; - - if (options.invert) this.value.now[z] *= -1; - - this.mouse.pos[z] = event.page[z] - this.value.now[z]; - - if (limit && limit[z]){ - var i = 2; - while (i--){ - var limitZI = limit[z][i]; - if (limitZI || limitZI === 0) this.limit[z][i] = (typeof limitZI == 'function') ? limitZI() : limitZI; - } - } - } - - if (typeOf(this.options.grid) == 'number') this.options.grid = { - x: this.options.grid, - y: this.options.grid - }; - - var events = { - mousemove: this.bound.check, - mouseup: this.bound.cancel - }; - events[this.selection] = this.bound.eventStop; - this.document.addEvents(events); - }, - - check: function(event){ - if (this.options.preventDefault) event.preventDefault(); - var distance = Math.round(Math.sqrt(Math.pow(event.page.x - this.mouse.start.x, 2) + Math.pow(event.page.y - this.mouse.start.y, 2))); - if (distance > this.options.snap){ - this.cancel(); - this.document.addEvents({ - mousemove: this.bound.drag, - mouseup: this.bound.stop - }); - this.fireEvent('start', [this.element, event]).fireEvent('snap', this.element); - } - }, - - drag: function(event){ - var options = this.options; - - if (options.preventDefault) event.preventDefault(); - this.mouse.now = event.page; - - for (var z in options.modifiers){ - if (!options.modifiers[z]) continue; - this.value.now[z] = this.mouse.now[z] - this.mouse.pos[z]; - - if (options.invert) this.value.now[z] *= -1; - - if (options.limit && this.limit[z]){ - if ((this.limit[z][1] || this.limit[z][1] === 0) && (this.value.now[z] > this.limit[z][1])){ - this.value.now[z] = this.limit[z][1]; - } else if ((this.limit[z][0] || this.limit[z][0] === 0) && (this.value.now[z] < this.limit[z][0])){ - this.value.now[z] = this.limit[z][0]; - } - } - - if (options.grid[z]) this.value.now[z] -= ((this.value.now[z] - (this.limit[z][0]||0)) % options.grid[z]); - - if (options.style) this.element.setStyle(options.modifiers[z], this.value.now[z] + options.unit); - else this.element[options.modifiers[z]] = this.value.now[z]; - } - - this.fireEvent('drag', [this.element, event]); - }, - - cancel: function(event){ - this.document.removeEvents({ - mousemove: this.bound.check, - mouseup: this.bound.cancel - }); - if (event){ - this.document.removeEvent(this.selection, this.bound.eventStop); - this.fireEvent('cancel', this.element); - } - }, - - stop: function(event){ - var events = { - mousemove: this.bound.drag, - mouseup: this.bound.stop - }; - events[this.selection] = this.bound.eventStop; - this.document.removeEvents(events); - if (event) this.fireEvent('complete', [this.element, event]); - } - -}); - -Element.implement({ - - makeResizable: function(options){ - var drag = new Drag(this, Object.merge({ - modifiers: { - x: 'width', - y: 'height' - } - }, options)); - - this.store('resizer', drag); - return drag.addEvent('drag', function(){ - this.fireEvent('resize', drag); - }.bind(this)); - } - -}); - - -/* ---- - -script: Drag.Move.js - -name: Drag.Move - -description: A Drag extension that provides support for the constraining of draggables to containers and droppables. - -license: MIT-style license - -authors: - - Valerio Proietti - - Tom Occhinno - - Jan Kassens - - Aaron Newton - - Scott Kyle - -requires: - - Core/Element.Dimensions - - Drag - -provides: [Drag.Move] - -... -*/ - -Drag.Move = new Class({ - - Extends: Drag, - - options: {/* - onEnter: function(thisElement, overed){}, - onLeave: function(thisElement, overed){}, - onDrop: function(thisElement, overed, event){},*/ - droppables: [], - container: false, - precalculate: false, - includeMargins: true, - checkDroppables: true - }, - - initialize: function(element, options){ - this.parent(element, options); - element = this.element; - - this.droppables = $$(this.options.droppables); - this.setContainer(this.options.container); - - if (this.options.style){ - if (this.options.modifiers.x == 'left' && this.options.modifiers.y == 'top'){ - var parent = element.getOffsetParent(), - styles = element.getStyles('left', 'top'); - if (parent && (styles.left == 'auto' || styles.top == 'auto')){ - element.setPosition(element.getPosition(parent)); - } - } - - if (element.getStyle('position') == 'static') element.setStyle('position', 'absolute'); - } - - this.addEvent('start', this.checkDroppables, true); - this.overed = null; - }, - - setContainer: function(container) { - this.container = document.id(container); - if (this.container && typeOf(this.container) != 'element'){ - this.container = document.id(this.container.getDocument().body); - } - }, - - start: function(event){ - if (this.container) this.options.limit = this.calculateLimit(); - - if (this.options.precalculate){ - this.positions = this.droppables.map(function(el){ - return el.getCoordinates(); - }); - } - - this.parent(event); - }, - - calculateLimit: function(){ - var element = this.element, - container = this.container, - - offsetParent = document.id(element.getOffsetParent()) || document.body, - containerCoordinates = container.getCoordinates(offsetParent), - elementMargin = {}, - elementBorder = {}, - containerMargin = {}, - containerBorder = {}, - offsetParentPadding = {}; - - ['top', 'right', 'bottom', 'left'].each(function(pad){ - elementMargin[pad] = element.getStyle('margin-' + pad).toInt(); - elementBorder[pad] = element.getStyle('border-' + pad).toInt(); - containerMargin[pad] = container.getStyle('margin-' + pad).toInt(); - containerBorder[pad] = container.getStyle('border-' + pad).toInt(); - offsetParentPadding[pad] = offsetParent.getStyle('padding-' + pad).toInt(); - }, this); - - var width = element.offsetWidth + elementMargin.left + elementMargin.right, - height = element.offsetHeight + elementMargin.top + elementMargin.bottom, - left = 0, - top = 0, - right = containerCoordinates.right - containerBorder.right - width, - bottom = containerCoordinates.bottom - containerBorder.bottom - height; - - if (this.options.includeMargins){ - left += elementMargin.left; - top += elementMargin.top; - } else { - right += elementMargin.right; - bottom += elementMargin.bottom; - } - - if (element.getStyle('position') == 'relative'){ - var coords = element.getCoordinates(offsetParent); - coords.left -= element.getStyle('left').toInt(); - coords.top -= element.getStyle('top').toInt(); - - left -= coords.left; - top -= coords.top; - if (container.getStyle('position') != 'relative'){ - left += containerBorder.left; - top += containerBorder.top; - } - right += elementMargin.left - coords.left; - bottom += elementMargin.top - coords.top; - - if (container != offsetParent){ - left += containerMargin.left + offsetParentPadding.left; - if (!offsetParentPadding.left && left < 0) left = 0; - top += offsetParent == document.body ? 0 : containerMargin.top + offsetParentPadding.top; - if (!offsetParentPadding.top && top < 0) top = 0; - } - } else { - left -= elementMargin.left; - top -= elementMargin.top; - if (container != offsetParent){ - left += containerCoordinates.left + containerBorder.left; - top += containerCoordinates.top + containerBorder.top; - } - } - - return { - x: [left, right], - y: [top, bottom] - }; - }, - - getDroppableCoordinates: function(element){ - var position = element.getCoordinates(); - if (element.getStyle('position') == 'fixed'){ - var scroll = window.getScroll(); - position.left += scroll.x; - position.right += scroll.x; - position.top += scroll.y; - position.bottom += scroll.y; - } - return position; - }, - - checkDroppables: function(){ - var overed = this.droppables.filter(function(el, i){ - el = this.positions ? this.positions[i] : this.getDroppableCoordinates(el); - var now = this.mouse.now; - return (now.x > el.left && now.x < el.right && now.y < el.bottom && now.y > el.top); - }, this).getLast(); - - if (this.overed != overed){ - if (this.overed) this.fireEvent('leave', [this.element, this.overed]); - if (overed) this.fireEvent('enter', [this.element, overed]); - this.overed = overed; - } - }, - - drag: function(event){ - this.parent(event); - if (this.options.checkDroppables && this.droppables.length) this.checkDroppables(); - }, - - stop: function(event){ - this.checkDroppables(); - this.fireEvent('drop', [this.element, this.overed, event]); - this.overed = null; - return this.parent(event); - } - -}); - -Element.implement({ - - makeDraggable: function(options){ - var drag = new Drag.Move(this, options); - this.store('dragger', drag); - return drag; - } - -}); - - -/* ---- - -script: Sortables.js - -name: Sortables - -description: Class for creating a drag and drop sorting interface for lists of items. - -license: MIT-style license - -authors: - - Tom Occhino - -requires: - - Core/Fx.Morph - - Drag.Move - -provides: [Sortables] - -... -*/ - -var Sortables = new Class({ - - Implements: [Events, Options], - - options: {/* - onSort: function(element, clone){}, - onStart: function(element, clone){}, - onComplete: function(element){},*/ - opacity: 1, - clone: false, - revert: false, - handle: false, - dragOptions: {}, - unDraggableTags: ['button', 'input', 'a', 'textarea', 'select', 'option'] - }, - - initialize: function(lists, options){ - this.setOptions(options); - - this.elements = []; - this.lists = []; - this.idle = true; - - this.addLists($$(document.id(lists) || lists)); - - if (!this.options.clone) this.options.revert = false; - if (this.options.revert) this.effect = new Fx.Morph(null, Object.merge({ - duration: 250, - link: 'cancel' - }, this.options.revert)); - }, - - attach: function(){ - this.addLists(this.lists); - return this; - }, - - detach: function(){ - this.lists = this.removeLists(this.lists); - return this; - }, - - addItems: function(){ - Array.flatten(arguments).each(function(element){ - this.elements.push(element); - var start = element.retrieve('sortables:start', function(event){ - this.start.call(this, event, element); - }.bind(this)); - (this.options.handle ? element.getElement(this.options.handle) || element : element).addEvent('mousedown', start); - }, this); - return this; - }, - - addLists: function(){ - Array.flatten(arguments).each(function(list){ - this.lists.include(list); - this.addItems(list.getChildren()); - }, this); - return this; - }, - - removeItems: function(){ - return $$(Array.flatten(arguments).map(function(element){ - this.elements.erase(element); - var start = element.retrieve('sortables:start'); - (this.options.handle ? element.getElement(this.options.handle) || element : element).removeEvent('mousedown', start); - - return element; - }, this)); - }, - - removeLists: function(){ - return $$(Array.flatten(arguments).map(function(list){ - this.lists.erase(list); - this.removeItems(list.getChildren()); - - return list; - }, this)); - }, - - getDroppableCoordinates: function (element){ - var offsetParent = element.getOffsetParent(); - var position = element.getPosition(offsetParent); - var scroll = { - w: window.getScroll(), - offsetParent: offsetParent.getScroll() - }; - position.x += scroll.offsetParent.x; - position.y += scroll.offsetParent.y; - - if (offsetParent.getStyle('position') == 'fixed'){ - position.x -= scroll.w.x; - position.y -= scroll.w.y; - } - - return position; - }, - - getClone: function(event, element){ - if (!this.options.clone) return new Element(element.tagName).inject(document.body); - if (typeOf(this.options.clone) == 'function') return this.options.clone.call(this, event, element, this.list); - var clone = element.clone(true).setStyles({ - margin: 0, - position: 'absolute', - visibility: 'hidden', - width: element.getStyle('width') - }).addEvent('mousedown', function(event){ - element.fireEvent('mousedown', event); - }); - //prevent the duplicated radio inputs from unchecking the real one - if (clone.get('html').test('radio')){ - clone.getElements('input[type=radio]').each(function(input, i){ - input.set('name', 'clone_' + i); - if (input.get('checked')) element.getElements('input[type=radio]')[i].set('checked', true); - }); - } - - return clone.inject(this.list).setPosition(this.getDroppableCoordinates(this.element)); - }, - - getDroppables: function(){ - var droppables = this.list.getChildren().erase(this.clone).erase(this.element); - if (!this.options.constrain) droppables.append(this.lists).erase(this.list); - return droppables; - }, - - insert: function(dragging, element){ - var where = 'inside'; - if (this.lists.contains(element)){ - this.list = element; - this.drag.droppables = this.getDroppables(); - } else { - where = this.element.getAllPrevious().contains(element) ? 'before' : 'after'; - } - this.element.inject(element, where); - this.fireEvent('sort', [this.element, this.clone]); - }, - - start: function(event, element){ - if ( - !this.idle || - event.rightClick || - (!this.options.handle && this.options.unDraggableTags.contains(event.target.get('tag'))) - ) return; - - this.idle = false; - this.element = element; - this.opacity = element.getStyle('opacity'); - this.list = element.getParent(); - this.clone = this.getClone(event, element); - - this.drag = new Drag.Move(this.clone, Object.merge({ - - droppables: this.getDroppables() - }, this.options.dragOptions)).addEvents({ - onSnap: function(){ - event.stop(); - this.clone.setStyle('visibility', 'visible'); - this.element.setStyle('opacity', this.options.opacity || 0); - this.fireEvent('start', [this.element, this.clone]); - }.bind(this), - onEnter: this.insert.bind(this), - onCancel: this.end.bind(this), - onComplete: this.end.bind(this) - }); - - this.clone.inject(this.element, 'before'); - this.drag.start(event); - }, - - end: function(){ - this.drag.detach(); - this.element.setStyle('opacity', this.opacity); - var self = this; - if (this.effect){ - var dim = this.element.getStyles('width', 'height'), - clone = this.clone, - pos = clone.computePosition(this.getDroppableCoordinates(clone)); - - var destroy = function(){ - this.removeEvent('cancel', destroy); - clone.destroy(); - self.reset(); - }; - - this.effect.element = clone; - this.effect.start({ - top: pos.top, - left: pos.left, - width: dim.width, - height: dim.height, - opacity: 0.25 - }).addEvent('cancel', destroy).chain(destroy); - } else { - this.clone.destroy(); - self.reset(); - } - - }, - - reset: function(){ - this.idle = true; - this.fireEvent('complete', this.element); - }, - - serialize: function(){ - var params = Array.link(arguments, { - modifier: Type.isFunction, - index: function(obj){ - return obj != null; - } - }); - var serial = this.lists.map(function(list){ - return list.getChildren().map(params.modifier || function(element){ - return element.get('id'); - }, this); - }, this); - - var index = params.index; - if (this.lists.length == 1) index = 0; - return (index || index === 0) && index >= 0 && index < this.lists.length ? serial[index] : serial; - } - -}); - - -/* ---- - -script: Request.Periodical.js - -name: Request.Periodical - -description: Requests the same URL to pull data from a server but increases the intervals if no data is returned to reduce the load - -license: MIT-style license - -authors: - - Christoph Pojer - -requires: - - Core/Request - - MooTools.More - -provides: [Request.Periodical] - -... -*/ - -Request.implement({ - - options: { - initialDelay: 5000, - delay: 5000, - limit: 60000 - }, - - startTimer: function(data){ - var fn = function(){ - if (!this.running) this.send({data: data}); - }; - this.lastDelay = this.options.initialDelay; - this.timer = fn.delay(this.lastDelay, this); - this.completeCheck = function(response){ - clearTimeout(this.timer); - this.lastDelay = (response) ? this.options.delay : (this.lastDelay + this.options.delay).min(this.options.limit); - this.timer = fn.delay(this.lastDelay, this); - }; - return this.addEvent('complete', this.completeCheck); - }, - - stopTimer: function(){ - clearTimeout(this.timer); - return this.removeEvent('complete', this.completeCheck); - } - -}); - - -/* ---- - -script: Color.js - -name: Color - -description: Class for creating and manipulating colors in JavaScript. Supports HSB -> RGB Conversions and vice versa. - -license: MIT-style license - -authors: - - Valerio Proietti - -requires: - - Core/Array - - Core/String - - Core/Number - - Core/Hash - - Core/Function - - MooTools.More - -provides: [Color] - -... -*/ - -(function(){ - -var Color = this.Color = new Type('Color', function(color, type){ - if (arguments.length >= 3){ - type = 'rgb'; color = Array.slice(arguments, 0, 3); - } else if (typeof color == 'string'){ - if (color.match(/rgb/)) color = color.rgbToHex().hexToRgb(true); - else if (color.match(/hsb/)) color = color.hsbToRgb(); - else color = color.hexToRgb(true); - } - type = type || 'rgb'; - switch (type){ - case 'hsb': - var old = color; - color = color.hsbToRgb(); - color.hsb = old; - break; - case 'hex': color = color.hexToRgb(true); break; - } - color.rgb = color.slice(0, 3); - color.hsb = color.hsb || color.rgbToHsb(); - color.hex = color.rgbToHex(); - return Object.append(color, this); -}); - -Color.implement({ - - mix: function(){ - var colors = Array.slice(arguments); - var alpha = (typeOf(colors.getLast()) == 'number') ? colors.pop() : 50; - var rgb = this.slice(); - colors.each(function(color){ - color = new Color(color); - for (var i = 0; i < 3; i++) rgb[i] = Math.round((rgb[i] / 100 * (100 - alpha)) + (color[i] / 100 * alpha)); - }); - return new Color(rgb, 'rgb'); - }, - - invert: function(){ - return new Color(this.map(function(value){ - return 255 - value; - })); - }, - - setHue: function(value){ - return new Color([value, this.hsb[1], this.hsb[2]], 'hsb'); - }, - - setSaturation: function(percent){ - return new Color([this.hsb[0], percent, this.hsb[2]], 'hsb'); - }, - - setBrightness: function(percent){ - return new Color([this.hsb[0], this.hsb[1], percent], 'hsb'); - } - -}); - -this.$RGB = function(r, g, b){ - return new Color([r, g, b], 'rgb'); -}; - -this.$HSB = function(h, s, b){ - return new Color([h, s, b], 'hsb'); -}; - -this.$HEX = function(hex){ - return new Color(hex, 'hex'); -}; - -Array.implement({ - - rgbToHsb: function(){ - var red = this[0], - green = this[1], - blue = this[2], - hue = 0; - var max = Math.max(red, green, blue), - min = Math.min(red, green, blue); - var delta = max - min; - var brightness = max / 255, - saturation = (max != 0) ? delta / max : 0; - if (saturation != 0){ - var rr = (max - red) / delta; - var gr = (max - green) / delta; - var br = (max - blue) / delta; - if (red == max) hue = br - gr; - else if (green == max) hue = 2 + rr - br; - else hue = 4 + gr - rr; - hue /= 6; - if (hue < 0) hue++; - } - return [Math.round(hue * 360), Math.round(saturation * 100), Math.round(brightness * 100)]; - }, - - hsbToRgb: function(){ - var br = Math.round(this[2] / 100 * 255); - if (this[1] == 0){ - return [br, br, br]; - } else { - var hue = this[0] % 360; - var f = hue % 60; - var p = Math.round((this[2] * (100 - this[1])) / 10000 * 255); - var q = Math.round((this[2] * (6000 - this[1] * f)) / 600000 * 255); - var t = Math.round((this[2] * (6000 - this[1] * (60 - f))) / 600000 * 255); - switch (Math.floor(hue / 60)){ - case 0: return [br, t, p]; - case 1: return [q, br, p]; - case 2: return [p, br, t]; - case 3: return [p, q, br]; - case 4: return [t, p, br]; - case 5: return [br, p, q]; - } - } - return false; - } - -}); - -String.implement({ - - rgbToHsb: function(){ - var rgb = this.match(/\d{1,3}/g); - return (rgb) ? rgb.rgbToHsb() : null; - }, - - hsbToRgb: function(){ - var hsb = this.match(/\d{1,3}/g); - return (hsb) ? hsb.hsbToRgb() : null; - } - -}); - -})(); - - diff --git a/pyload/webui/themes/Flat/js/static/mootools-more.min.js b/pyload/webui/themes/Flat/js/static/mootools-more.min.js deleted file mode 100644 index ce03a60fd..000000000 --- a/pyload/webui/themes/Flat/js/static/mootools-more.min.js +++ /dev/null @@ -1,226 +0,0 @@ -/* ---- -MooTools: the javascript framework - -web build: - - http://mootools.net/more/c1cc18c2fff04bcc58921b4dff80a6f1 - -packager build: - - packager build More/Form.Request More/Fx.Reveal More/Sortables More/Request.Periodical More/Color - -copyrights: - - [MooTools](http://mootools.net) - -licenses: - - [MIT License](http://mootools.net/license.txt) -... -*/ - -MooTools.More={version:"1.5.0",build:"73db5e24e6e9c5c87b3a27aebef2248053f7db37"};Class.Mutators.Binds=function(a){if(!this.prototype.initialize){this.implement("initialize",function(){}); -}return Array.from(a).concat(this.prototype.Binds||[]);};Class.Mutators.initialize=function(a){return function(){Array.from(this.Binds).each(function(b){var c=this[b]; -if(c){this[b]=c.bind(this);}},this);return a.apply(this,arguments);};};Class.Occlude=new Class({occlude:function(c,b){b=document.id(b||this.element);var a=b.retrieve(c||this.property); -if(a&&!this.occluded){return(this.occluded=a);}this.occluded=false;b.store(c||this.property,this);return this.occluded;}});Class.refactor=function(b,a){Object.each(a,function(e,d){var c=b.prototype[d]; -c=(c&&c.$origin)||c||function(){};b.implement(d,(typeof e=="function")?function(){var f=this.previous;this.previous=c;var g=e.apply(this,arguments);this.previous=f; -return g;}:e);});return b;};(function(){var b=function(e,d){var f=[];Object.each(d,function(g){Object.each(g,function(h){e.each(function(i){f.push(i+"-"+h+(i=="border"?"-width":"")); -});});});return f;};var c=function(f,e){var d=0;Object.each(e,function(h,g){if(g.test(f)){d=d+h.toInt();}});return d;};var a=function(d){return !!(!d||d.offsetHeight||d.offsetWidth); -};Element.implement({measure:function(h){if(a(this)){return h.call(this);}var g=this.getParent(),e=[];while(!a(g)&&g!=document.body){e.push(g.expose()); -g=g.getParent();}var f=this.expose(),d=h.call(this);f();e.each(function(i){i();});return d;},expose:function(){if(this.getStyle("display")!="none"){return function(){}; -}var d=this.style.cssText;this.setStyles({display:"block",position:"absolute",visibility:"hidden"});return function(){this.style.cssText=d;}.bind(this); -},getDimensions:function(d){d=Object.merge({computeSize:false},d);var i={x:0,y:0};var h=function(j,e){return(e.computeSize)?j.getComputedSize(e):j.getSize(); -};var f=this.getParent("body");if(f&&this.getStyle("display")=="none"){i=this.measure(function(){return h(this,d);});}else{if(f){try{i=h(this,d);}catch(g){}}}return Object.append(i,(i.x||i.x===0)?{width:i.x,height:i.y}:{x:i.width,y:i.height}); -},getComputedSize:function(d){d=Object.merge({styles:["padding","border"],planes:{height:["top","bottom"],width:["left","right"]},mode:"both"},d);var g={},e={width:0,height:0},f; -if(d.mode=="vertical"){delete e.width;delete d.planes.width;}else{if(d.mode=="horizontal"){delete e.height;delete d.planes.height;}}b(d.styles,d.planes).each(function(h){g[h]=this.getStyle(h).toInt(); -},this);Object.each(d.planes,function(i,h){var k=h.capitalize(),j=this.getStyle(h);if(j=="auto"&&!f){f=this.getDimensions();}j=g[h]=(j=="auto")?f[h]:j.toInt(); -e["total"+k]=j;i.each(function(m){var l=c(m,g);e["computed"+m.capitalize()]=l;e["total"+k]+=l;});},this);return Object.append(e,g);}});})();(function(b){var a=Element.Position={options:{relativeTo:document.body,position:{x:"center",y:"center"},offset:{x:0,y:0}},getOptions:function(d,c){c=Object.merge({},a.options,c); -a.setPositionOption(c);a.setEdgeOption(c);a.setOffsetOption(d,c);a.setDimensionsOption(d,c);return c;},setPositionOption:function(c){c.position=a.getCoordinateFromValue(c.position); -},setEdgeOption:function(d){var c=a.getCoordinateFromValue(d.edge);d.edge=c?c:(d.position.x=="center"&&d.position.y=="center")?{x:"center",y:"center"}:{x:"left",y:"top"}; -},setOffsetOption:function(f,d){var c={x:0,y:0};var e={x:0,y:0};var g=f.measure(function(){return document.id(this.getOffsetParent());});if(!g||g==f.getDocument().body){return; -}e=g.getScroll();c=g.measure(function(){var i=this.getPosition();if(this.getStyle("position")=="fixed"){var h=window.getScroll();i.x+=h.x;i.y+=h.y;}return i; -});d.offset={parentPositioned:g!=document.id(d.relativeTo),x:d.offset.x-c.x+e.x,y:d.offset.y-c.y+e.y};},setDimensionsOption:function(d,c){c.dimensions=d.getDimensions({computeSize:true,styles:["padding","border","margin"]}); -},getPosition:function(e,d){var c={};d=a.getOptions(e,d);var f=document.id(d.relativeTo)||document.body;a.setPositionCoordinates(d,c,f);if(d.edge){a.toEdge(c,d); -}var g=d.offset;c.left=((c.x>=0||g.parentPositioned||d.allowNegative)?c.x:0).toInt();c.top=((c.y>=0||g.parentPositioned||d.allowNegative)?c.y:0).toInt(); -a.toMinMax(c,d);if(d.relFixedPosition||f.getStyle("position")=="fixed"){a.toRelFixedPosition(f,c);}if(d.ignoreScroll){a.toIgnoreScroll(f,c);}if(d.ignoreMargins){a.toIgnoreMargins(c,d); -}c.left=Math.ceil(c.left);c.top=Math.ceil(c.top);delete c.x;delete c.y;return c;},setPositionCoordinates:function(k,g,d){var f=k.offset.y,h=k.offset.x,e=(d==document.body)?window.getScroll():d.getPosition(),j=e.y,c=e.x,i=window.getSize(); -switch(k.position.x){case"left":g.x=c+h;break;case"right":g.x=c+h+d.offsetWidth;break;default:g.x=c+((d==document.body?i.x:d.offsetWidth)/2)+h;break;}switch(k.position.y){case"top":g.y=j+f; -break;case"bottom":g.y=j+f+d.offsetHeight;break;default:g.y=j+((d==document.body?i.y:d.offsetHeight)/2)+f;break;}},toMinMax:function(c,d){var f={left:"x",top:"y"},e; -["minimum","maximum"].each(function(g){["left","top"].each(function(h){e=d[g]?d[g][f[h]]:null;if(e!=null&&((g=="minimum")?c[h]e)){c[h]=e;}});}); -},toRelFixedPosition:function(e,c){var d=window.getScroll();c.top+=d.y;c.left+=d.x;},toIgnoreScroll:function(e,d){var c=e.getScroll();d.top-=c.y;d.left-=c.x; -},toIgnoreMargins:function(c,d){c.left+=d.edge.x=="right"?d.dimensions["margin-right"]:(d.edge.x!="center"?-d.dimensions["margin-left"]:-d.dimensions["margin-left"]+((d.dimensions["margin-right"]+d.dimensions["margin-left"])/2)); -c.top+=d.edge.y=="bottom"?d.dimensions["margin-bottom"]:(d.edge.y!="center"?-d.dimensions["margin-top"]:-d.dimensions["margin-top"]+((d.dimensions["margin-bottom"]+d.dimensions["margin-top"])/2)); -},toEdge:function(c,d){var e={},g=d.dimensions,f=d.edge;switch(f.x){case"left":e.x=0;break;case"right":e.x=-g.x-g.computedRight-g.computedLeft;break;default:e.x=-(Math.round(g.totalWidth/2)); -break;}switch(f.y){case"top":e.y=0;break;case"bottom":e.y=-g.y-g.computedTop-g.computedBottom;break;default:e.y=-(Math.round(g.totalHeight/2));break;}c.x+=e.x; -c.y+=e.y;},getCoordinateFromValue:function(c){if(typeOf(c)!="string"){return c;}c=c.toLowerCase();return{x:c.test("left")?"left":(c.test("right")?"right":"center"),y:c.test(/upper|top/)?"top":(c.test("bottom")?"bottom":"center")}; -}};Element.implement({position:function(d){if(d&&(d.x!=null||d.y!=null)){return(b?b.apply(this,arguments):this);}var c=this.setStyle("position","absolute").calculatePosition(d); -return(d&&d.returnPos)?c:this.setStyles(c);},calculatePosition:function(c){return a.getPosition(this,c);}});})(Element.prototype.position);(function(){var a=false; -this.IframeShim=new Class({Implements:[Options,Events,Class.Occlude],options:{className:"iframeShim",src:'javascript:false;document.write("");',display:false,zIndex:null,margin:0,offset:{x:0,y:0},browsers:a},property:"IframeShim",initialize:function(c,b){this.element=document.id(c); -if(this.occlude()){return this.occluded;}this.setOptions(b);this.makeShim();return this;},makeShim:function(){if(this.options.browsers){var d=this.element.getStyle("zIndex").toInt(); -if(!d){d=1;var c=this.element.getStyle("position");if(c=="static"||!c){this.element.setStyle("position","relative");}this.element.setStyle("zIndex",d); -}d=((this.options.zIndex!=null||this.options.zIndex===0)&&d>this.options.zIndex)?this.options.zIndex:d-1;if(d<0){d=1;}this.shim=new Element("iframe",{src:this.options.src,scrolling:"no",frameborder:0,styles:{zIndex:d,position:"absolute",border:"none",filter:"progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)"},"class":this.options.className}).store("IframeShim",this); -var b=(function(){this.shim.inject(this.element,"after");this[this.options.display?"show":"hide"]();this.fireEvent("inject");}).bind(this);if(!IframeShim.ready){window.addEvent("load",b); -}else{b();}}else{this.position=this.hide=this.show=this.dispose=Function.from(this);}},position:function(){if(!IframeShim.ready||!this.shim){return this; -}var b=this.element.measure(function(){return this.getSize();});if(this.options.margin!=undefined){b.x=b.x-(this.options.margin*2);b.y=b.y-(this.options.margin*2); -this.options.offset.x+=this.options.margin;this.options.offset.y+=this.options.margin;}this.shim.set({width:b.x,height:b.y}).position({relativeTo:this.element,offset:this.options.offset}); -return this;},hide:function(){if(this.shim){this.shim.setStyle("display","none");}return this;},show:function(){if(this.shim){this.shim.setStyle("display","block"); -}return this.position();},dispose:function(){if(this.shim){this.shim.dispose();}return this;},destroy:function(){if(this.shim){this.shim.destroy();}return this; -}});})();window.addEvent("load",function(){IframeShim.ready=true;});var Mask=new Class({Implements:[Options,Events],Binds:["position"],options:{style:{},"class":"mask",maskMargins:false,useIframeShim:true,iframeShimOptions:{}},initialize:function(b,a){this.target=document.id(b)||document.id(document.body); -this.target.store("mask",this);this.setOptions(a);this.render();this.inject();},render:function(){this.element=new Element("div",{"class":this.options["class"],id:this.options.id||"mask-"+String.uniqueID(),styles:Object.merge({},this.options.style,{display:"none"}),events:{click:function(a){this.fireEvent("click",a); -if(this.options.hideOnClick){this.hide();}}.bind(this)}});this.hidden=true;},toElement:function(){return this.element;},inject:function(b,a){a=a||(this.options.inject?this.options.inject.where:"")||(this.target==document.body?"inside":"after"); -b=b||(this.options.inject&&this.options.inject.target)||this.target;this.element.inject(b,a);if(this.options.useIframeShim){this.shim=new IframeShim(this.element,this.options.iframeShimOptions); -this.addEvents({show:this.shim.show.bind(this.shim),hide:this.shim.hide.bind(this.shim),destroy:this.shim.destroy.bind(this.shim)});}},position:function(){this.resize(this.options.width,this.options.height); -this.element.position({relativeTo:this.target,position:"topLeft",ignoreMargins:!this.options.maskMargins,ignoreScroll:this.target==document.body});return this; -},resize:function(a,e){var b={styles:["padding","border"]};if(this.options.maskMargins){b.styles.push("margin");}var d=this.target.getComputedSize(b);if(this.target==document.body){this.element.setStyles({width:0,height:0}); -var c=window.getScrollSize();if(d.totalHeight0&&b>0)?true:this.style.display!="none";},toggle:function(){return this[this.isDisplayed()?"hide":"show"](); -},hide:function(){var b;try{b=this.getStyle("display");}catch(a){}if(b=="none"){return this;}return this.store("element:_originalDisplay",b||"").setStyle("display","none"); -},show:function(a){if(!a&&this.isDisplayed()){return this;}a=a||this.retrieve("element:_originalDisplay")||"block";return this.setStyle("display",(a=="none")?"block":a); -},swapClass:function(a,b){return this.removeClass(a).addClass(b);}});Document.implement({clearSelection:function(){if(window.getSelection){var a=window.getSelection(); -if(a&&a.removeAllRanges){a.removeAllRanges();}}else{if(document.selection&&document.selection.empty){try{document.selection.empty();}catch(b){}}}}});(function(){var a=function(d){var b=d.options.hideInputs; -if(window.OverText){var c=[null];OverText.each(function(e){c.include("."+e.options.labelClass);});if(c){b+=c.join(", ");}}return(b)?d.element.getElements(b):null; -};Fx.Reveal=new Class({Extends:Fx.Morph,options:{link:"cancel",styles:["padding","border","margin"],transitionOpacity:"opacity" in document.documentElement,mode:"vertical",display:function(){return this.element.get("tag")!="tr"?"block":"table-row"; -},opacity:1,hideInputs:!("opacity" in document.documentElement)?"select, input, textarea, object, embed":null},dissolve:function(){if(!this.hiding&&!this.showing){if(this.element.getStyle("display")!="none"){this.hiding=true; -this.showing=false;this.hidden=true;this.cssText=this.element.style.cssText;var d=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode}); -if(this.options.transitionOpacity){d.opacity=this.options.opacity;}var c={};Object.each(d,function(f,e){c[e]=[f,0];});this.element.setStyles({display:Function.from(this.options.display).call(this),overflow:"hidden"}); -var b=a(this);if(b){b.setStyle("visibility","hidden");}this.$chain.unshift(function(){if(this.hidden){this.hiding=false;this.element.style.cssText=this.cssText; -this.element.setStyle("display","none");if(b){b.setStyle("visibility","visible");}}this.fireEvent("hide",this.element);this.callChain();}.bind(this));this.start(c); -}else{this.callChain.delay(10,this);this.fireEvent("complete",this.element);this.fireEvent("hide",this.element);}}else{if(this.options.link=="chain"){this.chain(this.dissolve.bind(this)); -}else{if(this.options.link=="cancel"&&!this.hiding){this.cancel();this.dissolve();}}}return this;},reveal:function(){if(!this.showing&&!this.hiding){if(this.element.getStyle("display")=="none"){this.hiding=false; -this.showing=true;this.hidden=false;this.cssText=this.element.style.cssText;var d;this.element.measure(function(){d=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode}); -}.bind(this));if(this.options.heightOverride!=null){d.height=this.options.heightOverride.toInt();}if(this.options.widthOverride!=null){d.width=this.options.widthOverride.toInt(); -}if(this.options.transitionOpacity){this.element.setStyle("opacity",0);d.opacity=this.options.opacity;}var c={height:0,display:Function.from(this.options.display).call(this)}; -Object.each(d,function(f,e){c[e]=0;});c.overflow="hidden";this.element.setStyles(c);var b=a(this);if(b){b.setStyle("visibility","hidden");}this.$chain.unshift(function(){this.element.style.cssText=this.cssText; -this.element.setStyle("display",Function.from(this.options.display).call(this));if(!this.hidden){this.showing=false;}if(b){b.setStyle("visibility","visible"); -}this.callChain();this.fireEvent("show",this.element);}.bind(this));this.start(d);}else{this.callChain();this.fireEvent("complete",this.element);this.fireEvent("show",this.element); -}}else{if(this.options.link=="chain"){this.chain(this.reveal.bind(this));}else{if(this.options.link=="cancel"&&!this.showing){this.cancel();this.reveal(); -}}}return this;},toggle:function(){if(this.element.getStyle("display")=="none"){this.reveal();}else{this.dissolve();}return this;},cancel:function(){this.parent.apply(this,arguments); -if(this.cssText!=null){this.element.style.cssText=this.cssText;}this.hiding=false;this.showing=false;return this;}});Element.Properties.reveal={set:function(b){this.get("reveal").cancel().setOptions(b); -return this;},get:function(){var b=this.retrieve("reveal");if(!b){b=new Fx.Reveal(this);this.store("reveal",b);}return b;}};Element.Properties.dissolve=Element.Properties.reveal; -Element.implement({reveal:function(b){this.get("reveal").setOptions(b).reveal();return this;},dissolve:function(b){this.get("reveal").setOptions(b).dissolve(); -return this;},nix:function(b){var c=Array.link(arguments,{destroy:Type.isBoolean,options:Type.isObject});this.get("reveal").setOptions(b).dissolve().chain(function(){this[c.destroy?"destroy":"dispose"](); -}.bind(this));return this;},wink:function(){var c=Array.link(arguments,{duration:Type.isNumber,options:Type.isObject});var b=this.get("reveal").setOptions(c.options); -b.reveal().chain(function(){(function(){b.dissolve();}).delay(c.duration||2000);});}});})();var Drag=new Class({Implements:[Events,Options],options:{snap:6,unit:"px",grid:false,style:true,limit:false,handle:false,invert:false,preventDefault:false,stopPropagation:false,modifiers:{x:"left",y:"top"}},initialize:function(){var b=Array.link(arguments,{options:Type.isObject,element:function(c){return c!=null; -}});this.element=document.id(b.element);this.document=this.element.getDocument();this.setOptions(b.options||{});var a=typeOf(this.options.handle);this.handles=((a=="array"||a=="collection")?$$(this.options.handle):document.id(this.options.handle))||this.element; -this.mouse={now:{},pos:{}};this.value={start:{},now:{}};this.selection="selectstart" in document?"selectstart":"mousedown";if("ondragstart" in document&&!("FileReader" in window)&&!Drag.ondragstartFixed){document.ondragstart=Function.from(false); -Drag.ondragstartFixed=true;}this.bound={start:this.start.bind(this),check:this.check.bind(this),drag:this.drag.bind(this),stop:this.stop.bind(this),cancel:this.cancel.bind(this),eventStop:Function.from(false)}; -this.attach();},attach:function(){this.handles.addEvent("mousedown",this.bound.start);return this;},detach:function(){this.handles.removeEvent("mousedown",this.bound.start); -return this;},start:function(a){var j=this.options;if(a.rightClick){return;}if(j.preventDefault){a.preventDefault();}if(j.stopPropagation){a.stopPropagation(); -}this.mouse.start=a.page;this.fireEvent("beforeStart",this.element);var c=j.limit;this.limit={x:[],y:[]};var e,g;for(e in j.modifiers){if(!j.modifiers[e]){continue; -}var b=this.element.getStyle(j.modifiers[e]);if(b&&!b.match(/px$/)){if(!g){g=this.element.getCoordinates(this.element.getOffsetParent());}b=g[j.modifiers[e]]; -}if(j.style){this.value.now[e]=(b||0).toInt();}else{this.value.now[e]=this.element[j.modifiers[e]];}if(j.invert){this.value.now[e]*=-1;}this.mouse.pos[e]=a.page[e]-this.value.now[e]; -if(c&&c[e]){var d=2;while(d--){var f=c[e][d];if(f||f===0){this.limit[e][d]=(typeof f=="function")?f():f;}}}}if(typeOf(this.options.grid)=="number"){this.options.grid={x:this.options.grid,y:this.options.grid}; -}var h={mousemove:this.bound.check,mouseup:this.bound.cancel};h[this.selection]=this.bound.eventStop;this.document.addEvents(h);},check:function(a){if(this.options.preventDefault){a.preventDefault(); -}var b=Math.round(Math.sqrt(Math.pow(a.page.x-this.mouse.start.x,2)+Math.pow(a.page.y-this.mouse.start.y,2)));if(b>this.options.snap){this.cancel();this.document.addEvents({mousemove:this.bound.drag,mouseup:this.bound.stop}); -this.fireEvent("start",[this.element,a]).fireEvent("snap",this.element);}},drag:function(b){var a=this.options;if(a.preventDefault){b.preventDefault(); -}this.mouse.now=b.page;for(var c in a.modifiers){if(!a.modifiers[c]){continue;}this.value.now[c]=this.mouse.now[c]-this.mouse.pos[c];if(a.invert){this.value.now[c]*=-1; -}if(a.limit&&this.limit[c]){if((this.limit[c][1]||this.limit[c][1]===0)&&(this.value.now[c]>this.limit[c][1])){this.value.now[c]=this.limit[c][1];}else{if((this.limit[c][0]||this.limit[c][0]===0)&&(this.value.now[c]d.left&&b.xd.top);},this).getLast();if(this.overed!=a){if(this.overed){this.fireEvent("leave",[this.element,this.overed]); -}if(a){this.fireEvent("enter",[this.element,a]);}this.overed=a;}},drag:function(a){this.parent(a);if(this.options.checkDroppables&&this.droppables.length){this.checkDroppables(); -}},stop:function(a){this.checkDroppables();this.fireEvent("drop",[this.element,this.overed,a]);this.overed=null;return this.parent(a);}});Element.implement({makeDraggable:function(a){var b=new Drag.Move(this,a); -this.store("dragger",b);return b;}});var Sortables=new Class({Implements:[Events,Options],options:{opacity:1,clone:false,revert:false,handle:false,dragOptions:{},unDraggableTags:["button","input","a","textarea","select","option"]},initialize:function(a,b){this.setOptions(b); -this.elements=[];this.lists=[];this.idle=true;this.addLists($$(document.id(a)||a));if(!this.options.clone){this.options.revert=false;}if(this.options.revert){this.effect=new Fx.Morph(null,Object.merge({duration:250,link:"cancel"},this.options.revert)); -}},attach:function(){this.addLists(this.lists);return this;},detach:function(){this.lists=this.removeLists(this.lists);return this;},addItems:function(){Array.flatten(arguments).each(function(a){this.elements.push(a); -var b=a.retrieve("sortables:start",function(c){this.start.call(this,c,a);}.bind(this));(this.options.handle?a.getElement(this.options.handle)||a:a).addEvent("mousedown",b); -},this);return this;},addLists:function(){Array.flatten(arguments).each(function(a){this.lists.include(a);this.addItems(a.getChildren());},this);return this; -},removeItems:function(){return $$(Array.flatten(arguments).map(function(a){this.elements.erase(a);var b=a.retrieve("sortables:start");(this.options.handle?a.getElement(this.options.handle)||a:a).removeEvent("mousedown",b); -return a;},this));},removeLists:function(){return $$(Array.flatten(arguments).map(function(a){this.lists.erase(a);this.removeItems(a.getChildren());return a; -},this));},getDroppableCoordinates:function(c){var d=c.getOffsetParent();var b=c.getPosition(d);var a={w:window.getScroll(),offsetParent:d.getScroll()}; -b.x+=a.offsetParent.x;b.y+=a.offsetParent.y;if(d.getStyle("position")=="fixed"){b.x-=a.w.x;b.y-=a.w.y;}return b;},getClone:function(b,a){if(!this.options.clone){return new Element(a.tagName).inject(document.body); -}if(typeOf(this.options.clone)=="function"){return this.options.clone.call(this,b,a,this.list);}var c=a.clone(true).setStyles({margin:0,position:"absolute",visibility:"hidden",width:a.getStyle("width")}).addEvent("mousedown",function(d){a.fireEvent("mousedown",d); -});if(c.get("html").test("radio")){c.getElements("input[type=radio]").each(function(d,e){d.set("name","clone_"+e);if(d.get("checked")){a.getElements("input[type=radio]")[e].set("checked",true); -}});}return c.inject(this.list).setPosition(this.getDroppableCoordinates(this.element));},getDroppables:function(){var a=this.list.getChildren().erase(this.clone).erase(this.element); -if(!this.options.constrain){a.append(this.lists).erase(this.list);}return a;},insert:function(c,b){var a="inside";if(this.lists.contains(b)){this.list=b; -this.drag.droppables=this.getDroppables();}else{a=this.element.getAllPrevious().contains(b)?"before":"after";}this.element.inject(b,a);this.fireEvent("sort",[this.element,this.clone]); -},start:function(b,a){if(!this.idle||b.rightClick||(!this.options.handle&&this.options.unDraggableTags.contains(b.target.get("tag")))){return;}this.idle=false; -this.element=a;this.opacity=a.getStyle("opacity");this.list=a.getParent();this.clone=this.getClone(b,a);this.drag=new Drag.Move(this.clone,Object.merge({droppables:this.getDroppables()},this.options.dragOptions)).addEvents({onSnap:function(){b.stop(); -this.clone.setStyle("visibility","visible");this.element.setStyle("opacity",this.options.opacity||0);this.fireEvent("start",[this.element,this.clone]); -}.bind(this),onEnter:this.insert.bind(this),onCancel:this.end.bind(this),onComplete:this.end.bind(this)});this.clone.inject(this.element,"before");this.drag.start(b); -},end:function(){this.drag.detach();this.element.setStyle("opacity",this.opacity);var a=this;if(this.effect){var c=this.element.getStyles("width","height"),e=this.clone,d=e.computePosition(this.getDroppableCoordinates(e)); -var b=function(){this.removeEvent("cancel",b);e.destroy();a.reset();};this.effect.element=e;this.effect.start({top:d.top,left:d.left,width:c.width,height:c.height,opacity:0.25}).addEvent("cancel",b).chain(b); -}else{this.clone.destroy();a.reset();}},reset:function(){this.idle=true;this.fireEvent("complete",this.element);},serialize:function(){var c=Array.link(arguments,{modifier:Type.isFunction,index:function(d){return d!=null; -}});var b=this.lists.map(function(d){return d.getChildren().map(c.modifier||function(e){return e.get("id");},this);},this);var a=c.index;if(this.lists.length==1){a=0; -}return(a||a===0)&&a>=0&&a=3){d="rgb";c=Array.slice(arguments,0,3);}else{if(typeof c=="string"){if(c.match(/rgb/)){c=c.rgbToHex().hexToRgb(true); -}else{if(c.match(/hsb/)){c=c.hsbToRgb();}else{c=c.hexToRgb(true);}}}}d=d||"rgb";switch(d){case"hsb":var b=c;c=c.hsbToRgb();c.hsb=b;break;case"hex":c=c.hexToRgb(true); -break;}c.rgb=c.slice(0,3);c.hsb=c.hsb||c.rgbToHsb();c.hex=c.rgbToHex();return Object.append(c,this);});a.implement({mix:function(){var b=Array.slice(arguments); -var d=(typeOf(b.getLast())=="number")?b.pop():50;var c=this.slice();b.each(function(e){e=new a(e);for(var f=0;f<3;f++){c[f]=Math.round((c[f]/100*(100-d))+(e[f]/100*d)); -}});return new a(c,"rgb");},invert:function(){return new a(this.map(function(b){return 255-b;}));},setHue:function(b){return new a([b,this.hsb[1],this.hsb[2]],"hsb"); -},setSaturation:function(b){return new a([this.hsb[0],b,this.hsb[2]],"hsb");},setBrightness:function(b){return new a([this.hsb[0],this.hsb[1],b],"hsb"); -}});this.$RGB=function(e,d,c){return new a([e,d,c],"rgb");};this.$HSB=function(e,d,c){return new a([e,d,c],"hsb");};this.$HEX=function(b){return new a(b,"hex"); -};Array.implement({rgbToHsb:function(){var c=this[0],d=this[1],k=this[2],h=0;var j=Math.max(c,d,k),f=Math.min(c,d,k);var l=j-f;var i=j/255,g=(j!=0)?l/j:0; -if(g!=0){var e=(j-c)/l;var b=(j-d)/l;var m=(j-k)/l;if(c==j){h=m-b;}else{if(d==j){h=2+e-m;}else{h=4+b-e;}}h/=6;if(h<0){h++;}}return[Math.round(h*360),Math.round(g*100),Math.round(i*100)]; -},hsbToRgb:function(){var d=Math.round(this[2]/100*255);if(this[1]==0){return[d,d,d];}else{var b=this[0]%360;var g=b%60;var h=Math.round((this[2]*(100-this[1]))/10000*255); -var e=Math.round((this[2]*(6000-this[1]*g))/600000*255);var c=Math.round((this[2]*(6000-this[1]*(60-g)))/600000*255);switch(Math.floor(b/60)){case 0:return[d,c,h]; -case 1:return[e,d,h];case 2:return[h,d,c];case 3:return[h,e,d];case 4:return[c,h,d];case 5:return[d,h,e];}}return false;}});String.implement({rgbToHsb:function(){var b=this.match(/\d{1,3}/g); -return(b)?b.rgbToHsb():null;},hsbToRgb:function(){var b=this.match(/\d{1,3}/g);return(b)?b.hsbToRgb():null;}});})(); \ No newline at end of file diff --git a/pyload/webui/themes/Flat/js/static/purr.js b/pyload/webui/themes/Flat/js/static/purr.js deleted file mode 100644 index 9cbc503d9..000000000 --- a/pyload/webui/themes/Flat/js/static/purr.js +++ /dev/null @@ -1,309 +0,0 @@ -/* ---- -script: purr.js - -description: Class to create growl-style popup notifications. - -license: MIT-style - -authors: [atom smith] - -requires: -- core/1.3: [Core, Browser, Array, Function, Number, String, Hash, Event, Class.Extras, Element.Event, Element.Style, Element.Dimensions, Fx.CSS, FX.Tween, Fx.Morph] - -provides: [Purr, Element.alert] -... -*/ - - -var Purr = new Class({ - - 'options': { - 'mode': 'top', - 'position': 'left', - 'elementAlertClass': 'purr-element-alert', - 'elements': { - 'wrapper': 'div', - 'alert': 'div', - 'buttonWrapper': 'div', - 'button': 'button' - }, - 'elementOptions': { - 'wrapper': { - 'styles': { - 'position': 'fixed', - 'z-index': '9999' - }, - 'class': 'purr-wrapper' - }, - 'alert': { - 'class': 'purr-alert', - 'styles': { - 'opacity': '.85' - } - }, - 'buttonWrapper': { - 'class': 'purr-button-wrapper' - }, - 'button': { - 'class': 'purr-button' - } - }, - 'alert': { - 'buttons': [], - 'clickDismiss': true, - 'hoverWait': true, - 'hideAfter': 5000, - 'fx': { - 'duration': 500 - }, - 'highlight': false, - 'highlightRepeat': false, - 'highlight': { - 'start': '#FF0', - 'end': false - } - } - }, - - 'Implements': [Options, Events, Chain], - - 'initialize': function(options){ - this.setOptions(options); - this.createWrapper(); - return this; - }, - - 'bindAlert': function(){ - return this.alert.bind(this); - }, - - 'createWrapper': function(){ - this.wrapper = new Element(this.options.elements.wrapper, this.options.elementOptions.wrapper); - if(this.options.mode == 'top') - { - this.wrapper.setStyle('top', 0); - } - else - { - this.wrapper.setStyle('bottom', 0); - } - document.id(document.body).grab(this.wrapper); - this.positionWrapper(this.options.position); - }, - - 'positionWrapper': function(position){ - if(typeOf(position) == 'object') - { - - var wrapperCoords = this.getWrapperCoords(); - - this.wrapper.setStyles({ - 'bottom': '', - 'left': position.x, - 'top': position.y - wrapperCoords.height, - 'position': 'absolute' - }); - } - else if(position == 'left') - { - this.wrapper.setStyle('left', 0); - } - else if(position == 'right') - { - this.wrapper.setStyle('right', 0); - } - else - { - this.wrapper.setStyle('left', (window.innerWidth / 2) - (this.getWrapperCoords().width / 2)); - } - return this; - }, - - 'getWrapperCoords': function(){ - this.wrapper.setStyle('visibility', 'hidden'); - var measurer = this.alert('need something in here to measure'); - var coords = this.wrapper.getCoordinates(); - measurer.destroy(); - this.wrapper.setStyle('visibility',''); - return coords; - }, - - 'alert': function(msg, options){ - - options = Object.merge({}, this.options.alert, options || {}); - - var alert = new Element(this.options.elements.alert, this.options.elementOptions.alert); - - if(typeOf(msg) == 'string') - { - alert.set('html', msg); - } - else if(typeOf(msg) == 'element') - { - alert.grab(msg); - } - else if(typeOf(msg) == 'array') - { - var alerts = []; - msg.each(function(m){ - alerts.push(this.alert(m, options)); - }, this); - return alerts; - } - - alert.store('options', options); - - if(options.buttons.length > 0) - { - options.clickDismiss = false; - options.hideAfter = false; - options.hoverWait = false; - var buttonWrapper = new Element(this.options.elements.buttonWrapper, this.options.elementOptions.buttonWrapper); - alert.grab(buttonWrapper); - options.buttons.each(function(button){ - if(button.text != undefined) - { - var callbackButton = new Element(this.options.elements.button, this.options.elementOptions.button); - callbackButton.set('html', button.text); - if(button.callback != undefined) - { - callbackButton.addEvent('click', button.callback.pass(alert)); - } - if(button.dismiss != undefined && button.dismiss) - { - callbackButton.addEvent('click', this.dismiss.pass(alert, this)); - } - buttonWrapper.grab(callbackButton); - } - }, this); - } - if(options.className != undefined) - { - alert.addClass(options.className); - } - - this.wrapper.grab(alert, (this.options.mode == 'top') ? 'bottom' : 'top'); - - var fx = Object.merge(this.options.alert.fx, options.fx); - var alertFx = new Fx.Morph(alert, fx); - alert.store('fx', alertFx); - this.fadeIn(alert); - - if(options.highlight) - { - alertFx.addEvent('complete', function(){ - alert.highlight(options.highlight.start, options.highlight.end); - if(options.highlightRepeat) - { - alert.highlight.periodical(options.highlightRepeat, alert, [options.highlight.start, options.highlight.end]); - } - }); - } - if(options.hideAfter) - { - this.dismiss(alert); - } - - if(options.clickDismiss) - { - alert.addEvent('click', function(){ - this.holdUp = false; - this.dismiss(alert, true); - }.bind(this)); - } - - if(options.hoverWait) - { - alert.addEvents({ - 'mouseenter': function(){ - this.holdUp = true; - }.bind(this), - 'mouseleave': function(){ - this.holdUp = false; - }.bind(this) - }); - } - - return alert; - }, - - 'fadeIn': function(alert){ - var alertFx = alert.retrieve('fx'); - alertFx.set({ - 'opacity': 0 - }); - alertFx.start({ - 'opacity': [this.options.elementOptions.alert.styles.opacity, .9].pick(), - }); - }, - - 'dismiss': function(alert, now){ - now = now || false; - var options = alert.retrieve('options'); - if(now) - { - this.fadeOut(alert); - } - else - { - this.fadeOut.delay(options.hideAfter, this, alert); - } - }, - - 'fadeOut': function(alert){ - if(this.holdUp) - { - this.dismiss.delay(100, this, [alert, true]) - return null; - } - var alertFx = alert.retrieve('fx'); - if(!alertFx) - { - return null; - } - var to = { - 'opacity': 0 - } - if(this.options.mode == 'top') - { - to['margin-top'] = '-'+alert.offsetHeight+'px'; - } - else - { - to['margin-bottom'] = '-'+alert.offsetHeight+'px'; - } - alertFx.start(to); - alertFx.addEvent('complete', function(){ - alert.destroy(); - }); - } -}); - -Element.implement({ - - 'alert': function(msg, options){ - var alert = this.retrieve('alert'); - if(!alert) - { - options = options || { - 'mode':'top' - }; - alert = new Purr(options) - this.store('alert', alert); - } - - var coords = this.getCoordinates(); - - alert.alert(msg, options); - - alert.wrapper.setStyles({ - 'bottom': '', - 'left': (coords.left - (alert.wrapper.getWidth() / 2)) + (this.getWidth() / 2), - 'top': coords.top - (alert.wrapper.getHeight()), - 'position': 'absolute' - }); - - } - -}); \ No newline at end of file diff --git a/pyload/webui/themes/Flat/js/static/purr.min.js b/pyload/webui/themes/Flat/js/static/purr.min.js deleted file mode 100644 index bf70e357d..000000000 --- a/pyload/webui/themes/Flat/js/static/purr.min.js +++ /dev/null @@ -1 +0,0 @@ -var Purr=new Class({options:{mode:"top",position:"left",elementAlertClass:"purr-element-alert",elements:{wrapper:"div",alert:"div",buttonWrapper:"div",button:"button"},elementOptions:{wrapper:{styles:{position:"fixed","z-index":"9999"},"class":"purr-wrapper"},alert:{"class":"purr-alert",styles:{opacity:".85"}},buttonWrapper:{"class":"purr-button-wrapper"},button:{"class":"purr-button"}},alert:{buttons:[],clickDismiss:!0,hoverWait:!0,hideAfter:5e3,fx:{duration:500},highlight:!1,highlightRepeat:!1,highlight:{start:"#FF0",end:!1}}},Implements:[Options,Events,Chain],initialize:function(t){return this.setOptions(t),this.createWrapper(),this},bindAlert:function(){return this.alert.bind(this)},createWrapper:function(){this.wrapper=new Element(this.options.elements.wrapper,this.options.elementOptions.wrapper),"top"==this.options.mode?this.wrapper.setStyle("top",0):this.wrapper.setStyle("bottom",0),document.id(document.body).grab(this.wrapper),this.positionWrapper(this.options.position)},positionWrapper:function(t){if("object"==typeOf(t)){var e=this.getWrapperCoords();this.wrapper.setStyles({bottom:"",left:t.x,top:t.y-e.height,position:"absolute"})}else"left"==t?this.wrapper.setStyle("left",0):"right"==t?this.wrapper.setStyle("right",0):this.wrapper.setStyle("left",window.innerWidth/2-this.getWrapperCoords().width/2);return this},getWrapperCoords:function(){this.wrapper.setStyle("visibility","hidden");var t=this.alert("need something in here to measure"),e=this.wrapper.getCoordinates();return t.destroy(),this.wrapper.setStyle("visibility",""),e},alert:function(t,e){e=Object.merge({},this.options.alert,e||{});var i=new Element(this.options.elements.alert,this.options.elementOptions.alert);if("string"==typeOf(t))i.set("html",t);else if("element"==typeOf(t))i.grab(t);else if("array"==typeOf(t)){var s=[];return t.each(function(t){s.push(this.alert(t,e))},this),s}if(i.store("options",e),e.buttons.length>0){e.clickDismiss=!1,e.hideAfter=!1,e.hoverWait=!1;var r=new Element(this.options.elements.buttonWrapper,this.options.elementOptions.buttonWrapper);i.grab(r),e.buttons.each(function(t){if(void 0!=t.text){var e=new Element(this.options.elements.button,this.options.elementOptions.button);e.set("html",t.text),void 0!=t.callback&&e.addEvent("click",t.callback.pass(i)),void 0!=t.dismiss&&t.dismiss&&e.addEvent("click",this.dismiss.pass(i,this)),r.grab(e)}},this)}void 0!=e.className&&i.addClass(e.className),this.wrapper.grab(i,"top"==this.options.mode?"bottom":"top");var o=Object.merge(this.options.alert.fx,e.fx),n=new Fx.Morph(i,o);return i.store("fx",n),this.fadeIn(i),e.highlight&&n.addEvent("complete",function(){i.highlight(e.highlight.start,e.highlight.end),e.highlightRepeat&&i.highlight.periodical(e.highlightRepeat,i,[e.highlight.start,e.highlight.end])}),e.hideAfter&&this.dismiss(i),e.clickDismiss&&i.addEvent("click",function(){this.holdUp=!1,this.dismiss(i,!0)}.bind(this)),e.hoverWait&&i.addEvents({mouseenter:function(){this.holdUp=!0}.bind(this),mouseleave:function(){this.holdUp=!1}.bind(this)}),i},fadeIn:function(t){var e=t.retrieve("fx");e.set({opacity:0}),e.start({opacity:[this.options.elementOptions.alert.styles.opacity,.9].pick()})},dismiss:function(t,e){e=e||!1;var i=t.retrieve("options");e?this.fadeOut(t):this.fadeOut.delay(i.hideAfter,this,t)},fadeOut:function(t){if(this.holdUp)return this.dismiss.delay(100,this,[t,!0]),null;var e=t.retrieve("fx");if(!e)return null;var i={opacity:0};"top"==this.options.mode?i["margin-top"]="-"+t.offsetHeight+"px":i["margin-bottom"]="-"+t.offsetHeight+"px",e.start(i),e.addEvent("complete",function(){t.destroy()})}});Element.implement({alert:function(t,e){var i=this.retrieve("alert");i||(e=e||{mode:"top"},i=new Purr(e),this.store("alert",i));var s=this.getCoordinates();i.alert(t,e),i.wrapper.setStyles({bottom:"",left:s.left-i.wrapper.getWidth()/2+this.getWidth()/2,top:s.top-i.wrapper.getHeight(),position:"absolute"})}}); \ No newline at end of file diff --git a/pyload/webui/themes/Flat/js/static/tinytab.js b/pyload/webui/themes/Flat/js/static/tinytab.js deleted file mode 100644 index de50279fc..000000000 --- a/pyload/webui/themes/Flat/js/static/tinytab.js +++ /dev/null @@ -1,43 +0,0 @@ -/* ---- -description: TinyTab - Tiny and simple tab handler for Mootools. - -license: MIT-style - -authors: -- Danillo César de O. Melo - -requires: -- core/1.2.4: '*' - -provides: TinyTab - -... -*/ -(function($) { - this.TinyTab = new Class({ - Implements: Events, - initialize: function(tabs, contents, opt) { - this.tabs = tabs; - this.contents = contents; - if(!opt) opt = {}; - this.css = opt.selectedClass || 'selected'; - this.select(this.tabs[0]); - tabs.each(function(el){ - el.addEvent('click',function(e){ - this.select(el); - e.stop(); - }.bind(this)); - }.bind(this)); - }, - - select: function(el) { - this.tabs.removeClass(this.css); - el.addClass(this.css); - this.contents.setStyle('display','none'); - var content = this.contents[this.tabs.indexOf(el)]; - content.setStyle('display','block'); - this.fireEvent('change',[content,el]); - } - }); -})(document.id); \ No newline at end of file diff --git a/pyload/webui/themes/Flat/js/static/tinytab.min.js b/pyload/webui/themes/Flat/js/static/tinytab.min.js deleted file mode 100644 index 2f4fa0436..000000000 --- a/pyload/webui/themes/Flat/js/static/tinytab.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(){this.TinyTab=new Class({Implements:Events,initialize:function(s,t,e){this.tabs=s,this.contents=t,e||(e={}),this.css=e.selectedClass||"selected",this.select(this.tabs[0]),s.each(function(s){s.addEvent("click",function(t){this.select(s),t.stop()}.bind(this))}.bind(this))},select:function(s){this.tabs.removeClass(this.css),s.addClass(this.css),this.contents.setStyle("display","none");var t=this.contents[this.tabs.indexOf(s)];t.setStyle("display","block"),this.fireEvent("change",[t,s])}})}(document.id); \ No newline at end of file diff --git a/pyload/webui/themes/Flat/tml/admin.html b/pyload/webui/themes/Flat/tml/admin.html deleted file mode 100644 index eb87666ff..000000000 --- a/pyload/webui/themes/Flat/tml/admin.html +++ /dev/null @@ -1,98 +0,0 @@ -{% extends '/Flat/tml/base.html' %} - -{% block head %} - -{% endblock %} - - -{% block title %}{{ _("Administrate") }} - {{ super() }} {% endblock %} -{% block subtitle %}{{ _("Administrate") }}{% endblock %} - -{% block content %} - - {{_("Quit pyLoad")}} | - {{_("Restart pyLoad")}} -
        -
        - - {{ _("To add user or change passwords use:") }} python pyload.py -u
        - {{ _("Important: Admin user have always all permissions!") }} - -
        - - - - - - - - - {% for name, data in users.iteritems() %} - - - - - - - {% endfor %} - - -
        - {{ _("Name") }} - - {{ _("Change Password") }} - - {{ _("Admin") }} - - {{ _("Permissions") }} -
        {{ name }}{{ _("change") }} - -
        - - -
        -{% endblock %} -{% block hidden %} -
        -
        -

        {{ _("Change Password") }}

        - -

        {{ _("Enter your current and desired Password.") }}

        - - - - - - - - - - - - - - - -
        - -
        - -
        -{% endblock %} diff --git a/pyload/webui/themes/Flat/tml/base.html b/pyload/webui/themes/Flat/tml/base.html deleted file mode 100644 index 4473ee5e2..000000000 --- a/pyload/webui/themes/Flat/tml/base.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - - - - - - - - - - - -{% block title %}pyLoad {{_("Web UI")}}{% endblock %} - -{% block head %} -{% endblock %} - - - - -
        - - -
        - {% block headpanel %} - - {% if user.is_authenticated %} - - -{% if update %} - -{{_("pyLoad Update available!")}} - -{% endif %} - - -{% if plugins %} - -{{_("Plugins updated, please restart!")}} - -{% endif %} - - -Captcha: -{{_("Captcha waiting")}} - - - User:{{user.name}} - -{% else %} - {{_("Please Login!")}} -{% endif %} - - {% endblock %} -
        - - - -
        - -
        - -
        -
        - -{% if perms.STATUS %} - -{% endif %} - -{% if perms.LIST %} - -{% endif %} - -{% block pageactions %} -{% endblock %} -
        - -
        - -
        - -

        {% block subtitle %}pyLoad - {{_("Web UI")}}{% endblock %}

        - -{% block statusbar %} -{% endblock %} - - -
        - -
        -
        - - -{% for message in messages %} -

        {{message}}

        -{% endfor %} - -
        - - {{_("loading")}} -
        - -{% block content %} -{% endblock content %} - -
        - - -
        -
        - -
        - {% include '/Flat/tml/window.html' %} - {% include '/Flat/tml/captcha.html' %} - {% block hidden %} - {% endblock %} -
        - - diff --git a/pyload/webui/themes/Flat/tml/captcha.html b/pyload/webui/themes/Flat/tml/captcha.html deleted file mode 100644 index 731d97d11..000000000 --- a/pyload/webui/themes/Flat/tml/captcha.html +++ /dev/null @@ -1,42 +0,0 @@ - -
        - -
        - -

        {{_("Captcha reading")}}

        -

        {{_("Please read the text on the captcha.")}}

        - -
        - - - - - - - - - - - -
        - -
        - -
        - -
        - - - - -
        - -
        - -
        - -
        \ No newline at end of file diff --git a/pyload/webui/themes/Flat/tml/downloads.html b/pyload/webui/themes/Flat/tml/downloads.html deleted file mode 100644 index 4b9ae7baf..000000000 --- a/pyload/webui/themes/Flat/tml/downloads.html +++ /dev/null @@ -1,29 +0,0 @@ -{% extends '/Flat/tml/base.html' %} - -{% block title %}Downloads - {{super()}} {% endblock %} - -{% block subtitle %} -{{_("Downloads")}} -{% endblock %} - -{% block content %} - -
          - {% for folder in files.folder %} -
        • - {{ folder.name }} -
            - {% for file in folder.files %} -
          • {{file}}
          • - {% endfor %} -
          -
        • - {% endfor %} - - {% for file in files.files %} -
        • {{ file }}
        • - {% endfor %} - -
        - -{% endblock %} \ No newline at end of file diff --git a/pyload/webui/themes/Flat/tml/filemanager.html b/pyload/webui/themes/Flat/tml/filemanager.html deleted file mode 100644 index 4dbbd288c..000000000 --- a/pyload/webui/themes/Flat/tml/filemanager.html +++ /dev/null @@ -1,78 +0,0 @@ -{% extends '/Flat/tml/base.html' %} - -{% block head %} - - - - -{% endblock %} - -{% block title %}Downloads - {{super()}} {% endblock %} - - -{% block subtitle %} -{{_("FileManager")}} -{% endblock %} - -{% macro display_file(file) %} -
      • - - - - {{ file.name }} - - -    - - - -
      • -{%- endmacro %} - -{% macro display_folder(fld, open = false) -%} -
      • - - - - {{ fld.name }} - - -    - -    - - - - {% if (fld.folders|length + fld.files|length) > 0 %} - {% if open %} -
          - {% else %} -
            - {% endif %} - {% for child in fld.folders %} - {{ display_folder(child) }} - {% endfor %} - {% for child in fld.files %} - {{ display_file(child) }} - {% endfor %} -
          - {% else %} -
          {{ _("Folder is empty") }}
          - {% endif %} - -{%- endmacro %} - -{% block content %} - -
          - -
            -{{ display_folder(root, true) }} -
          - -{% endblock %} diff --git a/pyload/webui/themes/Flat/tml/folder.html b/pyload/webui/themes/Flat/tml/folder.html deleted file mode 100644 index a0d1dcec9..000000000 --- a/pyload/webui/themes/Flat/tml/folder.html +++ /dev/null @@ -1,15 +0,0 @@ -
        • - - - - {{ name }} - - -    - -    - - - -
          {{ _("Folder is empty") }}
          -
        • \ No newline at end of file diff --git a/pyload/webui/themes/Flat/tml/home.html b/pyload/webui/themes/Flat/tml/home.html deleted file mode 100644 index ec7f4aae2..000000000 --- a/pyload/webui/themes/Flat/tml/home.html +++ /dev/null @@ -1,266 +0,0 @@ -{% extends '/Flat/tml/base.html' %} -{% block head %} - - - -{% endblock %} - -{% block subtitle %} -{{_("Active Downloads")}} -{% endblock %} - -{% block menu %} -
        • - {{_("Home")}} -
        • -
        • - {{_("Queue")}} -
        • -
        • - {{_("Collector")}} -
        • -
        • - {{_("Downloads")}} -
        • -
        • - {{_("FileManager")}} -
        • -
        • - {{_("Logs")}} -
        • -
        • - {{_("Config")}} -
        • -{% endblock %} - -{% block content %} - - - - - - - - - - - - - {% for link in content %} - - - - - - - - - - - {% endfor %} - - -
          {{_("Name")}}{{_("Status")}}{{_("Information")}}{{_("Size")}}{{_("Progress")}}
          -{% endblock %} \ No newline at end of file diff --git a/pyload/webui/themes/Flat/tml/info.html b/pyload/webui/themes/Flat/tml/info.html deleted file mode 100644 index a650afc5a..000000000 --- a/pyload/webui/themes/Flat/tml/info.html +++ /dev/null @@ -1,81 +0,0 @@ -{% extends '/Flat/tml/base.html' %} - -{% block head %} - -{% endblock %} - -{% block title %}{{ _("Info") }} - {{ super() }} {% endblock %} -{% block subtitle %}{{ _("Info") }}{% endblock %} - -{% block content %} -

          {{ _("News") }}

          -
          - -

          {{ _("Support") }}

          - - - -

          {{ _("System") }}

          - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          {{ _("Python:") }}{{ python }}
          {{ _("OS:") }}{{ os }}
          {{ _("pyLoad version:") }}{{ version }}
          {{ _("Installation Folder:") }}{{ folder }}
          {{ _("Config Folder:") }}{{ config }}
          {{ _("Download Folder:") }}{{ download }}
          {{ _("Free Space:") }}{{ freespace }}
          {{ _("Language:") }}{{ language }}
          {{ _("Web UI Port:") }}{{ webif }}
          {{ _("Remote Interface Port:") }}{{ remote }}
          - -{% endblock %} \ No newline at end of file diff --git a/pyload/webui/themes/Flat/tml/login.html b/pyload/webui/themes/Flat/tml/login.html deleted file mode 100644 index 64ed28426..000000000 --- a/pyload/webui/themes/Flat/tml/login.html +++ /dev/null @@ -1,36 +0,0 @@ -{% extends '/Flat/tml/base.html' %} - -{% block title %}{{_("Login")}} - {{super()}} {% endblock %} - -{% block content %} - -
          -
          -
          - -
          - Login - -
          - -
          - -
          -
          -
          - -{% if errors %} -

          {{_("Your username and password didn't match. Please try again.")}}

          - {{ _("To reset your login data or add an user run:") }} python pyload.py -u -{% endif %} - -
          -
          - -{% endblock %} diff --git a/pyload/webui/themes/Flat/tml/logout.html b/pyload/webui/themes/Flat/tml/logout.html deleted file mode 100644 index f91b16914..000000000 --- a/pyload/webui/themes/Flat/tml/logout.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends '/Flat/tml/base.html' %} - -{% block head %} - -{% endblock %} - -{% block content %} -

          {{_("You were successfully logged out.")}}

          -{% endblock %} \ No newline at end of file diff --git a/pyload/webui/themes/Flat/tml/logs.html b/pyload/webui/themes/Flat/tml/logs.html deleted file mode 100644 index eada9ad3f..000000000 --- a/pyload/webui/themes/Flat/tml/logs.html +++ /dev/null @@ -1,41 +0,0 @@ -{% extends '/Flat/tml/base.html' %} - -{% block title %}{{_("Logs")}} - {{super()}} {% endblock %} -{% block subtitle %}{{_("Logs")}}{% endblock %} -{% block head %} - -{% endblock %} - -{% block content %} -
          - - -
          -
          - -   - - -
          -
          -
          {{warning}}
          -
          -
          - - {% for line in log %} - - {% endfor %} -
          {{line.line}}{{line.date}}{{line.level}}{{line.message}}
          -
          -
          -
          - - -
          -
          -
           
          -{% endblock %} \ No newline at end of file diff --git a/pyload/webui/themes/Flat/tml/pathchooser.html b/pyload/webui/themes/Flat/tml/pathchooser.html deleted file mode 100644 index 5ad1fd6d7..000000000 --- a/pyload/webui/themes/Flat/tml/pathchooser.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - -
          -
          -
          - - -
          - - {% if type == 'folder' %} - {{_("Path")}}: {{_("absolute")}} | {{_("relative")}} - {% else %} - {{_("Path")}}: {{_("absolute")}} | {{_("relative")}} - {% endif %} -
          - - - - - - - - {% if parentdir %} - - - - {% endif %} -{% for file in files %} - - {% if type == 'folder' %} - - {% else %} - - {% endif %} - - - - - -{% endfor %} -
          {{_("name")}}{{_("size")}}{{_("type")}}{{_("last modified")}}
          - {{_("parent directory")}} -
          {% if file.type == 'dir' %}{{ file.name|truncate(25) }}{% else %}{{ file.name|truncate(25) }}{% endif %}{% if file.type == 'dir' %}{{ file.name|truncate(25) }}{% else %}{{ file.name|truncate(25) }}{% endif %}{{ file.size|float|filesizeformat }}{% if file.type == 'dir' %}directory{% else %}{{ file.ext|default("file") }}{% endif %}{{ file.modified|date("d.m.Y - H:i:s") }}
          -
          - - \ No newline at end of file diff --git a/pyload/webui/themes/Flat/tml/queue.html b/pyload/webui/themes/Flat/tml/queue.html deleted file mode 100644 index 80e6c864c..000000000 --- a/pyload/webui/themes/Flat/tml/queue.html +++ /dev/null @@ -1,104 +0,0 @@ -{% extends '/Flat/tml/base.html' %} -{% block head %} - - - - -{% endblock %} - -{% if target %} - {% set name = _("Queue") %} -{% else %} - {% set name = _("Collector") %} -{% endif %} - -{% block title %}{{name}} - {{super()}} {% endblock %} -{% block subtitle %}{{name}}{% endblock %} - -{% block pageactions %} - -{% endblock %} - -{% block content %} -{% autoescape true %} - -
            -{% for package in content %} -
          • -
            - - -
            - - {{package.name}} -    - - -    - -    - -    - - -
            - {% set progress = (package.linksdone * 100) / package.linkstotal %} - -
            -
            - - -
            -
            - - -
            -
          • -{% endfor %} -
          -{% endautoescape %} -{% endblock %} - -{% block hidden %} -
          -
          -

          {{_("Edit Package")}}

          -

          {{_("Edit the package detais below.")}}

          - - - - - - - - - - - - -
          - -
          - -
          -{% endblock %} \ No newline at end of file diff --git a/pyload/webui/themes/Flat/tml/settings.html b/pyload/webui/themes/Flat/tml/settings.html deleted file mode 100644 index 8a8e54b0f..000000000 --- a/pyload/webui/themes/Flat/tml/settings.html +++ /dev/null @@ -1,204 +0,0 @@ -{% extends '/Flat/tml/base.html' %} - -{% block title %}{{ _("Settings") }} - {{ super() }} {% endblock %} -{% block subtitle %}{{ _("Settings") }}{% endblock %} - -{% block head %} - - - - -{% endblock %} - -{% block content %} - - - -
          - -
          - - - - - - -
          - -
          -

             {{ _("Choose a section from the menu") }}

          -
          -
          - - -
          -
          - - - - - - -
          - - -
          -

             {{ _("Choose a section from the menu") }}

          -
          -
          - -
          - -
          - - - -
          - - - - - - - - - - - - - - - - - - - - {% for account in conf.accs %} - {% set plugin = account.type %} - - - - - - - - - - - - - - {% endfor %} -
          {{ _("Plugin") }}{{ _("Name") }}{{ _("Password") }}{{ _("Status") }}{{ _("Premium") }}{{ _("Valid until") }}{{ _("Traffic left") }}{{ _("Time") }}{{ _("Max Parallel") }}{{ _("Delete?") }}
          - {{ plugin }} - - - - {% if account.valid %} - - {{ _("valid") }} - {% else %} - - {{ _("not valid") }} - {% endif %} - - - {% if account.premium %} - - {{ _("yes") }} - {% else %} - - {{ _("no") }} - {% endif %} - - - - {{ account.validuntil }} - - - - {{ account.trafficleft }} - - - - - - - -
          - - - -
          -
          -
          -{% endblock %} -{% block hidden %} -
          -
          -

          {{_("Add Account")}}

          -

          {{_("Enter your account data to use premium features.")}}

          - - - - - - - - - - - -
          - -
          - -
          -{% endblock %} \ No newline at end of file diff --git a/pyload/webui/themes/Flat/tml/settings_item.html b/pyload/webui/themes/Flat/tml/settings_item.html deleted file mode 100644 index 813383343..000000000 --- a/pyload/webui/themes/Flat/tml/settings_item.html +++ /dev/null @@ -1,48 +0,0 @@ - - {% if section.outline %} - - {% endif %} - {% for okey, option in section.iteritems() %} - {% if okey not in ("desc","outline") %} - - - - - {% endif %} - {% endfor %} -
          {{ section.outline }}
          - {% if option.type == "bool" %} - - {% elif ";" in option.type %} - - {% elif option.type == "folder" %} - - - {% elif option.type == "file" %} - - - {% elif option.type == "password" %} - - {% else %} - - {% endif %} -
          \ No newline at end of file diff --git a/pyload/webui/themes/Flat/tml/window.html b/pyload/webui/themes/Flat/tml/window.html deleted file mode 100644 index ea5d65e46..000000000 --- a/pyload/webui/themes/Flat/tml/window.html +++ /dev/null @@ -1,46 +0,0 @@ - - -
          -
          -

          {{_("Add Package")}}

          -

          {{_("Paste your links or upload a container.")}}

          - - - - - - - - - - - - - - - {{_("Queue")}} - - {{_("Collector")}} - - - - - -
          - -
          - -
          \ No newline at end of file -- cgit v1.2.3