mark.js不突出显示单词?

时间:2016-08-15 00:25:22

标签: javascript jquery css

我使用mark.js将网站的某些部分标记为正(绿色),负(红色)和中性(粗体)。它突出了身体三个单独的时间,为它添加一个类,然后用CSS设置它的样式。出于某种原因,代码并没有标记我的单词列表中的一些单词。例如:http://imgur.com/a/hmGRC。 “"锁定"应该突出显示。这是另一个例子:http://imgur.com/a/PdQpy单词" issue"应该标记。

var positive = [ "negotiable","leather","clean title","clean history",
                 "clean car history","clean vin","clean carfax","brand new",
                 "1 owner","one owner","original owner","sunroof","moonroof","Z71","texas edition",
                 "panoramic","panorama","convertable","nav","navigation","never been",
                 "OBO","or best offer",
                 "touch screen","touchscreen","voice","gps","camera","dvd",
                 "entertainment","tv","television","premium","plus","pkg","flex fuel","Moon Roofs","sun roofs","moonroofs","sunroofs",
                 "pack","package","turbo","alloy","chrome","aluminum","back up camera","backup camera","back up cam","backup cam",
                 "allwheel all-wheel awd?","camera","power drivers seat","Power Lift","sky slider","skyslider","skyview",
                 "power windows","hardtop","hard top","4wd","4x4","4 wheel","not had any problems","no problems",
                 "four wheel","awd","allwheel","all-wheel","power","powered","All wheel drive","leatherette","leatherett","leatheret",
                 "heated","heat","no accidents","no bumps","non smoker","Moon Roof","sun roof",
                 "non smoking","no smoking","non-smoker","non-smokers","NAVAGATION","LEATER",
                 "non-smoking","no dents","no scrapes","no issues","rust-free",
                 "no wreck","no accident" ];
var negative = [ "armada","quest","flex","aspen","veloster","5 series","defects","defect","Rebuild","ex-salvage","exsalvage","exsalvaged","salvage","salvaged",
                 "infiniti","monte carlo","avenger","impala","versa","mini","stains","stained","stain","local only","local buyers","locally only","sell local","sell locally",
                "mitsubishi","sebring","tiburon","durango","e250","scratches","dings","ding","scratch","scratched","mark","marked","marks",
                 "e350","rx8","miata","fiat","smart","mazda6","pontiac","not working","won't work","doesn't work","dealers","body work","needs","needing",
                 "magnum","accent","rio","crossfire","pt cruiser","pacifica","minor","blemishes","blemish","blemished","rusted",
                 "rondo","chrysler 200","saab","rendezvous","lexus gs","sentra","supercharger","supercharged","super charge","super charged","super charger","tuner","chip","chipped",
                 "mx5","accord lx","grand marquis","solara","non-negotiable","rough country","no dealers","no dealer","if you are a dealer",
                 "not negotiable","custom rims","nitro","nos","injected","firm","cracked","crack","cracks","cracking","aftermarket","programmer",
                 "noticeable","collision","impact","rear-ended","rearended","damage","damaged","damaging","local only","locals only","only local","be local","local sale only","local buyer only","local buyers only",
                 "rear ended","blemish","barely","wrapped","flaw","loose","mod","incident","incidents","branded","title brand","New transmission",
                 "bump","hole","burn","rip","tear","puncture","flat","dent","problems","problem","issue","issues","Tune","tuning",
                 "accident","wreck","scratch","scrape","break","bust","broken","spill","spilt","splash","wet","scratching","fading","faded","fade",
                 "rebuilt","salvaged","deploy","lowball","low-ball","repair","faulty","chips","h3","h3x","does not","leveling kit",
                 "fix","fixed","rust","hail","leak","torn","bent","stain","replace","replaced","Lowering","program","programming","programmed",
                 "scuff","problem","bad","horrible","stink","stank","stunk","dents","worn","fender bender","bender",
                 "lift","lifted","lowered","new york","nyc","new jersey","Rock Krawler",
                 "miami","lauderdale","doesn't work","stopped working",
                 "isn't working","do not","slight","modified","tuned","chipped",
                 "chip","burst","modification","vibrate","cosmetic","wrecked" ];
