├── .gitignore ├── README.md ├── acapp ├── __init__.py ├── asgi.py ├── settings.py ├── urls.py └── wsgi.py ├── db.sqlite3 ├── game ├── __init__.py ├── admin.py ├── apps.py ├── consumers │ ├── __init__.py │ └── multiplayer │ │ ├── __init__.py │ │ └── index.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_player_openid.py │ ├── 0003_player_score.py │ └── __init__.py ├── models │ ├── __init__.py │ └── player │ │ ├── __init__.py │ │ └── player.py ├── routing.py ├── static │ ├── css │ │ └── game.css │ ├── image │ │ └── menu │ │ │ └── background.gif │ └── js │ │ ├── dist │ │ └── game.js │ │ └── src │ │ ├── menu │ │ └── zbase.js │ │ ├── playground │ │ ├── ac_game_object │ │ │ └── zbase.js │ │ ├── chat_field │ │ │ └── zbase.js │ │ ├── game_map │ │ │ └── zbase.js │ │ ├── notice_board │ │ │ └── zbase.js │ │ ├── particle │ │ │ └── zbase.js │ │ ├── player │ │ │ └── zbase.js │ │ ├── score_board │ │ │ └── zbase.js │ │ ├── skill │ │ │ └── fireball │ │ │ │ └── zbase.js │ │ ├── socket │ │ │ └── multiplayer │ │ │ │ └── zbase.js │ │ └── zbase.js │ │ ├── settings │ │ └── zbase.js │ │ └── zbase.js ├── templates │ └── multiends │ │ └── web.html ├── tests.py ├── urls │ ├── __init__.py │ ├── index.py │ ├── menu │ │ ├── __init__.py │ │ └── index.py │ ├── playground │ │ ├── __init__.py │ │ └── index.py │ └── settings │ │ ├── __init__.py │ │ ├── acwing │ │ ├── __init__.py │ │ └── index.py │ │ └── index.py └── views │ ├── __init__.py │ ├── index.py │ ├── menu │ └── __init__.py │ ├── playground │ └── __init__.py │ └── settings │ ├── __init__.py │ ├── acwing │ ├── __init__.py │ ├── acapp │ │ ├── __init__.py │ │ ├── apply_code.py │ │ └── receive_code.py │ └── web │ │ ├── __init__.py │ │ ├── apply_code.py │ │ └── receive_code.py │ ├── getinfo.py │ ├── login.py │ ├── logout.py │ └── register.py ├── manage.py ├── match_system ├── __init__.py ├── src │ ├── __init__.py │ ├── main.py │ └── match_server │ │ ├── __init__.py │ │ └── match_service │ │ ├── Match-remote │ │ ├── Match.py │ │ ├── __init__.py │ │ ├── constants.py │ │ └── ttypes.py └── thrift │ └── match.thrift ├── scripts ├── compress_game_js.sh └── uwsgi.ini └── static ├── admin ├── css │ ├── autocomplete.css │ ├── base.css │ ├── changelists.css │ ├── dashboard.css │ ├── fonts.css │ ├── forms.css │ ├── login.css │ ├── nav_sidebar.css │ ├── responsive.css │ ├── responsive_rtl.css │ ├── rtl.css │ ├── vendor │ │ └── select2 │ │ │ ├── LICENSE-SELECT2.md │ │ │ ├── select2.css │ │ │ └── select2.min.css │ └── widgets.css ├── fonts │ ├── LICENSE.txt │ ├── README.txt │ ├── Roboto-Bold-webfont.woff │ ├── Roboto-Light-webfont.woff │ └── Roboto-Regular-webfont.woff ├── img │ ├── LICENSE │ ├── README.txt │ ├── calendar-icons.svg │ ├── gis │ │ ├── move_vertex_off.svg │ │ └── move_vertex_on.svg │ ├── icon-addlink.svg │ ├── icon-alert.svg │ ├── icon-calendar.svg │ ├── icon-changelink.svg │ ├── icon-clock.svg │ ├── icon-deletelink.svg │ ├── icon-no.svg │ ├── icon-unknown-alt.svg │ ├── icon-unknown.svg │ ├── icon-viewlink.svg │ ├── icon-yes.svg │ ├── inline-delete.svg │ ├── search.svg │ ├── selector-icons.svg │ ├── sorting-icons.svg │ ├── tooltag-add.svg │ └── tooltag-arrowright.svg └── js │ ├── SelectBox.js │ ├── SelectFilter2.js │ ├── actions.js │ ├── admin │ ├── DateTimeShortcuts.js │ └── RelatedObjectLookups.js │ ├── autocomplete.js │ ├── calendar.js │ ├── cancel.js │ ├── change_form.js │ ├── collapse.js │ ├── core.js │ ├── inlines.js │ ├── jquery.init.js │ ├── nav_sidebar.js │ ├── popup_response.js │ ├── prepopulate.js │ ├── prepopulate_init.js │ ├── urlify.js │ └── vendor │ ├── jquery │ ├── LICENSE.txt │ ├── jquery.js │ └── jquery.min.js │ ├── select2 │ ├── LICENSE.md │ ├── i18n │ │ ├── af.js │ │ ├── ar.js │ │ ├── az.js │ │ ├── bg.js │ │ ├── bn.js │ │ ├── bs.js │ │ ├── ca.js │ │ ├── cs.js │ │ ├── da.js │ │ ├── de.js │ │ ├── dsb.js │ │ ├── el.js │ │ ├── en.js │ │ ├── es.js │ │ ├── et.js │ │ ├── eu.js │ │ ├── fa.js │ │ ├── fi.js │ │ ├── fr.js │ │ ├── gl.js │ │ ├── he.js │ │ ├── hi.js │ │ ├── hr.js │ │ ├── hsb.js │ │ ├── hu.js │ │ ├── hy.js │ │ ├── id.js │ │ ├── is.js │ │ ├── it.js │ │ ├── ja.js │ │ ├── ka.js │ │ ├── km.js │ │ ├── ko.js │ │ ├── lt.js │ │ ├── lv.js │ │ ├── mk.js │ │ ├── ms.js │ │ ├── nb.js │ │ ├── ne.js │ │ ├── nl.js │ │ ├── pl.js │ │ ├── ps.js │ │ ├── pt-BR.js │ │ ├── pt.js │ │ ├── ro.js │ │ ├── ru.js │ │ ├── sk.js │ │ ├── sl.js │ │ ├── sq.js │ │ ├── sr-Cyrl.js │ │ ├── sr.js │ │ ├── sv.js │ │ ├── th.js │ │ ├── tk.js │ │ ├── tr.js │ │ ├── uk.js │ │ ├── vi.js │ │ ├── zh-CN.js │ │ └── zh-TW.js │ ├── select2.full.js │ └── select2.full.min.js │ └── xregexp │ ├── LICENSE.txt │ ├── xregexp.js │ └── xregexp.min.js ├── css └── game.css ├── image └── menu │ └── background.gif └── js ├── dist └── game.js └── src ├── menu └── zbase.js ├── playground ├── ac_game_object │ └── zbase.js ├── chat_field │ └── zbase.js ├── game_map │ └── zbase.js ├── notice_board │ └── zbase.js ├── particle │ └── zbase.js ├── player │ └── zbase.js ├── score_board │ └── zbase.js ├── skill │ └── fireball │ │ └── zbase.js ├── socket │ └── multiplayer │ │ └── zbase.js └── zbase.js ├── settings └── zbase.js └── zbase.js /.gitignore: -------------------------------------------------------------------------------- 1 | **/__pycache__ 2 | **/*.swp 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 一个伟大的史诗级巨著!!!! 2 | 3 | 4 | 项目地址:https://app2872.acapp.acwing.com.cn/ 5 | 6 | 玩法: 7 | * 右键点地板移动 8 | * q + 左键 施放火球 9 | * d + 左键 闪现 10 | -------------------------------------------------------------------------------- /acapp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/acapp/__init__.py -------------------------------------------------------------------------------- /acapp/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for acapp project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | import django 13 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'acapp.settings') 14 | django.setup() 15 | 16 | from channels.auth import AuthMiddlewareStack 17 | from channels.routing import ProtocolTypeRouter, URLRouter 18 | from django.core.asgi import get_asgi_application 19 | from game.routing import websocket_urlpatterns 20 | 21 | 22 | from channels.layers import get_channel_layer 23 | channel_layer = get_channel_layer() 24 | 25 | application = ProtocolTypeRouter({ 26 | "http": get_asgi_application(), 27 | "websocket": AuthMiddlewareStack(URLRouter(websocket_urlpatterns)) 28 | }) 29 | 30 | -------------------------------------------------------------------------------- /acapp/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for acapp project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.2.8. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/3.2/ref/settings/ 11 | """ 12 | import os 13 | from pathlib import Path 14 | 15 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 16 | BASE_DIR = Path(__file__).resolve().parent.parent 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'django-insecure-tb8mtvymwtp-1-=byjd^bgby7_&bi!4033xg%+0m+wcd500m^8' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = ["81.70.220.170", "app2872.acapp.acwing.com.cn"] 29 | 30 | CACHES = { 31 | 'default': { 32 | 'BACKEND': 'django_redis.cache.RedisCache', 33 | 'LOCATION': 'redis://127.0.0.1:6379/1', 34 | "OPTIONS": { 35 | "CLIENT_CLASS": "django_redis.client.DefaultClient", 36 | }, 37 | }, 38 | } 39 | USER_AGENTS_CACHE = 'default' 40 | 41 | 42 | # Application definition 43 | 44 | 45 | 46 | INSTALLED_APPS = [ 47 | 'channels', 48 | 'game.apps.GameConfig', 49 | 'django.contrib.admin', 50 | 'django.contrib.auth', 51 | 'django.contrib.contenttypes', 52 | 'django.contrib.sessions', 53 | 'django.contrib.messages', 54 | 'django.contrib.staticfiles', 55 | ] 56 | 57 | MIDDLEWARE = [ 58 | 'django.middleware.security.SecurityMiddleware', 59 | 'django.contrib.sessions.middleware.SessionMiddleware', 60 | 'django.middleware.common.CommonMiddleware', 61 | 'django.middleware.csrf.CsrfViewMiddleware', 62 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 63 | 'django.contrib.messages.middleware.MessageMiddleware', 64 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 65 | ] 66 | 67 | ROOT_URLCONF = 'acapp.urls' 68 | 69 | TEMPLATES = [ 70 | { 71 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 72 | 'DIRS': [], 73 | 'APP_DIRS': True, 74 | 'OPTIONS': { 75 | 'context_processors': [ 76 | 'django.template.context_processors.debug', 77 | 'django.template.context_processors.request', 78 | 'django.contrib.auth.context_processors.auth', 79 | 'django.contrib.messages.context_processors.messages', 80 | ], 81 | }, 82 | }, 83 | ] 84 | 85 | WSGI_APPLICATION = 'acapp.wsgi.application' 86 | 87 | 88 | # Database 89 | # https://docs.djangoproject.com/en/3.2/ref/settings/#databases 90 | 91 | DATABASES = { 92 | 'default': { 93 | 'ENGINE': 'django.db.backends.sqlite3', 94 | 'NAME': BASE_DIR / 'db.sqlite3', 95 | } 96 | } 97 | 98 | 99 | # Password validation 100 | # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators 101 | 102 | AUTH_PASSWORD_VALIDATORS = [ 103 | { 104 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 105 | }, 106 | { 107 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 108 | }, 109 | { 110 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 111 | }, 112 | { 113 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 114 | }, 115 | ] 116 | 117 | 118 | # Internationalization 119 | # https://docs.djangoproject.com/en/3.2/topics/i18n/ 120 | 121 | LANGUAGE_CODE = 'en-us' 122 | 123 | TIME_ZONE = 'Asia/Shanghai' 124 | 125 | USE_I18N = True 126 | 127 | USE_L10N = True 128 | 129 | USE_TZ = True 130 | 131 | 132 | # Static files (CSS, JavaScript, Images) 133 | # https://docs.djangoproject.com/en/3.2/hwto/static-files/ 134 | 135 | STATIC_ROOT = os.path.join(BASE_DIR, 'static') 136 | STATIC_URL = '/static/' 137 | 138 | MEDIA_ROOT = os.path.join(BASE_DIR, 'media') 139 | MEDIA_URL = '/media/' 140 | 141 | 142 | print("BASE_DIR = ", BASE_DIR) 143 | print("static_root = ", STATIC_ROOT) 144 | 145 | 146 | # Default primary key field type 147 | # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field 148 | 149 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' 150 | 151 | ASGI_APPLICATION = 'acapp.asgi.application' 152 | CHANNEL_LAYERS = { 153 | "default": { 154 | "BACKEND": "channels_redis.core.RedisChannelLayer", 155 | "CONFIG": { 156 | "hosts": [("127.0.0.1", 6379)], 157 | }, 158 | }, 159 | } 160 | 161 | ROOM_CAPACITY = 3 -------------------------------------------------------------------------------- /acapp/urls.py: -------------------------------------------------------------------------------- 1 | """acapp URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | urlpatterns = [ 20 | path('', include('game.urls.index')), 21 | path('admin/', admin.site.urls), 22 | ] 23 | -------------------------------------------------------------------------------- /acapp/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for acapp project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'acapp.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/db.sqlite3 -------------------------------------------------------------------------------- /game/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/__init__.py -------------------------------------------------------------------------------- /game/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from game.models.player.player import Player 3 | # Register your models here. 4 | 5 | 6 | admin.site.register(Player) 7 | -------------------------------------------------------------------------------- /game/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class GameConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'game' 7 | -------------------------------------------------------------------------------- /game/consumers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/consumers/__init__.py -------------------------------------------------------------------------------- /game/consumers/multiplayer/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/consumers/multiplayer/__init__.py -------------------------------------------------------------------------------- /game/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.8 on 2022-07-23 07:46 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | initial = True 11 | 12 | dependencies = [ 13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 14 | ] 15 | 16 | operations = [ 17 | migrations.CreateModel( 18 | name='Player', 19 | fields=[ 20 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 21 | ('photo', models.URLField(blank=True, max_length=256)), 22 | ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 23 | ], 24 | ), 25 | ] 26 | -------------------------------------------------------------------------------- /game/migrations/0002_player_openid.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.8 on 2022-07-24 15:04 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('game', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='player', 15 | name='openid', 16 | field=models.CharField(blank=True, default='', max_length=50, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /game/migrations/0003_player_score.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.8 on 2022-07-29 16:49 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('game', '0002_player_openid'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='player', 15 | name='score', 16 | field=models.IntegerField(default=1500), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /game/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/migrations/__init__.py -------------------------------------------------------------------------------- /game/models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/models/__init__.py -------------------------------------------------------------------------------- /game/models/player/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/models/player/__init__.py -------------------------------------------------------------------------------- /game/models/player/player.py: -------------------------------------------------------------------------------- 1 | from xml.etree.ElementTree import TreeBuilder 2 | from django.db import models 3 | from django.contrib.auth.models import User 4 | 5 | 6 | class Player(models.Model): 7 | user = models.OneToOneField(User, on_delete=models.CASCADE) 8 | photo = models.URLField(max_length=256, blank=True) 9 | openid = models.CharField(default="", max_length=50, blank=True, null=True) 10 | score = models.IntegerField(default=1500) 11 | def __str__(self): 12 | return str(self.user) 13 | -------------------------------------------------------------------------------- /game/routing.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from game.consumers.multiplayer.index import MultiPlayer 3 | 4 | websocket_urlpatterns = [ 5 | path("wss/multiplayer/", MultiPlayer.as_asgi(), name = "wss_multiplayer"), 6 | ] -------------------------------------------------------------------------------- /game/static/css/game.css: -------------------------------------------------------------------------------- 1 | .ac-game-settings { 2 | width: 100%; 3 | height: 100%; 4 | background-image: url("/static/image/menu/background.gif"); 5 | background-size: 100% 100%; 6 | user-select: none; 7 | } 8 | 9 | .ac-game-settings-login { 10 | height: 41vh; 11 | width: 20vw; 12 | position: relative; 13 | top: 50%; 14 | left: 50%; 15 | transform: translate(-50%, -50%); 16 | background-color: rgba(0, 0, 0, 0.7); 17 | border-radius: 5px; 18 | } 19 | 20 | 21 | .ac-game-settings-title { 22 | color: white; 23 | font-size: 3vh; 24 | text-align: center; 25 | padding-top: 2vh; 26 | margin-bottom: 2vh; 27 | } 28 | 29 | .ac-game-settings-username { 30 | display: block; 31 | height: 7vh; 32 | } 33 | 34 | .ac-game-settings-password { 35 | display: block; 36 | height: 7vh; 37 | } 38 | 39 | .ac-game-settings-submit { 40 | display: block; 41 | height: 7vh; 42 | } 43 | 44 | .ac-game-settings-acwing { 45 | display: block; 46 | height: 7vh; 47 | } 48 | 49 | .ac-game-settings-item { 50 | width: 100%; 51 | height: 100%; 52 | } 53 | 54 | .ac-game-settings-item > input { 55 | width: 90%; 56 | line-height: 3vh; 57 | position: relative; 58 | top: 50%; 59 | left: 50%; 60 | transform: translate(-50%, -50%); 61 | } 62 | 63 | .ac-game-settings-item > button { 64 | color: white; 65 | width: 90%; 66 | line-height: 3vh; 67 | position: relative; 68 | top: 50%; 69 | left: 50%; 70 | transform: translate(-50%, -50%); 71 | background-color: #4CAF50; 72 | border-radius: 5px; 73 | } 74 | 75 | .ac-game-settings-error-message { 76 | color: red; 77 | font-size: 0.8vh; 78 | display: inline; 79 | float: left; 80 | padding-left: 1vw; 81 | } 82 | 83 | .ac-game-settings-option { 84 | color: white; 85 | font-size: 2vh; 86 | display: inline; 87 | float: right; 88 | padding-right: 1vw; 89 | cursor: pointer; 90 | } 91 | 92 | .ac-game-settings-acwing > img { 93 | position: relative; 94 | top: 50%; 95 | left: 50%; 96 | transform: translate(-50%, -50%); 97 | cursor: pointer; 98 | display: block; 99 | } 100 | 101 | .ac-game-settings-acwing > div { 102 | color: white; 103 | font-size: 1.5vh; 104 | text-align: center; 105 | display: block; 106 | } 107 | 108 | .ac-game-settings-register { 109 | height: 49vh; 110 | width: 20vw; 111 | position: relative; 112 | top: 50%; 113 | left: 50%; 114 | transform: translate(-50%, -50%); 115 | background-color: rgba(0, 0, 0, 0.7); 116 | border-radius: 5px; 117 | } 118 | 119 | 120 | 121 | .ac-game-menu { 122 | width: 100%; 123 | height: 100%; 124 | background-image: url("/static/image/menu/background.gif"); 125 | background-size: 100% 100%; 126 | user-select: none; 127 | } 128 | 129 | .ac-game-menu-field { 130 | width: 20vw; 131 | position: relative; 132 | top: 40%; 133 | left: 20%; 134 | } 135 | 136 | .ac-game-menu-field-item { 137 | color: white; 138 | height: 6vh; 139 | width: 18vw; 140 | font-size: 4vh; 141 | font-style: italic; 142 | text-align: center; 143 | background-color: rgba(39,21,28, 0.6); 144 | border-radius: 10px; 145 | letter-spacing: 0.5vw; 146 | cursor: pointer; 147 | } 148 | 149 | .ac-game-menu-field-item:hover { 150 | transform: scale(1.2); 151 | transition: 100ms; 152 | } 153 | 154 | .ac-game-playground { 155 | width: 100%; 156 | height: 100%; 157 | user-select: none; 158 | background-color: grey; 159 | } 160 | 161 | .ac-game-playground > canvas { 162 | position: relative; 163 | top: 50%; 164 | left: 50%; 165 | transform: translate(-50%, -50%); 166 | } 167 | 168 | .ac-game-chat-field-history { 169 | position: absolute; 170 | top: 66%; 171 | left: 20%; 172 | 173 | transform: translate(-50%, -50%); 174 | 175 | width: 20%; 176 | height: 32%; 177 | 178 | color: white; 179 | font-size: 2vh; 180 | 181 | padding: 5px; 182 | overflow: auto; 183 | } 184 | 185 | .ac-game-chat-field-history::-webkit-scrollbar { 186 | width: 0; 187 | } 188 | 189 | .ac-game-chat-field-input { 190 | position: absolute; 191 | top: 86%; 192 | left: 20%; 193 | transform: translate(-50%, -50%); 194 | 195 | width: 20%; 196 | height: 3vh; 197 | 198 | color: white; 199 | font-size: 2vh; 200 | 201 | background-color: rgba(222,225,230, 0.2); 202 | } 203 | 204 | -------------------------------------------------------------------------------- /game/static/image/menu/background.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/static/image/menu/background.gif -------------------------------------------------------------------------------- /game/static/js/src/menu/zbase.js: -------------------------------------------------------------------------------- 1 | class AcGameMenu { 2 | constructor(root) { 3 | this.root = root; 4 | this.$menu = $(` 5 | 6 |
7 |
8 |
9 | 单人模式 10 |
11 |
12 |
13 | 多人模式 14 |
15 |
16 |
17 | 退出 18 |
19 | 20 |
21 |
22 | `); 23 | this.$menu.hide(); 24 | this.root.$ac_game.append(this.$menu); 25 | this.$single_mode = this.$menu.find('.ac-game-menu-field-item-single-mode'); 26 | this.$multi_mode = this.$menu.find('.ac-game-menu-field-item-multi-mode'); 27 | this.$settings = this.$menu.find('.ac-game-menu-field-item-settings'); 28 | this.start(); 29 | } 30 | 31 | 32 | start() { 33 | this.add_listening_events(); 34 | } 35 | 36 | add_listening_events() { 37 | let outer = this; 38 | this.$single_mode.click(function(){ 39 | outer.hide(); 40 | outer.root.playground.show("single mode"); 41 | }); 42 | this.$multi_mode.click(function() { 43 | outer.hide(); 44 | outer.root.playground.show("multi mode"); 45 | }); 46 | this.$settings.click(function(){ 47 | // 48 | outer.root.settings.logout_on_remote(); 49 | }); 50 | } 51 | 52 | 53 | show() { // show menu page 54 | this.$menu.show(); 55 | } 56 | 57 | 58 | hide() { // hide menu page 59 | this.$menu.hide(); 60 | } 61 | 62 | 63 | } 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /game/static/js/src/playground/ac_game_object/zbase.js: -------------------------------------------------------------------------------- 1 | let AC_GAME_OBJECTS = []; 2 | 3 | 4 | class AcGameObject { 5 | constructor() { 6 | AC_GAME_OBJECTS.push(this); 7 | this.has_called_start = false; // 是否实行过start函数 8 | this.timedelta = 0; // 当前距离上一帧的时间间隔 /ms 9 | this.uuid = this.create_uuid(); 10 | } 11 | 12 | create_uuid() { 13 | let res = ""; 14 | for (let i = 0; i < 8; i++) { 15 | let x = parseInt(Math.floor(Math.random() * 10)); 16 | res += x; 17 | } 18 | return res; 19 | } 20 | 21 | start() { // 只会在第一帧执行一次 22 | } 23 | 24 | 25 | update() { // 每一帧都要执行 26 | } 27 | 28 | late_update() { // 在每一帧的最后执行一次 29 | 30 | } 31 | 32 | on_destroy() { // 在被销毁前执行一次 33 | } 34 | 35 | destroy() { // 删掉该物体 36 | this.on_destroy(); 37 | for(let i = 0; i < AC_GAME_OBJECTS.length; i++) { 38 | if(AC_GAME_OBJECTS[i] === this){ 39 | AC_GAME_OBJECTS.splice(i, 1); 40 | break; 41 | } 42 | } 43 | } 44 | } 45 | 46 | 47 | let last_timestamp; 48 | let AC_GAME_ANIMATION = function(timestamp) { 49 | for(let i = 0; i < AC_GAME_OBJECTS.length; i++ ) { 50 | let obj = AC_GAME_OBJECTS[i]; 51 | if(!obj.has_called_start) { 52 | obj.start(); 53 | obj.has_called_start = true; 54 | } else { 55 | obj.timedelta = timestamp - last_timestamp; 56 | obj.update(); 57 | } 58 | } 59 | 60 | for (let i = 0; i < AC_GAME_OBJECTS.length; i++) { 61 | let obj = AC_GAME_OBJECTS[i]; 62 | obj.late_update(); 63 | } 64 | 65 | last_timestamp = timestamp; 66 | 67 | requestAnimationFrame(AC_GAME_ANIMATION); 68 | 69 | } 70 | 71 | requestAnimationFrame(AC_GAME_ANIMATION); 72 | -------------------------------------------------------------------------------- /game/static/js/src/playground/chat_field/zbase.js: -------------------------------------------------------------------------------- 1 | class CharField { 2 | constructor(playground) { 3 | this.playground = playground; 4 | this.$history = $(`
历史记录
`); 5 | this.$input = $(``); 6 | 7 | this.$history.hide(); 8 | this.$input.hide(); 9 | this.func_id = null; 10 | 11 | this.playground.$playground.append(this.$history); 12 | this.playground.$playground.append(this.$input); 13 | 14 | this.start(); 15 | 16 | } 17 | 18 | 19 | start() { 20 | this.add_listening_events(); 21 | } 22 | 23 | 24 | add_listening_events() { 25 | let outer = this; 26 | this.$input.keydown(function (e) { 27 | if (e.which === 27) { // esc 28 | outer.hide_input(); 29 | return false; 30 | } else if (e.which === 13) { 31 | let username = outer.playground.root.settings.username; 32 | let text = outer.$input.val(); 33 | if (text) { 34 | outer.$input.val(""); 35 | outer.add_message(username, text); 36 | outer.playground.mps.send_message(username, text); 37 | } 38 | return false; 39 | } 40 | }); 41 | } 42 | 43 | render_message(message) { 44 | return $(`
${message}
`); 45 | } 46 | 47 | add_message(username, text) { 48 | this.show_history(); 49 | let message = `[${username}]${text}`; 50 | this.$history.append(this.render_message(message)); 51 | this.$history.scrollTop(this.$history[0].scrollHeight); 52 | } 53 | 54 | 55 | show_history() { 56 | let outer = this; 57 | this.$history.fadeIn(); 58 | 59 | if (this.func_id) clearTimeout(this.func_id); 60 | 61 | this.func_id = setTimeout(function () { 62 | outer.$history.fadeOut(); 63 | outer.func_id = null; 64 | }, 6000); 65 | } 66 | 67 | show_input() { 68 | this.show_history(); 69 | 70 | this.$input.show(); 71 | this.$input.focus(); 72 | } 73 | 74 | hide_input() { 75 | // console.log("hide input!!!"); 76 | this.$input.hide(); 77 | this.playground.game_map.$canvas.focus(); 78 | } 79 | } -------------------------------------------------------------------------------- /game/static/js/src/playground/game_map/zbase.js: -------------------------------------------------------------------------------- 1 | class GameMap extends AcGameObject { 2 | constructor(playground) { 3 | super(); 4 | this.playground = playground; 5 | this.$canvas = $(``); 6 | this.ctx = this.$canvas[0].getContext('2d'); 7 | this.ctx.canvas.width = this.playground.width; 8 | this.ctx.canvas.height = this.playground.height; 9 | this.playground.$playground.append(this.$canvas); 10 | } 11 | 12 | 13 | start() { 14 | this.$canvas.focus(); 15 | } 16 | 17 | resize() { 18 | this.ctx.canvas.width = this.playground.width; 19 | this.ctx.canvas.height = this.playground.height; 20 | this.ctx.fillStyle = "rgba(0, 0, 0, 1)"; 21 | this.ctx.fillRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height); 22 | } 23 | 24 | update() { 25 | this.render(); 26 | 27 | } 28 | 29 | render() { 30 | this.ctx.fillStyle = "rgba(0, 0, 0, 0.2)"; 31 | this.ctx.fillRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /game/static/js/src/playground/notice_board/zbase.js: -------------------------------------------------------------------------------- 1 | class NoticeBoard extends AcGameObject { 2 | constructor(playground) { 3 | super(); 4 | this.playground = playground; 5 | this.ctx = this.playground.game_map.ctx; 6 | this.text = "已就绪:0人"; 7 | 8 | } 9 | 10 | start() { 11 | 12 | } 13 | 14 | write(text) { 15 | this.text = text; 16 | } 17 | 18 | update() { 19 | this.render(); 20 | } 21 | 22 | render() { 23 | this.ctx.font = "20px serif"; 24 | this.ctx.fillStyle = "white"; 25 | this.ctx.textAlign = "center"; 26 | this.ctx.fillText(this.text, this.playground.width / 2, 20); 27 | } 28 | } -------------------------------------------------------------------------------- /game/static/js/src/playground/particle/zbase.js: -------------------------------------------------------------------------------- 1 | class Particle extends AcGameObject { 2 | constructor(playground, x, y, radius, vx, vy, color, speed, move_length) { 3 | super(); 4 | this.playground = playground; 5 | this.ctx = this.playground.game_map.ctx; 6 | this.x = x; 7 | this.y = y; 8 | this.radius = radius; 9 | this.vx = vx; 10 | this.vy = vy; 11 | this.color = color; 12 | this.speed = speed; 13 | this.move_length = move_length; 14 | this.friction = 0.7; 15 | this.eps = 0.1; 16 | } 17 | 18 | start() {} 19 | 20 | update() { 21 | if(this.move_length < this.eps || this.speed < this.eps){ 22 | this.destroy(); 23 | return false; 24 | } 25 | 26 | let moved = Math.min(this.move_length, this.speed * this.timedelta / 1000); 27 | this.x += this.vx * moved; 28 | this.y += this.vy * moved; 29 | this.speed *= this.friction; 30 | this.move_length -= moved; 31 | this.render(); 32 | } 33 | 34 | render() { 35 | let scale = this.playground.scale; 36 | 37 | this.ctx.beginPath(); 38 | this.ctx.arc(this.x * scale, this.y * scale, this.radius * scale, 0, Math.PI * 2, false); 39 | this.ctx.fillStyle = this.color; 40 | this.ctx.fill(); 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /game/static/js/src/playground/score_board/zbase.js: -------------------------------------------------------------------------------- 1 | class ScoreBoard extends AcGameObject { 2 | constructor(playground) { 3 | super(); 4 | this.playground = playground; 5 | this.ctx = this.playground.game_map.ctx; 6 | 7 | this.state = null; // win or lose 8 | 9 | this.win_img = new Image(); 10 | this.win_img.src = "https://cdn.acwing.com/media/article/image/2021/12/17/1_8f58341a5e-win.png"; 11 | 12 | this.lose_img = new Image(); 13 | this.lose_img.src = "https://cdn.acwing.com/media/article/image/2021/12/17/1_9254b5f95e-lose.png"; 14 | 15 | 16 | } 17 | 18 | start() { 19 | 20 | } 21 | 22 | add_listening_event() { 23 | let outer = this; 24 | let $canvas = this.playground.game_map.$canvas; 25 | 26 | $canvas.on('click', function () { 27 | outer.playground.hide(); 28 | outer.playground.root.menu.show(); 29 | }); 30 | } 31 | 32 | win() { 33 | this.state = "win"; 34 | 35 | let outer = this; 36 | setTimeout(function () { 37 | outer.add_listening_event(); 38 | }, 1000); // 展示 1s 之后监听 39 | } 40 | 41 | lose() { 42 | this.state = "lose"; 43 | 44 | let outer = this; 45 | setTimeout(function () { 46 | outer.add_listening_event(); 47 | }, 1000); // 展示 1s 之后监听 48 | } 49 | late_update() { 50 | this.render(); 51 | } 52 | 53 | render() { 54 | let len = this.playground.height / 2; 55 | if (this.state === "win") { 56 | this.ctx.drawImage(this.win_img, this.playground.width / 2 - len / 2, this.playground.height / 2 - len / 2, len, len); 57 | } else if (this.state === "lose") { 58 | this.ctx.drawImage(this.lose_img, this.playground.width / 2 - len / 2, this.playground.height / 2 - len / 2, len, len); 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /game/static/js/src/playground/skill/fireball/zbase.js: -------------------------------------------------------------------------------- 1 | class FireBall extends AcGameObject { 2 | constructor(playground, player, x, y, radius, vx, vy, color, speed, move_length, damage) { 3 | super(); 4 | this.playground = playground; 5 | this.player = player; 6 | this.ctx = this.playground.game_map.ctx; 7 | this.x = x; 8 | this.y = y; 9 | this.vx = vx; 10 | this.vy = vy; 11 | this.radius = radius; 12 | this.color = color; 13 | this.speed = speed; 14 | this.move_length = move_length; 15 | this.damage = damage; 16 | this.eps = 0.1; 17 | } 18 | 19 | 20 | start() {} 21 | 22 | is_collision(obj) { 23 | let distance = this.get_dist(this.x, this.y, obj.x, obj.y); 24 | if(distance < this.radius + obj.radius) 25 | return true; 26 | return false; 27 | } 28 | 29 | update() { 30 | if (this.move_length < this.eps) { 31 | this.destroy(); 32 | return false; 33 | } 34 | 35 | this.update_move(); 36 | 37 | if (this.player.character !== "enemy") { 38 | this.update_attack(); 39 | } 40 | 41 | this.render(); 42 | } 43 | 44 | update_move() { 45 | let moved = Math.min(this.move_length, this.speed * this.timedelta / 1000); 46 | this.x += this.vx * moved; 47 | this.y += this.vy * moved; 48 | this.move_length -= moved; 49 | } 50 | 51 | update_attack() { 52 | for (let i = 0; i < this.playground.players.length; i ++ ) { 53 | let player = this.playground.players[i]; 54 | if((this.player !== player) && this.is_collision(player)) { 55 | this.attack(player); 56 | break; 57 | } 58 | } 59 | } 60 | 61 | get_dist(x1, y1, x2, y2) { 62 | let dx = x1 - x2; 63 | let dy = y1 - y2; 64 | return Math.sqrt(dx * dx + dy * dy); 65 | } 66 | 67 | attack(player) { 68 | let angle = Math.atan2(player.y - this.y, player.x - this.x); 69 | player.is_attacked(angle, this.damage); 70 | 71 | 72 | if (this.playground.mode === "multi mode") { 73 | //console.log("ball ", this.uuid, "is attack", player.uuid, "in js!!!"); 74 | this.playground.mps.send_attack(player.uuid, player.x, player.y, angle, this.damage, this.uuid); 75 | } 76 | 77 | this.destroy(); 78 | 79 | } 80 | 81 | 82 | render() { 83 | let scale = this.playground.scale; 84 | this.ctx.beginPath(); 85 | this.ctx.arc(this.x * scale, this.y * scale, this.radius * scale, 0, Math.PI * 2, false); 86 | this.ctx.fillStyle = this.color; 87 | this.ctx.fill(); 88 | } 89 | 90 | on_destroy() { 91 | let fireballs = this.player.fireballs; 92 | for (let i = 0; i < fireballs.length; i ++ ){ 93 | if (fireballs[i] === this) { 94 | fireballs.splice(i, 1); 95 | break; 96 | } 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /game/static/js/src/playground/socket/multiplayer/zbase.js: -------------------------------------------------------------------------------- 1 | class MultiPlayerSocket { 2 | constructor(playground) { 3 | this.playground = playground; 4 | this.ws = new WebSocket("wss://app2872.acapp.acwing.com.cn/wss/multiplayer/"); 5 | 6 | this.start(); 7 | } 8 | 9 | start() { 10 | this.receive(); 11 | } 12 | 13 | receive() { 14 | let outer = this; 15 | this.ws.onmessage = function (e) { 16 | let data = JSON.parse(e.data); 17 | let uuid = data.uuid; 18 | 19 | 20 | if (uuid === outer.uuid) return false; 21 | 22 | let event = data.event; 23 | if (event === "create_player") { 24 | outer.receive_create_player(uuid, data.username, data.photo); 25 | } else if (event === "move_to") { 26 | outer.receive_move_to(uuid, data.tx, data.ty); 27 | } else if (event === "shoot_fireball") { 28 | outer.receive_shoot_fireball(uuid, data.tx, data.ty, data.ball_uuid); 29 | } else if (event === 'attack') { 30 | outer.receive_attack(uuid, data.attackee_uuid, data.x, data.y, data.angle, data.damage, data.ball_uuid); 31 | } else if (event === "blink") { 32 | outer.receive_blink(uuid, data.tx, data.ty); 33 | } else if (event === "message") { 34 | outer.receive_message(uuid, data.username, data.text); 35 | } 36 | }; 37 | } 38 | 39 | send_create_player(username, photo) { 40 | let outer = this; 41 | this.ws.send(JSON.stringify({ 42 | 'event': 'create_player', 43 | 'uuid': outer.uuid, 44 | 'username': username, 45 | 'photo': photo, 46 | })); 47 | } 48 | 49 | get_player(uuid) { 50 | let players = this.playground.players; 51 | for (let i = 0; i < players.length; i++){ 52 | let player = players[i]; 53 | if (player.uuid === uuid) return player; 54 | } 55 | return null; 56 | } 57 | 58 | receive_create_player(uuid, username, photo) { 59 | let player = new Player( 60 | this.playground, 61 | this.playground.width / 2 / this.playground.scale, 62 | 0.5, 63 | 0.05, 64 | "white", 65 | 0.15, 66 | "enemy", 67 | username, 68 | photo, 69 | ); 70 | 71 | player.uuid = uuid; 72 | this.playground.players.push(player); 73 | } 74 | 75 | send_move_to(tx, ty) { 76 | let outer = this; 77 | // console.log("send_move_to, tx = ", tx, "ty = ", ty); 78 | this.ws.send(JSON.stringify({ 79 | 'event': "move_to", 80 | "uuid": outer.uuid, 81 | 'tx': tx, 82 | 'ty': ty, 83 | })); 84 | // console.log("send_move_to*** end!!!"); 85 | } 86 | 87 | receive_move_to(uuid, tx, ty) { 88 | let player = this.get_player(uuid); 89 | // console.log("receive uuid = ", uuid, "tx = ", tx, "ty = ", ty); 90 | if (player) { 91 | player.move_to(tx, ty); 92 | } 93 | } 94 | 95 | send_shoot_fireball(tx, ty, ball_uuid) { 96 | let outer = this; 97 | // console.log("send shoot fireball int js!!"); 98 | this.ws.send(JSON.stringify({ 99 | 'event': "shoot_fireball", 100 | 'uuid': outer.uuid, 101 | 'tx': tx, 102 | 'ty': ty, 103 | 'ball_uuid': ball_uuid, 104 | })) 105 | } 106 | 107 | 108 | receive_shoot_fireball(uuid, tx, ty, ball_uuid) { 109 | // console.log("receive shoot fireball int js!!"); 110 | let player = this.get_player(uuid); 111 | if (player) { 112 | let fireball = player.shoot_fireball(tx, ty); 113 | fireball.uuid = ball_uuid; 114 | } 115 | } 116 | 117 | send_attack(attackee_uuid, x, y, angle, damage, ball_uuid) { 118 | let outer = this; 119 | // console.log(outer.uuid, "attack ", attackee_uuid, "in js !!!"); 120 | this.ws.send(JSON.stringify({ 121 | 'event': "attack", 122 | 'uuid': outer.uuid, 123 | 'attackee_uuid': attackee_uuid, 124 | 'x': x, 125 | 'y': y, 126 | 'angle': angle, 127 | 'damage': damage, 128 | 'ball_uuid': ball_uuid, 129 | })); 130 | } 131 | 132 | receive_attack(uuid, attackee_uuid, x, y, angle, damage, ball_uuid) { 133 | let attacker = this.get_player(uuid); 134 | let attackee = this.get_player(attackee_uuid); 135 | if (attackee && attacker) { 136 | attackee.receive_attack(x, y, angle, damage, ball_uuid, attacker); 137 | } 138 | } 139 | 140 | send_blink(tx, ty) { 141 | let outer = this; 142 | // console.log("send blink in js"); 143 | this.ws.send(JSON.stringify({ 144 | 'event': 'blink', 145 | 'uuid': outer.uuid, 146 | 'tx': tx, 147 | 'ty': ty, 148 | })); 149 | } 150 | 151 | receive_blink(uuid, tx, ty) { 152 | // console.log("receive blink in js"); 153 | let player = this.get_player(uuid); 154 | if (player) { 155 | player.blink(tx, ty); 156 | } 157 | } 158 | 159 | send_message(username, text) { 160 | let outer = this; 161 | // console.log("send message in js"); 162 | this.ws.send(JSON.stringify({ 163 | 'event': "message", 164 | 'uuid': outer.uuid, 165 | 'username': username, 166 | 'text': text, 167 | })); 168 | } 169 | 170 | receive_message(uuid, username, text) { 171 | this.playground.chat_field.add_message(username, text); 172 | } 173 | } -------------------------------------------------------------------------------- /game/static/js/src/playground/zbase.js: -------------------------------------------------------------------------------- 1 | class AcGamePlayground { 2 | constructor(root) { 3 | this.root = root; 4 | this.$playground = $(`
`); 5 | this.root.$ac_game.append(this.$playground); 6 | this.hide(); 7 | this.start(); 8 | } 9 | 10 | 11 | get_random_color() { 12 | let colors = ["blue", "red", "pink", "grey", "green"]; 13 | return colors[Math.floor(Math.random() * 5)]; 14 | } 15 | 16 | create_uuid() { 17 | let res = ""; 18 | for (let i = 0; i < 8; i++) { 19 | let x = parseInt(Math.floor(Math.random() * 10)); 20 | res += x; 21 | } 22 | return res; 23 | } 24 | 25 | start() { 26 | let outer = this; 27 | let uuid = this.create_uuid(); 28 | $(window).on(`resize.${uuid}`, function () { 29 | // console.log("resize\n"); 30 | outer.resize(); 31 | }); 32 | 33 | if (this.root.AcWingOS) { 34 | this.root.AcWingOS.api.window.on_close(function () { 35 | $(window).off(`resize.${uuid}`); 36 | }); 37 | } 38 | } 39 | 40 | resize() { 41 | this.width = this.$playground.width(); 42 | this.height = this.$playground.height(); 43 | let unit = Math.min(this.width / 16, this.height / 9); 44 | this.width = unit * 16; 45 | this.height = unit * 9; 46 | this.scale = this.height; // 百分比地图的基准 47 | 48 | if (this.game_map) this.game_map.resize(); 49 | } 50 | 51 | update() { 52 | } 53 | 54 | show(mode) { // show playground 55 | let outer = this; 56 | this.$playground.show(); 57 | this.mode = mode; 58 | 59 | this.width = this.$playground.width(); 60 | this.height = this.$playground.height(); 61 | this.game_map = new GameMap(this); 62 | 63 | this.state = "waiting"; // 状态waiting -> fighting -> over 64 | this.notice_board = new NoticeBoard(this); 65 | this.score_board = new ScoreBoard(this); 66 | this.player_count = 0; 67 | 68 | this.resize(); 69 | this.players = []; 70 | this.players.push(new Player(this, this.width / 2 / this.scale, 0.5, 0.05, "white", 0.15, "me", this.root.settings.username, this.root.settings.photo)); 71 | 72 | 73 | if (mode === "single mode") { 74 | for (let i = 0; i < 5; i++) { 75 | this.players.push(new Player(this, this.width / 2 / this.scale, 0.5, 0.05, this.get_random_color(), 0.15, "robot")); 76 | } 77 | } else if (mode === "multi mode") { 78 | this.chat_field = new CharField(this); 79 | this.mps = new MultiPlayerSocket(this); 80 | this.mps.uuid = this.players[0].uuid; 81 | 82 | this.mps.ws.onopen = function () { 83 | outer.mps.send_create_player(outer.root.settings.username, outer.root.settings.photo); 84 | }; 85 | } 86 | } 87 | 88 | 89 | hide() { // close playground 90 | while (this.players && this.players.length > 0) { 91 | this.players[0].destroy(); 92 | } 93 | 94 | if (this.game_map) { 95 | this.game_map.destroy(); 96 | this.game_map = null; 97 | } 98 | 99 | if (this.notice_board) { 100 | this.notice_board.destroy(); 101 | this.notice_board = null; 102 | } 103 | 104 | if (this.score_board) { 105 | this.score_board.destroy(); 106 | this.score_board = null; 107 | } 108 | 109 | this.$playground.empty(); 110 | 111 | this.$playground.hide(); 112 | } 113 | 114 | 115 | } 116 | -------------------------------------------------------------------------------- /game/static/js/src/zbase.js: -------------------------------------------------------------------------------- 1 | export class AcGame { 2 | constructor(id, AcWingOS) { 3 | 4 | this.id = id; 5 | this.$ac_game = $('#' + id); 6 | this.AcWingOS = AcWingOS; 7 | 8 | this.settings = new Settings(this); 9 | 10 | 11 | this.menu = new AcGameMenu(this); 12 | 13 | this.playground = new AcGamePlayground(this); 14 | 15 | 16 | 17 | this.start() 18 | } 19 | 20 | start() { 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /game/templates/multiends/web.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 21 | 22 | -------------------------------------------------------------------------------- /game/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /game/urls/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/urls/__init__.py -------------------------------------------------------------------------------- /game/urls/index.py: -------------------------------------------------------------------------------- 1 | import imp 2 | from socket import IP_DEFAULT_MULTICAST_LOOP 3 | from django.urls import path, include 4 | from game.views.index import index 5 | 6 | 7 | urlpatterns = [ 8 | path("", index, name = "index"), 9 | path("menu/", include("game.urls.menu.index")), 10 | path("playground/", include("game.urls.playground.index")), 11 | path("settings/", include("game.urls.settings.index")), 12 | ] 13 | -------------------------------------------------------------------------------- /game/urls/menu/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/urls/menu/__init__.py -------------------------------------------------------------------------------- /game/urls/menu/index.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | 4 | urlpatterns = [ 5 | 6 | 7 | 8 | ] 9 | -------------------------------------------------------------------------------- /game/urls/playground/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/urls/playground/__init__.py -------------------------------------------------------------------------------- /game/urls/playground/index.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | 4 | urlpatterns = [ 5 | 6 | 7 | ] 8 | -------------------------------------------------------------------------------- /game/urls/settings/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/urls/settings/__init__.py -------------------------------------------------------------------------------- /game/urls/settings/acwing/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/urls/settings/acwing/__init__.py -------------------------------------------------------------------------------- /game/urls/settings/acwing/index.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from game.views.settings.acwing.web.apply_code import apply_code as web_apply_code 3 | from game.views.settings.acwing.web.receive_code import receive_code as web_receive_code 4 | from game.views.settings.acwing.acapp.apply_code import apply_code as acapp_apply_code 5 | from game.views.settings.acwing.acapp.receive_code import receive_code as acapp_receive_code 6 | 7 | 8 | urlpatterns = [ 9 | path("web/apply_code/", web_apply_code, name="settings_acwing_web_apply_code"), 10 | path("web/receive_code/", web_receive_code, name="settings_acwing_web_receive_code"), 11 | path("acapp/apply_code/", acapp_apply_code, name="settings_acwing_acapp_apply_code"), 12 | path("acapp/receive_code/", acapp_receive_code, name="settings_acwing_acapp_receive_code"), 13 | ] -------------------------------------------------------------------------------- /game/urls/settings/index.py: -------------------------------------------------------------------------------- 1 | from django.urls import include, path 2 | from game.views.settings.getinfo import getinfo 3 | from game.views.settings.login import signin 4 | from game.views.settings.logout import signout 5 | from game.views.settings.register import register 6 | 7 | urlpatterns = [ 8 | path("getinfo/", getinfo, name="settings_getinfo"), 9 | path("login/", signin, name="settings_login"), 10 | path("logout/", signout, name="settings_logout"), 11 | path("register/", register, name = "settings_register"), 12 | path("acwing/", include("game.urls.settings.acwing.index")), 13 | ] 14 | -------------------------------------------------------------------------------- /game/views/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/views/__init__.py -------------------------------------------------------------------------------- /game/views/index.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | 4 | def index(request): 5 | return render(request, "multiends/web.html") 6 | -------------------------------------------------------------------------------- /game/views/menu/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/views/menu/__init__.py -------------------------------------------------------------------------------- /game/views/playground/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/views/playground/__init__.py -------------------------------------------------------------------------------- /game/views/settings/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/views/settings/__init__.py -------------------------------------------------------------------------------- /game/views/settings/acwing/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/views/settings/acwing/__init__.py -------------------------------------------------------------------------------- /game/views/settings/acwing/acapp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/views/settings/acwing/acapp/__init__.py -------------------------------------------------------------------------------- /game/views/settings/acwing/acapp/apply_code.py: -------------------------------------------------------------------------------- 1 | from django.http import JsonResponse 2 | from urllib.parse import quote 3 | from random import randint 4 | from django.core.cache import cache 5 | 6 | 7 | def get_state(): 8 | res = "" 9 | for i in range(8): 10 | res += str(randint(0, 9)) 11 | return res 12 | 13 | def apply_code(request): 14 | appid = "2872" 15 | redirect_uri = quote("https://app2872.acapp.acwing.com.cn/settings/acwing/acapp/receive_code/") 16 | scope = "userinfo" 17 | state = get_state() 18 | 19 | cache.set(state, True, 7200) # 有效期 2 Hours 20 | 21 | return JsonResponse({ 22 | 'result': "success", 23 | 'appid': appid, 24 | 'redirect_uri': redirect_uri, 25 | 'scope': scope, 26 | 'state': state, 27 | }) -------------------------------------------------------------------------------- /game/views/settings/acwing/acapp/receive_code.py: -------------------------------------------------------------------------------- 1 | 2 | from django.http import JsonResponse 3 | from django.shortcuts import redirect 4 | from django.core.cache import cache 5 | import requests 6 | from django.contrib.auth.models import User 7 | from game.models.player.player import Player 8 | from random import randint 9 | 10 | def receive_code(request): 11 | data = request.GET 12 | 13 | if "errcode" in data: 14 | return JsonResponse({ 15 | 'result': "apply failed", 16 | 'errcode': data['errcode'], 17 | 'errmsg': data['errmsg'] 18 | }) 19 | code = data.get('code') 20 | state = data.get('state') 21 | 22 | # print("code = ", code, "state = ", state) 23 | 24 | if not cache.has_key(state): 25 | return JsonResponse({ 26 | 'result': 'state not exist', 27 | 28 | }) 29 | cache.delete(state) 30 | 31 | apply_access_token_url = "https://www.acwing.com/third_party/api/oauth2/access_token/" 32 | params = { 33 | 'appid': "2872", 34 | 'secret': "1eec686af02c4f5ba3eb6b4f252b21f9", 35 | 'code': code 36 | } 37 | 38 | access_token_res = requests.get(apply_access_token_url, params=params).json() 39 | 40 | access_token = access_token_res['access_token'] 41 | openid = access_token_res['openid'] 42 | 43 | players = Player.objects.filter(openid = openid) 44 | if players.exists(): # 如果该用户已存在,无需重新获取信息,直接登录即可 45 | player = players[0] 46 | return JsonResponse({ 47 | 'result' : 'success', 48 | 'username': player.user.username, 49 | 'photo': player.photo, 50 | }) 51 | 52 | get_userinfo_url = "https://www.acwing.com/third_party/api/meta/identity/getinfo/" 53 | params = { 54 | "access_token": access_token, 55 | "openid": openid 56 | } 57 | userinfo_res = requests.get(get_userinfo_url, params=params).json() 58 | username = userinfo_res['username'] 59 | photo = userinfo_res['photo'] 60 | 61 | while User.objects.filter(username = username).exists(): # 找到一个不存在的新用户名 62 | username += str(randint(0, 9)) 63 | 64 | user = User.objects.create(username = username) 65 | player = Player.objects.create(user=user, photo=photo, openid=openid) 66 | 67 | return JsonResponse({ 68 | 'result' : 'success', 69 | 'username': player.user.username, 70 | 'photo': player.photo, 71 | }) 72 | -------------------------------------------------------------------------------- /game/views/settings/acwing/web/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/game/views/settings/acwing/web/__init__.py -------------------------------------------------------------------------------- /game/views/settings/acwing/web/apply_code.py: -------------------------------------------------------------------------------- 1 | from django.http import JsonResponse 2 | from urllib.parse import quote 3 | from random import randint 4 | from django.core.cache import cache 5 | 6 | 7 | def get_state(): 8 | res = "" 9 | for i in range(8): 10 | res += str(randint(0, 9)) 11 | return res 12 | 13 | def apply_code(request): 14 | appid = "2872" 15 | redirect_uri = quote("https://app2872.acapp.acwing.com.cn/settings/acwing/web/receive_code/") 16 | scope = "userinfo" 17 | state = get_state() 18 | 19 | cache.set(state, True, 7200) # 有效期 2 Hours 20 | apply_code_url = "https://www.acwing.com/third_party/api/oauth2/web/authorize/" 21 | return JsonResponse({ 22 | 'result': "success", 23 | 'apply_code_url': apply_code_url + "?appid=%s&redirect_uri=%s&scope=%s&state=%s" % (appid, redirect_uri, scope, state) 24 | }) -------------------------------------------------------------------------------- /game/views/settings/acwing/web/receive_code.py: -------------------------------------------------------------------------------- 1 | 2 | from django.shortcuts import redirect 3 | from django.core.cache import cache 4 | import requests 5 | from django.contrib.auth.models import User 6 | from game.models.player.player import Player 7 | from django.contrib.auth import login 8 | from random import randint 9 | 10 | def receive_code(request): 11 | data = request.GET 12 | code = data.get('code') 13 | state = data.get('state') 14 | 15 | print("code = ", code, "state = ", state) 16 | 17 | if not cache.has_key(state): 18 | return redirect("index") 19 | cache.delete(state) 20 | 21 | apply_access_token_url = "https://www.acwing.com/third_party/api/oauth2/access_token/" 22 | params = { 23 | 'appid': "2872", 24 | 'secret': "1eec686af02c4f5ba3eb6b4f252b21f9", 25 | 'code': code 26 | } 27 | 28 | access_token_res = requests.get(apply_access_token_url, params=params).json() 29 | 30 | access_token = access_token_res['access_token'] 31 | openid = access_token_res['openid'] 32 | 33 | players = Player.objects.filter(openid = openid) 34 | if players.exists(): # 如果该用户已存在,无需重新获取信息,直接登录即可 35 | login(request, players[0].user) 36 | return redirect("index") 37 | 38 | get_userinfo_url = "https://www.acwing.com/third_party/api/meta/identity/getinfo/" 39 | params = { 40 | "access_token": access_token, 41 | "openid": openid 42 | } 43 | userinfo_res = requests.get(get_userinfo_url, params=params).json() 44 | username = userinfo_res['username'] 45 | photo = userinfo_res['photo'] 46 | 47 | while User.objects.filter(username = username).exists(): # 找到一个不存在的新用户名 48 | username += str(randint(0, 9)) 49 | 50 | user = User.objects.create(username = username) 51 | player = Player.objects.create(user=user, photo=photo, openid=openid) 52 | 53 | login(request, user) 54 | 55 | return redirect("index") -------------------------------------------------------------------------------- /game/views/settings/getinfo.py: -------------------------------------------------------------------------------- 1 | from django.http import JsonResponse 2 | from game.models.player.player import Player 3 | 4 | 5 | 6 | def getinfo_acapp(request): 7 | player = Player.objects.all()[0] 8 | return JsonResponse({ 9 | 'result': "success", 10 | 'username': player.user.username, 11 | 'photo': player.photo, 12 | }) 13 | 14 | 15 | 16 | def getinfo_web(request): 17 | user = request.user 18 | if not user.is_authenticated: 19 | return JsonResponse({ 20 | 'result': "未登录" 21 | }) 22 | else: 23 | player = Player.objects.get(user = user) 24 | return JsonResponse({ 25 | 'result': "success", 26 | 'username': player.user.username, 27 | 'photo': player.photo, 28 | }) 29 | 30 | 31 | def getinfo(request): 32 | platform = request.GET.get('platform') 33 | if platform == "ACAPP": 34 | return getinfo_acapp(request) 35 | elif platform == "WEB": 36 | return getinfo_web(request) 37 | -------------------------------------------------------------------------------- /game/views/settings/login.py: -------------------------------------------------------------------------------- 1 | from django.http import JsonResponse 2 | from django.contrib.auth import authenticate, login 3 | 4 | 5 | def signin(request): 6 | data = request.GET 7 | username = data.get('username') 8 | password = data.get('password') 9 | user = authenticate(username = username, password = password) 10 | if not user: 11 | return JsonResponse({ 12 | 'result': '用户名或密码不正确' 13 | 14 | }) 15 | login(request, user) 16 | return JsonResponse({ 17 | 'result': 'success' 18 | }) -------------------------------------------------------------------------------- /game/views/settings/logout.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth import logout 2 | from django.http import JsonResponse 3 | 4 | def signout(request): 5 | user = request.user 6 | if not user.is_authenticated: 7 | return JsonResponse({ 8 | 'result': "success", 9 | }) 10 | logout(request) 11 | return JsonResponse({ 12 | 'result': "success", 13 | }) -------------------------------------------------------------------------------- /game/views/settings/register.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth import login 2 | from django.http import JsonResponse 3 | from django.contrib.auth.models import User 4 | from game.models.player.player import Player 5 | 6 | 7 | def register(request): 8 | data = request.GET 9 | username = data.get("username", "").strip() 10 | password = data.get("password", "").strip() 11 | password_confirm = data.get("password_confirm", "").strip() 12 | if not username or not password: 13 | return JsonResponse({ 14 | 'result': "用户名和密码不能为空" 15 | }) 16 | if password != password_confirm: 17 | return JsonResponse({ 18 | 'result': "两个密码不一致", 19 | }) 20 | if User.objects.filter(username = username).exists(): 21 | return JsonResponse({ 22 | 'result': "用户名已存在" 23 | }) 24 | 25 | user = User(username = username) 26 | user.set_password(password) 27 | user.save() 28 | Player.objects.create(user = user, photo = "https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2FsQt1SVSd3qdaHbqV925bwm6DlRIbDJZ9tnx5%3DMMpb7kPY1556274862414.jpg&thumbnail=650x2147483647&quality=80&type=jpg") 29 | login(request, user) 30 | return JsonResponse({ 31 | 'result': "success" 32 | }) -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'acapp.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /match_system/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/match_system/__init__.py -------------------------------------------------------------------------------- /match_system/src/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/match_system/src/__init__.py -------------------------------------------------------------------------------- /match_system/src/main.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | import glob 4 | import sys 5 | 6 | sys.path.insert(0, glob.glob('../../')[0]) 7 | 8 | from match_server.match_service import Match 9 | 10 | from thrift.transport import TSocket 11 | from thrift.transport import TTransport 12 | from thrift.protocol import TBinaryProtocol 13 | from thrift.server import TServer 14 | 15 | from time import sleep 16 | from threading import Thread 17 | from queue import Queue 18 | 19 | from acapp.asgi import channel_layer 20 | from asgiref.sync import async_to_sync 21 | from django.core.cache import cache 22 | 23 | queue = Queue() # 消息队列 24 | 25 | class Player: 26 | def __init__(self, score, uuid, username, photo, channel_name): 27 | self.score = score 28 | self.uuid = uuid 29 | self.username = username 30 | self.photo = photo 31 | self.channel_name = channel_name 32 | self.waiting_time = 0 # 已经等待的时间 33 | 34 | class Pool: 35 | def __init__(self): 36 | self.players = [] 37 | 38 | def add_player(self, player): 39 | print("Add Player: %s %d" % (player.username, player.score)) 40 | self.players.append(player) 41 | 42 | def check_match(self, a, b): 43 | # if a.username == b.username: 44 | # return False 45 | dt = abs(a.score - b.score) 46 | a_max_dif = a.waiting_time * 50 47 | b_max_dif = b.waiting_time * 50 48 | return dt <= a_max_dif and dt <= b_max_dif 49 | 50 | def match_success(self, ps): 51 | print("Match Success %s %s %s" % (ps[0].username, ps[1].username, ps[2].username)) 52 | room_name = "room-%s-%s-%s" % (ps[0].uuid, ps[1].uuid, ps[2].uuid) 53 | players = [] 54 | for p in ps: 55 | async_to_sync(channel_layer.group_add)(room_name, p.channel_name) 56 | players.append({ 57 | 'uuid': p.uuid, 58 | 'username': p.username, 59 | 'photo': p.photo, 60 | 'hp': 100, 61 | }) 62 | 63 | cache.set(room_name, players, 3600) # 有效时间:1小时 64 | 65 | for p in ps: 66 | async_to_sync(channel_layer.group_send) ( 67 | room_name, 68 | { 69 | 'type': "group_send_event", 70 | 'event': "create_player", 71 | 'uuid': p.uuid, 72 | 'username': p.username, 73 | 'photo': p.photo, 74 | } 75 | ) 76 | 77 | def increase_waiting_time(self): 78 | for player in self.players: 79 | player.waiting_time += 1 80 | 81 | def match(self): 82 | while len(self.players) >= 3: 83 | self.players = sorted(self.players, key=lambda p : p.score) 84 | flag = False 85 | for i in range(len(self.players) - 2): 86 | a, b, c = self.players[i], self.players[i + 1], self.players[i + 2] 87 | if self.check_match(a, b) and self.check_match(a, c) and self.check_match(c, b): 88 | self.match_success([a, b, c]) 89 | self.players = self.players[:i] + self.players[i + 3:] 90 | flag = True 91 | break 92 | 93 | if not flag: 94 | break 95 | 96 | self.increase_waiting_time() 97 | 98 | 99 | class MatchHandler: 100 | def add_player(self, score, uuid, username, photo, channel_name): 101 | player = Player(score, uuid, username, photo, channel_name) 102 | queue.put(player) 103 | return 0 # 一定要return 0 104 | 105 | 106 | def get_player_from_queue(): 107 | try: 108 | return queue.get_nowait() 109 | except: 110 | return None 111 | 112 | 113 | def worker(): # 生产者消费者 114 | pool = Pool() 115 | while True: 116 | player = get_player_from_queue() 117 | if player: 118 | pool.add_player(player) 119 | else: 120 | pool.match() 121 | sleep(1) 122 | 123 | 124 | 125 | if __name__ == '__main__': 126 | handler = MatchHandler() 127 | processor = Match.Processor(handler) 128 | transport = TSocket.TServerSocket(host='127.0.0.1', port=9090) 129 | tfactory = TTransport.TBufferedTransportFactory() 130 | pfactory = TBinaryProtocol.TBinaryProtocolFactory() 131 | 132 | # server = TServer.TSimpleServer(processor, transport, tfactory, pfactory) 133 | 134 | # You could do one of these for a multithreaded server 135 | server = TServer.TThreadedServer( 136 | processor, transport, tfactory, pfactory) # 并行度最高 137 | # server = TServer.TThreadPoolServer( 138 | # processor, transport, tfactory, pfactory) # 匹配池server 固定并发度 139 | 140 | 141 | Thread(target=worker, daemon=True).start() 142 | 143 | print('Starting the server...') 144 | server.serve() # 死循环 145 | print('done.') -------------------------------------------------------------------------------- /match_system/src/match_server/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/match_system/src/match_server/__init__.py -------------------------------------------------------------------------------- /match_system/src/match_server/match_service/Match-remote: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Autogenerated by Thrift Compiler (0.16.0) 4 | # 5 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 6 | # 7 | # options string: py 8 | # 9 | 10 | import sys 11 | import pprint 12 | if sys.version_info[0] > 2: 13 | from urllib.parse import urlparse 14 | else: 15 | from urlparse import urlparse 16 | from thrift.transport import TTransport, TSocket, TSSLSocket, THttpClient 17 | from thrift.protocol.TBinaryProtocol import TBinaryProtocol 18 | 19 | from match_service import Match 20 | from match_service.ttypes import * 21 | 22 | if len(sys.argv) <= 1 or sys.argv[1] == '--help': 23 | print('') 24 | print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]') 25 | print('') 26 | print('Functions:') 27 | print(' i32 add_player(i32 score, string uuid, string username, string photo, string channel_name)') 28 | print('') 29 | sys.exit(0) 30 | 31 | pp = pprint.PrettyPrinter(indent=2) 32 | host = 'localhost' 33 | port = 9090 34 | uri = '' 35 | framed = False 36 | ssl = False 37 | validate = True 38 | ca_certs = None 39 | keyfile = None 40 | certfile = None 41 | http = False 42 | argi = 1 43 | 44 | if sys.argv[argi] == '-h': 45 | parts = sys.argv[argi + 1].split(':') 46 | host = parts[0] 47 | if len(parts) > 1: 48 | port = int(parts[1]) 49 | argi += 2 50 | 51 | if sys.argv[argi] == '-u': 52 | url = urlparse(sys.argv[argi + 1]) 53 | parts = url[1].split(':') 54 | host = parts[0] 55 | if len(parts) > 1: 56 | port = int(parts[1]) 57 | else: 58 | port = 80 59 | uri = url[2] 60 | if url[4]: 61 | uri += '?%s' % url[4] 62 | http = True 63 | argi += 2 64 | 65 | if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed': 66 | framed = True 67 | argi += 1 68 | 69 | if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl': 70 | ssl = True 71 | argi += 1 72 | 73 | if sys.argv[argi] == '-novalidate': 74 | validate = False 75 | argi += 1 76 | 77 | if sys.argv[argi] == '-ca_certs': 78 | ca_certs = sys.argv[argi+1] 79 | argi += 2 80 | 81 | if sys.argv[argi] == '-keyfile': 82 | keyfile = sys.argv[argi+1] 83 | argi += 2 84 | 85 | if sys.argv[argi] == '-certfile': 86 | certfile = sys.argv[argi+1] 87 | argi += 2 88 | 89 | cmd = sys.argv[argi] 90 | args = sys.argv[argi + 1:] 91 | 92 | if http: 93 | transport = THttpClient.THttpClient(host, port, uri) 94 | else: 95 | if ssl: 96 | socket = TSSLSocket.TSSLSocket(host, port, validate=validate, ca_certs=ca_certs, keyfile=keyfile, certfile=certfile) 97 | else: 98 | socket = TSocket.TSocket(host, port) 99 | if framed: 100 | transport = TTransport.TFramedTransport(socket) 101 | else: 102 | transport = TTransport.TBufferedTransport(socket) 103 | protocol = TBinaryProtocol(transport) 104 | client = Match.Client(protocol) 105 | transport.open() 106 | 107 | if cmd == 'add_player': 108 | if len(args) != 5: 109 | print('add_player requires 5 args') 110 | sys.exit(1) 111 | pp.pprint(client.add_player(eval(args[0]), args[1], args[2], args[3], args[4],)) 112 | 113 | else: 114 | print('Unrecognized method %s' % cmd) 115 | sys.exit(1) 116 | 117 | transport.close() 118 | -------------------------------------------------------------------------------- /match_system/src/match_server/match_service/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = ['ttypes', 'constants', 'Match'] 2 | -------------------------------------------------------------------------------- /match_system/src/match_server/match_service/constants.py: -------------------------------------------------------------------------------- 1 | # 2 | # Autogenerated by Thrift Compiler (0.16.0) 3 | # 4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | # 6 | # options string: py 7 | # 8 | 9 | from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException 10 | from thrift.protocol.TProtocol import TProtocolException 11 | from thrift.TRecursive import fix_spec 12 | 13 | import sys 14 | from .ttypes import * 15 | -------------------------------------------------------------------------------- /match_system/src/match_server/match_service/ttypes.py: -------------------------------------------------------------------------------- 1 | # 2 | # Autogenerated by Thrift Compiler (0.16.0) 3 | # 4 | # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 | # 6 | # options string: py 7 | # 8 | 9 | from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException 10 | from thrift.protocol.TProtocol import TProtocolException 11 | from thrift.TRecursive import fix_spec 12 | 13 | import sys 14 | 15 | from thrift.transport import TTransport 16 | all_structs = [] 17 | fix_spec(all_structs) 18 | del all_structs 19 | -------------------------------------------------------------------------------- /match_system/thrift/match.thrift: -------------------------------------------------------------------------------- 1 | namespace py match_service 2 | 3 | 4 | service Match { 5 | i32 add_player(1: i32 score, 2: string uuid, 3 : string username, 4: string photo, 5: string channel_name), 6 | 7 | } -------------------------------------------------------------------------------- /scripts/compress_game_js.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | JS_PATH=/home/jeemzz/acapp/game/static/js/ 4 | JS_PATH_DIST=${JS_PATH}dist/ 5 | JS_PATH_SRC=${JS_PATH}src/ 6 | 7 | find $JS_PATH_SRC -type f -name '*.js' | sort | xargs cat > ${JS_PATH_DIST}game.js 8 | 9 | echo yes | python3 manage.py collectstatic 10 | -------------------------------------------------------------------------------- /scripts/uwsgi.ini: -------------------------------------------------------------------------------- 1 | [uwsgi] 2 | socket = 127.0.0.1:8000 3 | chdir = /home/jeemzz/acapp 4 | wsgi-file = acapp/wsgi.py 5 | master = true 6 | processes = 2 7 | threads = 5 8 | vacuum = true 9 | -------------------------------------------------------------------------------- /static/admin/css/dashboard.css: -------------------------------------------------------------------------------- 1 | /* DASHBOARD */ 2 | 3 | .dashboard .module table th { 4 | width: 100%; 5 | } 6 | 7 | .dashboard .module table td { 8 | white-space: nowrap; 9 | } 10 | 11 | .dashboard .module table td a { 12 | display: block; 13 | padding-right: .6em; 14 | } 15 | 16 | /* RECENT ACTIONS MODULE */ 17 | 18 | .module ul.actionlist { 19 | margin-left: 0; 20 | } 21 | 22 | ul.actionlist li { 23 | list-style-type: none; 24 | overflow: hidden; 25 | text-overflow: ellipsis; 26 | } 27 | -------------------------------------------------------------------------------- /static/admin/css/fonts.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Roboto'; 3 | src: url('../fonts/Roboto-Bold-webfont.woff'); 4 | font-weight: 700; 5 | font-style: normal; 6 | } 7 | 8 | @font-face { 9 | font-family: 'Roboto'; 10 | src: url('../fonts/Roboto-Regular-webfont.woff'); 11 | font-weight: 400; 12 | font-style: normal; 13 | } 14 | 15 | @font-face { 16 | font-family: 'Roboto'; 17 | src: url('../fonts/Roboto-Light-webfont.woff'); 18 | font-weight: 300; 19 | font-style: normal; 20 | } 21 | -------------------------------------------------------------------------------- /static/admin/css/login.css: -------------------------------------------------------------------------------- 1 | /* LOGIN FORM */ 2 | 3 | .login { 4 | background: var(--darkened-bg); 5 | height: auto; 6 | } 7 | 8 | .login #header { 9 | height: auto; 10 | padding: 15px 16px; 11 | justify-content: center; 12 | } 13 | 14 | .login #header h1 { 15 | font-size: 18px; 16 | } 17 | 18 | .login #header h1 a { 19 | color: var(--header-link-color); 20 | } 21 | 22 | .login #content { 23 | padding: 20px 20px 0; 24 | } 25 | 26 | .login #container { 27 | background: var(--body-bg); 28 | border: 1px solid var(--hairline-color); 29 | border-radius: 4px; 30 | overflow: hidden; 31 | width: 28em; 32 | min-width: 300px; 33 | margin: 100px auto; 34 | height: auto; 35 | } 36 | 37 | .login .form-row { 38 | padding: 4px 0; 39 | } 40 | 41 | .login .form-row label { 42 | display: block; 43 | line-height: 2em; 44 | } 45 | 46 | .login .form-row #id_username, .login .form-row #id_password { 47 | padding: 8px; 48 | width: 100%; 49 | box-sizing: border-box; 50 | } 51 | 52 | .login .submit-row { 53 | padding: 1em 0 0 0; 54 | margin: 0; 55 | text-align: center; 56 | } 57 | 58 | .login .password-reset-link { 59 | text-align: center; 60 | } 61 | -------------------------------------------------------------------------------- /static/admin/css/nav_sidebar.css: -------------------------------------------------------------------------------- 1 | .sticky { 2 | position: sticky; 3 | top: 0; 4 | max-height: 100vh; 5 | } 6 | 7 | .toggle-nav-sidebar { 8 | z-index: 20; 9 | left: 0; 10 | display: flex; 11 | align-items: center; 12 | justify-content: center; 13 | flex: 0 0 23px; 14 | width: 23px; 15 | border: 0; 16 | border-right: 1px solid var(--hairline-color); 17 | background-color: var(--body-bg); 18 | cursor: pointer; 19 | font-size: 20px; 20 | color: var(--link-fg); 21 | padding: 0; 22 | } 23 | 24 | [dir="rtl"] .toggle-nav-sidebar { 25 | border-left: 1px solid var(--hairline-color); 26 | border-right: 0; 27 | } 28 | 29 | .toggle-nav-sidebar:hover, 30 | .toggle-nav-sidebar:focus { 31 | background-color: var(--darkened-bg); 32 | } 33 | 34 | #nav-sidebar { 35 | z-index: 15; 36 | flex: 0 0 275px; 37 | left: -276px; 38 | margin-left: -276px; 39 | border-top: 1px solid transparent; 40 | border-right: 1px solid var(--hairline-color); 41 | background-color: var(--body-bg); 42 | overflow: auto; 43 | } 44 | 45 | [dir="rtl"] #nav-sidebar { 46 | border-left: 1px solid var(--hairline-color); 47 | border-right: 0; 48 | left: 0; 49 | margin-left: 0; 50 | right: -276px; 51 | margin-right: -276px; 52 | } 53 | 54 | .toggle-nav-sidebar::before { 55 | content: '\00BB'; 56 | } 57 | 58 | .main.shifted .toggle-nav-sidebar::before { 59 | content: '\00AB'; 60 | } 61 | 62 | .main.shifted > #nav-sidebar { 63 | left: 24px; 64 | margin-left: 0; 65 | } 66 | 67 | [dir="rtl"] .main.shifted > #nav-sidebar { 68 | left: 0; 69 | right: 24px; 70 | margin-right: 0; 71 | } 72 | 73 | #nav-sidebar .module th { 74 | width: 100%; 75 | overflow-wrap: anywhere; 76 | } 77 | 78 | #nav-sidebar .module th, 79 | #nav-sidebar .module caption { 80 | padding-left: 16px; 81 | } 82 | 83 | #nav-sidebar .module td { 84 | white-space: nowrap; 85 | } 86 | 87 | [dir="rtl"] #nav-sidebar .module th, 88 | [dir="rtl"] #nav-sidebar .module caption { 89 | padding-left: 8px; 90 | padding-right: 16px; 91 | } 92 | 93 | #nav-sidebar .current-app .section:link, 94 | #nav-sidebar .current-app .section:visited { 95 | color: var(--header-color); 96 | font-weight: bold; 97 | } 98 | 99 | #nav-sidebar .current-model { 100 | background: var(--selected-row); 101 | } 102 | 103 | .main > #nav-sidebar + .content { 104 | max-width: calc(100% - 23px); 105 | } 106 | 107 | .main.shifted > #nav-sidebar + .content { 108 | max-width: calc(100% - 299px); 109 | } 110 | 111 | @media (max-width: 767px) { 112 | #nav-sidebar, #toggle-nav-sidebar { 113 | display: none; 114 | } 115 | 116 | .main > #nav-sidebar + .content, 117 | .main.shifted > #nav-sidebar + .content { 118 | max-width: 100%; 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /static/admin/css/responsive_rtl.css: -------------------------------------------------------------------------------- 1 | /* TABLETS */ 2 | 3 | @media (max-width: 1024px) { 4 | [dir="rtl"] .colMS { 5 | margin-right: 0; 6 | } 7 | 8 | [dir="rtl"] #user-tools { 9 | text-align: right; 10 | } 11 | 12 | [dir="rtl"] #changelist .actions label { 13 | padding-left: 10px; 14 | padding-right: 0; 15 | } 16 | 17 | [dir="rtl"] #changelist .actions select { 18 | margin-left: 0; 19 | margin-right: 15px; 20 | } 21 | 22 | [dir="rtl"] .change-list .filtered .results, 23 | [dir="rtl"] .change-list .filtered .paginator, 24 | [dir="rtl"] .filtered #toolbar, 25 | [dir="rtl"] .filtered div.xfull, 26 | [dir="rtl"] .filtered .actions, 27 | [dir="rtl"] #changelist-filter { 28 | margin-left: 0; 29 | } 30 | 31 | [dir="rtl"] .inline-group ul.tools a.add, 32 | [dir="rtl"] .inline-group div.add-row a, 33 | [dir="rtl"] .inline-group .tabular tr.add-row td a { 34 | padding: 8px 26px 8px 10px; 35 | background-position: calc(100% - 8px) 9px; 36 | } 37 | 38 | [dir="rtl"] .related-widget-wrapper-link + .selector { 39 | margin-right: 0; 40 | margin-left: 15px; 41 | } 42 | 43 | [dir="rtl"] .selector .selector-filter label { 44 | margin-right: 0; 45 | margin-left: 8px; 46 | } 47 | 48 | [dir="rtl"] .object-tools li { 49 | float: right; 50 | } 51 | 52 | [dir="rtl"] .object-tools li + li { 53 | margin-left: 0; 54 | margin-right: 15px; 55 | } 56 | 57 | [dir="rtl"] .dashboard .module table td a { 58 | padding-left: 0; 59 | padding-right: 16px; 60 | } 61 | } 62 | 63 | /* MOBILE */ 64 | 65 | @media (max-width: 767px) { 66 | [dir="rtl"] .aligned .related-lookup, 67 | [dir="rtl"] .aligned .datetimeshortcuts { 68 | margin-left: 0; 69 | margin-right: 15px; 70 | } 71 | 72 | [dir="rtl"] .aligned ul { 73 | margin-right: 0; 74 | } 75 | 76 | [dir="rtl"] #changelist-filter { 77 | margin-left: 0; 78 | margin-right: 0; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /static/admin/css/rtl.css: -------------------------------------------------------------------------------- 1 | /* GLOBAL */ 2 | 3 | th { 4 | text-align: right; 5 | } 6 | 7 | .module h2, .module caption { 8 | text-align: right; 9 | } 10 | 11 | .module ul, .module ol { 12 | margin-left: 0; 13 | margin-right: 1.5em; 14 | } 15 | 16 | .viewlink, .addlink, .changelink { 17 | padding-left: 0; 18 | padding-right: 16px; 19 | background-position: 100% 1px; 20 | } 21 | 22 | .deletelink { 23 | padding-left: 0; 24 | padding-right: 16px; 25 | background-position: 100% 1px; 26 | } 27 | 28 | .object-tools { 29 | float: left; 30 | } 31 | 32 | thead th:first-child, 33 | tfoot td:first-child { 34 | border-left: none; 35 | } 36 | 37 | /* LAYOUT */ 38 | 39 | #user-tools { 40 | right: auto; 41 | left: 0; 42 | text-align: left; 43 | } 44 | 45 | div.breadcrumbs { 46 | text-align: right; 47 | } 48 | 49 | #content-main { 50 | float: right; 51 | } 52 | 53 | #content-related { 54 | float: left; 55 | margin-left: -300px; 56 | margin-right: auto; 57 | } 58 | 59 | .colMS { 60 | margin-left: 300px; 61 | margin-right: 0; 62 | } 63 | 64 | /* SORTABLE TABLES */ 65 | 66 | table thead th.sorted .sortoptions { 67 | float: left; 68 | } 69 | 70 | thead th.sorted .text { 71 | padding-right: 0; 72 | padding-left: 42px; 73 | } 74 | 75 | /* dashboard styles */ 76 | 77 | .dashboard .module table td a { 78 | padding-left: .6em; 79 | padding-right: 16px; 80 | } 81 | 82 | /* changelists styles */ 83 | 84 | .change-list .filtered table { 85 | border-left: none; 86 | border-right: 0px none; 87 | } 88 | 89 | #changelist-filter { 90 | border-left: none; 91 | border-right: none; 92 | margin-left: 0; 93 | margin-right: 30px; 94 | } 95 | 96 | #changelist-filter li.selected { 97 | border-left: none; 98 | padding-left: 10px; 99 | margin-left: 0; 100 | border-right: 5px solid var(--hairline-color); 101 | padding-right: 10px; 102 | margin-right: -15px; 103 | } 104 | 105 | #changelist table tbody td:first-child, #changelist table tbody th:first-child { 106 | border-right: none; 107 | border-left: none; 108 | } 109 | 110 | /* FORMS */ 111 | 112 | .aligned label { 113 | padding: 0 0 3px 1em; 114 | float: right; 115 | } 116 | 117 | .submit-row { 118 | text-align: left 119 | } 120 | 121 | .submit-row p.deletelink-box { 122 | float: right; 123 | } 124 | 125 | .submit-row input.default { 126 | margin-left: 0; 127 | } 128 | 129 | .vDateField, .vTimeField { 130 | margin-left: 2px; 131 | } 132 | 133 | .aligned .form-row input { 134 | margin-left: 5px; 135 | } 136 | 137 | form .aligned p.help, form .aligned div.help { 138 | clear: right; 139 | } 140 | 141 | form .aligned ul { 142 | margin-right: 163px; 143 | margin-left: 0; 144 | } 145 | 146 | form ul.inline li { 147 | float: right; 148 | padding-right: 0; 149 | padding-left: 7px; 150 | } 151 | 152 | input[type=submit].default, .submit-row input.default { 153 | float: left; 154 | } 155 | 156 | fieldset .fieldBox { 157 | float: right; 158 | margin-left: 20px; 159 | margin-right: 0; 160 | } 161 | 162 | .errorlist li { 163 | background-position: 100% 12px; 164 | padding: 0; 165 | } 166 | 167 | .errornote { 168 | background-position: 100% 12px; 169 | padding: 10px 12px; 170 | } 171 | 172 | /* WIDGETS */ 173 | 174 | .calendarnav-previous { 175 | top: 0; 176 | left: auto; 177 | right: 10px; 178 | } 179 | 180 | .calendarnav-next { 181 | top: 0; 182 | right: auto; 183 | left: 10px; 184 | } 185 | 186 | .calendar caption, .calendarbox h2 { 187 | text-align: center; 188 | } 189 | 190 | .selector { 191 | float: right; 192 | } 193 | 194 | .selector .selector-filter { 195 | text-align: right; 196 | } 197 | 198 | .inline-deletelink { 199 | float: left; 200 | } 201 | 202 | form .form-row p.datetime { 203 | overflow: hidden; 204 | } 205 | 206 | .related-widget-wrapper { 207 | float: right; 208 | } 209 | 210 | /* MISC */ 211 | 212 | .inline-related h2, .inline-group h2 { 213 | text-align: right 214 | } 215 | 216 | .inline-related h3 span.delete { 217 | padding-right: 20px; 218 | padding-left: inherit; 219 | left: 10px; 220 | right: inherit; 221 | float:left; 222 | } 223 | 224 | .inline-related h3 span.delete label { 225 | margin-left: inherit; 226 | margin-right: 2px; 227 | } 228 | -------------------------------------------------------------------------------- /static/admin/css/vendor/select2/LICENSE-SELECT2.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2012-2017 Kevin Brown, Igor Vaynberg, and Select2 contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /static/admin/fonts/README.txt: -------------------------------------------------------------------------------- 1 | Roboto webfont source: https://www.google.com/fonts/specimen/Roboto 2 | WOFF files extracted using https://github.com/majodev/google-webfonts-helper 3 | Weights used in this project: Light (300), Regular (400), Bold (700) 4 | -------------------------------------------------------------------------------- /static/admin/fonts/Roboto-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/static/admin/fonts/Roboto-Bold-webfont.woff -------------------------------------------------------------------------------- /static/admin/fonts/Roboto-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/static/admin/fonts/Roboto-Light-webfont.woff -------------------------------------------------------------------------------- /static/admin/fonts/Roboto-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/static/admin/fonts/Roboto-Regular-webfont.woff -------------------------------------------------------------------------------- /static/admin/img/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Code Charm Ltd 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /static/admin/img/README.txt: -------------------------------------------------------------------------------- 1 | All icons are taken from Font Awesome (http://fontawesome.io/) project. 2 | The Font Awesome font is licensed under the SIL OFL 1.1: 3 | - https://scripts.sil.org/OFL 4 | 5 | SVG icons source: https://github.com/encharm/Font-Awesome-SVG-PNG 6 | Font-Awesome-SVG-PNG is licensed under the MIT license (see file license 7 | in current folder). 8 | -------------------------------------------------------------------------------- /static/admin/img/calendar-icons.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /static/admin/img/gis/move_vertex_off.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/admin/img/gis/move_vertex_on.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/admin/img/icon-addlink.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/icon-alert.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/icon-calendar.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /static/admin/img/icon-changelink.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/icon-clock.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /static/admin/img/icon-deletelink.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/icon-no.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/icon-unknown-alt.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/icon-unknown.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/icon-viewlink.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/icon-yes.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/inline-delete.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/search.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/selector-icons.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /static/admin/img/sorting-icons.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /static/admin/img/tooltag-add.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/img/tooltag-arrowright.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/admin/js/SelectBox.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | { 3 | const SelectBox = { 4 | cache: {}, 5 | init: function(id) { 6 | const box = document.getElementById(id); 7 | SelectBox.cache[id] = []; 8 | const cache = SelectBox.cache[id]; 9 | for (const node of box.options) { 10 | cache.push({value: node.value, text: node.text, displayed: 1}); 11 | } 12 | }, 13 | redisplay: function(id) { 14 | // Repopulate HTML select box from cache 15 | const box = document.getElementById(id); 16 | const scroll_value_from_top = box.scrollTop; 17 | box.innerHTML = ''; 18 | for (const node of SelectBox.cache[id]) { 19 | if (node.displayed) { 20 | const new_option = new Option(node.text, node.value, false, false); 21 | // Shows a tooltip when hovering over the option 22 | new_option.title = node.text; 23 | box.appendChild(new_option); 24 | } 25 | } 26 | box.scrollTop = scroll_value_from_top; 27 | }, 28 | filter: function(id, text) { 29 | // Redisplay the HTML select box, displaying only the choices containing ALL 30 | // the words in text. (It's an AND search.) 31 | const tokens = text.toLowerCase().split(/\s+/); 32 | for (const node of SelectBox.cache[id]) { 33 | node.displayed = 1; 34 | const node_text = node.text.toLowerCase(); 35 | for (const token of tokens) { 36 | if (!node_text.includes(token)) { 37 | node.displayed = 0; 38 | break; // Once the first token isn't found we're done 39 | } 40 | } 41 | } 42 | SelectBox.redisplay(id); 43 | }, 44 | delete_from_cache: function(id, value) { 45 | let delete_index = null; 46 | const cache = SelectBox.cache[id]; 47 | for (const [i, node] of cache.entries()) { 48 | if (node.value === value) { 49 | delete_index = i; 50 | break; 51 | } 52 | } 53 | cache.splice(delete_index, 1); 54 | }, 55 | add_to_cache: function(id, option) { 56 | SelectBox.cache[id].push({value: option.value, text: option.text, displayed: 1}); 57 | }, 58 | cache_contains: function(id, value) { 59 | // Check if an item is contained in the cache 60 | for (const node of SelectBox.cache[id]) { 61 | if (node.value === value) { 62 | return true; 63 | } 64 | } 65 | return false; 66 | }, 67 | move: function(from, to) { 68 | const from_box = document.getElementById(from); 69 | for (const option of from_box.options) { 70 | const option_value = option.value; 71 | if (option.selected && SelectBox.cache_contains(from, option_value)) { 72 | SelectBox.add_to_cache(to, {value: option_value, text: option.text, displayed: 1}); 73 | SelectBox.delete_from_cache(from, option_value); 74 | } 75 | } 76 | SelectBox.redisplay(from); 77 | SelectBox.redisplay(to); 78 | }, 79 | move_all: function(from, to) { 80 | const from_box = document.getElementById(from); 81 | for (const option of from_box.options) { 82 | const option_value = option.value; 83 | if (SelectBox.cache_contains(from, option_value)) { 84 | SelectBox.add_to_cache(to, {value: option_value, text: option.text, displayed: 1}); 85 | SelectBox.delete_from_cache(from, option_value); 86 | } 87 | } 88 | SelectBox.redisplay(from); 89 | SelectBox.redisplay(to); 90 | }, 91 | sort: function(id) { 92 | SelectBox.cache[id].sort(function(a, b) { 93 | a = a.text.toLowerCase(); 94 | b = b.text.toLowerCase(); 95 | if (a > b) { 96 | return 1; 97 | } 98 | if (a < b) { 99 | return -1; 100 | } 101 | return 0; 102 | } ); 103 | }, 104 | select_all: function(id) { 105 | const box = document.getElementById(id); 106 | for (const option of box.options) { 107 | option.selected = true; 108 | } 109 | } 110 | }; 111 | window.SelectBox = SelectBox; 112 | } 113 | -------------------------------------------------------------------------------- /static/admin/js/autocomplete.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | { 3 | const $ = django.jQuery; 4 | const init = function($element, options) { 5 | const settings = $.extend({ 6 | ajax: { 7 | data: function(params) { 8 | return { 9 | term: params.term, 10 | page: params.page, 11 | app_label: $element.data('app-label'), 12 | model_name: $element.data('model-name'), 13 | field_name: $element.data('field-name') 14 | }; 15 | } 16 | } 17 | }, options); 18 | $element.select2(settings); 19 | }; 20 | 21 | $.fn.djangoAdminSelect2 = function(options) { 22 | const settings = $.extend({}, options); 23 | $.each(this, function(i, element) { 24 | const $element = $(element); 25 | init($element, settings); 26 | }); 27 | return this; 28 | }; 29 | 30 | $(function() { 31 | // Initialize all autocomplete widgets except the one in the template 32 | // form used when a new formset is added. 33 | $('.admin-autocomplete').not('[name*=__prefix__]').djangoAdminSelect2(); 34 | }); 35 | 36 | $(document).on('formset:added', (function() { 37 | return function(event, $newFormset) { 38 | return $newFormset.find('.admin-autocomplete').djangoAdminSelect2(); 39 | }; 40 | })(this)); 41 | } 42 | -------------------------------------------------------------------------------- /static/admin/js/cancel.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | { 3 | // Call function fn when the DOM is loaded and ready. If it is already 4 | // loaded, call the function now. 5 | // http://youmightnotneedjquery.com/#ready 6 | function ready(fn) { 7 | if (document.readyState !== 'loading') { 8 | fn(); 9 | } else { 10 | document.addEventListener('DOMContentLoaded', fn); 11 | } 12 | } 13 | 14 | ready(function() { 15 | function handleClick(event) { 16 | event.preventDefault(); 17 | const params = new URLSearchParams(window.location.search); 18 | if (params.has('_popup')) { 19 | window.close(); // Close the popup. 20 | } else { 21 | window.history.back(); // Otherwise, go back. 22 | } 23 | } 24 | 25 | document.querySelectorAll('.cancel-link').forEach(function(el) { 26 | el.addEventListener('click', handleClick); 27 | }); 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /static/admin/js/change_form.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | { 3 | const inputTags = ['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA']; 4 | const modelName = document.getElementById('django-admin-form-add-constants').dataset.modelName; 5 | if (modelName) { 6 | const form = document.getElementById(modelName + '_form'); 7 | for (const element of form.elements) { 8 | // HTMLElement.offsetParent returns null when the element is not 9 | // rendered. 10 | if (inputTags.includes(element.tagName) && !element.disabled && element.offsetParent) { 11 | element.focus(); 12 | break; 13 | } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /static/admin/js/collapse.js: -------------------------------------------------------------------------------- 1 | /*global gettext*/ 2 | 'use strict'; 3 | { 4 | window.addEventListener('load', function() { 5 | // Add anchor tag for Show/Hide link 6 | const fieldsets = document.querySelectorAll('fieldset.collapse'); 7 | for (const [i, elem] of fieldsets.entries()) { 8 | // Don't hide if fields in this fieldset have errors 9 | if (elem.querySelectorAll('div.errors, ul.errorlist').length === 0) { 10 | elem.classList.add('collapsed'); 11 | const h2 = elem.querySelector('h2'); 12 | const link = document.createElement('a'); 13 | link.id = 'fieldsetcollapser' + i; 14 | link.className = 'collapse-toggle'; 15 | link.href = '#'; 16 | link.textContent = gettext('Show'); 17 | h2.appendChild(document.createTextNode(' (')); 18 | h2.appendChild(link); 19 | h2.appendChild(document.createTextNode(')')); 20 | } 21 | } 22 | // Add toggle to hide/show anchor tag 23 | const toggleFunc = function(ev) { 24 | if (ev.target.matches('.collapse-toggle')) { 25 | ev.preventDefault(); 26 | ev.stopPropagation(); 27 | const fieldset = ev.target.closest('fieldset'); 28 | if (fieldset.classList.contains('collapsed')) { 29 | // Show 30 | ev.target.textContent = gettext('Hide'); 31 | fieldset.classList.remove('collapsed'); 32 | } else { 33 | // Hide 34 | ev.target.textContent = gettext('Show'); 35 | fieldset.classList.add('collapsed'); 36 | } 37 | } 38 | }; 39 | document.querySelectorAll('fieldset.module').forEach(function(el) { 40 | el.addEventListener('click', toggleFunc); 41 | }); 42 | }); 43 | } 44 | -------------------------------------------------------------------------------- /static/admin/js/core.js: -------------------------------------------------------------------------------- 1 | // Core javascript helper functions 2 | 'use strict'; 3 | 4 | // quickElement(tagType, parentReference [, textInChildNode, attribute, attributeValue ...]); 5 | function quickElement() { 6 | const obj = document.createElement(arguments[0]); 7 | if (arguments[2]) { 8 | const textNode = document.createTextNode(arguments[2]); 9 | obj.appendChild(textNode); 10 | } 11 | const len = arguments.length; 12 | for (let i = 3; i < len; i += 2) { 13 | obj.setAttribute(arguments[i], arguments[i + 1]); 14 | } 15 | arguments[1].appendChild(obj); 16 | return obj; 17 | } 18 | 19 | // "a" is reference to an object 20 | function removeChildren(a) { 21 | while (a.hasChildNodes()) { 22 | a.removeChild(a.lastChild); 23 | } 24 | } 25 | 26 | // ---------------------------------------------------------------------------- 27 | // Find-position functions by PPK 28 | // See https://www.quirksmode.org/js/findpos.html 29 | // ---------------------------------------------------------------------------- 30 | function findPosX(obj) { 31 | let curleft = 0; 32 | if (obj.offsetParent) { 33 | while (obj.offsetParent) { 34 | curleft += obj.offsetLeft - obj.scrollLeft; 35 | obj = obj.offsetParent; 36 | } 37 | } else if (obj.x) { 38 | curleft += obj.x; 39 | } 40 | return curleft; 41 | } 42 | 43 | function findPosY(obj) { 44 | let curtop = 0; 45 | if (obj.offsetParent) { 46 | while (obj.offsetParent) { 47 | curtop += obj.offsetTop - obj.scrollTop; 48 | obj = obj.offsetParent; 49 | } 50 | } else if (obj.y) { 51 | curtop += obj.y; 52 | } 53 | return curtop; 54 | } 55 | 56 | //----------------------------------------------------------------------------- 57 | // Date object extensions 58 | // ---------------------------------------------------------------------------- 59 | { 60 | Date.prototype.getTwelveHours = function() { 61 | return this.getHours() % 12 || 12; 62 | }; 63 | 64 | Date.prototype.getTwoDigitMonth = function() { 65 | return (this.getMonth() < 9) ? '0' + (this.getMonth() + 1) : (this.getMonth() + 1); 66 | }; 67 | 68 | Date.prototype.getTwoDigitDate = function() { 69 | return (this.getDate() < 10) ? '0' + this.getDate() : this.getDate(); 70 | }; 71 | 72 | Date.prototype.getTwoDigitTwelveHour = function() { 73 | return (this.getTwelveHours() < 10) ? '0' + this.getTwelveHours() : this.getTwelveHours(); 74 | }; 75 | 76 | Date.prototype.getTwoDigitHour = function() { 77 | return (this.getHours() < 10) ? '0' + this.getHours() : this.getHours(); 78 | }; 79 | 80 | Date.prototype.getTwoDigitMinute = function() { 81 | return (this.getMinutes() < 10) ? '0' + this.getMinutes() : this.getMinutes(); 82 | }; 83 | 84 | Date.prototype.getTwoDigitSecond = function() { 85 | return (this.getSeconds() < 10) ? '0' + this.getSeconds() : this.getSeconds(); 86 | }; 87 | 88 | Date.prototype.getAbbrevMonthName = function() { 89 | return typeof window.CalendarNamespace === "undefined" 90 | ? this.getTwoDigitMonth() 91 | : window.CalendarNamespace.monthsOfYearAbbrev[this.getMonth()]; 92 | }; 93 | 94 | Date.prototype.getFullMonthName = function() { 95 | return typeof window.CalendarNamespace === "undefined" 96 | ? this.getTwoDigitMonth() 97 | : window.CalendarNamespace.monthsOfYear[this.getMonth()]; 98 | }; 99 | 100 | Date.prototype.strftime = function(format) { 101 | const fields = { 102 | b: this.getAbbrevMonthName(), 103 | B: this.getFullMonthName(), 104 | c: this.toString(), 105 | d: this.getTwoDigitDate(), 106 | H: this.getTwoDigitHour(), 107 | I: this.getTwoDigitTwelveHour(), 108 | m: this.getTwoDigitMonth(), 109 | M: this.getTwoDigitMinute(), 110 | p: (this.getHours() >= 12) ? 'PM' : 'AM', 111 | S: this.getTwoDigitSecond(), 112 | w: '0' + this.getDay(), 113 | x: this.toLocaleDateString(), 114 | X: this.toLocaleTimeString(), 115 | y: ('' + this.getFullYear()).substr(2, 4), 116 | Y: '' + this.getFullYear(), 117 | '%': '%' 118 | }; 119 | let result = '', i = 0; 120 | while (i < format.length) { 121 | if (format.charAt(i) === '%') { 122 | result = result + fields[format.charAt(i + 1)]; 123 | ++i; 124 | } 125 | else { 126 | result = result + format.charAt(i); 127 | } 128 | ++i; 129 | } 130 | return result; 131 | }; 132 | 133 | // ---------------------------------------------------------------------------- 134 | // String object extensions 135 | // ---------------------------------------------------------------------------- 136 | String.prototype.strptime = function(format) { 137 | const split_format = format.split(/[.\-/]/); 138 | const date = this.split(/[.\-/]/); 139 | let i = 0; 140 | let day, month, year; 141 | while (i < split_format.length) { 142 | switch (split_format[i]) { 143 | case "%d": 144 | day = date[i]; 145 | break; 146 | case "%m": 147 | month = date[i] - 1; 148 | break; 149 | case "%Y": 150 | year = date[i]; 151 | break; 152 | case "%y": 153 | // A %y value in the range of [00, 68] is in the current 154 | // century, while [69, 99] is in the previous century, 155 | // according to the Open Group Specification. 156 | if (parseInt(date[i], 10) >= 69) { 157 | year = date[i]; 158 | } else { 159 | year = (new Date(Date.UTC(date[i], 0))).getUTCFullYear() + 100; 160 | } 161 | break; 162 | } 163 | ++i; 164 | } 165 | // Create Date object from UTC since the parsed value is supposed to be 166 | // in UTC, not local time. Also, the calendar uses UTC functions for 167 | // date extraction. 168 | return new Date(Date.UTC(year, month, day)); 169 | }; 170 | } 171 | -------------------------------------------------------------------------------- /static/admin/js/jquery.init.js: -------------------------------------------------------------------------------- 1 | /*global jQuery:false*/ 2 | 'use strict'; 3 | /* Puts the included jQuery into our own namespace using noConflict and passing 4 | * it 'true'. This ensures that the included jQuery doesn't pollute the global 5 | * namespace (i.e. this preserves pre-existing values for both window.$ and 6 | * window.jQuery). 7 | */ 8 | window.django = {jQuery: jQuery.noConflict(true)}; 9 | -------------------------------------------------------------------------------- /static/admin/js/nav_sidebar.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | { 3 | const toggleNavSidebar = document.getElementById('toggle-nav-sidebar'); 4 | if (toggleNavSidebar !== null) { 5 | const navLinks = document.querySelectorAll('#nav-sidebar a'); 6 | function disableNavLinkTabbing() { 7 | for (const navLink of navLinks) { 8 | navLink.tabIndex = -1; 9 | } 10 | } 11 | function enableNavLinkTabbing() { 12 | for (const navLink of navLinks) { 13 | navLink.tabIndex = 0; 14 | } 15 | } 16 | 17 | const main = document.getElementById('main'); 18 | let navSidebarIsOpen = localStorage.getItem('django.admin.navSidebarIsOpen'); 19 | if (navSidebarIsOpen === null) { 20 | navSidebarIsOpen = 'true'; 21 | } 22 | if (navSidebarIsOpen === 'false') { 23 | disableNavLinkTabbing(); 24 | } 25 | main.classList.toggle('shifted', navSidebarIsOpen === 'true'); 26 | 27 | toggleNavSidebar.addEventListener('click', function() { 28 | if (navSidebarIsOpen === 'true') { 29 | navSidebarIsOpen = 'false'; 30 | disableNavLinkTabbing(); 31 | } else { 32 | navSidebarIsOpen = 'true'; 33 | enableNavLinkTabbing(); 34 | } 35 | localStorage.setItem('django.admin.navSidebarIsOpen', navSidebarIsOpen); 36 | main.classList.toggle('shifted'); 37 | }); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /static/admin/js/popup_response.js: -------------------------------------------------------------------------------- 1 | /*global opener */ 2 | 'use strict'; 3 | { 4 | const initData = JSON.parse(document.getElementById('django-admin-popup-response-constants').dataset.popupResponse); 5 | switch(initData.action) { 6 | case 'change': 7 | opener.dismissChangeRelatedObjectPopup(window, initData.value, initData.obj, initData.new_value); 8 | break; 9 | case 'delete': 10 | opener.dismissDeleteRelatedObjectPopup(window, initData.value); 11 | break; 12 | default: 13 | opener.dismissAddRelatedObjectPopup(window, initData.value, initData.obj); 14 | break; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /static/admin/js/prepopulate.js: -------------------------------------------------------------------------------- 1 | /*global URLify*/ 2 | 'use strict'; 3 | { 4 | const $ = django.jQuery; 5 | $.fn.prepopulate = function(dependencies, maxLength, allowUnicode) { 6 | /* 7 | Depends on urlify.js 8 | Populates a selected field with the values of the dependent fields, 9 | URLifies and shortens the string. 10 | dependencies - array of dependent fields ids 11 | maxLength - maximum length of the URLify'd string 12 | allowUnicode - Unicode support of the URLify'd string 13 | */ 14 | return this.each(function() { 15 | const prepopulatedField = $(this); 16 | 17 | const populate = function() { 18 | // Bail if the field's value has been changed by the user 19 | if (prepopulatedField.data('_changed')) { 20 | return; 21 | } 22 | 23 | const values = []; 24 | $.each(dependencies, function(i, field) { 25 | field = $(field); 26 | if (field.val().length > 0) { 27 | values.push(field.val()); 28 | } 29 | }); 30 | prepopulatedField.val(URLify(values.join(' '), maxLength, allowUnicode)); 31 | }; 32 | 33 | prepopulatedField.data('_changed', false); 34 | prepopulatedField.on('change', function() { 35 | prepopulatedField.data('_changed', true); 36 | }); 37 | 38 | if (!prepopulatedField.val()) { 39 | $(dependencies.join(',')).on('keyup change focus', populate); 40 | } 41 | }); 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /static/admin/js/prepopulate_init.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | { 3 | const $ = django.jQuery; 4 | const fields = $('#django-admin-prepopulated-fields-constants').data('prepopulatedFields'); 5 | $.each(fields, function(index, field) { 6 | $('.empty-form .form-row .field-' + field.name + ', .empty-form.form-row .field-' + field.name).addClass('prepopulated_field'); 7 | $(field.id).data('dependency_list', field.dependency_list).prepopulate( 8 | field.dependency_ids, field.maxLength, field.allowUnicode 9 | ); 10 | }); 11 | } 12 | -------------------------------------------------------------------------------- /static/admin/js/vendor/jquery/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright JS Foundation and other contributors, https://js.foundation/ 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2012-2017 Kevin Brown, Igor Vaynberg, and Select2 contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/af.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/af",[],function(){return{errorLoading:function(){return"Die resultate kon nie gelaai word nie."},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Verwyders asseblief "+n+" character";return 1!=n&&(r+="s"),r},inputTooShort:function(e){return"Voer asseblief "+(e.minimum-e.input.length)+" of meer karakters"},loadingMore:function(){return"Meer resultate word gelaai…"},maximumSelected:function(e){var n="Kies asseblief net "+e.maximum+" item";return 1!=e.maximum&&(n+="s"),n},noResults:function(){return"Geen resultate gevind"},searching:function(){return"Besig…"},removeAllItems:function(){return"Verwyder alle items"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/ar.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ar",[],function(){return{errorLoading:function(){return"لا يمكن تحميل النتائج"},inputTooLong:function(n){return"الرجاء حذف "+(n.input.length-n.maximum)+" عناصر"},inputTooShort:function(n){return"الرجاء إضافة "+(n.minimum-n.input.length)+" عناصر"},loadingMore:function(){return"جاري تحميل نتائج إضافية..."},maximumSelected:function(n){return"تستطيع إختيار "+n.maximum+" بنود فقط"},noResults:function(){return"لم يتم العثور على أي نتائج"},searching:function(){return"جاري البحث…"},removeAllItems:function(){return"قم بإزالة كل العناصر"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/az.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/az",[],function(){return{inputTooLong:function(n){return n.input.length-n.maximum+" simvol silin"},inputTooShort:function(n){return n.minimum-n.input.length+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(n){return"Sadəcə "+n.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"},removeAllItems:function(){return"Bütün elementləri sil"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/bg.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/bg",[],function(){return{inputTooLong:function(n){var e=n.input.length-n.maximum,u="Моля въведете с "+e+" по-малко символ";return e>1&&(u+="a"),u},inputTooShort:function(n){var e=n.minimum-n.input.length,u="Моля въведете още "+e+" символ";return e>1&&(u+="a"),u},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(n){var e="Можете да направите до "+n.maximum+" ";return n.maximum>1?e+="избора":e+="избор",e},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"},removeAllItems:function(){return"Премахнете всички елементи"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/bn.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/bn",[],function(){return{errorLoading:function(){return"ফলাফলগুলি লোড করা যায়নি।"},inputTooLong:function(n){var e=n.input.length-n.maximum,u="অনুগ্রহ করে "+e+" টি অক্ষর মুছে দিন।";return 1!=e&&(u="অনুগ্রহ করে "+e+" টি অক্ষর মুছে দিন।"),u},inputTooShort:function(n){return n.minimum-n.input.length+" টি অক্ষর অথবা অধিক অক্ষর লিখুন।"},loadingMore:function(){return"আরো ফলাফল লোড হচ্ছে ..."},maximumSelected:function(n){var e=n.maximum+" টি আইটেম নির্বাচন করতে পারবেন।";return 1!=n.maximum&&(e=n.maximum+" টি আইটেম নির্বাচন করতে পারবেন।"),e},noResults:function(){return"কোন ফলাফল পাওয়া যায়নি।"},searching:function(){return"অনুসন্ধান করা হচ্ছে ..."}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/bs.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/bs",[],function(){function e(e,n,r,t){return e%10==1&&e%100!=11?n:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?r:t}return{errorLoading:function(){return"Preuzimanje nije uspijelo."},inputTooLong:function(n){var r=n.input.length-n.maximum,t="Obrišite "+r+" simbol";return t+=e(r,"","a","a")},inputTooShort:function(n){var r=n.minimum-n.input.length,t="Ukucajte bar još "+r+" simbol";return t+=e(r,"","a","a")},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(n){var r="Možete izabrati samo "+n.maximum+" stavk";return r+=e(n.maximum,"u","e","i")},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"},removeAllItems:function(){return"Uklonite sve stavke"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/ca.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Si us plau, elimina "+n+" car";return r+=1==n?"àcter":"àcters"},inputTooShort:function(e){var n=e.minimum-e.input.length,r="Si us plau, introdueix "+n+" car";return r+=1==n?"àcter":"àcters"},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var n="Només es pot seleccionar "+e.maximum+" element";return 1!=e.maximum&&(n+="s"),n},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"},removeAllItems:function(){return"Treu tots els elements"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/cs.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/cs",[],function(){function e(e,n){switch(e){case 2:return n?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(n){var t=n.input.length-n.maximum;return 1==t?"Prosím, zadejte o jeden znak méně.":t<=4?"Prosím, zadejte o "+e(t,!0)+" znaky méně.":"Prosím, zadejte o "+t+" znaků méně."},inputTooShort:function(n){var t=n.minimum-n.input.length;return 1==t?"Prosím, zadejte ještě jeden znak.":t<=4?"Prosím, zadejte ještě další "+e(t,!0)+" znaky.":"Prosím, zadejte ještě dalších "+t+" znaků."},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(n){var t=n.maximum;return 1==t?"Můžete zvolit jen jednu položku.":t<=4?"Můžete zvolit maximálně "+e(t,!1)+" položky.":"Můžete zvolit maximálně "+t+" položek."},noResults:function(){return"Nenalezeny žádné položky."},searching:function(){return"Vyhledávání…"},removeAllItems:function(){return"Odstraňte všechny položky"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/da.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){return"Angiv venligst "+(e.input.length-e.maximum)+" tegn mindre"},inputTooShort:function(e){return"Angiv venligst "+(e.minimum-e.input.length)+" tegn mere"},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var n="Du kan kun vælge "+e.maximum+" emne";return 1!=e.maximum&&(n+="r"),n},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"},removeAllItems:function(){return"Fjern alle elementer"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/de.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/de",[],function(){return{errorLoading:function(){return"Die Ergebnisse konnten nicht geladen werden."},inputTooLong:function(e){return"Bitte "+(e.input.length-e.maximum)+" Zeichen weniger eingeben"},inputTooShort:function(e){return"Bitte "+(e.minimum-e.input.length)+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var n="Sie können nur "+e.maximum+" Element";return 1!=e.maximum&&(n+="e"),n+=" auswählen"},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"},removeAllItems:function(){return"Entferne alle Elemente"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/dsb.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/dsb",[],function(){var n=["znamuško","znamušce","znamuška","znamuškow"],e=["zapisk","zapiska","zapiski","zapiskow"],u=function(n,e){return 1===n?e[0]:2===n?e[1]:n>2&&n<=4?e[2]:n>=5?e[3]:void 0};return{errorLoading:function(){return"Wuslědki njejsu se dali zacytaś."},inputTooLong:function(e){var a=e.input.length-e.maximum;return"Pšosym lašuj "+a+" "+u(a,n)},inputTooShort:function(e){var a=e.minimum-e.input.length;return"Pšosym zapódaj nanejmjenjej "+a+" "+u(a,n)},loadingMore:function(){return"Dalšne wuslědki se zacytaju…"},maximumSelected:function(n){return"Móžoš jano "+n.maximum+" "+u(n.maximum,e)+"wubraś."},noResults:function(){return"Žedne wuslědki namakane"},searching:function(){return"Pyta se…"},removeAllItems:function(){return"Remove all items"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/el.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/el",[],function(){return{errorLoading:function(){return"Τα αποτελέσματα δεν μπόρεσαν να φορτώσουν."},inputTooLong:function(n){var e=n.input.length-n.maximum,u="Παρακαλώ διαγράψτε "+e+" χαρακτήρ";return 1==e&&(u+="α"),1!=e&&(u+="ες"),u},inputTooShort:function(n){return"Παρακαλώ συμπληρώστε "+(n.minimum-n.input.length)+" ή περισσότερους χαρακτήρες"},loadingMore:function(){return"Φόρτωση περισσότερων αποτελεσμάτων…"},maximumSelected:function(n){var e="Μπορείτε να επιλέξετε μόνο "+n.maximum+" επιλογ";return 1==n.maximum&&(e+="ή"),1!=n.maximum&&(e+="ές"),e},noResults:function(){return"Δεν βρέθηκαν αποτελέσματα"},searching:function(){return"Αναζήτηση…"},removeAllItems:function(){return"Καταργήστε όλα τα στοιχεία"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/en.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Please delete "+n+" character";return 1!=n&&(r+="s"),r},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var n="You can only select "+e.maximum+" item";return 1!=e.maximum&&(n+="s"),n},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/es.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"No se pudieron cargar los resultados"},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Por favor, elimine "+n+" car";return r+=1==n?"ácter":"acteres"},inputTooShort:function(e){var n=e.minimum-e.input.length,r="Por favor, introduzca "+n+" car";return r+=1==n?"ácter":"acteres"},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var n="Sólo puede seleccionar "+e.maximum+" elemento";return 1!=e.maximum&&(n+="s"),n},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Eliminar todos los elementos"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/et.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var n=e.input.length-e.maximum,t="Sisesta "+n+" täht";return 1!=n&&(t+="e"),t+=" vähem"},inputTooShort:function(e){var n=e.minimum-e.input.length,t="Sisesta "+n+" täht";return 1!=n&&(t+="e"),t+=" rohkem"},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var n="Saad vaid "+e.maximum+" tulemus";return 1==e.maximum?n+="e":n+="t",n+=" valida"},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"},removeAllItems:function(){return"Eemalda kõik esemed"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/eu.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return n+=1==t?"karaktere bat":t+" karaktere",n+=" gutxiago"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return n+=1==t?"karaktere bat":t+" karaktere",n+=" gehiago"},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return 1===e.maximum?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"},removeAllItems:function(){return"Kendu elementu guztiak"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/fa.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(n){return"لطفاً "+(n.input.length-n.maximum)+" کاراکتر را حذف نمایید"},inputTooShort:function(n){return"لطفاً تعداد "+(n.minimum-n.input.length)+" کاراکتر یا بیشتر وارد نمایید"},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(n){return"شما تنها می‌توانید "+n.maximum+" آیتم را انتخاب نمایید"},noResults:function(){return"هیچ نتیجه‌ای یافت نشد"},searching:function(){return"در حال جستجو..."},removeAllItems:function(){return"همه موارد را حذف کنید"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/fi.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/fi",[],function(){return{errorLoading:function(){return"Tuloksia ei saatu ladattua."},inputTooLong:function(n){return"Ole hyvä ja anna "+(n.input.length-n.maximum)+" merkkiä vähemmän"},inputTooShort:function(n){return"Ole hyvä ja anna "+(n.minimum-n.input.length)+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(n){return"Voit valita ainoastaan "+n.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){return"Haetaan…"},removeAllItems:function(){return"Poista kaikki kohteet"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/fr.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var n=e.input.length-e.maximum;return"Supprimez "+n+" caractère"+(n>1?"s":"")},inputTooShort:function(e){var n=e.minimum-e.input.length;return"Saisissez au moins "+n+" caractère"+(n>1?"s":"")},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){return"Vous pouvez seulement sélectionner "+e.maximum+" élément"+(e.maximum>1?"s":"")},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"},removeAllItems:function(){return"Supprimer tous les éléments"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/gl.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/gl",[],function(){return{errorLoading:function(){return"Non foi posíbel cargar os resultados."},inputTooLong:function(e){var n=e.input.length-e.maximum;return 1===n?"Elimine un carácter":"Elimine "+n+" caracteres"},inputTooShort:function(e){var n=e.minimum-e.input.length;return 1===n?"Engada un carácter":"Engada "+n+" caracteres"},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){return 1===e.maximum?"Só pode seleccionar un elemento":"Só pode seleccionar "+e.maximum+" elementos"},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Elimina todos os elementos"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/he.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(n){var e=n.input.length-n.maximum,r="נא למחוק ";return r+=1===e?"תו אחד":e+" תווים"},inputTooShort:function(n){var e=n.minimum-n.input.length,r="נא להכניס ";return r+=1===e?"תו אחד":e+" תווים",r+=" או יותר"},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(n){var e="באפשרותך לבחור עד ";return 1===n.maximum?e+="פריט אחד":e+=n.maximum+" פריטים",e},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"},removeAllItems:function(){return"הסר את כל הפריטים"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/hi.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(n){var e=n.input.length-n.maximum,r=e+" अक्षर को हटा दें";return e>1&&(r=e+" अक्षरों को हटा दें "),r},inputTooShort:function(n){return"कृपया "+(n.minimum-n.input.length)+" या अधिक अक्षर दर्ज करें"},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(n){return"आप केवल "+n.maximum+" आइटम का चयन कर सकते हैं"},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."},removeAllItems:function(){return"सभी वस्तुओं को हटा दें"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/hr.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/hr",[],function(){function n(n){var e=" "+n+" znak";return n%10<5&&n%10>0&&(n%100<5||n%100>19)?n%10>1&&(e+="a"):e+="ova",e}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(e){return"Unesite "+n(e.input.length-e.maximum)},inputTooShort:function(e){return"Unesite još "+n(e.minimum-e.input.length)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(n){return"Maksimalan broj odabranih stavki je "+n.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"},removeAllItems:function(){return"Ukloni sve stavke"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/hsb.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/hsb",[],function(){var n=["znamješko","znamješce","znamješka","znamješkow"],e=["zapisk","zapiskaj","zapiski","zapiskow"],u=function(n,e){return 1===n?e[0]:2===n?e[1]:n>2&&n<=4?e[2]:n>=5?e[3]:void 0};return{errorLoading:function(){return"Wuslědki njedachu so začitać."},inputTooLong:function(e){var a=e.input.length-e.maximum;return"Prošu zhašej "+a+" "+u(a,n)},inputTooShort:function(e){var a=e.minimum-e.input.length;return"Prošu zapodaj znajmjeńša "+a+" "+u(a,n)},loadingMore:function(){return"Dalše wuslědki so začitaja…"},maximumSelected:function(n){return"Móžeš jenož "+n.maximum+" "+u(n.maximum,e)+"wubrać"},noResults:function(){return"Žane wuslědki namakane"},searching:function(){return"Pyta so…"},removeAllItems:function(){return"Remove all items"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/hu.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/hu",[],function(){return{errorLoading:function(){return"Az eredmények betöltése nem sikerült."},inputTooLong:function(e){return"Túl hosszú. "+(e.input.length-e.maximum)+" karakterrel több, mint kellene."},inputTooShort:function(e){return"Túl rövid. Még "+(e.minimum-e.input.length)+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"},removeAllItems:function(){return"Távolítson el minden elemet"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/hy.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/hy",[],function(){return{errorLoading:function(){return"Արդյունքները հնարավոր չէ բեռնել։"},inputTooLong:function(n){return"Խնդրում ենք հեռացնել "+(n.input.length-n.maximum)+" նշան"},inputTooShort:function(n){return"Խնդրում ենք մուտքագրել "+(n.minimum-n.input.length)+" կամ ավել նշաններ"},loadingMore:function(){return"Բեռնվում են նոր արդյունքներ․․․"},maximumSelected:function(n){return"Դուք կարող եք ընտրել առավելագույնը "+n.maximum+" կետ"},noResults:function(){return"Արդյունքներ չեն գտնվել"},searching:function(){return"Որոնում․․․"},removeAllItems:function(){return"Հեռացնել բոլոր տարրերը"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/id.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(n){return"Hapuskan "+(n.input.length-n.maximum)+" huruf"},inputTooShort:function(n){return"Masukkan "+(n.minimum-n.input.length)+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(n){return"Anda hanya dapat memilih "+n.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"},removeAllItems:function(){return"Hapus semua item"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/is.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/is",[],function(){return{inputTooLong:function(n){var t=n.input.length-n.maximum,e="Vinsamlegast styttið texta um "+t+" staf";return t<=1?e:e+"i"},inputTooShort:function(n){var t=n.minimum-n.input.length,e="Vinsamlegast skrifið "+t+" staf";return t>1&&(e+="i"),e+=" í viðbót"},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(n){return"Þú getur aðeins valið "+n.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"},removeAllItems:function(){return"Fjarlægðu öll atriði"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/it.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var n=e.input.length-e.maximum,t="Per favore cancella "+n+" caratter";return t+=1!==n?"i":"e"},inputTooShort:function(e){return"Per favore inserisci "+(e.minimum-e.input.length)+" o più caratteri"},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var n="Puoi selezionare solo "+e.maximum+" element";return 1!==e.maximum?n+="i":n+="o",n},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"},removeAllItems:function(){return"Rimuovi tutti gli oggetti"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/ja.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(n){return n.input.length-n.maximum+" 文字を削除してください"},inputTooShort:function(n){return"少なくとも "+(n.minimum-n.input.length)+" 文字を入力してください"},loadingMore:function(){return"読み込み中…"},maximumSelected:function(n){return n.maximum+" 件しか選択できません"},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"},removeAllItems:function(){return"すべてのアイテムを削除"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/ka.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ka",[],function(){return{errorLoading:function(){return"მონაცემების ჩატვირთვა შეუძლებელია."},inputTooLong:function(n){return"გთხოვთ აკრიფეთ "+(n.input.length-n.maximum)+" სიმბოლოთი ნაკლები"},inputTooShort:function(n){return"გთხოვთ აკრიფეთ "+(n.minimum-n.input.length)+" სიმბოლო ან მეტი"},loadingMore:function(){return"მონაცემების ჩატვირთვა…"},maximumSelected:function(n){return"თქვენ შეგიძლიათ აირჩიოთ არაუმეტეს "+n.maximum+" ელემენტი"},noResults:function(){return"რეზულტატი არ მოიძებნა"},searching:function(){return"ძიება…"},removeAllItems:function(){return"ამოიღე ყველა ელემენტი"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/km.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/km",[],function(){return{errorLoading:function(){return"មិនអាចទាញយកទិន្នន័យ"},inputTooLong:function(n){return"សូមលុបចេញ "+(n.input.length-n.maximum)+" អក្សរ"},inputTooShort:function(n){return"សូមបញ្ចូល"+(n.minimum-n.input.length)+" អក្សរ រឺ ច្រើនជាងនេះ"},loadingMore:function(){return"កំពុងទាញយកទិន្នន័យបន្ថែម..."},maximumSelected:function(n){return"អ្នកអាចជ្រើសរើសបានតែ "+n.maximum+" ជម្រើសប៉ុណ្ណោះ"},noResults:function(){return"មិនមានលទ្ធផល"},searching:function(){return"កំពុងស្វែងរក..."},removeAllItems:function(){return"លុបធាតុទាំងអស់"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/ko.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(n){return"너무 깁니다. "+(n.input.length-n.maximum)+" 글자 지워주세요."},inputTooShort:function(n){return"너무 짧습니다. "+(n.minimum-n.input.length)+" 글자 더 입력해주세요."},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(n){return"최대 "+n.maximum+"개까지만 선택 가능합니다."},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"},removeAllItems:function(){return"모든 항목 삭제"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/lt.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/lt",[],function(){function n(n,e,i,t){return n%10==1&&(n%100<11||n%100>19)?e:n%10>=2&&n%10<=9&&(n%100<11||n%100>19)?i:t}return{inputTooLong:function(e){var i=e.input.length-e.maximum,t="Pašalinkite "+i+" simbol";return t+=n(i,"į","ius","ių")},inputTooShort:function(e){var i=e.minimum-e.input.length,t="Įrašykite dar "+i+" simbol";return t+=n(i,"į","ius","ių")},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(e){var i="Jūs galite pasirinkti tik "+e.maximum+" element";return i+=n(e.maximum,"ą","us","ų")},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"},removeAllItems:function(){return"Pašalinti visus elementus"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/lv.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/lv",[],function(){function e(e,n,u,i){return 11===e?n:e%10==1?u:i}return{inputTooLong:function(n){var u=n.input.length-n.maximum,i="Lūdzu ievadiet par "+u;return(i+=" simbol"+e(u,"iem","u","iem"))+" mazāk"},inputTooShort:function(n){var u=n.minimum-n.input.length,i="Lūdzu ievadiet vēl "+u;return i+=" simbol"+e(u,"us","u","us")},loadingMore:function(){return"Datu ielāde…"},maximumSelected:function(n){var u="Jūs varat izvēlēties ne vairāk kā "+n.maximum;return u+=" element"+e(n.maximum,"us","u","us")},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"},removeAllItems:function(){return"Noņemt visus vienumus"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/mk.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/mk",[],function(){return{inputTooLong:function(n){var e=(n.input.length,n.maximum,"Ве молиме внесете "+n.maximum+" помалку карактер");return 1!==n.maximum&&(e+="и"),e},inputTooShort:function(n){var e=(n.minimum,n.input.length,"Ве молиме внесете уште "+n.maximum+" карактер");return 1!==n.maximum&&(e+="и"),e},loadingMore:function(){return"Вчитување резултати…"},maximumSelected:function(n){var e="Можете да изберете само "+n.maximum+" ставк";return 1===n.maximum?e+="а":e+="и",e},noResults:function(){return"Нема пронајдено совпаѓања"},searching:function(){return"Пребарување…"},removeAllItems:function(){return"Отстрани ги сите предмети"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/ms.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ms",[],function(){return{errorLoading:function(){return"Keputusan tidak berjaya dimuatkan."},inputTooLong:function(n){return"Sila hapuskan "+(n.input.length-n.maximum)+" aksara"},inputTooShort:function(n){return"Sila masukkan "+(n.minimum-n.input.length)+" atau lebih aksara"},loadingMore:function(){return"Sedang memuatkan keputusan…"},maximumSelected:function(n){return"Anda hanya boleh memilih "+n.maximum+" pilihan"},noResults:function(){return"Tiada padanan yang ditemui"},searching:function(){return"Mencari…"},removeAllItems:function(){return"Keluarkan semua item"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/nb.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/nb",[],function(){return{errorLoading:function(){return"Kunne ikke hente resultater."},inputTooLong:function(e){return"Vennligst fjern "+(e.input.length-e.maximum)+" tegn"},inputTooShort:function(e){return"Vennligst skriv inn "+(e.minimum-e.input.length)+" tegn til"},loadingMore:function(){return"Laster flere resultater…"},maximumSelected:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"},removeAllItems:function(){return"Fjern alle elementer"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/ne.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ne",[],function(){return{errorLoading:function(){return"नतिजाहरु देखाउन सकिएन।"},inputTooLong:function(n){var e=n.input.length-n.maximum,u="कृपया "+e+" अक्षर मेटाउनुहोस्।";return 1!=e&&(u+="कृपया "+e+" अक्षरहरु मेटाउनुहोस्।"),u},inputTooShort:function(n){return"कृपया बाँकी रहेका "+(n.minimum-n.input.length)+" वा अरु धेरै अक्षरहरु भर्नुहोस्।"},loadingMore:function(){return"अरु नतिजाहरु भरिँदैछन् …"},maximumSelected:function(n){var e="तँपाई "+n.maximum+" वस्तु मात्र छान्न पाउँनुहुन्छ।";return 1!=n.maximum&&(e="तँपाई "+n.maximum+" वस्तुहरु मात्र छान्न पाउँनुहुन्छ।"),e},noResults:function(){return"कुनै पनि नतिजा भेटिएन।"},searching:function(){return"खोजि हुँदैछ…"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/nl.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){return"Gelieve "+(e.input.length-e.maximum)+" karakters te verwijderen"},inputTooShort:function(e){return"Gelieve "+(e.minimum-e.input.length)+" of meer karakters in te voeren"},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var n=1==e.maximum?"kan":"kunnen",r="Er "+n+" maar "+e.maximum+" item";return 1!=e.maximum&&(r+="s"),r+=" worden geselecteerd"},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"},removeAllItems:function(){return"Verwijder alle items"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/pl.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/pl",[],function(){var n=["znak","znaki","znaków"],e=["element","elementy","elementów"],r=function(n,e){return 1===n?e[0]:n>1&&n<=4?e[1]:n>=5?e[2]:void 0};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Usuń "+t+" "+r(t,n)},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Podaj przynajmniej "+t+" "+r(t,n)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(n){return"Możesz zaznaczyć tylko "+n.maximum+" "+r(n.maximum,e)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"},removeAllItems:function(){return"Usuń wszystkie przedmioty"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/ps.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ps",[],function(){return{errorLoading:function(){return"پايلي نه سي ترلاسه کېدای"},inputTooLong:function(n){var e=n.input.length-n.maximum,r="د مهربانۍ لمخي "+e+" توری ړنګ کړئ";return 1!=e&&(r=r.replace("توری","توري")),r},inputTooShort:function(n){return"لږ تر لږه "+(n.minimum-n.input.length)+" يا ډېر توري وليکئ"},loadingMore:function(){return"نوري پايلي ترلاسه کيږي..."},maximumSelected:function(n){var e="تاسو يوازي "+n.maximum+" قلم په نښه کولای سی";return 1!=n.maximum&&(e=e.replace("قلم","قلمونه")),e},noResults:function(){return"پايلي و نه موندل سوې"},searching:function(){return"لټول کيږي..."},removeAllItems:function(){return"ټول توکي لرې کړئ"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/pt-BR.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Apague "+n+" caracter";return 1!=n&&(r+="es"),r},inputTooShort:function(e){return"Digite "+(e.minimum-e.input.length)+" ou mais caracteres"},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var n="Você só pode selecionar "+e.maximum+" ite";return 1==e.maximum?n+="m":n+="ns",n},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Remover todos os itens"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/pt.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/pt",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var r=e.input.length-e.maximum,n="Por favor apague "+r+" ";return n+=1!=r?"caracteres":"caractere"},inputTooShort:function(e){return"Introduza "+(e.minimum-e.input.length)+" ou mais caracteres"},loadingMore:function(){return"A carregar mais resultados…"},maximumSelected:function(e){var r="Apenas pode seleccionar "+e.maximum+" ";return r+=1!=e.maximum?"itens":"item"},noResults:function(){return"Sem resultados"},searching:function(){return"A procurar…"},removeAllItems:function(){return"Remover todos os itens"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/ro.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/ro",[],function(){return{errorLoading:function(){return"Rezultatele nu au putut fi incărcate."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vă rugăm să ștergeți"+t+" caracter";return 1!==t&&(n+="e"),n},inputTooShort:function(e){return"Vă rugăm să introduceți "+(e.minimum-e.input.length)+" sau mai multe caractere"},loadingMore:function(){return"Se încarcă mai multe rezultate…"},maximumSelected:function(e){var t="Aveți voie să selectați cel mult "+e.maximum;return t+=" element",1!==e.maximum&&(t+="e"),t},noResults:function(){return"Nu au fost găsite rezultate"},searching:function(){return"Căutare…"},removeAllItems:function(){return"Eliminați toate elementele"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/ru.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ru",[],function(){function n(n,e,r,u){return n%10<5&&n%10>0&&n%100<5||n%100>20?n%10>1?r:e:u}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(e){var r=e.input.length-e.maximum,u="Пожалуйста, введите на "+r+" символ";return u+=n(r,"","a","ов"),u+=" меньше"},inputTooShort:function(e){var r=e.minimum-e.input.length,u="Пожалуйста, введите ещё хотя бы "+r+" символ";return u+=n(r,"","a","ов")},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(e){var r="Вы можете выбрать не более "+e.maximum+" элемент";return r+=n(e.maximum,"","a","ов")},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"},removeAllItems:function(){return"Удалить все элементы"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/sk.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/sk",[],function(){var e={2:function(e){return e?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{errorLoading:function(){return"Výsledky sa nepodarilo načítať."},inputTooLong:function(n){var t=n.input.length-n.maximum;return 1==t?"Prosím, zadajte o jeden znak menej":t>=2&&t<=4?"Prosím, zadajte o "+e[t](!0)+" znaky menej":"Prosím, zadajte o "+t+" znakov menej"},inputTooShort:function(n){var t=n.minimum-n.input.length;return 1==t?"Prosím, zadajte ešte jeden znak":t<=4?"Prosím, zadajte ešte ďalšie "+e[t](!0)+" znaky":"Prosím, zadajte ešte ďalších "+t+" znakov"},loadingMore:function(){return"Načítanie ďalších výsledkov…"},maximumSelected:function(n){return 1==n.maximum?"Môžete zvoliť len jednu položku":n.maximum>=2&&n.maximum<=4?"Môžete zvoliť najviac "+e[n.maximum](!1)+" položky":"Môžete zvoliť najviac "+n.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"},removeAllItems:function(){return"Odstráňte všetky položky"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/sl.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/sl",[],function(){return{errorLoading:function(){return"Zadetkov iskanja ni bilo mogoče naložiti."},inputTooLong:function(e){var n=e.input.length-e.maximum,t="Prosim zbrišite "+n+" znak";return 2==n?t+="a":1!=n&&(t+="e"),t},inputTooShort:function(e){var n=e.minimum-e.input.length,t="Prosim vpišite še "+n+" znak";return 2==n?t+="a":1!=n&&(t+="e"),t},loadingMore:function(){return"Nalagam več zadetkov…"},maximumSelected:function(e){var n="Označite lahko največ "+e.maximum+" predmet";return 2==e.maximum?n+="a":1!=e.maximum&&(n+="e"),n},noResults:function(){return"Ni zadetkov."},searching:function(){return"Iščem…"},removeAllItems:function(){return"Odstranite vse elemente"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/sq.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/sq",[],function(){return{errorLoading:function(){return"Rezultatet nuk mund të ngarkoheshin."},inputTooLong:function(e){var n=e.input.length-e.maximum,t="Të lutem fshi "+n+" karakter";return 1!=n&&(t+="e"),t},inputTooShort:function(e){return"Të lutem shkruaj "+(e.minimum-e.input.length)+" ose më shumë karaktere"},loadingMore:function(){return"Duke ngarkuar më shumë rezultate…"},maximumSelected:function(e){var n="Mund të zgjedhësh vetëm "+e.maximum+" element";return 1!=e.maximum&&(n+="e"),n},noResults:function(){return"Nuk u gjet asnjë rezultat"},searching:function(){return"Duke kërkuar…"},removeAllItems:function(){return"Hiq të gjitha sendet"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/sr-Cyrl.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/sr-Cyrl",[],function(){function n(n,e,r,u){return n%10==1&&n%100!=11?e:n%10>=2&&n%10<=4&&(n%100<12||n%100>14)?r:u}return{errorLoading:function(){return"Преузимање није успело."},inputTooLong:function(e){var r=e.input.length-e.maximum,u="Обришите "+r+" симбол";return u+=n(r,"","а","а")},inputTooShort:function(e){var r=e.minimum-e.input.length,u="Укуцајте бар још "+r+" симбол";return u+=n(r,"","а","а")},loadingMore:function(){return"Преузимање још резултата…"},maximumSelected:function(e){var r="Можете изабрати само "+e.maximum+" ставк";return r+=n(e.maximum,"у","е","и")},noResults:function(){return"Ништа није пронађено"},searching:function(){return"Претрага…"},removeAllItems:function(){return"Уклоните све ставке"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/sr.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/sr",[],function(){function n(n,e,r,t){return n%10==1&&n%100!=11?e:n%10>=2&&n%10<=4&&(n%100<12||n%100>14)?r:t}return{errorLoading:function(){return"Preuzimanje nije uspelo."},inputTooLong:function(e){var r=e.input.length-e.maximum,t="Obrišite "+r+" simbol";return t+=n(r,"","a","a")},inputTooShort:function(e){var r=e.minimum-e.input.length,t="Ukucajte bar još "+r+" simbol";return t+=n(r,"","a","a")},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(e){var r="Možete izabrati samo "+e.maximum+" stavk";return r+=n(e.maximum,"u","e","i")},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"},removeAllItems:function(){return"Уклоните све ставке"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/sv.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(n){return"Vänligen sudda ut "+(n.input.length-n.maximum)+" tecken"},inputTooShort:function(n){return"Vänligen skriv in "+(n.minimum-n.input.length)+" eller fler tecken"},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(n){return"Du kan max välja "+n.maximum+" element"},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"},removeAllItems:function(){return"Ta bort alla objekt"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/th.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/th",[],function(){return{errorLoading:function(){return"ไม่สามารถค้นข้อมูลได้"},inputTooLong:function(n){return"โปรดลบออก "+(n.input.length-n.maximum)+" ตัวอักษร"},inputTooShort:function(n){return"โปรดพิมพ์เพิ่มอีก "+(n.minimum-n.input.length)+" ตัวอักษร"},loadingMore:function(){return"กำลังค้นข้อมูลเพิ่ม…"},maximumSelected:function(n){return"คุณสามารถเลือกได้ไม่เกิน "+n.maximum+" รายการ"},noResults:function(){return"ไม่พบข้อมูล"},searching:function(){return"กำลังค้นข้อมูล…"},removeAllItems:function(){return"ลบรายการทั้งหมด"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/tk.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/tk",[],function(){return{errorLoading:function(){return"Netije ýüklenmedi."},inputTooLong:function(e){return e.input.length-e.maximum+" harp bozuň."},inputTooShort:function(e){return"Ýene-de iň az "+(e.minimum-e.input.length)+" harp ýazyň."},loadingMore:function(){return"Köpräk netije görkezilýär…"},maximumSelected:function(e){return"Diňe "+e.maximum+" sanysyny saýlaň."},noResults:function(){return"Netije tapylmady."},searching:function(){return"Gözlenýär…"},removeAllItems:function(){return"Remove all items"}}}),e.define,e.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/tr.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/tr",[],function(){return{errorLoading:function(){return"Sonuç yüklenemedi"},inputTooLong:function(n){return n.input.length-n.maximum+" karakter daha girmelisiniz"},inputTooShort:function(n){return"En az "+(n.minimum-n.input.length)+" karakter daha girmelisiniz"},loadingMore:function(){return"Daha fazla…"},maximumSelected:function(n){return"Sadece "+n.maximum+" seçim yapabilirsiniz"},noResults:function(){return"Sonuç bulunamadı"},searching:function(){return"Aranıyor…"},removeAllItems:function(){return"Tüm öğeleri kaldır"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/uk.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/uk",[],function(){function n(n,e,u,r){return n%100>10&&n%100<15?r:n%10==1?e:n%10>1&&n%10<5?u:r}return{errorLoading:function(){return"Неможливо завантажити результати"},inputTooLong:function(e){return"Будь ласка, видаліть "+(e.input.length-e.maximum)+" "+n(e.maximum,"літеру","літери","літер")},inputTooShort:function(n){return"Будь ласка, введіть "+(n.minimum-n.input.length)+" або більше літер"},loadingMore:function(){return"Завантаження інших результатів…"},maximumSelected:function(e){return"Ви можете вибрати лише "+e.maximum+" "+n(e.maximum,"пункт","пункти","пунктів")},noResults:function(){return"Нічого не знайдено"},searching:function(){return"Пошук…"},removeAllItems:function(){return"Видалити всі елементи"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/vi.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/vi",[],function(){return{inputTooLong:function(n){return"Vui lòng xóa bớt "+(n.input.length-n.maximum)+" ký tự"},inputTooShort:function(n){return"Vui lòng nhập thêm từ "+(n.minimum-n.input.length)+" ký tự trở lên"},loadingMore:function(){return"Đang lấy thêm kết quả…"},maximumSelected:function(n){return"Chỉ có thể chọn được "+n.maximum+" lựa chọn"},noResults:function(){return"Không tìm thấy kết quả"},searching:function(){return"Đang tìm…"},removeAllItems:function(){return"Xóa tất cả các mục"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/zh-CN.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/zh-CN",[],function(){return{errorLoading:function(){return"无法载入结果。"},inputTooLong:function(n){return"请删除"+(n.input.length-n.maximum)+"个字符"},inputTooShort:function(n){return"请再输入至少"+(n.minimum-n.input.length)+"个字符"},loadingMore:function(){return"载入更多结果…"},maximumSelected:function(n){return"最多只能选择"+n.maximum+"个项目"},noResults:function(){return"未找到结果"},searching:function(){return"搜索中…"},removeAllItems:function(){return"删除所有项目"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/select2/i18n/zh-TW.js: -------------------------------------------------------------------------------- 1 | /*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */ 2 | 3 | !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/zh-TW",[],function(){return{inputTooLong:function(n){return"請刪掉"+(n.input.length-n.maximum)+"個字元"},inputTooShort:function(n){return"請再輸入"+(n.minimum-n.input.length)+"個字元"},loadingMore:function(){return"載入中…"},maximumSelected:function(n){return"你只能選擇最多"+n.maximum+"項"},noResults:function(){return"沒有找到相符的項目"},searching:function(){return"搜尋中…"},removeAllItems:function(){return"刪除所有項目"}}}),n.define,n.require}(); -------------------------------------------------------------------------------- /static/admin/js/vendor/xregexp/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2007-2017 Steven Levithan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /static/css/game.css: -------------------------------------------------------------------------------- 1 | .ac-game-settings { 2 | width: 100%; 3 | height: 100%; 4 | background-image: url("/static/image/menu/background.gif"); 5 | background-size: 100% 100%; 6 | user-select: none; 7 | } 8 | 9 | .ac-game-settings-login { 10 | height: 41vh; 11 | width: 20vw; 12 | position: relative; 13 | top: 50%; 14 | left: 50%; 15 | transform: translate(-50%, -50%); 16 | background-color: rgba(0, 0, 0, 0.7); 17 | border-radius: 5px; 18 | } 19 | 20 | 21 | .ac-game-settings-title { 22 | color: white; 23 | font-size: 3vh; 24 | text-align: center; 25 | padding-top: 2vh; 26 | margin-bottom: 2vh; 27 | } 28 | 29 | .ac-game-settings-username { 30 | display: block; 31 | height: 7vh; 32 | } 33 | 34 | .ac-game-settings-password { 35 | display: block; 36 | height: 7vh; 37 | } 38 | 39 | .ac-game-settings-submit { 40 | display: block; 41 | height: 7vh; 42 | } 43 | 44 | .ac-game-settings-acwing { 45 | display: block; 46 | height: 7vh; 47 | } 48 | 49 | .ac-game-settings-item { 50 | width: 100%; 51 | height: 100%; 52 | } 53 | 54 | .ac-game-settings-item > input { 55 | width: 90%; 56 | line-height: 3vh; 57 | position: relative; 58 | top: 50%; 59 | left: 50%; 60 | transform: translate(-50%, -50%); 61 | } 62 | 63 | .ac-game-settings-item > button { 64 | color: white; 65 | width: 90%; 66 | line-height: 3vh; 67 | position: relative; 68 | top: 50%; 69 | left: 50%; 70 | transform: translate(-50%, -50%); 71 | background-color: #4CAF50; 72 | border-radius: 5px; 73 | } 74 | 75 | .ac-game-settings-error-message { 76 | color: red; 77 | font-size: 0.8vh; 78 | display: inline; 79 | float: left; 80 | padding-left: 1vw; 81 | } 82 | 83 | .ac-game-settings-option { 84 | color: white; 85 | font-size: 2vh; 86 | display: inline; 87 | float: right; 88 | padding-right: 1vw; 89 | cursor: pointer; 90 | } 91 | 92 | .ac-game-settings-acwing > img { 93 | position: relative; 94 | top: 50%; 95 | left: 50%; 96 | transform: translate(-50%, -50%); 97 | cursor: pointer; 98 | display: block; 99 | } 100 | 101 | .ac-game-settings-acwing > div { 102 | color: white; 103 | font-size: 1.5vh; 104 | text-align: center; 105 | display: block; 106 | } 107 | 108 | .ac-game-settings-register { 109 | height: 49vh; 110 | width: 20vw; 111 | position: relative; 112 | top: 50%; 113 | left: 50%; 114 | transform: translate(-50%, -50%); 115 | background-color: rgba(0, 0, 0, 0.7); 116 | border-radius: 5px; 117 | } 118 | 119 | 120 | 121 | .ac-game-menu { 122 | width: 100%; 123 | height: 100%; 124 | background-image: url("/static/image/menu/background.gif"); 125 | background-size: 100% 100%; 126 | user-select: none; 127 | } 128 | 129 | .ac-game-menu-field { 130 | width: 20vw; 131 | position: relative; 132 | top: 40%; 133 | left: 20%; 134 | } 135 | 136 | .ac-game-menu-field-item { 137 | color: white; 138 | height: 6vh; 139 | width: 18vw; 140 | font-size: 4vh; 141 | font-style: italic; 142 | text-align: center; 143 | background-color: rgba(39,21,28, 0.6); 144 | border-radius: 10px; 145 | letter-spacing: 0.5vw; 146 | cursor: pointer; 147 | } 148 | 149 | .ac-game-menu-field-item:hover { 150 | transform: scale(1.2); 151 | transition: 100ms; 152 | } 153 | 154 | .ac-game-playground { 155 | width: 100%; 156 | height: 100%; 157 | user-select: none; 158 | background-color: grey; 159 | } 160 | 161 | .ac-game-playground > canvas { 162 | position: relative; 163 | top: 50%; 164 | left: 50%; 165 | transform: translate(-50%, -50%); 166 | } 167 | 168 | .ac-game-chat-field-history { 169 | position: absolute; 170 | top: 66%; 171 | left: 20%; 172 | 173 | transform: translate(-50%, -50%); 174 | 175 | width: 20%; 176 | height: 32%; 177 | 178 | color: white; 179 | font-size: 2vh; 180 | 181 | padding: 5px; 182 | overflow: auto; 183 | } 184 | 185 | .ac-game-chat-field-history::-webkit-scrollbar { 186 | width: 0; 187 | } 188 | 189 | .ac-game-chat-field-input { 190 | position: absolute; 191 | top: 86%; 192 | left: 20%; 193 | transform: translate(-50%, -50%); 194 | 195 | width: 20%; 196 | height: 3vh; 197 | 198 | color: white; 199 | font-size: 2vh; 200 | 201 | background-color: rgba(222,225,230, 0.2); 202 | } 203 | 204 | -------------------------------------------------------------------------------- /static/image/menu/background.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeemzz147/django_project/65ff729eb371d6b146a41f7893095da3f65d0d83/static/image/menu/background.gif -------------------------------------------------------------------------------- /static/js/src/menu/zbase.js: -------------------------------------------------------------------------------- 1 | class AcGameMenu { 2 | constructor(root) { 3 | this.root = root; 4 | this.$menu = $(` 5 | 6 |
7 |
8 |
9 | 单人模式 10 |
11 |
12 |
13 | 多人模式 14 |
15 |
16 |
17 | 退出 18 |
19 | 20 |
21 |
22 | `); 23 | this.$menu.hide(); 24 | this.root.$ac_game.append(this.$menu); 25 | this.$single_mode = this.$menu.find('.ac-game-menu-field-item-single-mode'); 26 | this.$multi_mode = this.$menu.find('.ac-game-menu-field-item-multi-mode'); 27 | this.$settings = this.$menu.find('.ac-game-menu-field-item-settings'); 28 | this.start(); 29 | } 30 | 31 | 32 | start() { 33 | this.add_listening_events(); 34 | } 35 | 36 | add_listening_events() { 37 | let outer = this; 38 | this.$single_mode.click(function(){ 39 | outer.hide(); 40 | outer.root.playground.show("single mode"); 41 | }); 42 | this.$multi_mode.click(function() { 43 | outer.hide(); 44 | outer.root.playground.show("multi mode"); 45 | }); 46 | this.$settings.click(function(){ 47 | // 48 | outer.root.settings.logout_on_remote(); 49 | }); 50 | } 51 | 52 | 53 | show() { // show menu page 54 | this.$menu.show(); 55 | } 56 | 57 | 58 | hide() { // hide menu page 59 | this.$menu.hide(); 60 | } 61 | 62 | 63 | } 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /static/js/src/playground/ac_game_object/zbase.js: -------------------------------------------------------------------------------- 1 | let AC_GAME_OBJECTS = []; 2 | 3 | 4 | class AcGameObject { 5 | constructor() { 6 | AC_GAME_OBJECTS.push(this); 7 | this.has_called_start = false; // 是否实行过start函数 8 | this.timedelta = 0; // 当前距离上一帧的时间间隔 /ms 9 | this.uuid = this.create_uuid(); 10 | } 11 | 12 | create_uuid() { 13 | let res = ""; 14 | for (let i = 0; i < 8; i++) { 15 | let x = parseInt(Math.floor(Math.random() * 10)); 16 | res += x; 17 | } 18 | return res; 19 | } 20 | 21 | start() { // 只会在第一帧执行一次 22 | } 23 | 24 | 25 | update() { // 每一帧都要执行 26 | } 27 | 28 | late_update() { // 在每一帧的最后执行一次 29 | 30 | } 31 | 32 | on_destroy() { // 在被销毁前执行一次 33 | } 34 | 35 | destroy() { // 删掉该物体 36 | this.on_destroy(); 37 | for(let i = 0; i < AC_GAME_OBJECTS.length; i++) { 38 | if(AC_GAME_OBJECTS[i] === this){ 39 | AC_GAME_OBJECTS.splice(i, 1); 40 | break; 41 | } 42 | } 43 | } 44 | } 45 | 46 | 47 | let last_timestamp; 48 | let AC_GAME_ANIMATION = function(timestamp) { 49 | for(let i = 0; i < AC_GAME_OBJECTS.length; i++ ) { 50 | let obj = AC_GAME_OBJECTS[i]; 51 | if(!obj.has_called_start) { 52 | obj.start(); 53 | obj.has_called_start = true; 54 | } else { 55 | obj.timedelta = timestamp - last_timestamp; 56 | obj.update(); 57 | } 58 | } 59 | 60 | for (let i = 0; i < AC_GAME_OBJECTS.length; i++) { 61 | let obj = AC_GAME_OBJECTS[i]; 62 | obj.late_update(); 63 | } 64 | 65 | last_timestamp = timestamp; 66 | 67 | requestAnimationFrame(AC_GAME_ANIMATION); 68 | 69 | } 70 | 71 | requestAnimationFrame(AC_GAME_ANIMATION); 72 | -------------------------------------------------------------------------------- /static/js/src/playground/chat_field/zbase.js: -------------------------------------------------------------------------------- 1 | class CharField { 2 | constructor(playground) { 3 | this.playground = playground; 4 | this.$history = $(`
历史记录
`); 5 | this.$input = $(``); 6 | 7 | this.$history.hide(); 8 | this.$input.hide(); 9 | this.func_id = null; 10 | 11 | this.playground.$playground.append(this.$history); 12 | this.playground.$playground.append(this.$input); 13 | 14 | this.start(); 15 | 16 | } 17 | 18 | 19 | start() { 20 | this.add_listening_events(); 21 | } 22 | 23 | 24 | add_listening_events() { 25 | let outer = this; 26 | this.$input.keydown(function (e) { 27 | if (e.which === 27) { // esc 28 | outer.hide_input(); 29 | return false; 30 | } else if (e.which === 13) { 31 | let username = outer.playground.root.settings.username; 32 | let text = outer.$input.val(); 33 | if (text) { 34 | outer.$input.val(""); 35 | outer.add_message(username, text); 36 | outer.playground.mps.send_message(username, text); 37 | } 38 | return false; 39 | } 40 | }); 41 | } 42 | 43 | render_message(message) { 44 | return $(`
${message}
`); 45 | } 46 | 47 | add_message(username, text) { 48 | this.show_history(); 49 | let message = `[${username}]${text}`; 50 | this.$history.append(this.render_message(message)); 51 | this.$history.scrollTop(this.$history[0].scrollHeight); 52 | } 53 | 54 | 55 | show_history() { 56 | let outer = this; 57 | this.$history.fadeIn(); 58 | 59 | if (this.func_id) clearTimeout(this.func_id); 60 | 61 | this.func_id = setTimeout(function () { 62 | outer.$history.fadeOut(); 63 | outer.func_id = null; 64 | }, 6000); 65 | } 66 | 67 | show_input() { 68 | this.show_history(); 69 | 70 | this.$input.show(); 71 | this.$input.focus(); 72 | } 73 | 74 | hide_input() { 75 | // console.log("hide input!!!"); 76 | this.$input.hide(); 77 | this.playground.game_map.$canvas.focus(); 78 | } 79 | } -------------------------------------------------------------------------------- /static/js/src/playground/game_map/zbase.js: -------------------------------------------------------------------------------- 1 | class GameMap extends AcGameObject { 2 | constructor(playground) { 3 | super(); 4 | this.playground = playground; 5 | this.$canvas = $(``); 6 | this.ctx = this.$canvas[0].getContext('2d'); 7 | this.ctx.canvas.width = this.playground.width; 8 | this.ctx.canvas.height = this.playground.height; 9 | this.playground.$playground.append(this.$canvas); 10 | } 11 | 12 | 13 | start() { 14 | this.$canvas.focus(); 15 | } 16 | 17 | resize() { 18 | this.ctx.canvas.width = this.playground.width; 19 | this.ctx.canvas.height = this.playground.height; 20 | this.ctx.fillStyle = "rgba(0, 0, 0, 1)"; 21 | this.ctx.fillRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height); 22 | } 23 | 24 | update() { 25 | this.render(); 26 | 27 | } 28 | 29 | render() { 30 | this.ctx.fillStyle = "rgba(0, 0, 0, 0.2)"; 31 | this.ctx.fillRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /static/js/src/playground/notice_board/zbase.js: -------------------------------------------------------------------------------- 1 | class NoticeBoard extends AcGameObject { 2 | constructor(playground) { 3 | super(); 4 | this.playground = playground; 5 | this.ctx = this.playground.game_map.ctx; 6 | this.text = "已就绪:0人"; 7 | 8 | } 9 | 10 | start() { 11 | 12 | } 13 | 14 | write(text) { 15 | this.text = text; 16 | } 17 | 18 | update() { 19 | this.render(); 20 | } 21 | 22 | render() { 23 | this.ctx.font = "20px serif"; 24 | this.ctx.fillStyle = "white"; 25 | this.ctx.textAlign = "center"; 26 | this.ctx.fillText(this.text, this.playground.width / 2, 20); 27 | } 28 | } -------------------------------------------------------------------------------- /static/js/src/playground/particle/zbase.js: -------------------------------------------------------------------------------- 1 | class Particle extends AcGameObject { 2 | constructor(playground, x, y, radius, vx, vy, color, speed, move_length) { 3 | super(); 4 | this.playground = playground; 5 | this.ctx = this.playground.game_map.ctx; 6 | this.x = x; 7 | this.y = y; 8 | this.radius = radius; 9 | this.vx = vx; 10 | this.vy = vy; 11 | this.color = color; 12 | this.speed = speed; 13 | this.move_length = move_length; 14 | this.friction = 0.7; 15 | this.eps = 0.1; 16 | } 17 | 18 | start() {} 19 | 20 | update() { 21 | if(this.move_length < this.eps || this.speed < this.eps){ 22 | this.destroy(); 23 | return false; 24 | } 25 | 26 | let moved = Math.min(this.move_length, this.speed * this.timedelta / 1000); 27 | this.x += this.vx * moved; 28 | this.y += this.vy * moved; 29 | this.speed *= this.friction; 30 | this.move_length -= moved; 31 | this.render(); 32 | } 33 | 34 | render() { 35 | let scale = this.playground.scale; 36 | 37 | this.ctx.beginPath(); 38 | this.ctx.arc(this.x * scale, this.y * scale, this.radius * scale, 0, Math.PI * 2, false); 39 | this.ctx.fillStyle = this.color; 40 | this.ctx.fill(); 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /static/js/src/playground/score_board/zbase.js: -------------------------------------------------------------------------------- 1 | class ScoreBoard extends AcGameObject { 2 | constructor(playground) { 3 | super(); 4 | this.playground = playground; 5 | this.ctx = this.playground.game_map.ctx; 6 | 7 | this.state = null; // win or lose 8 | 9 | this.win_img = new Image(); 10 | this.win_img.src = "https://cdn.acwing.com/media/article/image/2021/12/17/1_8f58341a5e-win.png"; 11 | 12 | this.lose_img = new Image(); 13 | this.lose_img.src = "https://cdn.acwing.com/media/article/image/2021/12/17/1_9254b5f95e-lose.png"; 14 | 15 | 16 | } 17 | 18 | start() { 19 | 20 | } 21 | 22 | add_listening_event() { 23 | let outer = this; 24 | let $canvas = this.playground.game_map.$canvas; 25 | 26 | $canvas.on('click', function () { 27 | outer.playground.hide(); 28 | outer.playground.root.menu.show(); 29 | }); 30 | } 31 | 32 | win() { 33 | this.state = "win"; 34 | 35 | let outer = this; 36 | setTimeout(function () { 37 | outer.add_listening_event(); 38 | }, 1000); // 展示 1s 之后监听 39 | } 40 | 41 | lose() { 42 | this.state = "lose"; 43 | 44 | let outer = this; 45 | setTimeout(function () { 46 | outer.add_listening_event(); 47 | }, 1000); // 展示 1s 之后监听 48 | } 49 | late_update() { 50 | this.render(); 51 | } 52 | 53 | render() { 54 | let len = this.playground.height / 2; 55 | if (this.state === "win") { 56 | this.ctx.drawImage(this.win_img, this.playground.width / 2 - len / 2, this.playground.height / 2 - len / 2, len, len); 57 | } else if (this.state === "lose") { 58 | this.ctx.drawImage(this.lose_img, this.playground.width / 2 - len / 2, this.playground.height / 2 - len / 2, len, len); 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /static/js/src/playground/skill/fireball/zbase.js: -------------------------------------------------------------------------------- 1 | class FireBall extends AcGameObject { 2 | constructor(playground, player, x, y, radius, vx, vy, color, speed, move_length, damage) { 3 | super(); 4 | this.playground = playground; 5 | this.player = player; 6 | this.ctx = this.playground.game_map.ctx; 7 | this.x = x; 8 | this.y = y; 9 | this.vx = vx; 10 | this.vy = vy; 11 | this.radius = radius; 12 | this.color = color; 13 | this.speed = speed; 14 | this.move_length = move_length; 15 | this.damage = damage; 16 | this.eps = 0.1; 17 | } 18 | 19 | 20 | start() {} 21 | 22 | is_collision(obj) { 23 | let distance = this.get_dist(this.x, this.y, obj.x, obj.y); 24 | if(distance < this.radius + obj.radius) 25 | return true; 26 | return false; 27 | } 28 | 29 | update() { 30 | if (this.move_length < this.eps) { 31 | this.destroy(); 32 | return false; 33 | } 34 | 35 | this.update_move(); 36 | 37 | if (this.player.character !== "enemy") { 38 | this.update_attack(); 39 | } 40 | 41 | this.render(); 42 | } 43 | 44 | update_move() { 45 | let moved = Math.min(this.move_length, this.speed * this.timedelta / 1000); 46 | this.x += this.vx * moved; 47 | this.y += this.vy * moved; 48 | this.move_length -= moved; 49 | } 50 | 51 | update_attack() { 52 | for (let i = 0; i < this.playground.players.length; i ++ ) { 53 | let player = this.playground.players[i]; 54 | if((this.player !== player) && this.is_collision(player)) { 55 | this.attack(player); 56 | break; 57 | } 58 | } 59 | } 60 | 61 | get_dist(x1, y1, x2, y2) { 62 | let dx = x1 - x2; 63 | let dy = y1 - y2; 64 | return Math.sqrt(dx * dx + dy * dy); 65 | } 66 | 67 | attack(player) { 68 | let angle = Math.atan2(player.y - this.y, player.x - this.x); 69 | player.is_attacked(angle, this.damage); 70 | 71 | 72 | if (this.playground.mode === "multi mode") { 73 | //console.log("ball ", this.uuid, "is attack", player.uuid, "in js!!!"); 74 | this.playground.mps.send_attack(player.uuid, player.x, player.y, angle, this.damage, this.uuid); 75 | } 76 | 77 | this.destroy(); 78 | 79 | } 80 | 81 | 82 | render() { 83 | let scale = this.playground.scale; 84 | this.ctx.beginPath(); 85 | this.ctx.arc(this.x * scale, this.y * scale, this.radius * scale, 0, Math.PI * 2, false); 86 | this.ctx.fillStyle = this.color; 87 | this.ctx.fill(); 88 | } 89 | 90 | on_destroy() { 91 | let fireballs = this.player.fireballs; 92 | for (let i = 0; i < fireballs.length; i ++ ){ 93 | if (fireballs[i] === this) { 94 | fireballs.splice(i, 1); 95 | break; 96 | } 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /static/js/src/playground/socket/multiplayer/zbase.js: -------------------------------------------------------------------------------- 1 | class MultiPlayerSocket { 2 | constructor(playground) { 3 | this.playground = playground; 4 | this.ws = new WebSocket("wss://app2872.acapp.acwing.com.cn/wss/multiplayer/"); 5 | 6 | this.start(); 7 | } 8 | 9 | start() { 10 | this.receive(); 11 | } 12 | 13 | receive() { 14 | let outer = this; 15 | this.ws.onmessage = function (e) { 16 | let data = JSON.parse(e.data); 17 | let uuid = data.uuid; 18 | 19 | 20 | if (uuid === outer.uuid) return false; 21 | 22 | let event = data.event; 23 | if (event === "create_player") { 24 | outer.receive_create_player(uuid, data.username, data.photo); 25 | } else if (event === "move_to") { 26 | outer.receive_move_to(uuid, data.tx, data.ty); 27 | } else if (event === "shoot_fireball") { 28 | outer.receive_shoot_fireball(uuid, data.tx, data.ty, data.ball_uuid); 29 | } else if (event === 'attack') { 30 | outer.receive_attack(uuid, data.attackee_uuid, data.x, data.y, data.angle, data.damage, data.ball_uuid); 31 | } else if (event === "blink") { 32 | outer.receive_blink(uuid, data.tx, data.ty); 33 | } else if (event === "message") { 34 | outer.receive_message(uuid, data.username, data.text); 35 | } 36 | }; 37 | } 38 | 39 | send_create_player(username, photo) { 40 | let outer = this; 41 | this.ws.send(JSON.stringify({ 42 | 'event': 'create_player', 43 | 'uuid': outer.uuid, 44 | 'username': username, 45 | 'photo': photo, 46 | })); 47 | } 48 | 49 | get_player(uuid) { 50 | let players = this.playground.players; 51 | for (let i = 0; i < players.length; i++){ 52 | let player = players[i]; 53 | if (player.uuid === uuid) return player; 54 | } 55 | return null; 56 | } 57 | 58 | receive_create_player(uuid, username, photo) { 59 | let player = new Player( 60 | this.playground, 61 | this.playground.width / 2 / this.playground.scale, 62 | 0.5, 63 | 0.05, 64 | "white", 65 | 0.15, 66 | "enemy", 67 | username, 68 | photo, 69 | ); 70 | 71 | player.uuid = uuid; 72 | this.playground.players.push(player); 73 | } 74 | 75 | send_move_to(tx, ty) { 76 | let outer = this; 77 | // console.log("send_move_to, tx = ", tx, "ty = ", ty); 78 | this.ws.send(JSON.stringify({ 79 | 'event': "move_to", 80 | "uuid": outer.uuid, 81 | 'tx': tx, 82 | 'ty': ty, 83 | })); 84 | // console.log("send_move_to*** end!!!"); 85 | } 86 | 87 | receive_move_to(uuid, tx, ty) { 88 | let player = this.get_player(uuid); 89 | // console.log("receive uuid = ", uuid, "tx = ", tx, "ty = ", ty); 90 | if (player) { 91 | player.move_to(tx, ty); 92 | } 93 | } 94 | 95 | send_shoot_fireball(tx, ty, ball_uuid) { 96 | let outer = this; 97 | // console.log("send shoot fireball int js!!"); 98 | this.ws.send(JSON.stringify({ 99 | 'event': "shoot_fireball", 100 | 'uuid': outer.uuid, 101 | 'tx': tx, 102 | 'ty': ty, 103 | 'ball_uuid': ball_uuid, 104 | })) 105 | } 106 | 107 | 108 | receive_shoot_fireball(uuid, tx, ty, ball_uuid) { 109 | // console.log("receive shoot fireball int js!!"); 110 | let player = this.get_player(uuid); 111 | if (player) { 112 | let fireball = player.shoot_fireball(tx, ty); 113 | fireball.uuid = ball_uuid; 114 | } 115 | } 116 | 117 | send_attack(attackee_uuid, x, y, angle, damage, ball_uuid) { 118 | let outer = this; 119 | // console.log(outer.uuid, "attack ", attackee_uuid, "in js !!!"); 120 | this.ws.send(JSON.stringify({ 121 | 'event': "attack", 122 | 'uuid': outer.uuid, 123 | 'attackee_uuid': attackee_uuid, 124 | 'x': x, 125 | 'y': y, 126 | 'angle': angle, 127 | 'damage': damage, 128 | 'ball_uuid': ball_uuid, 129 | })); 130 | } 131 | 132 | receive_attack(uuid, attackee_uuid, x, y, angle, damage, ball_uuid) { 133 | let attacker = this.get_player(uuid); 134 | let attackee = this.get_player(attackee_uuid); 135 | if (attackee && attacker) { 136 | attackee.receive_attack(x, y, angle, damage, ball_uuid, attacker); 137 | } 138 | } 139 | 140 | send_blink(tx, ty) { 141 | let outer = this; 142 | // console.log("send blink in js"); 143 | this.ws.send(JSON.stringify({ 144 | 'event': 'blink', 145 | 'uuid': outer.uuid, 146 | 'tx': tx, 147 | 'ty': ty, 148 | })); 149 | } 150 | 151 | receive_blink(uuid, tx, ty) { 152 | // console.log("receive blink in js"); 153 | let player = this.get_player(uuid); 154 | if (player) { 155 | player.blink(tx, ty); 156 | } 157 | } 158 | 159 | send_message(username, text) { 160 | let outer = this; 161 | // console.log("send message in js"); 162 | this.ws.send(JSON.stringify({ 163 | 'event': "message", 164 | 'uuid': outer.uuid, 165 | 'username': username, 166 | 'text': text, 167 | })); 168 | } 169 | 170 | receive_message(uuid, username, text) { 171 | this.playground.chat_field.add_message(username, text); 172 | } 173 | } -------------------------------------------------------------------------------- /static/js/src/playground/zbase.js: -------------------------------------------------------------------------------- 1 | class AcGamePlayground { 2 | constructor(root) { 3 | this.root = root; 4 | this.$playground = $(`
`); 5 | this.root.$ac_game.append(this.$playground); 6 | this.hide(); 7 | this.start(); 8 | } 9 | 10 | 11 | get_random_color() { 12 | let colors = ["blue", "red", "pink", "grey", "green"]; 13 | return colors[Math.floor(Math.random() * 5)]; 14 | } 15 | 16 | create_uuid() { 17 | let res = ""; 18 | for (let i = 0; i < 8; i++) { 19 | let x = parseInt(Math.floor(Math.random() * 10)); 20 | res += x; 21 | } 22 | return res; 23 | } 24 | 25 | start() { 26 | let outer = this; 27 | let uuid = this.create_uuid(); 28 | $(window).on(`resize.${uuid}`, function () { 29 | // console.log("resize\n"); 30 | outer.resize(); 31 | }); 32 | 33 | if (this.root.AcWingOS) { 34 | this.root.AcWingOS.api.window.on_close(function () { 35 | $(window).off(`resize.${uuid}`); 36 | }); 37 | } 38 | } 39 | 40 | resize() { 41 | this.width = this.$playground.width(); 42 | this.height = this.$playground.height(); 43 | let unit = Math.min(this.width / 16, this.height / 9); 44 | this.width = unit * 16; 45 | this.height = unit * 9; 46 | this.scale = this.height; // 百分比地图的基准 47 | 48 | if (this.game_map) this.game_map.resize(); 49 | } 50 | 51 | update() { 52 | } 53 | 54 | show(mode) { // show playground 55 | let outer = this; 56 | this.$playground.show(); 57 | this.mode = mode; 58 | 59 | this.width = this.$playground.width(); 60 | this.height = this.$playground.height(); 61 | this.game_map = new GameMap(this); 62 | 63 | this.state = "waiting"; // 状态waiting -> fighting -> over 64 | this.notice_board = new NoticeBoard(this); 65 | this.score_board = new ScoreBoard(this); 66 | this.player_count = 0; 67 | 68 | this.resize(); 69 | this.players = []; 70 | this.players.push(new Player(this, this.width / 2 / this.scale, 0.5, 0.05, "white", 0.15, "me", this.root.settings.username, this.root.settings.photo)); 71 | 72 | 73 | if (mode === "single mode") { 74 | for (let i = 0; i < 5; i++) { 75 | this.players.push(new Player(this, this.width / 2 / this.scale, 0.5, 0.05, this.get_random_color(), 0.15, "robot")); 76 | } 77 | } else if (mode === "multi mode") { 78 | this.chat_field = new CharField(this); 79 | this.mps = new MultiPlayerSocket(this); 80 | this.mps.uuid = this.players[0].uuid; 81 | 82 | this.mps.ws.onopen = function () { 83 | outer.mps.send_create_player(outer.root.settings.username, outer.root.settings.photo); 84 | }; 85 | } 86 | } 87 | 88 | 89 | hide() { // close playground 90 | while (this.players && this.players.length > 0) { 91 | this.players[0].destroy(); 92 | } 93 | 94 | if (this.game_map) { 95 | this.game_map.destroy(); 96 | this.game_map = null; 97 | } 98 | 99 | if (this.notice_board) { 100 | this.notice_board.destroy(); 101 | this.notice_board = null; 102 | } 103 | 104 | if (this.score_board) { 105 | this.score_board.destroy(); 106 | this.score_board = null; 107 | } 108 | 109 | this.$playground.empty(); 110 | 111 | this.$playground.hide(); 112 | } 113 | 114 | 115 | } 116 | -------------------------------------------------------------------------------- /static/js/src/zbase.js: -------------------------------------------------------------------------------- 1 | export class AcGame { 2 | constructor(id, AcWingOS) { 3 | 4 | this.id = id; 5 | this.$ac_game = $('#' + id); 6 | this.AcWingOS = AcWingOS; 7 | 8 | this.settings = new Settings(this); 9 | 10 | 11 | this.menu = new AcGameMenu(this); 12 | 13 | this.playground = new AcGamePlayground(this); 14 | 15 | 16 | 17 | this.start() 18 | } 19 | 20 | start() { 21 | 22 | } 23 | } 24 | --------------------------------------------------------------------------------