mirror of
				https://github.com/Sunnyyoung/WeChatTweak-macOS.git
				synced 2025-11-04 20:06:06 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			32 lines
		
	
	
		
			746 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			746 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
// LaunchBar Action Script
 | 
						|
 | 
						|
function run(string) {
 | 
						|
  if (!string) return [];
 | 
						|
 | 
						|
  var url = 'http://localhost:48065/wechat/search?keyword=';
 | 
						|
  var result = HTTP.getJSON(url + encodeURIComponent(string.trim()));
 | 
						|
 | 
						|
  if (result == undefined) {
 | 
						|
    LaunchBar.alert('HTTP.getJSON() returned undefined');
 | 
						|
    return [];
 | 
						|
  }
 | 
						|
 | 
						|
  if (result.error != undefined) {
 | 
						|
    LaunchBar.log('Error in HTTP request: ' + result.error);
 | 
						|
    return [];
 | 
						|
  }
 | 
						|
 | 
						|
  return result.data.map(function (i) {
 | 
						|
    return {
 | 
						|
      title: i.m_nsRemark || i.m_nsNickName,
 | 
						|
      subtitle: i.m_nsNickName,
 | 
						|
      icon: "icon.png",
 | 
						|
      action: "open",
 | 
						|
      actionArgument: i.m_nsUsrName
 | 
						|
    }
 | 
						|
  });
 | 
						|
}
 | 
						|
 | 
						|
function open(id) {
 | 
						|
  HTTP.get('http://localhost:48065/wechat/start?session=' + id);
 | 
						|
} |