mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
disable right panel by default, don't perform Twitter https call if panel is disabled
This commit is contained in:
parent
b4fa1762a3
commit
37c1c0bb79
2 changed files with 23 additions and 20 deletions
2
main.qml
2
main.qml
|
@ -43,7 +43,7 @@ ApplicationWindow {
|
||||||
property var currentItem
|
property var currentItem
|
||||||
property bool whatIsEnable: false
|
property bool whatIsEnable: false
|
||||||
property bool ctrlPressed: false
|
property bool ctrlPressed: false
|
||||||
property bool rightPanelExpanded: true
|
property bool rightPanelExpanded: false
|
||||||
property bool osx: false
|
property bool osx: false
|
||||||
property alias persistentSettings : persistentSettings
|
property alias persistentSettings : persistentSettings
|
||||||
property var wallet;
|
property var wallet;
|
||||||
|
|
|
@ -60,30 +60,33 @@ Item {
|
||||||
if (from == "" && phrase == "")
|
if (from == "" && phrase == "")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (appWindow.rightPanelExpanded) {
|
||||||
|
|
||||||
//! [requesting]
|
//! [requesting]
|
||||||
var req = new XMLHttpRequest;
|
var req = new XMLHttpRequest;
|
||||||
req.open("GET", "https://api.twitter.com/1.1/search/tweets.json?from=" + from +
|
req.open("GET", "https://api.twitter.com/1.1/search/tweets.json?from=" + from +
|
||||||
"&count=" + tweetsMaxCount + "&q=" + encodePhrase(phrase));
|
"&count=" + tweetsMaxCount + "&q=" + encodePhrase(phrase));
|
||||||
req.setRequestHeader("Authorization", "Bearer " + bearerToken);
|
req.setRequestHeader("Authorization", "Bearer " + bearerToken);
|
||||||
req.onreadystatechange = function() {
|
req.onreadystatechange = function() {
|
||||||
status = req.readyState;
|
status = req.readyState;
|
||||||
if (status === XMLHttpRequest.DONE) {
|
if (status === XMLHttpRequest.DONE) {
|
||||||
var objectArray = JSON.parse(req.responseText);
|
var objectArray = JSON.parse(req.responseText);
|
||||||
if (objectArray.errors !== undefined)
|
if (objectArray.errors !== undefined)
|
||||||
console.log("Error fetching tweets: " + objectArray.errors[0].message)
|
console.log("Error fetching tweets: " + objectArray.errors[0].message)
|
||||||
else {
|
else {
|
||||||
for (var key in objectArray.statuses) {
|
for (var key in objectArray.statuses) {
|
||||||
var jsonObject = objectArray.statuses[key];
|
var jsonObject = objectArray.statuses[key];
|
||||||
tweets.append(jsonObject);
|
tweets.append(jsonObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (wasLoading == true)
|
||||||
|
wrapper.isLoaded()
|
||||||
}
|
}
|
||||||
if (wasLoading == true)
|
wasLoading = (status === XMLHttpRequest.LOADING);
|
||||||
wrapper.isLoaded()
|
|
||||||
}
|
}
|
||||||
wasLoading = (status === XMLHttpRequest.LOADING);
|
req.send();
|
||||||
}
|
|
||||||
req.send();
|
|
||||||
//! [requesting]
|
//! [requesting]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue