Skip to content

Commit

Permalink
add clear localstorage method
Browse files Browse the repository at this point in the history
  • Loading branch information
MOTOO11 committed Dec 9, 2016
1 parent c225331 commit df6457a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/electron/ts/Main.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Main {
// Create the browser window.
this.mainWindow = new BrowserWindow({
width: 800, height: 600,
icon: __dirname + '/assets/icon/favicon.png',
icon: __dirname + '/assets/icon/favicon.png'
});
// disable menubar.
this.mainWindow.setMenu(null);
Expand Down
2 changes: 1 addition & 1 deletion src/electron/ts/Main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Main {
// Create the browser window.
this.mainWindow = new BrowserWindow({
width: 800, height: 600,
icon: __dirname + '/assets/icon/favicon.png',
icon: __dirname + '/assets/icon/favicon.png'
});
// disable menubar.
this.mainWindow.setMenu(null);
Expand Down
8 changes: 6 additions & 2 deletions src/renderer/css/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
visibility: hidden;
}

.mdl-layout__content{
.mdl-layout__content {
padding-left: 10px;
}

#loading {
&.aa {
&.aa {
font-family: "MS Pゴシック", "MS PGothic", "Mona", "mona-gothic-jisx0208.1990-0", sans-serif;
overflow: auto;
line-height: 1.125em;
Expand All @@ -20,6 +20,10 @@
}
}

.cursor--hand {
cursor: pointer;
}


/*
body {
Expand Down
3 changes: 1 addition & 2 deletions src/renderer/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@
<button v-on:click="test('テスト:',testMessage)" v-bind:disabled="processing">send</button>
</div>
</span>

<span class="mdl-navigation__link">
<label><i class="material-icons">info</i> version:{{version}}</label>
<label><i v-on:click="clearDataSource()" class="material-icons cursor--hand">info</i> version:{{version}}</label>
</span>
</nav>
</div>
Expand Down
29 changes: 21 additions & 8 deletions src/renderer/ts/Application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class Application extends Vue {
Logger.log("start", "hello application.");
this.pManager = new ProvideManager();
this.setTitle("");
this.thread = new Shitaraba("dummy");
this.thread = new Shitaraba("dummyThread");
this.loadSettings();
}

Expand Down Expand Up @@ -161,8 +161,8 @@ export default class Application extends Vue {
return true;
}

usePath():boolean{
return this.pManager.voice === VOICE.SOFTALK || this.pManager.voice === VOICE.TAMIYASU;
usePath(): boolean {
return this.pManager.voice === VOICE.SOFTALK || this.pManager.voice === VOICE.TAMIYASU;
}
// refresh
requestOnce() {
Expand Down Expand Up @@ -203,10 +203,13 @@ export default class Application extends Vue {

// 表示するものがない時
dummyText: string = "";

provideDummyText() {
this.pManager.dummyText(this.dummyText);
}

dummyTextTemp: string = "";

insertDummyText() {
this.dummyText = this.dummyTextTemp;
if (!this.processing)
Expand Down Expand Up @@ -246,11 +249,10 @@ export default class Application extends Vue {
}

test(letter: string, body: string) {
this.pManager.provide(letter, body, this.pManager.reading,null,this.provideTimeLimit);
this.pManager.provide(letter, body, this.pManager.reading, null, this.provideTimeLimit);
}

autoScroll: boolean = false;
cnangeAutoScroll() {
autoScroll: boolean = false; cnangeAutoScroll() {
this.autoScroll = !this.autoScroll;
}
scrollTo(value: number, duration?: number) {
Expand All @@ -270,7 +272,6 @@ export default class Application extends Vue {
Logger.log("pManager.reading", this.pManager.reading)
}

// softalk or webspeechapi
path: string = "";
@Watch("pManager.voice")
onVoiceChange(newValue: number, oldValue: number) {
Expand Down Expand Up @@ -340,10 +341,12 @@ export default class Application extends Vue {
this.loadSettings();
}
}

mounted() {
if (this.thread.bookmark != 0)
this.scrollTo(this.thread.bookmark);
};

saveSettings() {
localStorage.setItem(SETTINGS, JSON.stringify({
url: this.url,
Expand All @@ -360,13 +363,14 @@ export default class Application extends Vue {
dummyText: this.dummyText
}));
};

@Watch("settings")
onSettingsChange(newValue: number, oldValue: number) {
this.saveSettings()
var settings = JSON.parse(localStorage.getItem(SETTINGS));
}
version = VERSION;

version = VERSION;

isValidURL(): boolean {
if (!this.url) {
Expand All @@ -391,4 +395,13 @@ export default class Application extends Vue {
}
}
}

clearDataSource() {
for (var a in localStorage) {
if (a.startsWith("http"))
DataSource.clearDataSource(a);
}
this.snackbar({ message: "キャッシュを消去しました" });
this.thread = new Shitaraba("dummyThread");
}
}

0 comments on commit df6457a

Please sign in to comment.