var neutral =  [ "transmission","tread","automatic","manual","2wd","rwd","fwd","small",
                 "4x2","2 wheel","two wheel","seat","diesel","kelly","paperwork","leveling","level","leveled",
                 "v8","v6","v10","v4","v5","custom","sound system","good","great","auto","trans","we","i","us","moving","our","I've","we've",
                 "rims","excellent","condition","amazing","roof","cruise","remote","warranty",
                 "push","bucket","amp","liftgate","lift gate","liter","kit","rim","seats","3rd","third row","tires",
                "wheels","lift gate","vin","17 inch","18 inch","19 inch","carpet","stock","never",
                 "20 inch","21 inch","22 inch","23 inch","24 inch","17\"","18\"","xm","sirius","satellite",
                 "19\"","20\"","21\"","22\"","23\"","24\"","impact","crew","supercrew","replaced","replace","replacing",
                 "cab","supercab","crew cab","exhaust","locks","window","driver","tinted","tint",
                 "seat","door","running board","runningboard","extra","edition","mile","miles","milages","mileage",
                 "ex-l","lx","kbb","loaded","appointment","maintenance","dealership","bluetooth",
                 "dealer","sport","luxury","reasonable","asap","lease","finance","pay",
                 "lien","loan","bank","limited","driver","very fair","old","dog","pet",
                 "animal","elderly","trim","cloth","owners","smell","airbag",
                 "title in hand","in hand","hemi","engine","must sell","personal",
                 "negotiate","price","coupe","dual","towing","hatchback","wagon","wife","son","father","mother","daughter","college","student","elderly",
                 "bus","sedan","truck","suv","trade","garage","reduced","stereo",
                 "five-speed","six-speed","fivespeed","liter","cylinder","tint","row","Running Boards","runningboard","running board","interior","certified",
                 "adult","teenager","teenage","daughter","son","college","father",
                 "mother","grandfather","grandson","grandmother","granddaughter",
                 "death","family","emergency","moving","carfax","cheap","title",
                 "nada","blue book","smoke","pet","owner","upgrade","new","subs","I have","I may","I owned","I've had","I've owned",
                 "subwoofer","amplifier","after market","installed",
                 "condition","contact","via","call","cell","telephone","phone",
                 "evening","morning","anytime","reach","email","text","number",
                 "owned","had this","my","photo","evidence","proof","photograph",
                 "picture","more info","hybrid","electric","customer",
                 "best offer","current offer","top offer","declined","decline",
                 "reject","refuse","owe","cash","money","$","no" ];
var names =    [ "honda", "toyota", "ford","XLT","Escape","Chevy","Silverado","1500","2500","Edge","lariat","lariet",
                 "LT","LTZ","Crew Cab","Extended Cab","Dodge","Ram","quad cab","2006","2007",
                 "2008","2009","2010","2011","2012","2013","2014","2015","2016","fx4",
                 "Rav4","Jeep","Compass","Commander","Liberty","Wrangler","Unlimited","Limited","ltd","Sahara","Rubicon","Patriot",
                 "Acura","MDX","technology","RDX","xl","xlt","f150","f250","f350","f-150","f-250","f-350" ];
var brands =   [ "Acura", "Audi", "Buick", "Cadillac", "Chevrolet", "Chevy", "Chrysler", "Dodge", "Ford", "GMC",
                 "Honda", "Hummer", "Hyundai", "Jeep", "Kia", "Land Rover", "Landrover", "Lexus", "Lincoln",
                 "Mazda", "Mercedes-Benz", "Mercedes", "Mercury", "Nissan", "Scion", "Subaru", "Toyota",
                 "Volkswagen", "VW", "Volvo" ];


_ready = function() {
    _formatBody();
};

_formatBody = function(n) {
    var body = n && $(n).closest('body') || $('body');

var instance = new Mark(document.querySelector("#postingbody"));
instance.mark(positive, {
           accuracy: "exactly",
           separateWordSearch: false,
           className: "positive"
});
var instance = new Mark(document.querySelector("#postingbody"));
instance.mark(negative, {
           accuracy: "exactly",
           separateWordSearch: false,
           className: "negative"
});

var instance = new Mark(document.querySelector("#postingbody"));
instance.mark(neutral, {
           accuracy: "exactly",
           separateWordSearch: false,
           className: "neutral"
});
$('.positive').css({'color': '#0f6f00', 'font-weight': 'bold', "background-color":"transparent"});
$('.negative').css({'color': '#bd0000', 'font-weight': 'bold', "background-color":"transparent"});
$('.neutral').css({'font-weight':'bold', "background-color":"transparent"});

    body.find('.mapbox, .tsb, footer').remove();

    _checkValue(body);
};

是的,#34;重复"并没有真正包含那个人的错误

0 个答案:

没有答案