1Tuts / chamani-w2-project

@seeking ,@AminRahkan CIW Programming (Old W3+W4) Final Project
0 stars 1 forks source link

jqury browser detect #9

Open ghost opened 12 years ago

ghost commented 12 years ago

hi mr @alimd dar mored on scripti ke farmodid browser detect kone va bara css3 ha, khodesh bezane "-moz-" or "-webkit-" or "-o-" and "-ms-" ino bayad chetori drost konim? please help (F1) me :tr

seeking commented 12 years ago

salam chera fek mikoni jenabe alimd miyad in typic ro didan kone ! ishoon vaght nemikonan toye class javab bedan ;)) ... agha hala chi moshkel dari ?! mikhay chekar koni !?

ghost commented 12 years ago

dar na omidi basi omid ast :d & :tr

... ye script mikham (ba jqury) ke css3 ro beshnase az to styleha va bar asas browser code makhsose khodesh ro ijad kone masalan: man bara div in style ro neveshtam:

div{
    width:400px;
    background:#000;
    font-family:Tahoma, Arial, "Times New Roman", Times, serif;
    font-size:11px;
    line-height:20px;
    box-shadow:0 0 2px #fff;
    border-radius:3px;
}

hala nemikahm khodam be sorat dasti biam bar shadow & radius bara har borwser stylesh ro benvisam: yani nemikahm intori beshe:

div{
    width:400px;
    background:#000;
    font-family:Tahoma, Arial, "Times New Roman", Times, serif;
    font-size:11px;
    line-height:20px;
    box-shadow:0 0 2px #fff;
    -moz-box-shadow:0 0 2px #fff;
    -webkit-box-shadow:0 0 2px #fff;
    -o-box-shadow:0 0 2px #fff;
    -ms-box-shadow:0 0 2px #fff;
    border-radius:3px;
    -moz-border-radius:3px;
    -webkit-border-radius:3px;
    -o-border-radius:3px;
    -ms-border-radius:3px;
}

kari ke daghighan mikahm in hast ke jqury browser ro shenasaie kone va tag makhsose khode browser ro bra css3 ha bezare yani age masalan user ba browser firefox bod, style intori beshe:

div{
    width:400px;
    background:#000;
    font-family:Tahoma, Arial, "Times New Roman", Times, serif;
    font-size:11px;
    line-height:20px;
    box-shadow:0 0 2px #fff;
    -moz-box-shadow:0 0 2px #fff;
    border-radius:3px;
    -moz-border-radius:3px;
}

va age ba browser opera bod intori beshe

div{
    width:400px;
    background:#000;
    font-family:Tahoma, Arial, "Times New Roman", Times, serif;
    font-size:11px;
    line-height:20px;
    box-shadow:0 0 2px #fff;
    -o-box-shadow:0 0 2px #fff;
    border-radius:3px;
    -o-border-radius:3px;
}

on "-moz-" & "-o-" tavasot jqury be tor khodkar ezafe shode

.... motavajehe manzoram shodi? :d

seeking commented 12 years ago

man ke omidi nadaram :D

agha az hame inha begzarim ;) .... toye jq ya js emkane read va write file vojod nadare ,

vali ba php mishe !

bayad ye script ba php neveshte beshe ke vaghti browser site ro baz mikone ,

code haye css ro ganarate kone va ona ro neshon bede !

faghat hamin rah momkene va ya ghayr .

ghost commented 12 years ago

ahan mano bego az sobhe daram donbale rahe hal ba js migardam pas masood zahmatesh ro bekeshhhhhhhhhhh :d vase pro lazem daram :tr

seeking commented 12 years ago

bashe ishalla ok mikonam !

alan khodam roye ye proje daram kar mikonam !

uni ham dast az sare ma var nemidare :((

bara key mikhay !? age moredi nist man ta 2-3 roz dg in to w3schools-am mizaram ;) in ba man ;) :D

ghost commented 12 years ago

ok ta 2-3 rooz dg mitone ok koni dg :d

ghost commented 12 years ago

rasti ye tozih bede bayad chikar konim shayad tonestam ok konam :-??

seeking commented 12 years ago

age omri baghi bashe va zende basham :D

seeking commented 12 years ago

ye algoritm be zehnam resid minevisam ::

1- browser detect 2- switch(browser) { case ie : add("ms"); break; case mozilla : add("moz"); break; case chrome : add("webkit"); break; case opera : add("o"); break; default : add("");//?? break; }

3- create a func for add($d){ -fopen file while (!feof)//ta vaghti ke file css-emon tamom nashode { $line = fgets( $fp, 1024 );//ye khat bekhon (az 1 ka akhare file yeki yeki mikhone) if (strpos($line,"border-radius")){//be sharti ke class ya id nebashe !! echo "-".$d."-"."border-radius:on chizi ke az khate ghabli joloye 'border-radius' bode "; } } -fclose file style.css

}

tamom shod :D didi cheghad sade bod fagaht lamasab rize kari khili dare :D

seeking commented 12 years ago

bara browser detect ham mishe az ($_SERVER['HTTP_USER_AGENT'] estefade kard masalan in tori : switch($_SERVER['HTTP_USER_AGENT']) { case 'MSIE': echo 'ie'; break; case 'Firefox': echo 'ff'; break; case 'Chrome'; echo 'chrome';
break; default: echo 'other '; }

ghost commented 12 years ago

ahsant :d

... test mikonam bebinam mitonam rah bendazam ya na :d

seeking commented 12 years ago

ok fagaht bebin in code nist ha faghat algoritme va raveshe kare ,

albate ye jahayi jav gir shodam kollan code neveshtam ha ;)