From 7a9c53e2284a42ed07746d36c7ddf80b3e714db3 Mon Sep 17 00:00:00 2001 From: vordenken <62395860+vordenken@users.noreply.github.com> Date: Thu, 28 Nov 2024 10:20:50 +0100 Subject: [PATCH 1/3] update content.js add feature for automatic PiP on program change (even without stagemanager) --- AutoPiP Extension/Resources/content.js | 37 ++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/AutoPiP Extension/Resources/content.js b/AutoPiP Extension/Resources/content.js index c699e98..89e1e16 100644 --- a/AutoPiP Extension/Resources/content.js +++ b/AutoPiP Extension/Resources/content.js @@ -1,5 +1,9 @@ // content.js -document.addEventListener("visibilitychange", function() { +document.addEventListener("visibilitychange", handleVisibilityChange); +window.addEventListener("blur", handleWindowBlur); +window.addEventListener("focus", handleWindowFocus); + +function handleVisibilityChange() { const video = getVideo(); if (!video) return; @@ -9,13 +13,36 @@ document.addEventListener("visibilitychange", function() { enablePiP(); } } else { - // Tab wird wieder aktiv - beende PiP - if (document.pictureInPictureElement || - (video.webkitPresentationMode && video.webkitPresentationMode === "picture-in-picture")) { + // Tab wird wieder aktiv - beende PiP nur wenn wir wirklich im Tab sind + if (document.hasFocus() && + (document.pictureInPictureElement || + (video.webkitPresentationMode && video.webkitPresentationMode === "picture-in-picture"))) { disablePiP(); } } -}); +} + +function handleWindowBlur() { + const video = getVideo(); + if (!video) return; + + // Aktiviere PiP wenn Safari den Fokus verliert und Video läuft + if (!video.paused && video.currentTime > 0 && !video.ended) { + enablePiP(); + } +} + +function handleWindowFocus() { + const video = getVideo(); + if (!video) return; + + // Deaktiviere PiP wenn Safari den Fokus erhält und wir im Video-Tab sind + if (!document.hidden && document.hasFocus() && + (document.pictureInPictureElement || + (video.webkitPresentationMode && video.webkitPresentationMode === "picture-in-picture"))) { + disablePiP(); + } +} // DOM Änderungen überwachen new MutationObserver(checkForVideo).observe(document, { From 24dd276d3dbe8fefdc4850ff38369f0cc436f929 Mon Sep 17 00:00:00 2001 From: vordenken <62395860+vordenken@users.noreply.github.com> Date: Thu, 28 Nov 2024 12:20:39 +0100 Subject: [PATCH 2/3] add toolbar menu with on/off toggle and links to github/kofi/bmc add feature for automatically toggle PiP when switching to different app add PRIVACY.md add icons for kofi/bmc/toolbar update README.md increment version to 0.3 --- .github/FUNDING.yml | 3 +- AutoPiP Extension/Info.plist | 11 ++ AutoPiP Extension/Resources/content.js | 48 ++++++++- .../Resources/images/icons8-bmc-64.png | Bin 0 -> 1372 bytes .../Resources/images/icons8-github-64.png | Bin 0 -> 1348 bytes .../Resources/images/icons8-kofi-64.png | Bin 0 -> 2878 bytes .../Resources/images/toolbar-icon-128.png | Bin 0 -> 2833 bytes .../Resources/images/toolbar-icon-16.png | Bin 0 -> 1452 bytes .../Resources/images/toolbar-icon-48.png | Bin 0 -> 1887 bytes AutoPiP Extension/Resources/manifest.json | 15 ++- AutoPiP Extension/Resources/popup.html | 94 +++++++++++++++++- AutoPiP Extension/Resources/popup.js | 37 ++++++- AutoPiP.xcodeproj/project.pbxproj | 30 ++++-- PRIVACY.md | 26 +++++ README.md | 18 +++- 15 files changed, 259 insertions(+), 23 deletions(-) create mode 100644 AutoPiP Extension/Resources/images/icons8-bmc-64.png create mode 100644 AutoPiP Extension/Resources/images/icons8-github-64.png create mode 100644 AutoPiP Extension/Resources/images/icons8-kofi-64.png create mode 100644 AutoPiP Extension/Resources/images/toolbar-icon-128.png create mode 100644 AutoPiP Extension/Resources/images/toolbar-icon-16.png create mode 100644 AutoPiP Extension/Resources/images/toolbar-icon-48.png create mode 100644 PRIVACY.md diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index ccd6e75..1eca744 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,4 @@ # Thank you so much for supporting me. This will help me further develop apps and eventually publish them in the AppStore. -buy_me_a_coffee: vordenken \ No newline at end of file +buy_me_a_coffee: vordenken +ko_fi: vordenken \ No newline at end of file diff --git a/AutoPiP Extension/Info.plist b/AutoPiP Extension/Info.plist index 9ee504d..f0071b1 100644 --- a/AutoPiP Extension/Info.plist +++ b/AutoPiP Extension/Info.plist @@ -2,6 +2,17 @@ + SFSafariToolbarItem + + Label + AutoPiP + Image + toolbar-icon.svg + Identifier + com.vd.AutoPiP.Extension + Action + Popup + NSExtension NSExtensionPointIdentifier diff --git a/AutoPiP Extension/Resources/content.js b/AutoPiP Extension/Resources/content.js index 89e1e16..61abaaa 100644 --- a/AutoPiP Extension/Resources/content.js +++ b/AutoPiP Extension/Resources/content.js @@ -1,7 +1,49 @@ // content.js -document.addEventListener("visibilitychange", handleVisibilityChange); -window.addEventListener("blur", handleWindowBlur); -window.addEventListener("focus", handleWindowFocus); +let isEnabled = true; + +// Wrapper-Funktionen für Event Listener +function handleVisibilityChangeWrapper() { + if (isEnabled) handleVisibilityChange(); +} + +function handleWindowBlurWrapper() { + if (isEnabled) handleWindowBlur(); +} + +function handleWindowFocusWrapper() { + if (isEnabled) handleWindowFocus(); +} + +// Initial Event Listener Setup mit Wrapper-Funktionen +document.addEventListener("visibilitychange", handleVisibilityChangeWrapper); +window.addEventListener("blur", handleWindowBlurWrapper); +window.addEventListener("focus", handleWindowFocusWrapper); + +// Lade initialen Status +browser.storage.local.get('enabled', function(result) { + isEnabled = result.enabled === undefined ? true : result.enabled; +}); + +// Message Listener für Toggle-Befehle +browser.runtime.onMessage.addListener((message, sender, sendResponse) => { + if (message.command === "toggleAutoPiP") { + isEnabled = message.enabled; + console.log('AutoPiP enabled:', isEnabled); + + // Wenn deaktiviert, PiP sofort beenden + if (!isEnabled && getVideo()) { + const video = getVideo(); + if (document.pictureInPictureElement || + (video.webkitPresentationMode && + video.webkitPresentationMode === "picture-in-picture")) { + disablePiP(); + } + } + + sendResponse({enabled: isEnabled}); + return true; + } +}); function handleVisibilityChange() { const video = getVideo(); diff --git a/AutoPiP Extension/Resources/images/icons8-bmc-64.png b/AutoPiP Extension/Resources/images/icons8-bmc-64.png new file mode 100644 index 0000000000000000000000000000000000000000..fddd541a8ae99df90b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#YQT?%aAy%bN4?UnI zvdO|*CBjpVy0m$Fy@Y2h`xuIq(_!3=H96_<{)ujN^kO5I-pf&H&YpcR5f?Udq+0O} z^plyR9aQBLWtOyZ=gnu-yVDXErM7@0>loV?nVmm0?Ke73>xw0Za)(gBI9b?A-_JL+ z;zv{WXr7^a{Q2fbQ{&HR8$QGAE%sG%coF8vbG*{-`qv>w2onz{GRPmWCPxK^PL{_8 zF_WV?nX%u<@v-9_EK9-43@lE-_w)24NnTo1KAgn=<&P=*b%7 literal 0 HcmV?d00001 diff --git a/AutoPiP Extension/Resources/images/toolbar-icon-128.png b/AutoPiP Extension/Resources/images/toolbar-icon-128.png new file mode 100644 index 0000000000000000000000000000000000000000..ef77f9403d1305301a14a6ca042ef98e6900e4eb GIT binary patch literal 2833 zcmds3do+~m8vkZoHcBX4j-+u(ZZqG^$ZgDwLoQLSTic*8F&MY8X9i<8qAlsrIZ`B> zjI8V;$>m5yF z$-zciN=XU;0BPI9mM+j5Cma&u(ENl*Zh;mU!^Oq|C~j3AfnI*2kZk?!?ExLgmH@edU3fT>$XrCi^d+rVK6wXF#?0e z=|i>wP$|wYgIto~hus+ffKnF@7%Sf_5&%RhsIDX?$^IzLmlld5`_WEPP^{2!p%Q>+ z;UF`V!XzVDp&?-m9E+f~g1|wxa2r%ZtU#E-1T~Vq6XFn!PC*!=&?vMTQ3`=T;OTz; zI2TLnH9GW0Pzz)-!*L)O6%~bw(nrzg0U*Z2!~{fRK`a&tA&`vdFeaIW3}dLTihS0w zq%eHx)Nm%17KRY&l26him;^O7VW2P1YMvApbv;rTW34QxKv3ubF(@>+6%8u(OMZW1 zvB=?HB{8Y~Ux_93tkPBvV>L&-FazAm7w&FJ4W)!Jpn8ZHtTBEix4(GStJ}aNeU-Vv zvw;Z}hC4*32pi0mMhhWs*>8AoGi)mbiY1vzAqtxeiNPST#;%{6Oc#y8q0t*eR*{=D z?4hplBQwccsTkl68gEqj6Ly1+@LX{u7Yc(G5+UpcqCR@%0Wrb_5B|l!nY&Is7Di;5exZuD>FI?|~WsH<19#jJ(fxVMJKgTlt%(CDkTXk{0=Mnoy-ct2lB zqEvHgj6VQ~tJ_+dyRu+o*ZNy1-zheD*DBSXdn~4I@cf@zZU^Oq#*b!N-j}7{mK~^< zM*07uv0G~imiOi@T+WVuNZsm{#!%Q`Cqn$0xF6!`5HTWkuTAR_xR)E69#!CSRO5W#L~6YrsuS#bE7DNdZ)Q-mtsH3eGM&;v4r6^I zmJ2JZruEWi%JB}_BUD~YMFn|}h3aUG)vuFN&+;(EyMq@;!`a6!srY=`xyvI>_mfP1 zrK@v@5nuCL!J~&Af?nGs8{qcTyBn`hX~MeON{tG$)qocQ{7cq$i3oCBOJ z)wr2g^YgJOO@z98Czj&bm26b$)g#w~K4G)I3CfG^7x^j%~JZp&S>3pfX8F@an;zwij4HglnJ}84{tq1?>4=^db$z&NCSRVrN#NhplWyE zlFCFV?+y=q@~^D4KDplmE-7oq%?5WC=oi2aAVr^5ML#v_JknQyOq8rk(Ro^ol)SP_ z?!37{Y^(%t|6C>S$k5Y1r*~sz*xN&B*h3|$8t)O(TuHK@7_1+@kX4gm)UrsO?HNiK zGqUs6tTpd@cp~t->c}%mjQvUd?O~JGw4a-6Z(nd1*glILoIC!!GWm4-y=#}Vjg?0` z1$HsMph{VhX5uu^uifK0aBDcNM!o2A(SdNEv5WP6g3~ghbM`q#oih!XpwzT*s5JL~KfOn3vQo7T1gXONsIClB(pvg{LuDi)A-u5^? zvPUU`Tdh=`RP(p4u8cTNj$w0kBRBVtA@4ny|Kiv83`JwY3@)?3-tgfa;a^?A*2=-M J*uv+h{{T+tB+dW; literal 0 HcmV?d00001 diff --git a/AutoPiP Extension/Resources/images/toolbar-icon-16.png b/AutoPiP Extension/Resources/images/toolbar-icon-16.png new file mode 100644 index 0000000000000000000000000000000000000000..c265dbbd675ec62521ee385c4bc7f582b74bcd16 GIT binary patch literal 1452 zcmeAS@N?(olHy`uVBq!ia0vp^{2T7^B zh^Yf2V01ucMQToNVo83HLO@Zzg0Y^No}n=V1Iq*!uo)siwVM_&BJ5wl1UHX=0W*RP zGTF$$$i&Lf(8|a{!O+0U7|1qd*#5ZTDo~2Ez$3Dlfk96hgc&QA+LtjfFmKKbi71Ki z^|4CM&(%vz$xlkvtH>h?X&sHg;q@=(~U%$M(T(8_%FTW^V z-_X+1Qs2Nx-^fT8s6w~6GOr}DLN~8i8Da>`9GBGMkwpkBiD?@cS{WE183Iv>W`-{?&7>rjBw{ng)XKmd z*%TDDNalb-)hZ$=wKzYg6qFY1j19m*-w;IE=wryE>qTe{&C4vYGlFVC6Gqn+iIB%? zBeFcYUjL%ZRA8D0yVekD9kLiyy^TI7StBKLNFD-<0yB{v7ch8X8PbmH;Eqe0z&v`u z)5S4FL-gvT-CTzp1Y93S2PP@s;7H0|+1eWa;Q23MMrm#CgI;TN`huIFsuWEVC=Cfe(V-`+J>l?G9TLrfy@*ZMB|w`JzN&c-i_ZzuKKTzx=tieL4Hs=r73GdD$x+s(Zj@p{J&xr`N3vRZ2r Q_&^1Yr>mdKI;Vst0DY>XS^xk5 literal 0 HcmV?d00001 diff --git a/AutoPiP Extension/Resources/images/toolbar-icon-48.png b/AutoPiP Extension/Resources/images/toolbar-icon-48.png new file mode 100644 index 0000000000000000000000000000000000000000..a434de2372891d5041853f57178d94b3df527317 GIT binary patch literal 1887 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC#^NA%Cx&(BWL^R}$5JCa(|mmy zw18|51~x_^24;{FAY@>aVqgWc85qJCrQz&2Mh&PMCZHNa1|Z2G2E=LYnG7sY^))~m z#MA*1FghT!A~h#Bu_V7pA)qK<*bEV%+D!`>5%w=&f}3ZsfEmFC znQUZWWMXA#Xk}!fU}#`v3}l-!d=6YL2bAJ0@Q5sCV9-+rVaAH3_GJtV%$qYqB1$5B zeXNr6bM+Ea@{>~aDsl@zCNbDlSOJ;2sU?XD6}dTi#a0!zN?;XMKsHENUr7P1q$Jx` zDZ)2E!8yMuRl!W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document_end" - }] + }], + "browser_action": { + "default_popup": "popup.html", + "default_icon": { + "16": "images/toolbar-icon-16.png", + "48": "images/toolbar-icon-48.png", + "128": "images/toolbar-icon-128.png" + } + } } diff --git a/AutoPiP Extension/Resources/popup.html b/AutoPiP Extension/Resources/popup.html index ac52319..eab3d1c 100644 --- a/AutoPiP Extension/Resources/popup.html +++ b/AutoPiP Extension/Resources/popup.html @@ -1,11 +1,99 @@ + - - + - Hello World! +
+ AutoPiP +
+
AutoPiP
+
v0.3
+
+
+ +
+ + +
+ +
+ + + + diff --git a/AutoPiP Extension/Resources/popup.js b/AutoPiP Extension/Resources/popup.js index 5c1aa86..7ee57ec 100644 --- a/AutoPiP Extension/Resources/popup.js +++ b/AutoPiP Extension/Resources/popup.js @@ -1 +1,36 @@ -console.log("Hello World!", browser); +// popup.js +document.addEventListener('DOMContentLoaded', function() { + const toggleCheckbox = document.getElementById('toggleCheckbox'); + + // Lade gespeicherten Status + browser.storage.local.get('enabled', function(result) { + const enabled = result.enabled === undefined ? true : result.enabled; + toggleCheckbox.checked = enabled; + + // Sende initialen Status an alle Tabs + updateAllTabs(enabled); + }); + + // Checkbox Event Listener + toggleCheckbox.addEventListener('change', function() { + const enabled = toggleCheckbox.checked; + console.log('Checkbox changed to:', enabled); // Debug logging + + // Speichere Status + browser.storage.local.set({ enabled: enabled }); + + // Update alle Tabs + updateAllTabs(enabled); + }); +}); + +function updateAllTabs(enabled) { + browser.tabs.query({}, function(tabs) { + tabs.forEach(tab => { + browser.tabs.sendMessage(tab.id, { + command: "toggleAutoPiP", + enabled: enabled + }).catch(err => console.log('Error sending message to tab:', err)); + }); + }); +} diff --git a/AutoPiP.xcodeproj/project.pbxproj b/AutoPiP.xcodeproj/project.pbxproj index d15fbc9..22b5823 100644 --- a/AutoPiP.xcodeproj/project.pbxproj +++ b/AutoPiP.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ B9E4C0902CEB6D0D00364B69 /* AutoPiP Extension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = B9E4C08F2CEB6D0D00364B69 /* AutoPiP Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; B9E722042CF5F34B00951548 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = B9E722032CF5F34B00951548 /* Sparkle */; }; B9E722082CF5F6D300951548 /* appcast.xml in Resources */ = {isa = PBXBuildFile; fileRef = B9E722072CF5F6D300951548 /* appcast.xml */; }; + B9E7D7432CF8832100E527CC /* PRIVACY.md in Resources */ = {isa = PBXBuildFile; fileRef = B9E7D7422CF8831C00E527CC /* PRIVACY.md */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -62,6 +63,7 @@ B9E4C0832CEB6D0D00364B69 /* AutoPiPUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AutoPiPUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; B9E4C08F2CEB6D0D00364B69 /* AutoPiP Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "AutoPiP Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; B9E722072CF5F6D300951548 /* appcast.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = appcast.xml; sourceTree = ""; }; + B9E7D7422CF8831C00E527CC /* PRIVACY.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = PRIVACY.md; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ @@ -150,6 +152,7 @@ B9E4C0542CEB6D0B00364B69 = { isa = PBXGroup; children = ( + B9E7D7422CF8831C00E527CC /* PRIVACY.md */, B9E722072CF5F6D300951548 /* appcast.xml */, B9D72C4D2CEB7D1A00C3853D /* LICENSE */, B9D72C4B2CEB7B3400C3853D /* README.md */, @@ -326,6 +329,7 @@ buildActionMask = 2147483647; files = ( B9D72C4E2CEB7D1A00C3853D /* LICENSE in Resources */, + B9E7D7432CF8832100E527CC /* PRIVACY.md in Resources */, B9E722082CF5F6D300951548 /* appcast.xml in Resources */, B9D72C4C2CEB7B3800C3853D /* README.md in Resources */, B96CF0842CEB761900C7166A /* .gitignore in Resources */, @@ -410,7 +414,6 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = "AutoPiP Extension/AutoPiP_Extension.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 0.2; DEVELOPMENT_TEAM = NRKZZ9TFF7; ENABLE_HARDENED_RUNTIME = YES; GENERATE_INFOPLIST_FILE = YES; @@ -424,7 +427,7 @@ "@executable_path/../../../../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14; - MARKETING_VERSION = 0.2; + MARKETING_VERSION = 0.3; OTHER_LDFLAGS = ( "-framework", SafariServices, @@ -444,7 +447,6 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = "AutoPiP Extension/AutoPiP_Extension.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 0.2; DEVELOPMENT_TEAM = NRKZZ9TFF7; ENABLE_HARDENED_RUNTIME = YES; GENERATE_INFOPLIST_FILE = YES; @@ -458,7 +460,7 @@ "@executable_path/../../../../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14; - MARKETING_VERSION = 0.2; + MARKETING_VERSION = 0.3; OTHER_LDFLAGS = ( "-framework", SafariServices, @@ -607,9 +609,14 @@ CODE_SIGN_ENTITLEMENTS = AutoPiP/AutoPiP.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 0.2; DEVELOPMENT_TEAM = NRKZZ9TFF7; ENABLE_HARDENED_RUNTIME = YES; + EXCLUDED_SOURCE_FILE_NAMES = ( + README.md, + appcast.xml, + PRIVACY.md, + ".github/*", + ); GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = AutoPiP/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = AutoPiP; @@ -623,7 +630,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14; - MARKETING_VERSION = 0.2; + MARKETING_VERSION = 0.3; OTHER_LDFLAGS = ( "-framework", SafariServices, @@ -647,9 +654,14 @@ CODE_SIGN_ENTITLEMENTS = AutoPiP/AutoPiP.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 0.2; DEVELOPMENT_TEAM = NRKZZ9TFF7; ENABLE_HARDENED_RUNTIME = YES; + EXCLUDED_SOURCE_FILE_NAMES = ( + README.md, + appcast.xml, + PRIVACY.md, + ".github/*", + ); GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = AutoPiP/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = AutoPiP; @@ -663,7 +675,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.14; - MARKETING_VERSION = 0.2; + MARKETING_VERSION = 0.3; OTHER_LDFLAGS = ( "-framework", SafariServices, @@ -722,6 +734,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = NRKZZ9TFF7; GENERATE_INFOPLIST_FILE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.vd.AutoPiPUITests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -738,6 +751,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = NRKZZ9TFF7; GENERATE_INFOPLIST_FILE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.vd.AutoPiPUITests; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/PRIVACY.md b/PRIVACY.md new file mode 100644 index 0000000..cdbe521 --- /dev/null +++ b/PRIVACY.md @@ -0,0 +1,26 @@ +# Privacy Policy + +AutoPiP is designed with privacy in mind and does not collect, store, or transmit any personal data. + +## Permissions + +- The extension requires permission to "Access all websites" solely to detect video players and enable Picture-in-Picture functionality across different websites +- No data is collected, stored, or shared with third parties +- All functionality operates locally on your device + +## Data Collection + +- **No personal data** is collected +- **No usage statistics** are gathered +- **No cookies** are used +- **No analytics** are implemented +- **No user tracking** takes place + +## Third-Party Services + +- The extension does not communicate with any external servers +- No data is shared with third parties + +For questions about privacy, please open an issue on GitHub. + +Last updated: November 28, 2024 diff --git a/README.md b/README.md index 710cba8..ca87058 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,6 @@ A Safari extension that automatically enables Picture-in-Picture (PiP) mode for - **Auto Disable**: Automatically disables PiP when returning to the video tab - **Wide Compatibility**: See [Compatibility Status](#compatibility-status) for more information -- **Status Indication**: Visual feedback of extension status through toolbar icon (coming soon) - ## Installation - Download the latest release [here](https://github.com/vordenken/AutoPiP/releases) @@ -48,6 +46,14 @@ A Safari extension that automatically enables Picture-in-Picture (PiP) mode for - PiP will deactivate automatically when: - You return to the video tab +## Support the Project + +If you find this extension helpful, consider supporting its development: + +[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/vordenken) + +[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/vordenken) + ## Requirements - macOS 14 or later @@ -63,12 +69,11 @@ This extension is built using: ## Current Limitations - Only tested on macOS 15.1 -- Toggle functionality via toolbar icon is still under development - Code might need optimization (beginner project) ## To-Do -- [ ] Implement toolbar icon toggle functionality +- [X] Implement toolbar icon toggle functionality - [ ] Test with other video platforms - [ ] Test on different macOS versions - [ ] Add visual status indication @@ -91,12 +96,17 @@ All contributions are welcome! Feel free to submit issues and pull requests. This project is licensed under the GNU GPLv3 License - see the LICENSE file for details. +## Privacy + +AutoPiP respects your privacy and does not collect any personal data. For more information, see our [Privacy Policy](PRIVACY.md). + ## Acknowledgments - Inspired by various PiP extensions - Built with Safari Web Extension technology - Thanks to the Swift and Safari development community for resources and documentation - Updater using [Sparkle](https://sparkle-project.org) +- Icons by [icons8](https://icons8.com) ## Author From 864015246b302f5062880de0799290deed6152b4 Mon Sep 17 00:00:00 2001 From: vordenken <62395860+vordenken@users.noreply.github.com> Date: Thu, 28 Nov 2024 12:41:37 +0100 Subject: [PATCH 3/3] update .gitignore add new release to appcast.xml --- .gitignore | 2 ++ appcast.xml | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/.gitignore b/.gitignore index 52fe2f7..5cf0669 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,5 @@ fastlane/report.xml fastlane/Preview.html fastlane/screenshots/**/*.png fastlane/test_output + +releases/ diff --git a/appcast.xml b/appcast.xml index 6ef5a5c..4bee4e2 100755 --- a/appcast.xml +++ b/appcast.xml @@ -2,6 +2,25 @@ AutoPiP Updates + + Version 0.3 + + +
  • Added toolbar menu icon to easily toggle the extension on/off
  • +
  • New feature: Automatic PiP activation when switching from Safari to another app (and deactivation when switching back)
  • +
  • Added Ko-fi/Buy Me a Coffee support options for those who want to support the development
  • + + ]]> +
    + Do, 28 Nov 2024 12:45:00 +0000 + +
    Version 0.2