ipcRenderer.on('testConnection', (event, success) => { if (success) { swal("Success", "Connection made successfully", "success"); } else { swal("Error", "There was some error making the connection.", "error"); } });
function articleContent() { const form = document.forms.articleForm; const children = form.elements; const title = children.title.value; const content = children.content.value; if (!title) { swal('请输入标题!', '标题不能为空哦🙅', 'error'); return false; } if (!content) { swal('请输入内容!', '内容不能为空哦🙅', 'error'); return false; } let tags = document .querySelector('.article__tags') .getAttribute('tags'); tags = tags.trim() === '' ? [] : tags.split(','); const category = children.category.value; return { title, tags, category, content, }; }
followers.once('value', list => { let matchFound = false list.forEach(item => { let followerId = item.val() if(followerId===uid) { matchFound = true } }); if (matchFound === true) { sweetAlert('Oops!', 'You are already following this person', 'error'); } else { followers.push(uid); this.setState({ followers: list.numChildren() + 1 }); firebase.child(uid).child('following').push(uid1) this.setState({ following:uid1 }) sweetAlert('Yay', 'You are following ' + username + '!', 'success') } });
ipcRenderer.on('saveConnection', (event, success) => { if (success) { swal("Success", "Connection save successfully", "success"); $('#addConnection').modal('hide'); } else { swal("Error", "Connection not saved", "error"); } });
success: function (response) { if(response.code !== 500) { swal("Загрузка завершена", "Фотографии успешно добавлены в альбом", "success"); window.history.back(); } else { swal("Ошибка!", response.message); } }
Meteor.call('delete.pcategory', pcategory_id, (error, result) => { if (error) { console.log(error.reason); FlashMessages.sendError(err.reason); swal("Error!", err.reason, "error"); } else { FlashMessages.sendSuccess("Post category deleted"); swal("Success", "Your post category deleted!", "success"); } });
friend() { let username= this.state.username; let uid1 = this.props.params.uid; let uid = sessionStorage.getItem('uid'); if(uid1===uid) { sweetAlert('Oops!', 'You cannot friend yourself!', 'error') } else { sweetAlert('Yay', 'A friend request has been sent to ' + username + '!' , 'success') } }
.then((res) => { if (res.data.status === 1) { swal(res.data.text, '跳转到文章中...', 'success'); setTimeout(() => { window.location.href = res.data.link; }, 1200); return false; } else { swal(res.data.text, '', 'error'); } });
.then(function(response){ let message = response.data.message if (message !== 'Successfully updated your profile') { swal(message, {icon: 'warning'}) } else { swal(message, {icon: 'success'}) localStorage.removeItem('username') localStorage.setItem('username', userData.username) router.push('/home') } })
bindSaveButton([addonsEditor, structureEditor, styleEditor], function(options) { if (!isValidJSON(options.addons)) { sweetAlert("Ops!", "\"Add-ons\" isn't a valid JSON", "error"); } else if (!isValidJSON(options.structure)) { sweetAlert("Ops!", "\"Structure\" isn't a valid JSON", "error"); } else { Storage.save(options); sweetAlert("Success", "Options saved!", "success"); } });
.then(function (response) { console.log(response.data) if (response.data.message != 'Success login') { swal(response.data.message, {icon: 'warning'}) } else { swal(response.data.message, {icon: 'success'}) localStorage.setItem('token', response.data.token) localStorage.setItem('firstname', response.data.firstname) localStorage.setItem('lastname', response.data.lastname) localStorage.setItem('username', response.data.username) localStorage.setItem('fb', 0) commit('userLoggedIn') router.push('/home') } })
}, (inputValue) => { if (inputValue === false) return false; if (inputValue === '') { swal.showInputError('You need to write something!'); return false } if (/f**k|bitch|shit|bullshit|c**t|arse|ass|dick/ig.test(inputValue)) { swal.showInputError('Come On. Use better language','error'); } else if (inputValue.length > 175) { swal.showInputError('Your message is too long!','error'); } else{ sweetAlert('Nice', 'Your thoughts are valuable to the world', 'success'); let firebase = new Firebase('https://crackling-heat-8405.firebaseio.com/justchat/topicChatMessages/') let uid = sessionStorage.getItem('uid') firebase.push({ text:inputValue, uid: uid, username: this.state.username }); } });
s.info = function(title, message){ var t = title || 'Information', m = message || ''; swalData(t,m); swalConfig.type = 'info'; swal(swalConfig); };
togglePasswordForm: function(id, newArchive) { var model = this.collection.get(id), action = (newArchive === true) ? 'new' : 'connect'; swal({ title: newArchive ? "New Archive" : "Load Buttercup", text: newArchive ? "Please choose a safe password:"******"Enter your archive's password:"******"input", showCancelButton: true, closeOnConfirm: false, animation: "pop", inputType: "password", inputPlaceholder: "Archive's password..." }, function(inputValue) { if (inputValue === false || inputValue === undefined) { return false; } if (inputValue === "") { swal.showInputError("You need to write something!"); return false; } ipc.on('workspace.error', function(e, error) { swal.showInputError("Invalid password."); }); ipc.send('workspace.' + action, { path: model.get('path'), password: inputValue }); }); },
_showLink : function(type){ switch (type){ case 1 : window.location.href = "https://www.facebook.com/profile.php?id=100011125991941";break; case 2 : window.location.href = "https://github.com/ksqb0156596";break; case 3 : swal({title:'',text:'',imageUrl:'../images/qrcode.png',imageSize:'300x300'});break; } }
}, function(inputValue) { if (inputValue === false) return false; if (inputValue === '') { swal.showInputError('You need to write something!'); return false } if (/f**k|bitch|shit|bullshit|c**t|arse|ass|dick/ig.test(inputValue)) { swal.showInputError('Come On. Use better language','error'); } else if (inputValue.length > 175) { swal.showInputError('Your message is too long!','error'); } else if ((inputValue==='Real Madrid and FC Barcelona') || (inputValue==='FC Barcelona and Real Madrid')) { firebase.child(uid).child('points').once('value', x => { firebase.child(uid).child('points').push(inputValue); this.setState({ points: x.numChildren() + 1 }) }) sweetAlert('Yay!', 'You received 1 point','success') } else { swal.showInputError('That is not the answer. Try again!', 'error') } }
.catch(function (error) { swal({ title: 'Error!', text: err.response.data.message, icon: 'warning' }) })
$.get("/api/tours/remove/" + that.tour.id).done(function (response) { if (response.code === 200) { that.$el.remove(); } else { swal("Ошибка", response.message); } });
.catch(function (err) { swal({ title: 'Error!', text: 'Something went wrong! Please contact the developer', icon: 'Warning' }) })
showModal(content) { sweetAlert.setDefaults({ confirmButtonColor: '#c1d640' }); sweetAlert({ title: 'E-mail Notification', text: content, allowOutsideClick: true, type: 'input', inputPlaceholder: '*****@*****.**', confirmButtonText: 'Notify Me', showCancelButton: true, closeOnConfirm: false, }, function(inputValue){ log(inputValue); if (inputValue === false) return false; if (inputValue === "") { sweetAlert.showInputError("You need to write something!"); return false } sweetAlert("Nice!", "You wrote: " + inputValue, "success"); }); }
_delete : function(){ var selectedRows = this.state.selectedRows; if(selectedRows.length == 0){ message.error('请至少选择一条记录'); return false; } swal({ title: '确定要删除吗?', text: "", type: 'warning', showCancelButton: true, confirmButtonColor: '#ec6c62', cancelButtonColor: '#d33', confirmButtonText: '确定', cancelButtonText: '取消', },function() { var ids = []; for(var i in selectedRows){ // ids["ids["+i+"]"] = selectedRows[i].id; ids.push(selectedRows[i].id); } message.loading("加载中,请稍后。。。",0); Api.request({ method : 'POST', url : Url.DEL_ROLE, data : {ids:ids} }).then(function(result){ this.findList(this.state.pageNum,this.state.pageSize); }.bind(this)) }.bind(this)) },
}, (inputValue) => { if (inputValue === false) return false; if (inputValue === '') { swal.showInputError('You need to write something!'); return false } if (/f**k|bitch|shit|bullshit|c**t|arse|ass|dick/ig.test(inputValue)) { swal.showInputError('Come On. Use better language','error'); return false; } else if (inputValue.length > 175) { swal.showInputError('Your message is too long!','error'); } else { sweetAlert('Nice!', 'You have put up a new post', 'success'); let uid = sessionStorage.getItem('uid') let firebase = new Firebase('https://crackling-heat-8405.firebaseio.com/justchat/messages/') firebase.child(uid).push({text:inputValue}); }});
$.get("/api/gallery/best/add/" + id, function (response) { if(response.code !== 500) { $(e.target).removeClass('icon-star-empty best-add').addClass('icon-star best-remove').attr('title', 'Удалить из избранного'); } else { swal("Ошибка", response.message); } });
}).catch((err) => { if (err.status === 404){ swal({ "title":"Identification échouée", "text":"Nom d'utilisateur ou mot de passe incorrect", "type":"error" }); } else { swal({ "title":"Identification échouée", "text":"Erreur inconnue", "type":"error" }); console.console.error(err); } }).finally(() => {
$.get("/api/gallery/country/remove/" + countryItem.data("countryname")).done(function (response) { if (response.code === 200) { countryItem.remove(); } else { swal("Ошибка", response.message); } });
$('.delete-country').on('click', function (e) { var countryItem = $(e.currentTarget).closest('li'); swal({ title: "Удалить альбом", text: "Вы действительно хотите безворвзратно удалить альбом?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Удалить", cancelButtonText: "Отмена", closeOnConfirm: true, closeOnCancel: true }, function () { //FIXME: isnt working $.get("/api/gallery/country/remove/" + countryItem.data("countryname")).done(function (response) { if (response.code === 200) { countryItem.remove(); } else { swal("Ошибка", response.message); } }); }); e.preventDefault(); e.stopPropagation(); });
post() { swal({ title: 'Share a post to your feed', text: 'Write something interesting', type: 'input', showCancelButton: true, closeOnConfirm: false, animation: 'slide-from-top', inputPlaceholder: 'Write something here' }, function(inputValue) { if (inputValue === false) return false; if (inputValue === '') { swal.showInputError('You need to write something!'); return false } if (/f**k|bitch|shit|bullshit|c**t|arse|ass|dick/ig.test(inputValue)) { swal.showInputError('Come On. Use better language','error'); } else if (inputValue.length > 175) { swal.showInputError('Your message is too long!','error'); } else { sweetAlert('Nice!', 'You have put up a new post', 'success'); let uid = sessionStorage.getItem('uid') let firebase = new Firebase('https://crackling-heat-8405.firebaseio.com/justchat/messages/') firebase.child(uid).push({text:inputValue, uid: uid, username: this.state.username}); } }); }
function login() { var username = $("#username").val().trim(); var password = $("#password").val(); if(username.length < 4 || username.length > 16) { return sweetAlert({ title: "登录失败", text: "请输入正确的用户名长度", type: "error", confirmButtonText: "/人◕‿‿◕人\" }); } if(password.length < 5 || password.length > 16) { return sweetAlert({ title: "登录失败", text: "请输入正确的密码长度。", type: "error", confirmButtonText: "/人◕‿‿◕人\" }); } $.post("/secure/signin", { username: username, password: password }, function(res) { if(typeof res !== "object") { return sweetAlert({ title: "登录失败", text: "请求失败。", type: "error", confirmButtonText: "/人◕‿‿◕人\" }); } if(!res.status) { return sweetAlert({ title: "登录失败", text: res.msg, type: "error", confirmButtonText: "/人◕‿‿◕人\" }); } window.location.href = "/"; }); }
error: function(error, callback) { swal({ title: 'Error', text: error, type: 'error', confirmButtonText: 'Close' }, callback); },
s.success = function(title, message){ var t = title || 'Yipeee', m = message || ''; swalData(t,m); swalConfig.type = 'success'; swal(swalConfig); };