2016-06-24 63 views
1

我不断收到此消息我的扩展一直被拒,我不知道为什么

“我们会定期与 ourProgram政策在Chrome Web Store的项目合规性,以确保安全和值得信赖的经验我们的 用户。您的项目“$ myitem”$ mycode正在被取消,因为它目前 违反了开发者计划政策中与 恶意产品相关的部分,因为它对部分代码进行了模糊处理。根据我们的 政策,尽可能多地将代码显示在 包中。如果某些应用程序的逻辑被隐藏,并且我t 似乎是可疑的,我们可能会将其删除。“

要使您的项目恢复,请以 任何必要的更改确保:

所有的文件和代码都包括在该项目的包。

包内部是人类可读的(没有混淆或缩小的代码)。

避免请求或执行远程托管代码(包括 参考远程JavaScript文件或执行由XHR 请求获得代码)。“所有的代码

我重写我的代码以符合所有的,而我还是老样子不断收到这种

,这是我的代码


 

 
function SuperM(){ 
 
    
 
    this.disabled = false 
 
    this.$about = false \t 
 
    this.init = function(){ 
 
     
 
\t 
 
\t 
 
\t //verefying script tool runs only once 
 
\t if(typeof contextPreContext != 'undefined') 
 
\t \t return \t 
 
\t 
 
\t contextPreContext = true 
 
\t 
 
     me.loadingAssets() 
 
\t 
 
\t $(window).scroll(function() { 
 
\t \t \t if(typeof me.$sm != "undefined") 
 
\t \t \t \t me.$sm.remove() 
 
\t \t }); 
 
     document.addEventListener('click', me.openToolMenu); 
 
     $(document).keyup(function(e) { 
 
      if (e.keyCode == 27) { // escape key maps to keycode `27` 
 
       me.$sm.remove()  
 
      } 
 
      
 
      if (e.keyCode == 121&& e.ctrlKey) { // escape key maps to keycode `27` 
 
       me.openPopup("https://translate.google.com/?q=", 761, 550) 
 
      } 
 
      
 
      
 
     }); 
 
\t 
 
\t // 
 
\t \t me.selectFrominput() 
 
\t $('a').hover(function(e){ 
 
\t \t console.log(e.ctrlKey) 
 
\t \t if(e.ctrlKey) { 
 
\t \t \t me.openToolMenu(e,0, $(this).text()) 
 
\t \t } 
 
\t }, function(){ 
 
\t \t //me.$sm.remove() 
 
\t }) 
 
\t 
 
    } 
 
    
 
    this.loadingAssets = function(){ 
 
\t //Loading the about window HTML 
 
\t //PLUGIN_ASSETS 
 
\t $.get(chrome.extension.getURL("about.html"), function(d){ 
 
\t \t me.aboutTpl = d 
 
\t }) 
 
\t 
 
\t //Loading the menu HTML \t 
 
\t $.get(chrome.extension.getURL("menu.html"), function(d){ 
 
\t \t me.smTpl = d 
 
\t }) 
 
\t //font awesome 
 
\t var fa = document.createElement('style'); 
 
\t \t \t fa.type = 'text/css'; 
 
\t \t \t fa.textContent = '@font-face { font-family: FontAwesome; src: url("' 
 
\t \t \t \t + chrome.extension.getURL('font-awesome/fonts/fontawesome-webfont.woff') 
 
\t \t \t \t + '"); }'; 
 
\t \t document.head.appendChild(fa); 
 
\t $('<link rel="stylesheet" href="'+chrome.extension.getURL('font-awesome/css/font-awesome.css')+'">') 
 
     .appendTo('body'); 
 
\t \t 
 
\t //END_PLUGIN_ASSETS 
 
\t 
 
\t 
 
\t 
 
\t 
 
    } 
 
    
 
    //Get the hightlight text 
 
    
 
    this.getSelected = function(e){   
 
\t \t var html=window.getSelection().toString() 
 
\t \t if(!html) 
 
\t \t \t html=''; 
 
\t \t if(html.length>500) 
 
\t \t \t html=html.substr(0,500) 
 
\t \t return html.replace(/\s+/g,' ').replace(/^\s+|\s+$/g,''); 
 
    } 
 
    
 
    
 
\t //Set the menu position 
 
    this.pos = function(ev,el){ 
 
\t \t \t \t var fontsize=parseInt($(ev.target).css("font-size").replace("px","")) 
 
\t \t \t \t var left=ev.pageX-$(document).scrollLeft(); 
 
\t \t \t \t var dirx="W" 
 
\t \t \t \t dirx=(ev.pageX>innerWidth-el.width())?"E":"W" 
 
\t \t \t \t 
 
\t \t \t \t //Make some delta between the menu and the text 
 
\t \t \t \t if(dirx=="W") 
 
\t \t \t \t \t left-=50 
 
\t \t \t \t else 
 
\t \t \t \t \t left-=el.width()-50 
 

 
\t \t \t \t var top=ev.pageY-$(document).scrollTop(); 
 
\t \t \t \t var diry=(top>$(window).height()-el.height()-62)?"S":"N"; 
 
\t \t \t \t 
 

 
\t \t \t \t if(diry=="N") 
 
\t \t \t \t \t top+=15+fontsize 
 
\t \t \t \t else 
 
\t \t \t \t \t top-=35+el.height()+fontsize 
 

 

 
\t \t \t \t //Set the menu position 
 
\t \t \t \t el.addClass("contextPre"+diry+dirx) \t \t \t \t 
 
\t \t \t \t el.css('top',top); 
 
\t \t \t \t el.css('left',left); 
 
\t \t \t }, 
 
    
 
\t //Use the url to open popup 
 
    this.openPopup = function(url,width, height){   
 
     //close previus popup if exist 
 
\t \t if(me.popup!=undefined) 
 
      me.popup.close() 
 
\t \t 
 
\t \t //Encoding the text 
 
     var q=encodeURIComponent(me.text.toLowerCase().replace(/^[\s\[email protected]#\$%\^&\*\(\)\-_=\+\[\]{}\\\/]+|[\s\[email protected]#\$%\^&\*\(\)\-_=\+\[\]{}\\\/]+$/g,'')) 
 
      .replace(/'/g,"%27") 
 
      url = url.replace("[q]", q) 
 
     
 
\t \t //getThe text language and use it in the url if needed 
 
\t \t var lang = "en" 
 
     guessLanguage.info(me.text, function(info) { 
 
      if(info[0] !== "unknown") { 
 
       lang = info[0] 
 
       
 
      } 
 
     });   
 
     url = url.replace("[lang]", lang) 
 
\t \t 
 
\t \t //open the popup 
 
     me.popup=window.open(url,"popup","height="+height+", left="+(innerWidth/2-200)+",scrollbars=no, width="+width+", top="+(innerHeight/2-290)+", menuba=0,location=0,status=0,titlebar=0,toolbar=0") 
 
     return;   
 
    } 
 

 
\t 
 
    this.openToolMenu = function(e, isDB, selection){ 
 
     if(me.$sm!=undefined) 
 
      me.$sm.remove() 
 
\t if(selection) 
 
\t \t me.text = selection 
 
\t else{ 
 
\t \t var q = me.getSelected(e) 
 
\t \t if(q) 
 
\t \t \t me.text = q \t 
 
\t \t else 
 
\t \t \t return 
 
\t } 
 
\t 
 
\t 
 
     if(me.$sm!=undefined) 
 
      me.$sm.remove() 
 
\t 
 
     if(selection == undefined) { 
 
\t \t if(!e.ctrlKey||e.which!=1||e.target.tagName=="EMBED"||!me.text||me.disabled){   
 
\t \t \t return; 
 
\t \t } 
 
\t } 
 
     me.$sm = $(me.smTpl)    
 
      
 
\t setTimeout(me.menuHandler) 
 
      
 
     me.pos(e, me.$sm) 
 
     
 

 
    } 
 
    
 
    // append the menu to the body and handle menu events 
 
    this.menuHandler = function(){ 
 
\t \t \t \t 
 
\t \t \t \t me.$sm.appendTo("body") 
 
\t \t \t \t .find('.contextPreSelItm') 
 
        .click(me.menuEvents) 
 
\t \t \t \t 
 
\t \t \t \t me.$sm.find('.contextPrex') 
 
\t \t \t \t \t .click(me.closeMenu) 
 
\t \t \t \t \t 
 
\t \t \t \t \t me.$sm.find('.contextPrehelp') 
 
\t \t \t \t \t .click(me.openAbout) 
 
\t \t \t \t $('.hideSmForSession').click(function(){ 
 
\t \t \t \t \t me.disabled = true 
 
\t \t \t \t }) \t 
 
\t \t \t \t 
 
\t \t \t \t 
 
\t \t \t } 
 
\t \t \t 
 
\t //Take the menu.html's item parameters and openPopup \t \t 
 
\t this.menuEvents = function(e){ 
 
        e.preventDefault(); 
 
        e.stopPropagation(); 
 
        me.openPopup($(this).attr("url"), $(this).attr("width"), $(this).attr("height")) 
 
        } \t \t 
 
\t \t \t \t 
 
\t \t \t \t 
 
\t this.closeMenu = function(e){ 
 
\t \t \t \t \t \t 
 
\t \t \t \t \t \t e.preventDefault(); 
 
\t \t \t \t \t \t e.stopPropagation(); 
 
\t \t \t \t \t \t $('.contextPresmhidemenu').show() 
 
\t \t \t \t \t } \t \t \t 
 
    
 
    this.openAbout = function(e){ \t \t \t \t \t 
 
\t \t 
 
\t \t e.preventDefault(); 
 
\t \t e.stopPropagation(); 
 
\t \t 
 
\t \t 
 
\t \t if(!me.$about) 
 
\t \t me.$about = $(me.aboutTpl) 
 
\t \t \t .appendTo("body") 
 
\t \t \t 
 
\t \t me.$about.find(".contextPreclose") 
 
\t \t \t .click(function(){ 
 
\t \t \t \t me.$about.remove() 
 
\t \t \t \t me.$about = false 
 
\t \t \t }) 
 
\t \t \t .after("<img src='"+chrome.extension.getURL("icon.png")+"' class='contextPre-reset'>") 
 
\t \t 
 
\t \t \t 
 
\t } 
 
\t \t \t \t \t 
 
    this.selectFrominput = function() { 
 
    $('input,textarea').click(function(e){ 
 
\t \t \t if(e.which!=1 || !e.ctrlKey) 
 
\t \t \t \t return 
 
\t \t \t 
 
\t \t \t // obtain the index of the first selected character 
 
\t \t \t var start = $(this)[0].selectionStart; 
 
\t \t \t // obtain the index of the last selected character 
 
\t \t \t var finish = $(this)[0].selectionEnd; 
 
\t \t \t // obtain the selected text 
 
\t \t \t var sel = $(this)[0].value.substring(start, finish); 
 
\t \t \t console.log(sel) 
 
\t \t \t me.openToolMenu(e,0, sel) 
 
\t \t 
 
\t }) 
 
    
 
    // do something with the selected content 
 
} 
 
    
 
    var me = this 
 
    this.init() 
 
} 
 

 
//LOADING_LIBS 
 
new SuperM(); 
 

 
//END_LOADING_LIBS

这是我的manifest.json:

{ 
 
    "manifest_version": 2, 
 

 
    "name": "Context", 
 
    "description": "Context is a menu that opens when one press CTRL & highlight text. It allows to explore the hightlited text without leaving the site", 
 
    "version": "1.10", 
 

 
    "icons": { "16": "icon16.png", 
 
      "32": "icon32.png", 
 
      "128": "icon.png" }, 
 
"web_accessible_resources": [ \t \t 
 
\t \t "font-awesome/css/*", 
 
\t \t "font-awesome/fonts/*", 
 
\t \t "about.html", 
 
\t \t "menu.html", 
 
\t \t "icon.png" 
 
\t ], 
 
\t 
 
    "content_scripts": [ 
 
    { 
 
     "matches": ["http://*/*","https://*/*"], 
 
     "css": ["style.css"], 
 
\t "js": [ "jquery.js", "guessLanguage.js","context.js"], 
 
     "run_at": "document_end" 
 
    } 
 
    ], 
 
    "permissions": [ 
 
    "activeTab", 
 
    "tabs", 
 
\t "http://*/*", 
 
    "http://*/*" 
 
    ] 
 
}

这是我的应用程序的截图

enter image description here

得益于先进

回答

2

的铬带状片S tore可能有一个bot通过代码来查看并使用一定的公式来猜测一个扩展有很可能是恶意的。您的代码中的某些内容正在被此机器人识别并被标记为“恶意”。

从Chrome的Developer Program Policies页:

恶意产品:不得传播病毒,蠕虫,缺陷,特洛伊木马,恶意软件,或具有破坏​​性的任何其他项目。我们不允许危害或干扰Google或任何第三方的网络,服务器或其他基础架构的内容。 Chrome网上应用店也禁止间谍软件,恶意脚本和密码网络钓鱼诈骗。尽可能在包装中尽可能多地显示代码。如果您的某些应用的逻辑被隐藏,并且看起来可疑,我们可能会将其删除。

基本上,Google认为你的代码隐藏了一些东西,这是由于它的写法。我可以拿出一些提示:

  1. 你的脚本缩进很少,这可能会让谷歌认为你的代码是obfuscated。尝试将您的代码通过javascript beautifier,以便它更具可读性,并且看起来更人性化。
  2. 使用descriptive variable names
  3. 我有一个猜测,脚本中的(非jquery)美元符号可能会影响谷歌的解析器。请参阅讨论here。谷歌可能会认为你的美元符号是“机械生成代码”的结果?尝试尝试更改变量名称以删除美元符号。
  4. 你不能从分机运行外部代码,所以要小心XHR请求的(没有看到任何在你的代码虽然)
+0

谢谢您的efford! 我会实施你的建议,并回复你 –

+0

@YhhudaGoldner你有没有运气发布你的扩展? –

相关问题