Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jaumesegarra committed Sep 9, 2018
1 parent e93f8c3 commit 641721d
Show file tree
Hide file tree
Showing 18 changed files with 861 additions and 419 deletions.
4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ module.exports = function (grunt) {
cacheDir: './build/cache',
macIcns: './app-icon.icns',
winIco: './app-icon.ico',
version: '0.30.1',
version: '0.33.0',
flavor: 'normal',
buildDir: './builds', // Where the build version your app is saved
},
src: ['./package.json', './app/**/*', '!./app/scss/**/**'].concat(modules) // Your NW.js app
src: ['./package.json', './engine.js', './bin/*', './app/**/*', '!./app/scss/**/**'].concat(modules) // Your NW.js app
}
});

Expand Down
3 changes: 3 additions & 0 deletions app/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<link href="css/app.css" rel="stylesheet"/>
</head>
<body class="config" ng-controller="configController">
<script type="text/javascript">
if(process.platform == "win32") document.body.classList.add('windows');
</script>
<nav>
<a href="#app" class="button grey light">App</a>
<a href="#wallpaper" class="button grey light">Wallpaper</a>
Expand Down
22 changes: 12 additions & 10 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@

<body class="main" ng-controller="mainController">
<script type="text/javascript">
if(process.platform == "win32") document.body.classList.add('-no-radius');
if(process.platform == "win32") document.body.classList.add('windows');
if(localStorage.getItem('ls.LightTheme') == "true") document.body.classList.add('light');
</script>
<header>
<a id="close" class="window-button" title="Close" ng-click="closeWindow()"></a>
<a id="minimize" class="window-button" title="Minimize" ng-click="minimizeWindow()"></a>

<header ng-dblClick="minimizeWindow(true)">
<div class="window-buttons">
<a id="close" class="window-button" title="Close" ng-click="closeWindow()"><span><strong>&times;</strong></span></a>
<a id="minimize" class="window-button" title="Minimize" ng-click="minimizeWindow()"><span><strong>&ndash;</strong></span></a>
</div>
<h1>
<img src="img/logoText.png" title="ranwall: created by Jaume Segarra" onmousedown="return false"/>
</h1>
Expand All @@ -27,20 +28,20 @@ <h1>
</header>

<div id="drag">
<div id="random-wallpaper-active" class="loading" ng-dblClick="setBtnClick()">
<img ng-mouseover="previewup()" ng-mouseout="previewdown()"/>
<div id="random-wallpaper-active" class="loading" ng-class="{loading: isDownloading, error: hasError}" ng-dblClick="setBtnClick()">
<img ng-class="{preview: current_wallpaper && current_wallpaper.status == 0}" ng-hide="!current_wallpaper" ng-src="{{((current_wallpaper) ? 'file:///'+current_wallpaper.output() : undefined)}}"/>
<div class="on-error">
<h2>Error trying load wallpaper</h2>
<p>Will be retry at 10 seconds automatically.</p>
</div>

<div class="foot-buttons">
<div class="info">
<span title="Wallpaper provider">{{current_wallpaper.provider}}</span>
<span ng-show="!current_wallpaper.isDesiredResize" title="Original wallpaper size">{{current_wallpaper.originalResize.width}}x{{current_wallpaper.originalResize.height}}</span>
<span title="Wallpaper provider">{{current_wallpaper.provider.name}}</span>
<span ng-show="current_wallpaper.originalResize && !current_wallpaper.isDesiredResize()" title="Original wallpaper size">{{current_wallpaper.originalResize.width}}x{{current_wallpaper.originalResize.height}}</span>
</div>
<button class="very light" id="saveas-wallpaper" title="Save as wallpaper" ng-click="saveasBtnClick()"><i class="la la-download"></i></button>
<button class="light" id="set-wallpaper" title="Set wallpaper" ng-click="setBtnClick()">set</button>
<button class="light" id="set-wallpaper" title="Set wallpaper" ng-mouseenter="previewup()" ng-mouseout="previewdown()" ng-click="setBtnClick()" ng-if="current_wallpaper.status != 1">set</button>
</div>
</div>
</div>
Expand All @@ -55,6 +56,7 @@ <h2>Error trying load wallpaper</h2>
<script src="js/wall.js"></script>
<script src="js/previewer.js"></script>
<script src="js/updater.js"></script>
<script src="js/globalRuns.js"></script>
</body>

