diff --git a/main.js b/main.js index 0bfc138..c6879a7 100644 --- a/main.js +++ b/main.js @@ -4,7 +4,7 @@ // @version 2024-11-18 // @desc try to take over the world! // @author You -// @match https://rst.runcity.org/*/cp_mgmt* +// @match https://rst.runcity.org/* // @icon https://www.google.com/s2/favicons?sz=64&domain=runcity.org // @grant none // @require https://code.jquery.com/jquery-3.7.1.min.js @@ -758,10 +758,12 @@ function addFullscreenButton() { $(async () => { - while (L.Control.Fullscreen === undefined) { - await sleep(500) + if (document.querySelector("#map") !== null) { + while (L.Control.Fullscreen === undefined) { + await sleep(500) + } + map.addControl(new L.Control.Fullscreen()) } - map.addControl(new L.Control.Fullscreen()) }) } @@ -776,325 +778,325 @@ #content-wrapper { display: flex; gap: 20px; - } - - #props { - width: unset !important; - } - - #content-wrapper form { - width: 50%; - } - - #content-wrapper #map-wrapper { - width: 50%; - } - - #content-wrapper #map { - width: unset !important; - } - - #new { - display: flex; - flex-direction: column; - } - - #new > :not(:first-child) { - padding-top: 5px; - border-top: 1px solid #ddd; - } - - #new > :not(:last-child) { - padding-bottom: 5px; - } - - #cps_main { - width: 150px; - } - - #new .map-icon { - width: 15px; - height: 15px; - } - - #new .copy-button { - all: unset; - cursor: pointer; - } - - #new .copy-button img { - width: 15px; - heigth: 15px; - } - - input[type=submit] { - width: fit-content; - } - - .desc-icon-container { - display: flex; - align-items: center; - } - - .desc-icon { - width: 15px; - height: 15px; - cursor: help; - } - - button, input[type=submit] { - cursor: pointer; - } - - #new input[type=radio], input[type=checkbox] { - margin: 0; - } - - #new input[type="file"] { - display: none; - } - - #new div > input[type="checkbox"] { - display: flex; - align-items: center; - } - - .buttons-row__content-wrapper { - display: flex; - justify-content: center; - gap: 10px; - font-weight: normal; - } - - #new input#cp_number { - width: 3em; - } - - #new select#cps_main { - width: 6em; - } - - #new input:is(#lat, #lng) { - width: 5.5em; - } - - #new input[name="cp[name_int]"] { - width: 34em; - } - - .custom-file-upload { - display: block; - width: fit-content; - border: 1px solid black; - padding: 5px 14px; - border-radius: 5px; - box-shadow: 0 1px 3px #ddd; - background: linear-gradient(white, #ddd); - } - - .buttons > * > * { - display: flex; - gap: 10px; - } - - .always-prettify-container { - display: flex; - align-items: center; - gap: 5px; - } - - .header > * { - display: flex; - gap: 5px; - } - - :is(.header, .options) input { - width: unset; - } - - .header { - display: flex; - gap: 30px; - align-items: start; - } - - .options { - display: flex; - flex-wrap: wrap; - gap: 10px; - } - - .options > * { - display: flex; - gap: 5px; - align-items: center; - } - - .legend-container { - display: flex; - } - - .legend-container > :not(:last-child) { - padding-right: 15px; - border-right: 1px solid #ddd; - } - - .legend-container > :not(:first-child) { - padding-left: 15px; - } - - .legend-container > * { - display: flex; - flex-direction: column; - flex: 0 1 48%; - gap: 5px; - } - - .legend-container__desc-header { - display: flex; - gap: 10px; - align-items: center; - justify-content: end; - } - - .legend-desc { - display: flex; - flex-direction: column; - gap: 5px; - } - - .collapsed, .hidden { - display: none; - } - - .collapse-button::after { - content: "Свернуть" - } - - .collapsed + * > .collapse-button::after { - content: "Развернуть" - } - :is(.comment, .legend-desc) > * { - display: flex; - gap: 5px; - } + #props { + width: unset !important; + } - :is(.comment, .legend-desc) label { - display: block; - width: 10em; - } + form { + width: 50%; + } - :is(.comment, .legend-desc) > * > :nth-child(2) { - flex: 1 1 auto; - } + #map-wrapper { + width: 50%; + } - textarea { - width: 100%; - } + #map { + width: unset !important; + } - .files-container input[type=radio] { - display: none; - } + #new { + display: flex; + flex-direction: column; - .file-list-container { - display: flex; - flex-wrap: wrap; - gap: 10px; - margin-top: 5px; - } + & > :not(:first-child) { + padding-top: 5px; + border-top: 1px solid #ddd; + } - .file-container { - display: flex; - flex-direction: column; - gap: 5px; - } + & > :not(:last-child) { + padding-bottom: 5px; + } - .file-container img.preview { - width: 120px; - } + .map-icon { + width: 15px; + height: 15px; + } - .file-container img.preview-small { - width: 60px; - } + .copy-button { + all: unset; + cursor: pointer; + } - .file-container img:is(.preview, .preview-small) { - cursor: zoom-in; - } + .copy-button img { + width: 15px; + heigth: 15px; + } - dialog .preview, - .swiper { - max-width: 1000px; - width: 100%; - max-height: 500px; - height: 100%; - } + input[type=radio], input[type=checkbox] { + margin: 0; + } - .swiper-button-next, - .swiper-button-prev { - user-select: none; - -webkit-user-select: none; - } + input[type="file"] { + display: none; + } - .swiper-wrapper { - align-items: center; - } + div > input[type="checkbox"] { + display: flex; + align-items: center; + } - .swiper-wrapper > .swiper-slide { - width: 100%; - max-height: 500px; - height: 100%; - } + input#cp_number { + width: 3em; + } - .swiper-slide img { - width: 100%; - max-height: 500px; - height: 100%; - object-fit: contain; - object-position: center; - } + select#cps_main { + width: 6em; + } - .swiper-download-link { - display: block; - position: absolute; - top: 0; - right: 0; - background: white; - padding: 5px 10px; - margin: 5px; - border: 1px solid #ccc; - border-radius: 7.5px; - } + input:is(#lat, #lng) { + width: 5.5em; + } - button.button-delete { - padding: 0; - border: 0; - margin: 0; - background: none; - font-size: 18px; - } + input[name="cp[name_int]"] { + width: 34em; + } + } - .admin-files-container { - display: flex; - } + #cps_main { + width: 150px; + } - .admin-files-container > :not(:last-child) { - padding-right: 10px; - border-right: 1px solid #ddd; - } + input[type=submit] { + width: fit-content; + } - .admin-files-container > :not(:first-child) { - padding-left: 10px; - } + .desc-icon-container { + display: flex; + align-items: center; + } - dialog img.preview { - width: auto; - } + .desc-icon { + width: 15px; + height: 15px; + cursor: help; + } - .file-buttons-container { - display: flex; - align-items: center; - gap: 5px; + button, input[type=submit] { + cursor: pointer; + } + + .buttons-row__content-wrapper { + display: flex; + justify-content: center; + gap: 10px; + font-weight: normal; + } + + .custom-file-upload { + display: block; + width: fit-content; + border: 1px solid black; + padding: 5px 14px; + border-radius: 5px; + box-shadow: 0 1px 3px #ddd; + background: linear-gradient(white, #ddd); + } + + .buttons > * > * { + display: flex; + gap: 10px; + } + + .always-prettify-container { + display: flex; + align-items: center; + gap: 5px; + } + + .header > * { + display: flex; + gap: 5px; + } + + :is(.header, .options) input { + width: unset; + } + + .header { + display: flex; + gap: 30px; + align-items: start; + } + + .options { + display: flex; + flex-wrap: wrap; + gap: 10px; + } + + .options > * { + display: flex; + gap: 5px; + align-items: center; + } + + .legend-container { + display: flex; + } + + .legend-container > :not(:last-child) { + padding-right: 15px; + border-right: 1px solid #ddd; + } + + .legend-container > :not(:first-child) { + padding-left: 15px; + } + + .legend-container > * { + display: flex; + flex-direction: column; + flex: 0 1 48%; + gap: 5px; + } + + .legend-container__desc-header { + display: flex; + gap: 10px; + align-items: center; + justify-content: end; + } + + .legend-desc { + display: flex; + flex-direction: column; + gap: 5px; + } + + .collapsed, .hidden { + display: none; + } + + .collapse-button::after { + content: "Свернуть" + } + + .collapsed + * > .collapse-button::after { + content: "Развернуть" + } + + :is(.comment, .legend-desc) > * { + display: flex; + gap: 5px; + } + + :is(.comment, .legend-desc) label { + display: block; + width: 10em; + } + + :is(.comment, .legend-desc) > * > :nth-child(2) { + flex: 1 1 auto; + } + + textarea { + width: 100%; + } + + .files-container input[type=radio] { + display: none; + } + + .file-list-container { + display: flex; + flex-wrap: wrap; + gap: 10px; + margin-top: 5px; + } + + .file-container { + display: flex; + flex-direction: column; + gap: 5px; + } + + .file-container img.preview { + width: 120px; + } + + .file-container img.preview-small { + width: 60px; + } + + .file-container img:is(.preview, .preview-small) { + cursor: zoom-in; + } + + dialog .preview, + .swiper { + max-width: 1000px; + width: 100%; + max-height: 500px; + height: 100%; + } + + .swiper-button-next, + .swiper-button-prev { + user-select: none; + -webkit-user-select: none; + } + + .swiper-wrapper { + align-items: center; + } + + .swiper-wrapper > .swiper-slide { + width: 100%; + max-height: 500px; + height: 100%; + } + + .swiper-slide img { + width: 100%; + max-height: 500px; + height: 100%; + object-fit: contain; + object-position: center; + } + + .swiper-download-link { + display: block; + position: absolute; + top: 0; + right: 0; + background: white; + padding: 5px 10px; + margin: 5px; + border: 1px solid #ccc; + border-radius: 7.5px; + } + + button.button-delete { + padding: 0; + border: 0; + margin: 0; + background: none; + font-size: 18px; + } + + .admin-files-container { + display: flex; + } + + .admin-files-container > :not(:last-child) { + padding-right: 10px; + border-right: 1px solid #ddd; + } + + .admin-files-container > :not(:first-child) { + padding-left: 10px; + } + + dialog img.preview { + width: auto; + } + + .file-buttons-container { + display: flex; + align-items: center; + gap: 5px; + } } `