Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a1e09b5
commit d773ccc
Showing
16 changed files
with
844 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
ProductHunt.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// AppDelegate.swift | ||
// ProductHunt | ||
// | ||
// Created by Remi Robert on 11/06/15. | ||
// Copyright (c) 2015 Remi Robert. All rights reserved. | ||
// | ||
|
||
import Cocoa | ||
|
||
@NSApplicationMain | ||
class AppDelegate: NSObject, NSApplicationDelegate { | ||
|
||
|
||
|
||
func applicationDidFinishLaunching(aNotification: NSNotification) { | ||
// Insert code here to initialize your application | ||
} | ||
|
||
func applicationWillTerminate(aNotification: NSNotification) { | ||
// Insert code here to tear down your application | ||
} | ||
|
||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS"> | ||
<dependencies> | ||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7706"/> | ||
<plugIn identifier="com.apple.WebKitIBPlugin" version="7706"/> | ||
</dependencies> | ||
<scenes> | ||
<!--Application--> | ||
<scene sceneID="JPo-4y-FX3"> | ||
<objects> | ||
<application id="hnw-xV-0zn" sceneMemberID="viewController"> | ||
<menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6"> | ||
<items> | ||
<menuItem title="ProductHunt" id="1Xt-HY-uBw"> | ||
<modifierMask key="keyEquivalentModifierMask"/> | ||
<menu key="submenu" title="ProductHunt" systemMenu="apple" id="uQy-DD-JDr"> | ||
<items> | ||
<menuItem title="About ProductHunt" id="5kV-Vb-QxS"> | ||
<modifierMask key="keyEquivalentModifierMask"/> | ||
<connections> | ||
<action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem"/> | ||
</connections> | ||
</menuItem> | ||
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/> | ||
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/> | ||
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/> | ||
<menuItem title="Services" id="NMo-om-nkz"> | ||
<modifierMask key="keyEquivalentModifierMask"/> | ||
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/> | ||
</menuItem> | ||
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/> | ||
<menuItem title="Hide ProductHunt" keyEquivalent="h" id="Olw-nP-bQN"> | ||
<connections> | ||
<action selector="hide:" target="Ady-hI-5gd" id="PnN-Uc-m68"/> | ||
</connections> | ||
</menuItem> | ||
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO"> | ||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/> | ||
<connections> | ||
<action selector="hideOtherApplications:" target="Ady-hI-5gd" id="VT4-aY-XCT"/> | ||
</connections> | ||
</menuItem> | ||
<menuItem title="Show All" id="Kd2-mp-pUS"> | ||
<modifierMask key="keyEquivalentModifierMask"/> | ||
<connections> | ||
<action selector="unhideAllApplications:" target="Ady-hI-5gd" id="Dhg-Le-xox"/> | ||
</connections> | ||
</menuItem> | ||
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/> | ||
<menuItem title="Quit ProductHunt" keyEquivalent="q" id="4sb-4s-VLi"> | ||
<connections> | ||
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF"/> | ||
</connections> | ||
</menuItem> | ||
</items> | ||
</menu> | ||
</menuItem> | ||
<menuItem title="File" id="dMs-cI-mzQ"> | ||
<modifierMask key="keyEquivalentModifierMask"/> | ||
</menuItem> | ||
<menuItem title="Edit" id="5QF-Oa-p0T"> | ||
<modifierMask key="keyEquivalentModifierMask"/> | ||
</menuItem> | ||
<menuItem title="Format" id="jxT-CU-nIS"> | ||
<modifierMask key="keyEquivalentModifierMask"/> | ||
</menuItem> | ||
<menuItem title="View" id="H8h-7b-M4v"> | ||
<modifierMask key="keyEquivalentModifierMask"/> | ||
</menuItem> | ||
<menuItem title="Window" id="aUF-d1-5bR"> | ||
<modifierMask key="keyEquivalentModifierMask"/> | ||
</menuItem> | ||
<menuItem title="Help" id="wpr-3q-Mcd"> | ||
<modifierMask key="keyEquivalentModifierMask"/> | ||
</menuItem> | ||
</items> | ||
</menu> | ||
<connections> | ||
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/> | ||
</connections> | ||
</application> | ||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="ProductHunt" customModuleProvider="target"/> | ||
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="75" y="0.0"/> | ||
</scene> | ||
<!--Window Controller--> | ||
<scene sceneID="R2V-B0-nI4"> | ||
<objects> | ||
<windowController id="B8D-0N-5wS" sceneMemberID="viewController"> | ||
<window key="window" title="Product hunt" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA"> | ||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/> | ||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> | ||
<rect key="contentRect" x="196" y="240" width="480" height="270"/> | ||
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/> | ||
</window> | ||
<connections> | ||
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/> | ||
</connections> | ||
</windowController> | ||
<customObject id="Oky-zY-oP4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="75" y="250"/> | ||
</scene> | ||
<!--Product hunt--> | ||
<scene sceneID="hIz-AP-VOD"> | ||
<objects> | ||
<viewController title="Product hunt" id="XfG-lQ-9wD" customClass="ViewController" customModule="ProductHunt" customModuleProvider="target" sceneMemberID="viewController"> | ||
<view key="view" id="m2S-Jp-Qdl"> | ||
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/> | ||
<autoresizingMask key="autoresizingMask"/> | ||
<subviews> | ||
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="M7g-bw-Hc5"> | ||
<rect key="frame" x="136" y="48" width="209" height="174"/> | ||
<constraints> | ||
<constraint firstAttribute="width" constant="209" id="4LX-e1-M3n"/> | ||
<constraint firstAttribute="height" constant="174" id="kxc-dv-38M"/> | ||
</constraints> | ||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="product-hunt-logo-vertical-orange" id="0RQ-vK-wdn"/> | ||
</imageView> | ||
<webView translatesAutoresizingMaskIntoConstraints="NO" id="nT2-fw-EJW"> | ||
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/> | ||
<webPreferences key="preferences" defaultFontSize="12" defaultFixedFontSize="12"/> | ||
</webView> | ||
</subviews> | ||
<constraints> | ||
<constraint firstAttribute="centerY" secondItem="M7g-bw-Hc5" secondAttribute="centerY" id="5Sj-YK-5XO"/> | ||
<constraint firstItem="nT2-fw-EJW" firstAttribute="leading" secondItem="m2S-Jp-Qdl" secondAttribute="leading" id="5kq-vn-DRh"/> | ||
<constraint firstAttribute="bottom" secondItem="nT2-fw-EJW" secondAttribute="bottom" id="bWm-eO-wsZ"/> | ||
<constraint firstAttribute="trailing" secondItem="nT2-fw-EJW" secondAttribute="trailing" id="sYZ-g8-n48"/> | ||
<constraint firstItem="nT2-fw-EJW" firstAttribute="top" secondItem="m2S-Jp-Qdl" secondAttribute="top" id="uFN-fy-NK2"/> | ||
<constraint firstAttribute="centerX" secondItem="M7g-bw-Hc5" secondAttribute="centerX" constant="-0.5" id="wGc-xb-h6f"/> | ||
</constraints> | ||
</view> | ||
<connections> | ||
<outlet property="imageView" destination="M7g-bw-Hc5" id="O40-Xt-N3D"/> | ||
<outlet property="webView" destination="nT2-fw-EJW" id="yLb-TI-ezd"/> | ||
</connections> | ||
</viewController> | ||
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="75" y="655"/> | ||
</scene> | ||
</scenes> | ||
<resources> | ||
<image name="product-hunt-logo-vertical-orange" width="990" height="840"/> | ||
</resources> | ||
</document> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions
63
ProductHunt/Images.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"size" : "16x16", | ||
"idiom" : "mac", | ||
"filename" : "16x16.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"size" : "16x16", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"size" : "32x32", | ||
"idiom" : "mac", | ||
"filename" : "32x32.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"size" : "32x32", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"size" : "128x128", | ||
"idiom" : "mac", | ||
"filename" : "128x128.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"size" : "128x128", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"size" : "256x256", | ||
"idiom" : "mac", | ||
"filename" : "256x256.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"size" : "256x256", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"size" : "512x512", | ||
"idiom" : "mac", | ||
"filename" : "512x512.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"size" : "512x512", | ||
"scale" : "2x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
ProductHunt/Images.xcassets/product-hunt-logo-vertical-orange.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x", | ||
"filename" : "product-hunt-logo-vertical-orange.png" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Binary file added
BIN
+21.9 KB
...roduct-hunt-logo-vertical-orange.imageset/product-hunt-logo-vertical-orange.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?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>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIconFile</key> | ||
<string></string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.remirobert.$(PRODUCT_NAME:rfc1034identifier)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
<key>LSMinimumSystemVersion</key> | ||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string> | ||
<key>NSHumanReadableCopyright</key> | ||
<string>Copyright © 2015 Remi Robert. All rights reserved.</string> | ||
<key>NSMainStoryboardFile</key> | ||
<string>Main</string> | ||
<key>NSPrincipalClass</key> | ||
<string>NSApplication</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// ViewController.swift | ||
// ProductHunt | ||
// | ||
// Created by Remi Robert on 11/06/15. | ||
// Copyright (c) 2015 Remi Robert. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import WebKit | ||
import AppKit | ||
import Cocoa | ||
|
||
class ViewController: NSViewController, WKNavigationDelegate { | ||
|
||
@IBOutlet var webView: WebView! | ||
@IBOutlet var imageView: NSImageView! | ||
let webUrl = "http://www.producthunt.com" | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
webView.policyDelegate = self | ||
webView.drawsBackground = false | ||
webView.frameLoadDelegate = self | ||
loadWebRequest() | ||
} | ||
|
||
func loadWebRequest() { | ||
if let url = NSURL(string: webUrl) { | ||
let request = NSMutableURLRequest(URL: url) | ||
webView.mainFrame.loadRequest(request) | ||
} | ||
} | ||
|
||
func webView(sender: WKWebView, | ||
decidePolicyForNavigationAction navigationAction: WKNavigationAction, decisionHandler: (WKNavigationActionPolicy) -> Void) { | ||
if sender == webView { | ||
if let url = navigationAction.request.URL { | ||
NSWorkspace.sharedWorkspace().openURL(url) | ||
} | ||
} | ||
} | ||
|
||
override func webView(sender: WebView!, didFinishLoadForFrame frame: WebFrame!) { | ||
imageView.alphaValue = 0 | ||
imageView.hidden = true | ||
} | ||
|
||
override func webView(sender: WebView!, decidePolicyForNavigationAction actionInformation: [NSObject : AnyObject]!, request: NSURLRequest!, frame: WebFrame!, decisionListener listener: WebPolicyDecisionListener!) { | ||
listener.use() | ||
} | ||
|
||
override func webView(webView: WebView!, decidePolicyForNewWindowAction actionInformation: [NSObject : AnyObject]!, request: NSURLRequest!, newFrameName frameName: String!, decisionListener listener: WebPolicyDecisionListener!) { | ||
if let linkUrl = actionInformation["WebActionOriginalURLKey"]?.absoluteString { | ||
if let url = NSURL(string: linkUrl!) { | ||
NSWorkspace.sharedWorkspace().openURL(url) | ||
} | ||
} | ||
listener.ignore() | ||
} | ||
|
||
override func webView(sender: WebView!, resource identifier: AnyObject!, willSendRequest request: NSURLRequest!, redirectResponse: NSURLResponse!, fromDataSource dataSource: WebDataSource!) -> NSURLRequest! { | ||
if let url = request.URL { | ||
return NSMutableURLRequest(URL: url, cachePolicy: NSURLRequestCachePolicy.ReloadIgnoringLocalCacheData, timeoutInterval: request.timeoutInterval) | ||
} | ||
return nil | ||
} | ||
} | ||
|
Oops, something went wrong.