</html>
7 changes: 5 additions & 2 deletions app/js/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use strict';

angular.module('app', ['angularRandomString', 'LocalStorageModule'])
angular.module('app', ['angularRandomString', 'LocalStorageModule'], function($compileProvider){
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|file|chrome-extension):|data:image\//);
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|chrome-extension):/);
})
.constant('USER_RESOLUTION', [window.screen.width, window.screen.height])
.constant('WALLPAPER_PROVIDERS', [
{
Expand Down Expand Up @@ -67,7 +70,7 @@ angular.module('app', ['angularRandomString', 'LocalStorageModule'])
.constant('NW', (function(){
var requires = {
gui: require('nw.gui'),
wallpaper: require('wallpaper'),
wallpaper: require('../engine.js'),
fs: require('fs'),
mkdirp: require('mkdirp'),
http: require('follow-redirects').http,
Expand Down
1 change: 1 addition & 0 deletions app/js/configController.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ angular.module('app')
}

$scope.wproviders = wproviders;
$scope.selectedProviders = JSON.parse(localStorage.getItem("ls.wall_providers"));

$scope.providersChanged = function(){
for(var key in $scope.wproviders) {
Expand Down
97 changes: 97 additions & 0 deletions app/js/globalRuns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
'use strict';

angular.module('app')
.factory('globalruns', ['$rootScope', 'localStorageService', 'NW', 'win', 'MAGIC_SHORTCUT', 'UserConfig', 'updater', function($scope, $localStorageService, NW, $win, _MAGIC_SHORTCUT, _UserConfig, $updater) {
var _ConfigWindow;

var menu = [
{
"name": "Set new wallpaper!",
"key": _MAGIC_SHORTCUT.key,
"modifiers": _MAGIC_SHORTCUT.modifiers,
"click": null
},
{
"separator": 1
},
{
"name":"Show/Hide",
"click": function(){
$win.toggleShow();
}
},
{
"name":"Configuration",
"click": function(){
obj.openConfig();
}
},
{
"name": "Check for updates",
"click": function(){
$updater.checkUpdate(true,true);
}
},
{
"name": "Exit",
"click": function () {
NW.gui.App.quit();
}
}
];

var obj = {
initials: function (setWallpaperFunc) {
$updater.checkUpdate();

obj.setTrayMenu(setWallpaperFunc);
obj.setCommands(setWallpaperFunc);

obj.checkTheme();
},
setTrayMenu: function(setWallpaperFunc){
menu[0].click = setWallpaperFunc;
$win.atLaunch(menu);
},
setCommands: function(setWallpaperFunc){
$win.command(_MAGIC_SHORTCUT.modifiers+"+"+_MAGIC_SHORTCUT.key, setWallpaperFunc);
},
checkTheme: function(){
$scope.$watch(function () { return $localStorageService.get("LightTheme"); },function(){
var isLight = _UserConfig.LightTheme();

if(isLight)
document.body.classList.add('light');
else
document.body.classList.remove('light');
});
},
openConfig: function() {
if(_ConfigWindow == null){

NW.gui.Window.open('app/config.html', {
position: 'center',
width: 485,
height: 310,
resizable:false
},
function(win){
_ConfigWindow = win;

win.on('closed', function() {
_ConfigWindow = null;

if (PLATFORM == "mac") {
var menu = new NW.gui.Menu({type: "menubar"});
menu.createMacBuiltin && menu.createMacBuiltin("ranwall");
NW.gui.Window.get().menu = menu;
}
});
});

}else _ConfigWindow.focus();
}
};

return obj;
}])
Loading

0 comments on commit 641721d

Please sign in to comment.