- +
diff --git a/lang/de-de/index.html b/lang/de-de/index.html index c772d5b..39265d0 100644 --- a/lang/de-de/index.html +++ b/lang/de-de/index.html @@ -94,7 +94,7 @@- +
diff --git a/lang/en-us/index.html b/lang/en-us/index.html index 58787e2..8c84dbe 100644 --- a/lang/en-us/index.html +++ b/lang/en-us/index.html @@ -94,7 +94,7 @@- +
diff --git a/lang/es-ar/index.html b/lang/es-ar/index.html index 08e5060..6f233ac 100644 --- a/lang/es-ar/index.html +++ b/lang/es-ar/index.html @@ -94,7 +94,7 @@- +
diff --git a/lang/pt-br/index.html b/lang/pt-br/index.html index fced317..425408e 100644 --- a/lang/pt-br/index.html +++ b/lang/pt-br/index.html @@ -94,7 +94,7 @@- +
diff --git a/package.json b/package.json index 4b43c52..d4f914d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "instantgram", - "version": "12.0.0", + "version": "12.1.0", "description": "A bookmarklet for download photos in Instagram", "author": "Matheus Falcão and from 4.0.0 Sascha Heim", "homepage": "https://thinkbig-company.github.io/instantgram/", @@ -24,16 +24,15 @@ "build": "npm run build:webpack && npm run build:release" }, "devDependencies": { + "@babel/core": "^7.1.6", "@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/parser": "^4.33.0", - "babel-core": "^6.26.3", - "babel-loader": "^7.1.5", + "babel-loader": "^8.0.4", "babel-polyfill": "^6.26.0", "babel-preset-env": "^1.7.0", "babel-preset-es2015": "^6.24.1", "babel-preset-stage-0": "^6.24.1", "bookmarkletify": "github:ThinkBIG-Company/bookmarkletify", - "closure-webpack-plugin": "^2.5.0", "compression-webpack-plugin": "^8.0.0", "concurrently": "^6.5.1", "css-loader": "^5.2.7", @@ -61,6 +60,7 @@ }, "dependencies": { "client-zip": "^2.2.2", - "gulp": "^4.0.2" + "detect-browser": "^5.3.0", + "gulp": "^3.9.1" } } diff --git a/src/App.ts b/src/App.ts index fcaa21f..2652e4c 100644 --- a/src/App.ts +++ b/src/App.ts @@ -1,6 +1,8 @@ export type Program = { VERSION: string + browser: any + hostname: string path: string diff --git a/src/_langs/partials/button.html b/src/_langs/partials/button.html index 6fbbda8..7bac636 100644 --- a/src/_langs/partials/button.html +++ b/src/_langs/partials/button.html @@ -1 +1 @@ -[instantgram 12.0.0] \ No newline at end of file +[instantgram 12.1.0] \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 24d9cad..5234351 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,11 +5,17 @@ import { Modal } from './components/Modal' import Update from './modules/Update' import localize from './helpers/localize' +import { detect } from "detect-browser" +// Init browser detection +const browser = detect() + console.clear() const program: Program = { VERSION: process.env.VERSION as string, + browser: browser, + hostname: window.location.hostname, path: window.location.pathname, @@ -27,6 +33,12 @@ const program: Program = { if (process.env.DEV) { console.info(['Developer Mode Caution!', program]) + + if (program.browser) { + console.info(['Browser Name', program.browser.name]) + console.info(['Browser Version', program.browser.version]) + console.info(['Browser OS', program.browser.os]) + } } /* =============================== diff --git a/src/modules/FeedScanner.ts b/src/modules/FeedScanner.ts index 94fdaaa..1d6c564 100644 --- a/src/modules/FeedScanner.ts +++ b/src/modules/FeedScanner.ts @@ -25,9 +25,6 @@ export class FeedScanner implements Module { let selectedCarouselMediaSlideIndex: number let isLastMedia: boolean = false - // Container - let $container = document.querySelector("main") - // Selected Article let $article: Element @@ -37,21 +34,17 @@ export class FeedScanner implements Module { // Media selector let mediaSelector: string = "._aagv" - let carouselLeftButtonSelector: string = "._aahh" - let carouselRightButtonSelector: string = "._aahi" + let carouselLeftButtonSelector: string = "._9zm0" + let carouselRightButtonSelector: string = "._9zm2" + // Scanner begins if (mediaEl == null) { - $container = document.querySelector("main section > div:first-child > div:last-child > div:first-child > div:first-child") - //$articles = $container.querySelectorAll("article") $articles = document.getElementsByTagName("article") let mediaElInfos: any[] = [] for (let i1 = 0; i1 < $articles.length; i1++) { let isCarousel = $articles[i1].querySelector(carouselLeftButtonSelector) !== null || $articles[i1].querySelector(carouselRightButtonSelector) !== null - //console.log([`article ${i1 + 1}`, $articles[i1]]) - //console.log([`isCarousel ${i1 + 1}`, isCarousel]) - let mediaEl: any if (isCarousel) { mediaEl = $articles[i1].querySelector(":first-child > :nth-child(2) > :first-child ul > li:nth-child(2) img[crossorigin='anonymous']") @@ -86,11 +79,15 @@ export class FeedScanner implements Module { ).filter((el: any) => el.firstChild != null && el.classList.length > 0) if (carouselMediaSlideElements != null && carouselMediaSlideElements.length > 0) { - let carouselControlsArray: any = ($article as HTMLElement).querySelectorAll(":first-child > div:nth-child(2) > div > div:nth-child(2) > div") + let carouselControlsArray: any = Array.from( + ($article as HTMLElement).querySelectorAll( + ":first-child > div:nth-child(2) > div > div:nth-child(2) > div" + ) + ).filter((el: any) => el.classList.length <= 2) // Detect current image index of carousel for (let i = 0; i < carouselControlsArray.length; i++) { - if (carouselControlsArray[i].classList.length >= 2) { + if (carouselControlsArray[i].classList.length == 2) { selectedCarouselMediaSlideIndex = i } @@ -140,60 +137,157 @@ export class FeedScanner implements Module { } break case 5: - if (S == 4) { - mediaEl = M[Math.ceil(M.length / 2)] - } else if (S == 3) { - mediaEl = M[Math.ceil(M.length / 2)] + if (program.browser.name == "firefox") { + if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } else { - mediaEl = M[Math.ceil(M.length / 2) - 1] + if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } break case 6: - if (S == 4) { - mediaEl = M[Math.ceil(M.length / 2) - 1] - } else if (S == 3) { - mediaEl = M[Math.ceil(M.length / 2)] - } else if (S == 2) { - mediaEl = M[Math.ceil(M.length / 2) - 1] + if (program.browser.name == "firefox") { + if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 2) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else { + mediaEl = M[Math.ceil(M.length / 2)] + } } else { - mediaEl = M[Math.ceil(M.length / 2)] + if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 2) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else { + mediaEl = M[Math.ceil(M.length / 2)] + } } break case 7: - if (S == 5) { - mediaEl = M[Math.ceil(M.length / 2)] - } else if (S == 4) { - mediaEl = M[Math.ceil(M.length / 2) - 1] - } else if (S == 3) { - mediaEl = M[Math.ceil(M.length / 2)] + if (program.browser.name == "firefox") { + if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } else { - mediaEl = M[Math.ceil(M.length / 2) - 1] + if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } break case 8: - if (S == 6) { - mediaEl = M[Math.ceil(M.length / 2) - 1] - } else if (S == 5) { - mediaEl = M[Math.ceil(M.length / 2)] - } else if (S == 4) { - mediaEl = M[Math.ceil(M.length / 2) - 1] - } else if (S == 3) { - mediaEl = M[Math.ceil(M.length / 2)] + if (program.browser.name == "firefox") { + if (S == 7) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 6) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } else { - mediaEl = M[Math.ceil(M.length / 2) - 1] + if (S == 6) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } + } + break + case 9: + if (program.browser.name == "firefox") { + if (S == 7) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 6) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } + } else { + if (S == 6) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } break case 10: - if (S == 8) { - mediaEl = M[Math.ceil(M.length / 2)] - } else if (S == 5) { - mediaEl = M[Math.ceil(M.length / 2)] - } else if (S == 4) { - mediaEl = M[Math.ceil(M.length / 2) - 1] - } else if (S == 3) { - mediaEl = M[Math.ceil(M.length / 2)] + if (program.browser.name == "firefox") { + if (S == 9) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 8) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 7) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } else { - mediaEl = M[Math.ceil(M.length / 2) - 1] + if (S == 8) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } break } diff --git a/src/modules/PostScanner.ts b/src/modules/PostScanner.ts index 67f5f57..1086723 100644 --- a/src/modules/PostScanner.ts +++ b/src/modules/PostScanner.ts @@ -21,9 +21,8 @@ export class PostScanner implements Module { let mediaEl = null let mediaType: MediaType = MediaType.UNDEFINED - let mediaURL: string = null - let selectedCarouselIndex: number + let selectedCarouselMediaSlideIndex: number let isLastMedia: boolean = false // Container @@ -35,8 +34,8 @@ export class PostScanner implements Module { // Media selector let mediaSelector: string = "._aagv" - let carouselLeftButtonSelector: string = "._aahh" - let carouselRightButtonSelector: string = "._aahi" + let carouselLeftButtonSelector: string = "._9zm0" + let carouselRightButtonSelector: string = "._9zm2" // Scanner begins if (isModal) { @@ -50,209 +49,333 @@ export class PostScanner implements Module { isCarousel = $article.querySelectorAll(carouselLeftButtonSelector).length !== 0 || $article.querySelectorAll(carouselRightButtonSelector).length !== 0 } - console.log(["$article", $article]) - /* Series images in a modal */ if (isCarousel) { - let multiMedia: any = Array.from( + let carouselMediaSlideElements: any = Array.from( ($article as any).querySelectorAll( "div > :first-child > :first-child > :first-child > ul li" ) ).filter((el: any) => el.firstChild != null && el.classList.length > 0) - if (multiMedia != null && multiMedia.length > 0) { - mediaEl = null - mediaURL = null - - if (process.env.DEV) { - console.log(["multiMedia", multiMedia]) - console.log(["multiMedia.length", multiMedia.length]) - } - - let carouselControlsArray: any = ($article as HTMLElement).querySelectorAll("article > :first-child > :first-child > :first-child > div:nth-child(2) > div") + if (carouselMediaSlideElements != null && carouselMediaSlideElements.length > 0) { + let carouselControlsArray: any = Array.from( + ($article as HTMLElement).querySelectorAll( + "article > :first-child > :first-child > :first-child > div:nth-child(2) > div" + ) + ).filter((el: any) => el.classList.length <= 2) // Detect current image index of carousel for (let i = 0; i < carouselControlsArray.length; i++) { - if (carouselControlsArray[i].classList.length >= 2) { - selectedCarouselIndex = i + if (carouselControlsArray[i].classList.length == 2) { + selectedCarouselMediaSlideIndex = i } // Is last media - if (selectedCarouselIndex == carouselControlsArray.length - 1) { + if (selectedCarouselMediaSlideIndex == carouselControlsArray.length - 1) { isLastMedia = true break } } - selectedCarouselIndex++ + selectedCarouselMediaSlideIndex++ if (process.env.DEV) { console.log(["carouselControlsArray", carouselControlsArray]) console.log(["carouselControlsArray.length", carouselControlsArray.length]) - console.log(["selectedCarouselIndex", selectedCarouselIndex]) + console.log(["selectedCarouselMediaSlideIndex", selectedCarouselMediaSlideIndex]) console.log(["isLastMedia", isLastMedia]) } - for (let i = 0; i < multiMedia.length; i++) { - if (multiMedia.length == 2) { + let M = carouselMediaSlideElements + let S = selectedCarouselMediaSlideIndex + for (let i = 0; i < M.length; i++) { + if (M.length == 2) { if (isLastMedia) { - mediaEl = multiMedia[1] + mediaEl = M[1] } else { - mediaEl = multiMedia[0] + mediaEl = M[0] } - } else if (multiMedia.length == 3) { + } else if (M.length == 3) { if (isLastMedia) { - mediaEl = multiMedia[2] + mediaEl = M[2] } else { - mediaEl = multiMedia[1] - console.log('ff') - console.log(mediaEl); - + mediaEl = M[1] } - } else if (multiMedia.length == 4) { + } else if (M.length == 4) { if (isLastMedia) { - mediaEl = multiMedia[2] + mediaEl = M[2] } else { // Dont mess with me Instagram!!! if (isModal && Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0) < 445) { switch (carouselControlsArray.length) { case 4: - if (selectedCarouselIndex == 3) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 2) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 2) { + mediaEl = M[Math.ceil(M.length / 2) - 1] } else { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + mediaEl = M[Math.ceil(M.length / 2) - 1] } break case 5: - if (selectedCarouselIndex == 4) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 3) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + if (program.browser.name == "firefox") { + if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } else { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + + if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } break case 6: - if (selectedCarouselIndex == 4) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 3) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] - } else if (selectedCarouselIndex == 2) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 2) { + mediaEl = M[Math.ceil(M.length / 2) - 1] } else { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] + mediaEl = M[Math.ceil(M.length / 2)] } break case 7: - if (selectedCarouselIndex == 5) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 4) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 3) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + if (program.browser.name == "firefox") { + if (S == 6) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } else { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } break case 8: - if (selectedCarouselIndex == 7) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 6) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 5) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] - } else if (selectedCarouselIndex == 4) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] - } else if (selectedCarouselIndex == 3) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + if (program.browser.name == "firefox") { + if (S == 6) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } else { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + if (S == 7) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 6) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } break case 10: - if (selectedCarouselIndex == 9) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 8) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] - } else if (selectedCarouselIndex == 5) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 4) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 3) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + if (program.browser.name == "firefox") { + if (S == 9) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 8) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 7) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 6) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } else { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + if (S == 9) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 8) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } break } } else { switch (carouselControlsArray.length) { case 4: - if (selectedCarouselIndex == 3) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 2) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 2) { + mediaEl = M[Math.ceil(M.length / 2) - 1] } else { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + mediaEl = M[Math.ceil(M.length / 2) - 1] } break case 5: - if (selectedCarouselIndex == 4) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 3) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] + if (program.browser.name == "firefox") { + if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } else { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } break case 6: - if (selectedCarouselIndex == 4) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] - } else if (selectedCarouselIndex == 3) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 2) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + if (program.browser.name == "firefox") { + if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 2) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else { + mediaEl = M[Math.ceil(M.length / 2)] + } } else { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] + if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 2) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else { + mediaEl = M[Math.ceil(M.length / 2)] + } } break case 7: - if (selectedCarouselIndex == 5) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 4) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] - } else if (selectedCarouselIndex == 3) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] + if (program.browser.name == "firefox") { + if (S == 6) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } else { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } break case 8: - if (selectedCarouselIndex == 6) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] - } else if (selectedCarouselIndex == 5) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 4) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] - } else if (selectedCarouselIndex == 3) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] + if (program.browser.name == "firefox") { + if (S == 7) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 6) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } else { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + if (S == 6) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } break case 10: - if (selectedCarouselIndex == 8) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 5) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] - } else if (selectedCarouselIndex == 4) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] - } else if (selectedCarouselIndex == 3) { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2)] + if (program.browser.name == "firefox") { + if (S == 9) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 8) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 7) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 6) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } else { - mediaEl = multiMedia[Math.ceil(multiMedia.length / 2) - 1] + if (S == 8) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 5) { + mediaEl = M[Math.ceil(M.length / 2)] + } else if (S == 4) { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } else if (S == 3) { + mediaEl = M[Math.ceil(M.length / 2)] + } else { + mediaEl = M[Math.ceil(M.length / 2) - 1] + } } break }