Skip to content
This repository was archived by the owner on Jun 16, 2020. It is now read-only.

Commit

Permalink
some updates and fixes
Browse files Browse the repository at this point in the history
- removed some unneccessary code
- BetterPiP now launches and plays the video with single click on the chrome extension
- BetterPiP closes when the video gets closed
- fixed display Notification when no video was found
- removed Chrome altert when clicking on the extension
  • Loading branch information
dun198 committed Mar 31, 2018
1 parent b70659a commit 6df166d
Show file tree
Hide file tree
Showing 55 changed files with 765 additions and 100 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
chrome-extension/test.html
Empty file modified LICENSE
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions PIP.framework/PIP
1 change: 1 addition & 0 deletions PIP.framework/Resources
Binary file added PIP.framework/Versions/A/PIP
Binary file not shown.
46 changes: 46 additions & 0 deletions PIP.framework/Versions/A/Resources/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>15A284</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>PIP</string>
<key>CFBundleIdentifier</key>
<string>com.apple.PIP</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>PIP</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>50</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>8R174l</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>16A299</string>
<key>DTSDKName</key>
<string>macosx10.12internal</string>
<key>DTXcode</key>
<string>0800</string>
<key>DTXcodeBuild</key>
<string>8R174l</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2015 Apple Inc. All rights reserved.</string>
</dict>
</plist>
12 changes: 12 additions & 0 deletions PIP.framework/Versions/A/Resources/framework.sb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
;;
;; PIP - sandbox profile
;; Copyright (c) 2015 Apple Inc. All Rights reserved.
;;
;; WARNING: The sandbox rules in this file currently constitute
;; Apple System Private Interface and are subject to change at any time and
;; without notice. The contents of this file are also auto-generated and not
;; user editable; it may be overwritten at any time.
;;

(allow mach-lookup
(global-name "com.apple.PIPAgent"))
18 changes: 18 additions & 0 deletions PIP.framework/Versions/A/Resources/version.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildAliasOf</key>
<string>PIPAgent</string>
<key>BuildVersion</key>
<string>2</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>50</string>
<key>ProjectName</key>
<string>PIPFramework</string>
<key>SourceVersion</key>
<string>50000000000000</string>
</dict>
</plist>
131 changes: 131 additions & 0 deletions PIP.framework/Versions/A/_CodeSignature/CodeResources
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Resources/Info.plist</key>
<data>
j3i1EyUrGox8WSRK8vxC15iur8E6DgvgfK8zyhPphNA=
</data>
<key>Resources/framework.sb</key>
<data>
BrLJvMrNp6g7Kgk7vXm7KJLgQcUJp45Fh8OaPh3rizU=
</data>
<key>Resources/version.plist</key>
<data>
oeFO/xLw56FfEC5GToj5LytsjW37zDqxNUIIGS7EOx8=
</data>
</dict>
<key>files2</key>
<dict>
<key>Resources/Info.plist</key>
<data>
j3i1EyUrGox8WSRK8vxC15iur8E6DgvgfK8zyhPphNA=
</data>
<key>Resources/framework.sb</key>
<data>
BrLJvMrNp6g7Kgk7vXm7KJLgQcUJp45Fh8OaPh3rizU=
</data>
<key>Resources/version.plist</key>
<data>
oeFO/xLw56FfEC5GToj5LytsjW37zDqxNUIIGS7EOx8=
</data>
</dict>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
1 change: 1 addition & 0 deletions PIP.framework/Versions/Current
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified chrome-extension/.gitignore
100644 → 100755
Empty file.
Empty file modified chrome-extension/package-lock.json
100644 → 100755
Empty file.
Empty file modified chrome-extension/package.json
100644 → 100755
Empty file.
Empty file modified chrome-extension/src/background.html
100644 → 100755
Empty file.
13 changes: 11 additions & 2 deletions chrome-extension/src/background.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
function onClick(tab) {
chrome.tabs.sendMessage(tab.id, { type: 'get_video' }, function(response) {
if (response && !response.success) {
chrome.tabs.sendMessage(tab.id, {type: 'get_video'}, function(response) {

if (response.success) {
chrome.notifications.create(null, {
type: "basic",
title: "Response",
message: response.url,
iconUrl: "new_icon.png"
});
} else {
chrome.notifications.create(null, {
type: "basic",
title: "Unable to use Picture-in-Picture",
Expand All @@ -12,6 +20,7 @@ function onClick(tab) {

}


chrome.browserAction.onClicked.addListener(onClick);

if (chrome.runtime && chrome.runtime.onStartup) {
Expand Down
10 changes: 9 additions & 1 deletion chrome-extension/src/content.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ chrome.runtime.onMessage.addListener(async function(request, sender, sendRespons
videoData = getDefaultVideoData();
}

if (videoData)
if (videoData) {
openUrl(videoData);
sendResponse({url: pageUrl,
success: true});
} else {
sendResponse({url: pageUrl,
success: false});
}

}

});
Empty file modified chrome-extension/src/icon.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified chrome-extension/src/icon.psd
100644 → 100755
Empty file.
16 changes: 9 additions & 7 deletions chrome-extension/src/manifest.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
"persistent": false,
"page": "background.html"
},
"content_scripts": [{
"matches": ["<all_urls>"],
"js": ["utils.js", "youtube.js", "content.js"],
"run_at": "document_end"
}],
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["utils.js", "youtube.js", "content.js"],
"run_at": "document_end"
}
],
"browser_action": {
"default_icon": "new_icon.png"
},
Expand All @@ -23,6 +25,6 @@
"webNavigation",
"notifications"
],
"version": "4.4.0",
"manifest_version": 2
"version": "4.5.0",
"manifest_version": 3
}
Empty file modified chrome-extension/src/new_icon.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions chrome-extension/src/utils.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ function openUrl(videoData) {
if (f ) {f.parentNode.removeChild(f);}
var a = d.createElement('a');
a.href = 'betterpip://open?url=' + encodeURIComponent(videoData.url) + '&time=' + encodeURIComponent(videoData.time);
alert(a.href);
a.innerHTML = "Link"
//alert(a.href);
a.innerHTML = "Link"
a.setAttribute('id','customUrlLink');
a.setAttribute("style", "display:none; ");
d.body.appendChild(a);
Expand Down
Empty file modified chrome-extension/src/youtube.js
100644 → 100755
Empty file.
Loading

0 comments on commit 6df166d

Please sign in to comment.